refactor(reflection): extract the distiller prompt into system and user parts#958
Draft
gorkem2020 wants to merge 1 commit into
Draft
refactor(reflection): extract the distiller prompt into system and user parts#958gorkem2020 wants to merge 1 commit into
gorkem2020 wants to merge 1 commit into
Conversation
…er parts
buildReflectionPromptParts builds the distiller prompt as { system, user }:
system carries the identity opener and every static block (task, headings
contract, hard rules, section and governance rules, notes, output
template); user carries only the dynamically generated content (tool
error signals and the INPUT transcript fence).
buildReflectionPrompt stays exported as the combined single-slot wrapper,
byte-identical to the previous prompt text, and both runners keep sending
that combined form: the embedded raw run does not honor a separate system
slot, and the CLI fallback carries a single user message. Zero behavior
change; the static/dynamic seam becomes explicit, tested, and reusable by
deployments whose runner honors a real system slot.
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 Problem This Solves
The reflection distiller's prompt mixes identity plus static instruction blocks with per-run dynamic content (tool error signals and the transcript fence) in one string. A deployment whose embedded runner honors a real system slot cannot deliver the static block on that slot without forking the prompt builder, and the seam between static and dynamic content is untested, so prompt edits can silently leak dynamic content into the static block or the other way around.
Why This Change Was Made
buildReflectionPromptPartsbuilds the prompt as{ system, user }: system carries the identity opener and every static block, user carries only the dynamic content.buildReflectionPromptstays exported as the combined single-slot wrapper (system + blank line + user), byte-identical to the previous prompt, and both runners keep sending that combined form (the embedded raw run does not honor a separate system slot, and the CLI fallback carries a single user message). Zero behavior change; the seam becomes explicit and tested.User Impact
None at runtime: prompt text, prompt hash, and delivery are unchanged. Deployments whose runner honors a system slot can deliver the parts split without changing one byte of prompt text.
Evidence
test/reflection-prompt-split.test.mjs(7 tests): slot placement for every static sentinel, dynamic-only user content, verbatim combined form, tail clipping, embedded runner contract (combined prompt, no system-slot param, raw-run semantics preserved), and the CLI fallback payload.