Repository navigation
Reduce the resident prompt to identity and policy (measured 50% vs 73% for identity-only) #1813
Description
Overview
The production resident prompt measurably degrades task success. Delete it down to identity and policy, and measure the result.
Problem Statement
packages/agent/src/agent_guidance.rs holds roughly 2,300 tokens of prose; the assembled system prompt is 10,493 characters. On cases constructed to exercise the prompt's own guard rules, it scored 50% against 73% for a 445-character identity-only prompt.
The mechanism is dilution, not misunderstanding: under the full prompt, "List all my wine" produced node_type: "album" — a type absent from the injected context block entirely. The rule instructing verbatim id-copying was present in that prompt and did not prevent it.
The cost is structural as well as behavioral. The inference engine enforces N_CTX_MINIMUM = 16_384, justified by the tool-registered system prompt alone being roughly 6,600 tokens, and ADR-062 budgets context against total RAM. Prompt size is a hardware-requirements input.
Scope
Delete everything ADR-064 assigns to another channel:
- Argument-shape rules → already in tool schemas (
agent_guidance.rs:20-28: TITLE TEMPLATE, FIELD RULES, ENUM FIELDS) - Tool-selection guidance → tool descriptions (much of
TOOL_STRATEGY_RULES) - Rules duplicating an existing code guard → delete outright. Identical repeated tool calls, duplicate cross-turn writes, false action claims, the iteration cap, and malformed-argument runs are all already enforced in
agent_loop.rs; the prose adds nothing but tokens
Retained: identity, blast-radius and deletion policy, the clarification contract, output formatting.
Explicit non-goal: do not replace the deleted block with a differently-worded resident block. The measured winner was identity-only at 445 characters. The evidence supports deletion, not substitution. Re-occupying the channel with better prose re-litigates the same failure — and rule 5 of ADR-064 says so directly. Content returns only when a specific measurement demands it, one rule at a time.
Evidence
- Full production prompt 50% vs identity-only 73%, on 10 adversarial cases, n=30 per arm
- "List all my wine" →
node_type: "album", a type not in context - Channel authority: tool schema 100%, prose 87.5%, absent 62.5%
- Adding field types to the prompt did not stop the model packing values into a free-text field — prose does not repair argument shape even when correct
packages/agent/src/agent_guidance.rs;N_CTX_MINIMUM = 16_384in the inference engine
Carried caveat: 2 of the 7 guard cases in that harness were badly designed — one scored 0% in every arm including the control, and one was non-monotonic. The effect direction is supported; the exact magnitude is not. Repair those cases before re-measuring.
Acceptance Criteria
-
agent_guidance.rsreduced to identity and policy; deleted content is deleted, not relocated into another prose surface - Every deleted rule is traced to the channel that now owns it, or explicitly recorded as dropped
- The two known-bad guard cases are repaired before the measurement is run
- A non-adversarial case set is added — the existing cases were built to defeat this prompt and cannot measure average-case cost
- Success rate at least matches the 73% identity-only arm; a result below the 50% production arm blocks the change
- Full agent test suite shows no regression
- Assembled prompt character count recorded before and after;
N_CTX_MINIMUMre-evaluated if the reduction is large
Architecture Impact
Implements ADR-064 rule 5. May relax the minimum context window and, through ADR-062, the memory floor.
Reference harness at ~/nodespace/spike-1802-harness/ (not committed). Repair the harness before trusting any number from it — its README documents known defects, and six harness faults during the original spike each reversed a conclusion.
Activity
malibio commentedon Jul 30, 2026
Frontend baseline: 171 test files passed, 4112 tests passed. Starting work in worktree issue-1813-resident-prompt-reduction.
malibio commentedon Jul 30, 2026
Update following #1699 and #1820
Two things changed since this was filed.
Terminology. #1699 renamed the
promptnode type toagent-guidanceand retitledPromptAssembler's doc comments and queries accordingly (node_type == "agent-guidance"throughoutprompt_assembler.rs).packages/agent/src/agent_guidance.rs— the Rust module holdingTOOL_STRATEGY_RULESand friends — is unaffected by the rename (it was never theprompt-typed node itself, just the source of the seeded content), but anyone picking this up should use "agent-guidance node" rather than "prompt node" when describing the graph-stored side, to match the current code and avoid the exact ambiguity #1699 just resolved.Scope addition — coordinate with #1820, don't duplicate its cuts. #1820 (in progress) is independently deleting the per-operation routing lines from
TOOL_STRATEGY_RULES(lines 41, 42, 48, 54, 55 as filed) and the tool-usage reference lines (50-53, 56-57), on the grounds that they belong to tool selection/schemas, not resident prose — the same ADR-064 rule 1/2 argument this issue makes for argument-shape and tool-selection rules generally. That means a meaningful fraction of what this issue's Scope section describes deleting will already be gone by the time this starts, if #1820 lands first.Recommended sequencing: let #1820 land first, then measure this issue's reduction against whatever
agent_guidance.rslooks like afterward — not against the version quoted in this issue's Evidence section (10,493 chars), which predates #1820's cuts. Re-baseline the "before" character count at the start of this issue's work rather than reusing the number above.If #1813 starts before #1820 finishes: don't re-delete the same lines in a conflicting way — check #1820's PR/branch first, and treat its retained 5 safety-invariant lines (chitchat, tool-history honesty, unverified-schema-claims, no-repeat-calls, no-claim-without-result) as this issue's floor for what "identity and policy" retains, since #1820 already did that categorization work for the
TOOL_STRATEGY_RULESportion specifically.No change to acceptance criteria — the 73%/50% targets and the harness-repair requirement still apply to whatever
agent_guidance.rslooks like when this is actually measured.Address review: document AMBIGUITY deletion trace and N_CTX_MINIMUM d…