Skip to content

Author and tune the golden prompt corpus: production-shaped, dev-domain prompt strings #2122

Closed

Description

@malibio

Overview

Author and tune the golden prompt corpus: a set of production-shaped prompt strings, in NodeSpace's dev-workflow domain, iterated against the locked native model until each case reliably produces the right tool call.

The committed case files are the deliverable. They become the target the NodeSpace assembly line is engineered to reproduce — asserted by #2119, implemented by #2120.

This issue touches no production source. It produces strings, not code.

Why this is its own issue

The chain previously went #2118 (utility) → #2120 (edit source) → #2119 (assert). That had no step producing the goldens themselves — #2119 would have been asserting against a corpus nobody authored, and #2120 mixed "decide what the prompt should say" with "edit the files that emit it."

Separating them keeps the conflation this whole effort exists to eliminate from reappearing: a failure here is a prompt failure, and a failure in #2120 is a plumbing failure. Never both at once.

Prerequisites

What the corpus must contain

Production-shaped, not minimal

A golden must be structurally what production sends, with the content of each block being what is under tuning:

  • the assembled resident system prompt
  • the Stage-2 candidate block with rendered skill instruction subtrees
  • the RELEVANT ENTITY TYPES block
  • the full scoped tool surface with real parameter schemas
  • history carrying prior tool-call records, tool results, and write receipts

A minimal hand-authored prompt answers "can the model do this under favorable conditions?" — useful as a control, but not the string NodeSpace pumps. Scenario 6 is the cautionary case: hand-authored got resolve_query 3/3, production fired it 0/8. Same task, different environment.

Use NODESPACE_PROMPT_DUMP on a real session to derive the structural reference (which blocks appear, in what order), then author fresh content into that structure. Fresh content, production structure — a golden built from production's current text cannot be a target to engineer toward, and one missing production's blocks cannot be either.

Dev-workflow domain

Entities in the shape a Jira/Linear user would recognize: ADR, Spec, Ticket, Sprint, PR, Release. Status enums must be workflow-shaped — ready_for_dev, in_dev, ready_for_review, in_review, done.

The schema definitions shown to the model are themselves a tuned channel, not decoration — worked examples, create_schema field examples, entity-type blocks, enum samples. Per ADR-038 Finding 2, the model reproduces the worked example's pattern, so the example IS the template. Swapping only the user-facing prompts would leave the model pattern-matching business entities against dev requests.

Scenario coverage

At minimum the operations the matrix already exercises, re-expressed in the dev domain:

  • schema creation (a Ticket or ADR type with a status enum)
  • instance creation against an existing type
  • query / list
  • state change through an enum value (in_dev → ready_for_review)
  • indirect reference resolution ("that one", "the auth ticket")
  • empty-result query
  • a genuinely ambiguous request whose correct answer is to clarify
  • relationship creation (ticket → sprint, PR → ticket, ADR supersedes ADR)

Approach

Each string change is a hypothesis validated at N reps, not an edit that looks better. Two axes, kept separable in the results:

  1. Domain — dev entities and enums replacing business ones
  2. Length — cut per ADR-064's deletion-not-substitution rule; do not rewrite the same content more concisely into the same slot. The resident-prompt ablation measured 10,493 chars at 50% against 445 at 73%, so trimming is the prior — but each cut must be measured, not assumed.

Re-run the whole tuned set after each change. A prompt edit that fixes one case and silently breaks another is the specific regression this sequencing exists to catch.

