feat: wire customInstructions from plugin config#181
Open
jamebobob wants to merge 1 commit intoMartian-Engineering:mainfrom
Open
feat: wire customInstructions from plugin config#181jamebobob wants to merge 1 commit intoMartian-Engineering:mainfrom
jamebobob wants to merge 1 commit intoMartian-Engineering:mainfrom
Conversation
The customInstructions parameter threads through all 4 prompt builders (buildLeafSummaryPrompt, buildD1Prompt, buildD2Prompt, buildD3PlusPrompt) but is never read from config. This means operators cannot control summarization tone or style without patching source. Fix: - Add customInstructions to LcmConfig type and resolver (config.ts) - Read in resolveSummarize() chokepoint (engine.ts) with fallback: params.customInstructions || this.config.customInstructions || undefined - Add to plugin schema and uiHints (openclaw.plugin.json) - Add config test coverage (test/custom-instructions.test.ts) Every summarization path (afterTurn, /compact, overflow recovery) gets instructions automatically through the chokepoint without caller changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
customInstructionsparameter threads through all 4 prompt builders (buildLeafSummaryPrompt,buildD1Prompt,buildD2Prompt,buildD3PlusPrompt) but is never read from config. Operators cannot control summarization tone or style without patching source.This matters because LCM summaries are injected into the agent's context window via DAG assembly — the summarizer's voice becomes the agent's voice. AugmentedMind's ResonantOS article documents how the memoryFlush gap under LCM leaves operators without control over what persists through compaction. Operator-controlled summarization instructions are a step toward closing that gap.
Changes
src/db/config.ts: AddcustomInstructions: stringtoLcmConfigtype and resolver. Follows the same 3-tier precedence assummaryModel: env (LCM_CUSTOM_INSTRUCTIONS) → plugin config → default ("").src/engine.ts: Readthis.config.customInstructionsas fallback inresolveSummarize()— the single chokepoint all summarization paths pass through. Explicit caller values still win.openclaw.plugin.json: AddcustomInstructionstoconfigSchema.propertiesanduiHints.test/custom-instructions.test.ts: Config test coverage: defaults, plugin config, env override, trimming, type coercion, manifest schema.Usage
{ "plugins": { "entries": { "lossless-claw": { "config": { "customInstructions": "Write as a neutral documenter, not as the assistant. Use third person. Report what happened, not its significance." } } } } }This gives operators control over summarization tone. For example, an operator running a long-lived agent might want summaries written in third person to prevent the summarizer's editorial voice from propagating into agent output through DAG assembly.
Design
The change is minimal by design: one config field, one fallback line in the chokepoint. No caller changes needed —
afterTurn,/compact, overflow recovery, and any future compaction path all get instructions automatically.