Repository navigation
Description
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
- Golden-prompt runner: iterate on agent prompts as data against llama.cpp, no recompile, no plumbing #2118 — the golden-prompt utility (PR Golden-prompt utility: iterate on agent prompts as data (closes #2118) #2121). Every tuned string is validated through it at N reps.
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 TYPESblock - 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
TicketorADRtype 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:
- Domain — dev entities and enums replacing business ones
- 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_DUMPcapture and documented in each case'snotes, 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_valuesrather 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
expectfield 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
- Changing
skill_pipeline.rs/tools.rs/agent_guidance.rsto emit these strings (Generate write-tool field declarations from retrieved schemas, and delete the prose they replace #2120) - The snapshot gate asserting production reproduces them (Prompt-assembly snapshot gate: assert production reproduces the tuned golden prompt (zero model calls) #2119)
- Matrix and routing eval fixtures (Redesign agent-matrix eval scenarios around NodeSpace's actual dev-workflow use case #1977)
Notes
node_typewas 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 theirallowed_valuesin the prompt. That mirrors production, whereRELEVANT ENTITY TYPESdoes 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
malibio commentedon Aug 17, 2026
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.
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.
malibio commentedon Aug 17, 2026
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
Use
--release. A debug-profile model load is slow enough to break the edit-rerun rhythm this issue depends on.--checkprints 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_DUMPworks unchanged through the bin: it hooks the chokepoint innlp-engine'schat/mod.rs, so it captures the post-template string with nothing extra wired up.1.
--reps 3is not enough to call a case tuned, and 3/3 does not mean stableThe two committed cases each ran 3/3 byte-identical. But the same case, same code, run in two different sessions, produced different
node_typearguments —"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_valueschoice 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:
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_clarifycriterion.)3. A reproducible continuation gap, ready to tune against
scenario6-full-sequence.tomlturn 3 callsresolve_queryand then stops — it never continues toupdate_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
--checkinstead.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
malibio commentedon Aug 17, 2026
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 (
toolwith subset arg matching,sequencewithmin_properties_on,clarify,text,observe), scoring, and achainflag. 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:
expectis 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."args_contain, nomin_properties_on, no pass/fail, no N/N tallies.chain = false.Reading corrections for this issue's ACs:
route_clarify" → one case whose correct behavior is the model asking for clarification rather than acting, withexpectsaying so in prose. Not a typedclarifykind.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.tomlandscenario6-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-clarifyis 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.
malibio commentedon Aug 17, 2026
Baseline (worktree issue-2122-golden-prompt-corpus): Frontend 216 test files / 4704 tests passed, 100.26s. Exit 0.
malibio commentedon Aug 17, 2026
NODESPACE_PROMPT_DUMPcapture recipe — no daemon, no DB, no gRPCRequested for #2119's use as well. The daemon is not needed: the dump hook sits at the
generate_blockingchokepoint inpackages/nlp-engine/src/chat/mod.rs, and the golden runner from #2118 passes through it. So neither theNODESPACED_DB_PATHisolation trap nor the stale-nodespacedrebuild trap applies to capturing a structural reference.Output is line-delimited JSON, one record per model call:
{"engine": "native", "kind": "prompt", "prompt": "<post-template string>", "prompt_len": 1021, "seq": 0}promptis 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:
Pair it with
--check, which prints the pre-template strings escaped, without loading the 5GB GGUF. The two together bracket the boundary:--checkshows 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)indirect-reference-resolvesscenario6-full-sequenceModel 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:
STAGE1_SYSTEM_PROMPT,packages/agent/src/local_agent/agent_loop.rs:58WorkspaceContext::format_for_prompt,packages/core/src/ops/context_ops.rs:393, emitting in order:COLLECTIONS: …, thenRELEVANT_ENTITY_TYPES_HEADER(context_ops.rs:119), thenRELATED (via relationship, not directly matched):, thenACTIVE PLAYBOOKS: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.render_candidates_for_prompt,packages/agent/src/local_agent/routing.rs:340: aREFERENCE — procedures relevant to this request…header, then per candidate--- Candidate N: <name>,Purpose: …, the instruction subtree, and a second independent rendering ofRELEVANT ENTITY TYPESfrom that candidate'sschema_metadata.packages/agent/src/local_agent/tools.rsNote 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
malibio commentedon Aug 17, 2026
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 —+typeshurt (25%→8%),+relationshipswas 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 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-creationa 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. Indev-instance-creationthe 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-referenceturn 3 went straight toupdate_nodecarrying 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).
dev-status-change-enumdev-schema-creationdev-ambiguous-clarifydev-instance-creationdev-empty-result-querydev-relationship-creationdev-indirect-referenceStable 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, notproperties, because a parameter namedpropertiesis silently deleted by the template (#2123). Strictly, that makes those cases not production-shaped today — production saysproperties. 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 itsnotesso they are never mistaken for validated production shape.🤖 Generated with Claude Code
malibio commentedon Aug 17, 2026
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-enumso 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.)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 TYPESis the one that paid — and narrowlyWithout it, both enum values collapse to prose, in both turns, all three reps:
in_dev"dev"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.tomlcarries that caveat so it survives without me.Not run (recorded rather than silently sampled): related-entities/
RELATEDblock,COLLECTIONS, resident-prompt length arms, and the ablation across the other seven cases. Onlydev-status-change-enumwas ablated.Per-case results
All against the locked native model at 3 reps, one session. Production-shaped (full block set) unless noted.
dev-status-change-enumdev-schema-creationallowed_values, no contaminationdev-ambiguous-clarifyroute_clarifywith both real ids; first try, no tuningdev-relationship-creationdev-indirect-referencedev-empty-result-querydev-unseen-schemadev-instance-creationStability of arguments is recorded per case, not just the tally: #2118 measured tool names stable while
node_typevaried across sessions (equipmentvsProduct, 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-creationa 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. Indev-instance-creationthe 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'shistoryarray. The model passed the ticket's title asid, 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-referenceturn 3 went straight toupdate_nodecarrying 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-schemais the sharpest case here. Every other case usesticket/adr— the same types the worked examples show, which measures pattern-following. This one uses aReleasetype 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 saysticket/status/in_devso the model must map across types.soakis the measurement. The user says "baking on staging" and never the word; it is not guessable from general knowledge the wayshippedwould be. The model produced it 3/3 and resistedshipped— 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
Control vs production-shaped stays distinguishable: the two inherited files are minimal controls, and
dev-indirect-referenceis the production-shaped counterpart toindirect-reference-resolvesfor 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, notproperties, because a parameter namedpropertiesis silently deleted by the template (#2123). Production saysproperties, 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
Diagnose the unlisted-value failure to a capability boundary (#2122)
The unlisted-value drop is silent, not unaware (#2122)
A procedural "do not skip" step does not reach the drop either (#2122)
Apply the declared-field pattern corpus-wide, re-measuring each (#2122)
Re-sync ablation arms to the new base; one finding revised (#2122)
Make the two-site entity-types shape uniform across every turn (#2122)
Record the two-site redundancy measurement in PATTERN.toml (#2122)
Scope each per-candidate entity block to its own candidate's type (#2122
Head the block EXISTING SCHEMAS — a constraint, not a label (#2122)
malibio commentedon Aug 18, 2026
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.
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-enumfor reference: 2 turns, post-template lengths 2667 and 4401 chars.Block order (turn 1, verbatim)
Each block maps to the code that must emit it:
agent_loop.rsSTAGE1_SYSTEM_PROMPTCOLLECTIONS:context_ops.rsformat_for_promptEXISTING SCHEMAS(resident)context_ops.rs, heading constantentity_types_block.rsrender_lineREFERENCE+ candidatesrouting.rsrender_candidates_for_promptEXISTING SCHEMAS(per-candidate)c.schema_metadataFour things the assembly must get right, each measured
The heading is
EXISTING SCHEMAS (do not recreate these; …)— notRELEVANT ENTITY TYPES. Measured:RELEVANT NODE TYPES0/5 andRELEVANT SCHEMAS0/3 on the schema-creation case, against 5/5 for this wording.RELEVANT Xreads as a topic label;EXISTING X (do not recreate these)reads as a constraint. Requires renamingRELEVANT_ENTITY_TYPES_HEADERincontext_ops.rs.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.rsdocuments.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.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 usesfield_valuesfor exactly this reason, which is also why it is not production-shaped today.Order: #2123 → #2119 → #2120.
🤖 Generated with Claude Code
Address review: re-fix stale counts, standardize pointers, add nits (#…
Address re-review: fix 3 accuracy defects, correct a claim I overstat…
Scope the `in` repair to `filters`; the no-denylist claim was false
Get search_nodes' `in` operator an array — and correct what #2182 att…