feat(dream): add --prompt and --system reflection overrides#3313
Merged
Conversation
Add two advanced flags to `letta dream`: - --prompt <text>: replace the reflection task prompt entirely (the caller supplies the transcript/memory mechanics via $TRANSCRIPT_PATH/$MEMORY_DIR). --instruction stays additive; --prompt is a full-replacement escape hatch. - --system <text>: replace the reflection subagent's system prompt/persona, passed to the child as --system-custom instead of the built-in --system <type>. Threaded like #3306's --model: dream.ts -> launchReflectionSubagent (reflectionPromptOverride/reflectionSystemPromptOverride) -> the task prompt assembly (buildReflectionSubagentPrompt is bypassed when overridden) and the subagent deploy boundary (spawnBackgroundSubagentTask -> spawnSubagent -> executeSubagent -> buildSubagentArgs). Omitting both preserves current behavior.
carenthomas
requested review from
4shub,
christinatong01,
cpacker,
jnjpng,
kl2806 and
sarahwooders
as code owners
July 10, 2026 22:42
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.
What
Two advanced override flags on
letta dream, for callers (e.g. dreambench) that need to steer the reflection engine directly:--prompt <text>— replace the reflection task prompt entirely.--instructionstays additive (folded into the default prompt, subordinated to "only persist durable memory");--promptis the full-replacement escape hatch. The caller owns the mechanics: the default prompt's$TRANSCRIPT_PATH(read the payload) and$MEMORY_DIR(write + commit) env vars are still injected by the harness, so an override must reference them.--system <text>— replace the reflection subagent's system prompt / persona. Passed to the child as--system-custom <text>instead of the built-in--system <type>, so the defaultreflection.mdpersona (and its "durable memory, not transient task state" framing) is bypassed.Omitting both preserves current behavior exactly.
Motivation
letta dream's reflection is doubly biased toward general durable memory: thereflection.mdpersona (system prompt) and the base task prompt's "only persist durable memory-worthy learnings, do not store transient task state" line.--instructioncan't override that (it's inserted as a subordinated "focus" lens). For benchmarks/consumers that want task-specific distillation, these two flags provide full control without touching the default path.How (threaded like #3306's
--model)dream.ts(--prompt/--system) →launchReflectionSubagent(reflectionPromptOverride/reflectionSystemPromptOverride) →prepareReflectionMemoryWorktreeLaunchusesreflectionPromptOverride ?? buildReflectionSubagentPrompt(...)(the builder is bypassed, incl. the parent-memory snapshot).spawnBackgroundSubagentTask({ systemPromptOverride })→spawnSubagent→executeSubagent→buildSubagentArgs, which emits--system-custom <text>instead of--system <type>for new agents.buildReflectionSubagentPromptis untouched. This PR lands cleanly now thatmanager.tsis under the 1,000-line ceiling (after #3308/#3310/#3312); it adds ~15 lines there (888 total, no baseline entry).Notes / caveats
--promptand--systemhave no short flags (avoids clashing with-m/-i/-h).--promptoverride that forgets$TRANSCRIPT_PATH/$MEMORY_DIRwill silently produce no memory — documented in the help text and a code comment (acceptable for the advanced/internal use case).--systemreplacesreflection.mdwholesale, so its built-in guardrails/output-format go with it — that's the point.Test
bun run check— 12/12 pass.bun test src/cli/subcommands/dream.test.ts— parse + help-text coverage for both flags.bun teston the three subagent suites (model-resolution, env-composition, parent-id-propagation) — 84/84 pass (coversbuildSubagentArgs).