Acceptance Criteria

  • Golden case files committed, covering the scenario list above in the dev-workflow domain
  • Each golden is production-shaped: resident prompt, candidate block with instruction subtree, RELEVANT ENTITY TYPES, full scoped tool surface with real parameter schemas, realistic history
  • Structural reference derived from a real NODESPACE_PROMPT_DUMP capture and documented in each case's notes, so the shape is verifiable rather than assumed
  • At least one case exercises a workflow status enum, requiring selection of a valid value from allowed_values rather than a boolean flip
  • At least one case's correct outcome is route_clarify — asking is a first-class right answer under ADR-038's clarification contract
  • Every case validated at N reps against the locked native model, with per-case results recorded in this issue
  • Control (minimal) and production-shaped goldens distinguishable in the corpus, so a favorable-conditions result is never misread as production-representative
  • Each case's expect field states what it was tuned to produce, so intent survives without the tuner
  • Cases stay lexically distinct from eval fixture prompts (contamination guard, Eval-contamination guard does not cover tool descriptions or parameter schemas #1932)
  • No production source modified — that is Generate write-tool field declarations from retrieved schemas, and delete the prose they replace #2120

Out of scope

Notes

  • node_type was measured unstable across sessions when nothing in the prompt says what types exist — the same case produced "equipment" in one session and "Product" in another, each 3/3 internally. Any case depending on a specific type or enum value must put the available types and their allowed_values in the prompt. That mirrors production, where RELEVANT ENTITY TYPES does exactly this.
  • Single runs are not decision-grade here: identical code scored 6/7/7 on the matrix, and scenario 6 measured 3/3 vs 0/8 depending on history.
  • ADR-064's channel doctrine governs where a given rule belongs: tool schemas own argument shape, tool descriptions own tool selection, skill descriptions own retrieval matching, tool results own facts not plans, resident prose owns identity and policy only.

Activity

  1. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    Revised sequencing: #2118 → #2122 → #2119 → #2120 → #1977

    Supersedes the earlier sequencing comment. The chain gained a step and #2120 was rescoped, because the previous plan had no issue that actually produced the golden corpus — #2119 would have asserted against goldens nobody authored.

    # issue deliverable touches production source?
    1 #2118 the utility (PR #2121) new bin only
    2 #2122 tuned golden prompt strings no
    3 #2119 snapshot gate test only
    4 #2120 assembly emits the goldens yes
    5 #1977 eval retargeted to match fixtures only

    The split that matters

    #2120 previously mixed what should the prompt say with edit the files that emit it. That is the exact conflation this effort exists to remove — a failure could be a bad prompt or bad plumbing, indistinguishable.

    Now:

    A failure in #2122 is a prompt failure. A failure in #2120 is a plumbing failure. By construction.

    Why #2119 moved ahead of #2120

    The gate is what defines #2120's done condition. "Make plumbing match" has no test without it.

    The governing requirement across all of them

    Goldens must be production-shaped: same blocks, same structure, same tool surface as what NodeSpace actually sends — with the content of those blocks being what is tuned. A minimal hand-authored prompt is a useful control but not a target; scenario 6 is the cautionary case, at 3/3 hand-authored vs 0/8 in production for the same task.

  2. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    Handoff from #2118 — what the utility actually does, and four things measured while building it

    The utility landed in PR #2121 (merged, 709e4870). Notes below are things learned by running it that are not obvious from its source, plus one correction to an assumption this issue's body inherits.

    Invocation

    cargo run --release -p nodespace-agent --bin golden_runner -- packages/agent/goldens/<case>.toml
    cargo run --release -p nodespace-agent --bin golden_runner -- --reps 5 <case.toml>
    cargo run --release -p nodespace-agent --bin golden_runner -- --check <case.toml>   # no model load

    Use --release. A debug-profile model load is slow enough to break the edit-rerun rhythm this issue depends on.

    --check prints every string the model would see, escaped, without loading the 5GB GGUF. Use it after every case edit — it is how the whitespace bug below was caught, and it costs nothing.

    For the structural reference this issue asks for, NODESPACE_PROMPT_DUMP works unchanged through the bin: it hooks the chokepoint in nlp-engine's chat/mod.rs, so it captures the post-template string with nothing extra wired up.

    1. --reps 3 is not enough to call a case tuned, and 3/3 does not mean stable

    The two committed cases each ran 3/3 byte-identical. But the same case, same code, run in two different sessions, produced different node_type arguments — "equipment" one session, "Product" another, each internally 3/3.

    The tool name was stable; a tool argument was not. Within-session repetition measures much less than it appears to. When AC says "validated at N reps, with per-case results recorded," recording which fields were stable is worth more than the tally — and a second session is worth more than more reps in the first.

    Directly relevant to the enum-selection criterion: a case asserting a specific allowed_values choice needs the available values in the prompt. Neither committed case tells the model what types exist, which is exactly why it invented one.

    2. Two axes is one too few — style is a third, and it dominated size

    This issue's Approach names domain and length. A third axis measured during #2118, on the arms since removed from the corpus:

    history arm tokens style result
    terse-control ~150 flat facts resolves
    medium-verbose ~412 narrative — paragraphs, numbered options, a question back refuses
    terse-matched ~412 flat facts resolves

    Token count matched between arms 2 and 3, style matched between 1 and 3. Style, not size. The narrative arm failed at a length the terse arm passed.

    That sharpens the ADR-064 deletion rule for the history channel specifically: compact carried-forward history into terse factual statements, not into shorter narrative summaries. A "concise summary" that stays conversational reproduces the failure at a smaller size. Worth treating as a prior when authoring the realistic-history part of each production-shaped golden, since production traces are narrative-shaped.

    (Also observed: when the verbose arm failed, it asked for a node id in prose rather than calling a clarification tool. Separate defect, relevant to the route_clarify criterion.)

    3. A reproducible continuation gap, ready to tune against

    scenario6-full-sequence.toml turn 3 calls resolve_query and then stops — it never continues to update_node. Measured 0/3, byte-identical.

    The single-turn-pull boundary, now cheap to reproduce. Probably the highest-value first target here: a real defect with a clean repro, where a tuned prompt that produces resolve→update reliably would be a genuine golden rather than a port.

    4. TOML """ does not behave like Rust "…\

    Rust's line continuation strips the next line's indentation; TOML's does not. Left unhandled, every prompt reaches the model with a leading newline, a per-line indent, and doubled spaces at each continuation — one ported block measured 35 characters longer than the literal it reproduced.

    The loader normalizes this (normalize_case_text), so case files can be indented for readability and the model still sees column-0 text. Blank lines and relative indentation survive, since narrative shape is sometimes the variable under test.

    Do not defeat it by hand-flattening TOML to column 0 — verify with --check instead.

    On the two committed case files

    They are ports, not tuned prompts: reproductions of the pre-existing Rust goldens, run 3/3 only to prove the port is faithful. No edit-rerun-compare loop was run in #2118. They are worked instances of the format and useful as minimal controls — the "control vs production-shaped" criterion above — but nothing in them is tuned, and neither is dev-domain.

    They are also both minimal, not production-shaped. Per this issue's own scenario-6 caution (hand-authored 3/3 vs production 0/8), treat them as the favorable-conditions control and author the production-shaped cases fresh.

    🤖 Generated with Claude Code

  3. self-assigned this
    on Aug 17, 2026
  4. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    Correction: this issue's ACs describe an expectation system that does not exist

    Flagged by nodespace-core-6a on pickup, and they're right. #2122 was written against #2118's original spec, which I over-specified as a harness with typed expectation kinds (tool with subset arg matching, sequence with min_properties_on, clarify, text, observe), scoring, and a chain flag. The user rescoped #2118 to a one-time utility mid-build, and the merged code (PR #2121, 709e4870) has none of that.

    What actually shipped:

    • expect is a free-text prose field, printed next to what the model did, never evaluated. Comparing them is the reader's job. Its doc comment states the rationale: "the moment it has structure, something will be tempted to assert on it, and a second scoring system is what this utility exists to not be."
    • No typed expectation kinds, no args_contain, no min_properties_on, no pass/fail, no N/N tallies.
    • Turns always chain; independent probes go in separate files. There is no chain = false.

    Reading corrections for this issue's ACs:

    • "at least one case's correct outcome is route_clarify" → one case whose correct behavior is the model asking for clarification rather than acting, with expect saying so in prose. Not a typed clarify kind.
    • Any AC implying assertion, scoring, or subset matching → the judgment is human. The utility prints; you read.

    The substantive requirements are unchanged and still govern: production-shaped goldens, dev-workflow domain, N reps per case, control vs production-shaped distinguishable, intent recorded in expect.

    Also stale, from #2118's pre-simplification commit message: it claims five case files. Only two are on origin/main — indirect-reference-resolves.toml and scenario6-full-sequence.toml. Three were cut in the simplification (ambiguous-reference-clarify, scenario6-compact-history, scenario6-zero-history-control, scenario6-history-size-vs-style — four dropped, one renamed). They remain recoverable as reference: git show 625263a0:packages/agent/goldens/<name>.toml. ambiguous-reference-clarify is worth reading before authoring the clarify case.

    Note both surviving case files are minimal controls, not production-shaped. Neither is a template for what this issue needs — see the environment-fidelity comment above.

  5. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    Baseline (worktree issue-2122-golden-prompt-corpus): Frontend 216 test files / 4704 tests passed, 100.26s. Exit 0.

  6. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    NODESPACE_PROMPT_DUMP capture recipe — no daemon, no DB, no gRPC

    Requested for #2119's use as well. The daemon is not needed: the dump hook sits at the generate_blocking chokepoint in packages/nlp-engine/src/chat/mod.rs, and the golden runner from #2118 passes through it. So neither the NODESPACED_DB_PATH isolation trap nor the stale-nodespaced rebuild trap applies to capturing a structural reference.

    cargo build --release -p nodespace-agent --bin golden_runner   # ~1m43s cold in a fresh worktree
    
    NODESPACE_PROMPT_DUMP=/tmp/dump.jsonl \
      ./target/release/golden_runner --reps 1 packages/agent/goldens/<case>.toml

    Output is line-delimited JSON, one record per model call:

    {"engine": "native", "kind": "prompt", "prompt": "<post-template string>", "prompt_len": 1021, "seq": 0}

    prompt is the post-template string — what llama.cpp actually receives after the Gemma-4 chat template runs, including <|turn> / <|tool> framing and the template's own uppercasing of JSON Schema types ("string" → STRING). That is the layer where the #2123 defect is visible and where nothing else can see it.

    Read it with:

    python3 -c "
    import json
    d = json.loads(open('/tmp/dump.jsonl').readline())
    print(d['prompt_len']); print(d['prompt'])
    "

    Pair it with --check, which prints the pre-template strings escaped, without loading the 5GB GGUF. The two together bracket the boundary: --check shows what the case file declares, the dump shows what survived the template. The #2123 defect is precisely a divergence between them — invisible from either side alone.

    Measured wall-clock (M-series, --release, locked E4B)

    run reps × turns total
    indirect-reference-resolves 1 × 1 6.5s
    scenario6-full-sequence 3 × 3 17.7s

    Model load plus Metal kernel compilation dominates the first few seconds and amortizes across reps. The edit → re-run → read loop is seconds, as intended.

    Production block structure, from source rather than assumed

    Sources for the blocks a production-shaped golden must carry:

    • Resident system prompt — STAGE1_SYSTEM_PROMPT, packages/agent/src/local_agent/agent_loop.rs:58
    • Workspace context — WorkspaceContext::format_for_prompt, packages/core/src/ops/context_ops.rs:393, emitting in order: COLLECTIONS: …, then RELEVANT_ENTITY_TYPES_HEADER (context_ops.rs:119), then RELATED (via relationship, not directly matched):, then ACTIVE PLAYBOOKS:
    • Per-type line — EntityTypeDescriptor::render_line, packages/core/src/ops/entity_types_block.rs:268:
      - type_id "Display Name" -> field: type {enum,values}, required; other: type [title_template: …]
      Enum values are {}-wrapped inside a ->-introduced field list, deliberately so the delimiters never nest identically.
    • Stage-2 candidate block — render_candidates_for_prompt, packages/agent/src/local_agent/routing.rs:340: a REFERENCE — procedures relevant to this request… header, then per candidate --- Candidate N: <name>, Purpose: …, the instruction subtree, and a second independent rendering of RELEVANT ENTITY TYPES from that candidate's schema_metadata.
    • Tool surface — packages/agent/src/local_agent/tools.rs

    Note the entity-types heading is rendered at two independent sites (resident workspace context and per-candidate routing) via one shared constant, so a production-shaped golden that carries only one of them is not reproducing production's shape.

    🤖 Generated with Claude Code

  7. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    Scope note: the corpus is being built as an ablation, and that is bigger than "author case files"

    Recording a scope call rather than making it silently. Proceeding on the plan below unless redirected — nothing is blocked.

    What changed

    The corpus was reframed as an ablation — cases as arms that differ by which context blocks are present — rather than one canonical production-shaped shape. The reasoning is that production's shape is itself untested: the Stage-2 candidate block, rendered instruction subtrees, RELEVANT ENTITY TYPES, and related-entities were each built on a plausible theory, and none has been measured against its own absence. The project's own prior measurements are not encouraging about the ones that were tested — +types hurt (25%→8%), +relationships was null, 10,493 chars of resident prose scored 50% against 445 chars at 73%.

    That is the right frame and I have adopted it. It also means the deliverable is materially larger than the issue body describes.

    Why it costs less than it sounds

    The seven cases already committed are all production-shaped with the full block set, so they are the full arm — the ceiling everything else is compared against. The ablation is subtractive from here: copy an arm, delete one block, re-run. At measured wall-clock (~6s for one rep including model load, ~18s for 3 reps × 3 turns) an arm is seconds, not minutes.

    What I am building

    • the corpus (done — seven cases, all measured, results below)
    • a first ablation on the highest-value axes only, not a full matrix
    • explicit recording of which axes were not run, so a partial sweep is never mistaken for a complete one

    The recommendation

    A complete mechanism × case matrix at N reps reads to me like its own issue, not a silent expansion of this one. Two reasons: single runs are not decision-grade here (identical code has scored 6/7/7 on the matrix, and scenario 6 measured 3/3 vs 0/8 depending on carried history), so every cell needs reps; and a full matrix's value is in its completeness, which is exactly what a partial sweep inside another issue cannot deliver.

    So: this issue delivers the corpus plus a first ablation on the axes most likely to change a decision. If the full matrix is wanted, I would open it separately rather than let this issue's scope drift.

    Redirect me if that split is wrong.

    Two measured results that argue for the ablation frame

    The worked example is a lever in one case and inert in another. In dev-schema-creation a detail the user mentioned was dropped 3/3. Prose in the candidate instructions: no effect. Prose in the schema description: no effect. Adding a third field to the worked example: fixed 3/3 immediately. In dev-instance-creation the identical edit — an unlisted key in the example, with a sentence naming why it was there — did nothing, still dropped 3/3.

    Same channel, same model, same shape of fix, opposite outcomes. ADR-038 Finding 2 holds when the example models a list the model is already building, and fails when the value must first be recognised as unlisted. Mechanisms are not uniformly useful, which is the ablation's whole premise.

    The continuation gap did not reproduce. dev-indirect-reference turn 3 went straight to update_node carrying both the resolved id and the change, 3/3 — no stop-after-lookup. #2118 measured scenario 6's turn 3 resolving and then stopping, 0/3 byte-identical. The difference: here the record was already in the conversation, so no separate resolve step stood between the reference and the write. That points at the resolve→write handoff specifically rather than continuation in general.

    Per-case results so far

    All against the locked native model, 3 reps each, all production-shaped (full block set).

    case result
    dev-status-change-enum 3/3 both turns — real uuid + exact enum member
    dev-schema-creation 3/3 — one schema, enum with allowed_values, no contamination off the listed type
    dev-ambiguous-clarify 3/3 first try — route_clarify with both real ids as options
    dev-instance-creation listed fields 3/3; unlisted value dropped 3/3 — standing failure, left failing
    dev-empty-result-query 3/3 — correct outcome is prose, not a tool call
    dev-relationship-creation 3/3 first try — correct tool and correct direction
    dev-indirect-reference 3/3 all three turns — description beat recency

    Stable fields are recorded per case rather than only the tally, since #2118 measured tool names stable while tool arguments varied across sessions. A second session is worth more than more reps in the first, and these are all one session.

    Provisional on #2123

    Every write case uses field_values, not properties, because a parameter named properties is silently deleted by the template (#2123). Strictly, that makes those cases not production-shaped today — production says properties. They are provisional on #2123 being fixed by renaming the parameter; if it is fixed another way (template patch, schema restructuring), they need rewriting. Each affected case says so in its notes so they are never mistaken for validated production shape.

    🤖 Generated with Claude Code

  8. malibio commented on Aug 17, 2026

    @malibio
    CollaboratorAuthor

    The ablation: two of three context mechanisms bought nothing measurable

    The headline result, and the reason the corpus was built as arms rather than one tuned shape.

    Three arms, subtracted from dev-status-change-enum so exactly one block moves per arm. Verified before spending model time: tool surfaces hash-identical across all four arms, each system prompt differing only in its intended block. (Arm entanglement has burned this project before — three failed runs of one experiment — so the isolation is checked, not assumed.)

    arm turn-1 prompt result
    full (base) 1507 3/3 correct
    no-candidate-block 575 (−62%) 3/3 identical — inert
    no-instruction-subtree 1204 3/3 identical — inert
    no-entity-types 826 3/3 wrong — enums collapse

    The Stage-2 candidate block earned nothing here

    Removing it entirely — REFERENCE header, --- Candidate N: framing, Purpose line, rendered instruction subtree — produced byte-identical output across all three reps at 62% less prompt. Same tool, same exact enum member, same real uuid carried from turn 1.

    The finer arm resolves which half was carrying the weight: neither. Keeping the framing while dropping the instructions changed nothing; dropping both changed nothing. The tool descriptions alone selected the tool — which is ADR-064 rule 2 working exactly as specified, with the candidate block restating a decision the tool surface already owned.

    Consistent with this project's other measurements of instruction text: a continuation rule inert at 72/72, and 10,493 chars of resident prose scoring 50% against 445 chars at 73%.

    RELEVANT ENTITY TYPES is the one that paid — and narrowly

    Without it, both enum values collapse to prose, in both turns, all three reps:

    with block without
    turn 1 filter in_dev "dev"
    turn 2 write ready_for_review "ready for review"

    Both writes would be rejected by a schema that validates its enum, and the turn-1 filter would silently match nothing — indistinguishable from a genuinely empty result, which is the failure this corpus has a separate case for.

    Everything else survived: right tools, real uuid, populated value map. What it lost was the one thing only this block supplies — the legal values. It fell back to prettifying the user's own wording, exactly as #2118 saw when nothing in the prompt says what exists.

    So what earns its context is the {a,b,c} allowed-values rendering specifically, not the prose framing around it.

    What this does not license

    A tie is not permission to delete a block. One case is not the workload, and a block inert here can be load-bearing on a case this corpus does not contain. The arms bound the claim to what was measured; ablation/README.toml carries that caveat so it survives without me.

    Not run (recorded rather than silently sampled): related-entities/RELATED block, COLLECTIONS, resident-prompt length arms, and the ablation across the other seven cases. Only dev-status-change-enum was ablated.

    Per-case results

    All against the locked native model at 3 reps, one session. Production-shaped (full block set) unless noted.

    case result notes
    dev-status-change-enum 3/3 real uuid + exact enum member, both turns
    dev-schema-creation 3/3 one schema, enum with allowed_values, no contamination
    dev-ambiguous-clarify 3/3 route_clarify with both real ids; first try, no tuning
    dev-relationship-creation 3/3 correct tool and direction; first try
    dev-indirect-reference 3/3 all 3 turns; description beat recency
    dev-empty-result-query 3/3 correct outcome is prose, not a tool call
    dev-unseen-schema 3/3 the generalisation test — see below
    dev-instance-creation partial listed fields 3/3; unlisted value dropped 3/3 — standing failure

    Stability of arguments is recorded per case, not just the tally: #2118 measured tool names stable while node_type varied across sessions (equipment vs Product, each 3/3 internally). These are all one session, so cross-session stability remains unverified.

    Three findings worth more than the tallies

    1. The worked example is a lever in one case and inert in another. In dev-schema-creation a detail the user mentioned was dropped 3/3. Prose in the candidate instructions: no effect. Prose in the schema description: no effect. Adding a third field to the worked example: fixed 3/3 immediately. In dev-instance-creation the identical edit — an unlisted key in the example, plus a sentence naming why it was there — did nothing, still dropped 3/3.

    Same channel, same model, same shape of fix, opposite outcomes. ADR-038 Finding 2 holds when the example models a list the model is already building, and fails when the value must first be recognised as unlisted. That recognition step is the hard part and no channel reached it. Left failing on purpose — a case whose recorded result flattered production would be worse than no case.

    2. Reachability masquerades as a tuning failure. dev-status-change-enum's first draft put the search result in the case file's history array. The model passed the ticket's title as id, 3/3 byte-identical. Adding "never the node's title" to the schema description changed nothing, also 3/3.

    Cause: a role = "tool" history message is dropped entirely by the Gemma-4 template — probed with five markers, all four other roles survive. The id was never in the prompt. Restructuring the prior call as a chained turn (which emits the real tool_call/tool_response pair) fixed it outright.

    The general lesson, and it is the same shape as #2123: dump the prompt and confirm a fact is present before tuning the words that reference it. Two 3/3 "failures" here were both invisible inputs, not model comprehension.

    3. The continuation gap did not reproduce. dev-indirect-reference turn 3 went straight to update_node carrying both the resolved id and the change, 3/3 — no stop-after-lookup. #2118 measured scenario 6's turn 3 resolving and then stopping, 0/3. The difference: here the record was already in the conversation, so no separate resolve step stood between reference and write. Points at the resolve→write handoff specifically rather than continuation in general.

    The generalisation test

    dev-unseen-schema is the sharpest case here. Every other case uses ticket/adr — the same types the worked examples show, which measures pattern-following. This one uses a Release type with stages {cut,soak,shipped,rolled_back}: vocabulary in no example, no tool description, no instruction anywhere in the prompt, while the worked example still says ticket/status/in_dev so the model must map across types.

    soak is the measurement. The user says "baking on staging" and never the word; it is not guessable from general knowledge the way shipped would be. The model produced it 3/3 and resisted shipped — the plausible wrong answer the user's own sentence invites by mentioning shipping as a later step.

    That is inference over supplied context rather than recall, and it rests on the same block the ablation just proved load-bearing. Users invent their own schemas; this is the case that says the mechanism generalises to them.

    Corpus contents

    packages/agent/goldens/
      dev-status-change-enum.toml        dev-schema-creation.toml
      dev-ambiguous-clarify.toml         dev-instance-creation.toml
      dev-empty-result-query.toml        dev-relationship-creation.toml
      dev-indirect-reference.toml        dev-unseen-schema.toml
      indirect-reference-resolves.toml   scenario6-full-sequence.toml   <- inherited controls
      ablation/
        README.toml                      no-candidate-block.toml
        no-entity-types.toml             no-instruction-subtree.toml
    

    Control vs production-shaped stays distinguishable: the two inherited files are minimal controls, and dev-indirect-reference is the production-shaped counterpart to indirect-reference-resolves for the same behaviour — the pair being the point, given scenario 6 measured 3/3 hand-authored against 0/8 in production.

    Provisional on #2123

    Every write case uses field_values, not properties, because a parameter named properties is silently deleted by the template (#2123). Production says properties, so strictly these cases do not reproduce production's tool surface today and must not be read as validated production shape.

    Each affected case now states the conditional explicitly: fixed by renaming, the case becomes correct as written; fixed any other way, it needs rewriting and re-measuring rather than re-annotating. Three cases carry a specific consequence — most importantly dev-instance-creation, whose standing failure is measured against a parameter the model can see, whereas under production's current name the whole parameter is invisible and the same request loses every value.

    No production source modified

    Case files, an ablation directory, and issue comments only.

    🤖 Generated with Claude Code

  9. malibio commented on Aug 18, 2026

    @malibio
    CollaboratorAuthor

    The target string is pinned — here is how to get it byte-exact

    For #2120 (make assembly emit it) and #2119 (assert it). Nothing here needs re-derivation; the corpus is the specification.

    NODESPACE_PROMPT_DUMP=/tmp/target.jsonl \
      ./target/release/golden_runner --reps 1 packages/agent/goldens/<case>.toml

    That writes the post-template string — what llama.cpp actually receives — one JSON record per model call. It is the only layer at which #2123-class defects are visible, so it is the layer a snapshot gate should assert on.

    dev-status-change-enum for reference: 2 turns, post-template lengths 2667 and 4401 chars.

    Block order (turn 1, verbatim)

    <|turn>system
    You are NodeSpace's assistant, acting on a user's workspace.
    Call exactly one tool. Do not answer the user in prose when a tool applies.
    
    COLLECTIONS: Engineering, Q3 Planning
    
    EXISTING SCHEMAS (do not recreate these; do not copy their fields onto a new type):
    - ticket "Ticket" -> title: text, required; status: enum {ready_for_dev,in_dev,ready_for_review,in_review,done}, required; assignee: text; sprint: text [title_template: {title}]
    - adr "ADR" -> title: text, required; status: enum {proposed,accepted,superseded}, required; supersedes: text
    
    REFERENCE — procedures relevant to this request. Use whichever applies and IGNORE the rest. …
    
    --- Candidate 1: Node Search
    Purpose: Find, list, or filter existing records by title, type, or stored field value.
    
    CALL search_nodes NOW: your next action is the tool call, not planning text.
    …
    
    EXISTING SCHEMAS (do not recreate these; do not copy their fields onto a new type):
    - ticket "Ticket" -> …
    

    Each block maps to the code that must emit it:

    block source
    resident prompt agent_loop.rs STAGE1_SYSTEM_PROMPT
    COLLECTIONS: context_ops.rs format_for_prompt
    EXISTING SCHEMAS (resident) context_ops.rs, heading constant
    per-type line entity_types_block.rs render_line
    REFERENCE + candidates routing.rs render_candidates_for_prompt
    EXISTING SCHEMAS (per-candidate) same, from c.schema_metadata

    Four things the assembly must get right, each measured

    1. The heading is EXISTING SCHEMAS (do not recreate these; …) — not RELEVANT ENTITY TYPES. Measured: RELEVANT NODE TYPES 0/5 and RELEVANT SCHEMAS 0/3 on the schema-creation case, against 5/5 for this wording. RELEVANT X reads as a topic label; EXISTING X (do not recreate these) reads as a constraint. Requires renaming RELEVANT_ENTITY_TYPES_HEADER in context_ops.rs.

    2. Two sites, differently scoped. Resident carries the retrieved schemas; per-candidate carries only that candidate's own types. An early draft copied the resident list into the candidate block and reproduced production's structure while violating its scoping — the exact contamination routing.rs documents.

    3. Write tools declare each field as a typed sub-property, enums inline (PATTERN.toml). This is the single largest behavioural requirement in the corpus: it is what makes a value the model would otherwise drop survive. Generatable from the same schema data that renders the type line.

    4. Delete the prose the declarations replace. An arm carrying both the declaration and the invent-a-key prose failed; the declaration alone passes. Adding structure while leaving the instruction it supersedes is measurably not the same edit.

    Prerequisite

    #2123 blocks all of this. Production's value parameter is named properties, which the template deletes wholesale — declarations inside a deleted parameter reach the model no better than its description does. The corpus uses field_values for exactly this reason, which is also why it is not production-shaped today.

    Order: #2123 → #2119 → #2120.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions