Repository navigation
Description
Split from #1922 — genuinely separate scope: this is prompt-mass reduction for tool schemas specifically, not a scenario-6 fix.
Finding
Captured the full turn-1 acting prompt for agent-matrix scenario 6 (20,005 chars, zero conversation history, fresh purged DB, gemma-4-e4b-q4km). Section breakdown:
system prose (identity + guidance): 3,043 chars (15%)
tool declarations (12 tools): 16,962 chars (85%)
Per-tool sizes:
3,310 create_schema
3,195 search_nodes
2,953 search_semantic
2,329 update_schema
1,133 create_node
683 update_node
597 create_relationship
551 create_nodes_from_markdown
546 get_related_nodes
475 get_node
427 update_task_status
286 delete_node
Top 4 tools account for 11,787 of 16,485 chars (71%) of all tool-schema text, sent in full on every turn those tools are offered — none of it retrieved or summarized adaptively.
Why this is NOT a simple trim (checked, not assumed)
Read create_schema's full rendered description directly. Most of its size is genuinely load-bearing argument-shape content per ADR-064 rule 1 — required-field rules, the title_template↔fields cross-reference constraint, coreValues validation requirements. This is correctly-placed content, not padding.
A confound in the specific measurement
The 20,005-char turn measured landed on routing::fail_open_surface (12 tools, near-maximum surface) because no skill cleared the score gate that turn — a routing-miss symptom, not purely tool-description verbosity. Fixing routing reliability would also reduce prompt size on fail-open turns, for free. Worth checking whether fail-open frequency is itself a measurable, fixable rate before concluding tool-schema size is the primary lever.
Proposed approach, mirroring #1813's rigor (do not skip this)
#1813 ("reduce the resident prompt") required: a repaired measurement harness, a non-adversarial case set, before/after size AND success-rate comparison, and an explicit non-goal against re-occupying the channel with differently-worded content. The same discipline should apply here before any tool-schema description is shortened — this is shared, load-bearing surface across the whole tool registry, and ADR-064 rule 1 gives tool schemas argument-shape authority for a measured reason (100% compliance vs 62.5% absent, 87.5% for prose).
Acceptance criteria
- Measure fail-open turn frequency across the matrix — is 12-tool fail-open common enough to matter, or was this one measurement an outlier?
- For each of the top 4 tools, classify every sentence of its description: argument-shape (keep, ADR-064 rule 1) vs. tool-selection guidance (candidate for moving to a different channel or cutting) vs. genuinely redundant
- A repaired measurement harness and non-adversarial case set, per Reduce the resident prompt to identity and policy (measured 50% vs 73% for identity-only) #1813's precedent — do not trust a single live-model probe
- Before/after size AND success-rate comparison; a result below current baseline blocks the change
- Full agent test suite shows no regression
- Full 12-scenario matrix gate (3+ reps) before merge per Autonomous goal: drive local-agent matrix reliability to 10/12+ without turn-by-turn relay #1917's standing rule
Reference
- Autonomous goal: drive local-agent matrix reliability to 10/12+ without turn-by-turn relay #1917 checkpoint 18, Scenario 6: entity-types block never reaches the prompt despite successful schema retrieval (dynamic_ctx_len=0 with count=1) #1922 (the investigation this was split from)
- Reduce the resident prompt to identity and policy (measured 50% vs 73% for identity-only) #1813 (resident-prompt reduction — same methodology, different target)
- ADR-064 rule 1 (tool schemas own argument shape)
Activity
malibio commentedon Aug 2, 2026
Classification + fail-open frequency measurement
Per-sentence classification of the top 4 tools' descriptions (top-level
description+ parameter-leveldescriptionfields — the full rendered surface the #1924 char counts are drawn from), and a fail-open frequency measurement from existing matrix artifacts. No code changed, no live-model calls made — source-reading + on-disk artifact analysis only, per the task scope.Method note on scope of "description"
The 3,310/3,195/2,953/2,329-char figures in #1924 count the whole rendered tool schema (top-level description + every parameter/sub-field description), not just the top-level string. I classified all of it — the parameter descriptions carry real weight (e.g.
create_schema'scoreValuesfield description alone is ~340 chars) and ADR-064 rule 1 speaks to "parameter names, types, required-ness, enum membership" which lives almost entirely at that level.create_schema(source:packages/agent/src/local_agent/tools.rs:696-767)Top-level description, sentence by sentence:
"required": ["name", "fields"]already encodes this structurally — this sentence is redundant with that, though it does add the "display name" semantic gloss the bare schema can't carry. Borderline: keep the semantic gloss, the required-ness restatement is redundant.create_schemafeeds intocreate_node'snode_typeparam), not this tool's own argument shape. ADR-064 rule 2 territory. Candidate to move tocreate_node's description (which already partially covers this — see below) or trim.title_template↔fieldscross-reference constraint #1924 already flagged as load-bearing — confirmed: this is enforced in code (interpolate_title_template_with_schema,packages/core/src/utils/markdown.rs), not just asserted in prose. Keep, this is exactly the kind of cross-field constraint a flat JSON Schema cannot express.relationshipsis a separate top-level array). Keep, but could be tightened; it's also partially restated in therelationshipsparam description ("Use instead of array fields when referencing existing types") — see redundancy note below.Parameter-level descriptions:
description(top-level param)fields"required": ["name", "fields"](minor). The scalar-vs-relationship split restates top-level sentence 8 — this is the genuinely redundant pairing: the same "fields are scalar-only, use relationships for refs" rule appears at the top-level description (sentence 8) AND here AND again in therelationshipsparam description below. Three-way redundancy; two of the three occurrences are candidates for deletion, keep the one closest to the parameter it governs (this one, onfields).fields.items.coreValuesrequiredarray can't express (required only when a sibling field has a specific value). Keep. "Use lowercase values" is argument-shape (a convention/format rule) — keep, cheap and prevents a real failure mode. "If predefined values aren't known yet, use type=text instead; values can be added later with update_schema" is tool-selection guidance — it's telling the model when NOT to use this tool's own enum machinery and to defer to a different tool (update_schema) later. Candidate to trim or relocate toupdate_schema'sadd_fields.coreValues(which currently lacks this same escape-hatch advice, creating an asymmetry).title_templatetitle_templateside. This is not redundant in the pejorative sense — cross-referencing constraints genuinely need to be visible from both sides (a model fillingfieldsfirst needs the rule as much as one fillingtitle_templatefirst) — but it IS the same rule stated twice. Given ADR-064 doesn't have a rule against restating a single cross-field constraint from both of its endpoints (this is different from restating the same single-field rule redundantly), I'd call this legitimately-duplicated argument-shape, not "genuinely redundant" — recommend keeping both.relationshipsfieldsrow above) — genuinely redundant with the other two. Candidate for deletion (keep it onfields, drop here and at top-level sentence 8, OR keep here and top-level, drop thefieldsone — either way, one of the three should go).relationships.items.targetTypecreate_schemasummary: ~85% of the text is genuinely load-bearing argument-shape (much of it enforcing constraints JSON Schema cannot express structurally: conditional-required, cross-field references, field-name collisions). One real tool-selection sentence (output feedscreate_node.node_type). The clearest trim target is the 3-way duplication of "fields are scalar, use relationships for type references" (top-level sentence 8,fieldsparam,relationshipsparam) — collapsing to one occurrence saves real chars with zero information loss. Sentence 7 ("Only define type-specific fields") is pure restatement of sentence 5 and can go outright.search_nodes(source:tools.rs:327-418)Top-level description:
query='invoice',query='', node_type='task',status='open', amount > 500, due_date before a date) are argument-shape usage examples that substantially duplicate what thefiltersparameter's own items schema already documents in more precise, structured form (operator enum, type enum, worked example onfilters.items.property). This is the strongest genuinely-redundant candidate in this tool: the prose walks through the same three query modes the parameter schema already fully specifies.valuefield is untyped/description-only: "Use string for dates (YYYY-MM-DD)..." — see below, this is a second, near-verbatim occurrence). Genuinely redundant withfilters.items.value's own description. Keep one, drop the other — I'd keep it onvalue(closer to the field it governs) and drop it from the top-level description.search_nodesandsearch_semantic. Correctly placed per doctrine (rule 2 says tool descriptions own tool selection). Not a trim candidate on channel-misplacement grounds. Note: asymmetric —search_semantic's own description carries no reciprocal pointer back tosearch_nodes. Not itself a defect (doctrine doesn't require symmetry), but worth flagging since a routing failure that surfacessearch_semanticwithoutsearch_nodesloses this disambiguation entirely.Parameter-level descriptions (the largest share of this tool's size — the
filtersarray's nested schema):querynode_typecreate_node.node_type,resolve_query.node_type— cross-tool redundancy, not within-tool, so out of this tool's own scope to trim, but worth flagging as a registry-wide pattern (same warning copy-pasted 3+ times across tools rather than centralized).filters(array-level)filters.items.type["property","content","metadata","relationship"]) gives membership but not semantics or the property-vs-metadata confusion this text is specifically guarding against — "NEVER use 'metadata' for status...it will fail with 'Invalid metadata field'" documents a real, named error message a model would otherwise hit and have to recover from blind. Keep in full — this is the strongest possible case for rule-1 placement, not a trim candidate.filters.items.operatorfilters.items.propertyfilters.items.type's own description already establishes ("status is a property filter, not metadata" is the same fact as "'property' for ANY schema/node field...use this for status" / "NEVER use 'metadata' for status"). Strong trim candidate — the full JSON example adds format-syntax value but the trailing clause is pure repetition.filters.items.valuefilters.items.case_sensitivefilters.items.relationship_type["parent","children","mentions","mentioned_by"]are more "which edge" than "direction" — minor wording nit, not a channel issue).filters.items.node_idsorting,sorting.items.field,sorting.items.direction,limitsearch_nodessummary: This tool has the clearest redundancy findings of the four. Two concrete, low-risk trims: (a) drop the "Dates use YYYY-MM-DD" top-level sentence, keep it onfilters.items.valuewhere it already exists; (b) drop the trailing "status is a property filter, not metadata" clause fromfilters.items.property's example, sincefilters.items.typealready states this fact more completely (and is the field that actually governs it). The big top-level "use it for all three of..." block is tool-selection guidance correctly placed per ADR-064 rule 2 and should NOT be cut on channel grounds, though its three inline examples are lower-value than the structured schema examples elsewhere in the same tool.search_semantic(source:tools.rs:480-543)Top-level description (one block, no clear sentence boundaries beyond these 4):
"description": "Number of top results..."oninclude_markdowndoesn't itself convey (a default of1looks arbitrary without this). Keep, though see redundancy note below.include_markdown's own parameter description: "Number of top results to include full markdown content for (0-5, default 1). Set to 0 for IDs and snippets only, or increase to get full content for multiple results." — this is almost a verbatim restatement, two sentences apart. Strongest redundancy finding in this tool; drop one copy (recommend keeping the parameter-level one, dropping this top-level sentence, since the parameter-level version already carries the range0-5and default that this one lacks).Parameter-level descriptions:
All parameter descriptions (
query,limit,include_markdown,collection,threshold,scope,include_archived,node_types,exclude_collections,property_filters,include_edges,graph_boost) are argument-shape, each describing a single field's semantics/format/default with no cross-tool or selection content. No redundancy found among them except theinclude_markdownoverlap with top-level sentence 3 noted above.scope's note about ai-chat conversations never being embedded ("Note: ai-chat conversations are not embedded, so they are never returned by search regardless of scope") is a real, non-obvious behavioral fact — keep, it prevents a plausible-looking dead end.search_semanticsummary: Smallest of the 4 tools and the cleanest — one clear redundancy (include_markdowndefault/behavior explained twice), everything else load-bearing. The one tool-selection sentence present (sentence 4) is correctly placed and should not be touched.update_schema(source:tools.rs:769-847)Top-level description:
add_fields/remove_fields/rename_fields/add_relationships/remove_relationships/description/title_template) that are already visible as top-level keys in the schema itself. Borderline genuinely redundant with the schema's own key names, but a capability-summary sentence like this is standard/expected tool-description content across the registry (e.g.create_schema's own opening sentence does the same) — I would not flag this one for deletion in isolation, since removing it would leave the tool with no prose purpose statement at all.remove_fields+add_fieldsto rename, silently losing data) — correctly placed, keep.Parameter-level descriptions:
schema_idsearch_nodes.node_typeandcreate_node.node_type, this one lacks the "copy exactly from RELEVANT ENTITY TYPES block, don't paraphrase" warning that ADR-064's own evidence section identifies as measurably load-bearing elsewhere in the registry. This is an asymmetry/gap, not a redundancy — flagging it as a possible place to add a proven-effective sentence, not cut one, so out of scope for a trim but worth recording.descriptiontitle_templatecreate_schema.title_template, restated for the update path). Legitimately duplicated across the two tools for the same reason ascreate_schema's internal duplication (both endpoints of a schema-authoring workflow need it); not a within-tool redundancy. Keep.add_fields(array + items)create_schema.fields.items(name,type,description,coreValues)coreValuesdescription here ("REQUIRED and must be non-empty when type="enum"...Array of {value, label} pairs.") is a shortened version ofcreate_schema's — it's missing the "use lowercase values" convention rule and the "if predefined values aren't known yet, use type=text instead" escape hatch thatcreate_schemacarries. This is an inconsistency (same field, same constraint, different completeness across two tools) rather than a redundancy — flagging, not a trim target.remove_fieldsrename_fields(array + items)add_relationships,remove_relationshipsupdate_schemasummary: The smallest of the 4 (2,329 chars) and proportionally the tightest — no strong redundancy findings within the tool itself. The two things worth recording are cross-tool, not within-tool: (1)schema_idis missing the "copy exactly, don't paraphrase" warningnode_typecarries elsewhere — a gap, not something to cut; (2)add_fields.coreValuesis a strictly weaker version ofcreate_schema.fields.coreValuesfor the identical constraint — worth reconciling for consistency, though which direction (shortencreate_schema's or lengthenupdate_schema's) is a product judgment, not something this classification pass should decide.Cross-tool pattern: the real redundancy is often between tools, not within one
The single-tool redundancy findings above are individually small. The larger pattern, visible only by reading all 4 side by side: the "copy the id exactly from RELEVANT ENTITY TYPES — character for character, including underscores — never shorten, singularize, paraphrase, or guess" warning is repeated near-verbatim in
search_nodes.node_type,create_node.node_type, andresolve_query.node_type(and appears increate_schema's narrative aroundtargetTypein a shorter form). That's real, measured-effective content per ADR-064's own evidence section — I'm not suggesting deleting it — but if a future pass wants a structural fix rather than a wording trim, centralizing this into something the ENTITY TYPES context-block renderer states once (channel 4, not tool schemas) rather than repeating per-tool would cut more aggregate text than any single-tool sentence trim identified above, without touching the content's effectiveness. Flagging as a structural observation, not a recommendation to act on now — it's a bigger design change than "delete a redundant clause" and deserves its own measurement.Fail-open frequency measurement
Data source:
/tmp/matrix-1917*/run{1,2,3}.json(8 matrix passes × 3 reps = 24 run files, 288 total scenario-turns), all atevalCommit=db708a90(current HEAD) per each file'sprovenance.evalCommitfield — directly comparable to today's tool registry and to the #1924 measurement. (Excluded from the count:/tmp/agent-matrix-/and/tmp/nodespace-matrix-e4b/, both at older commits4c580818/6f7250cdfrom 2026-07-31 — not comparable, noted for completeness but not folded into the number below.)Method: parsed each turn's
toolsOffered(comma-separated tool-name string) and counted tool names per turn. The registry has 14 tools;fail_open_surface()(packages/agent/src/local_agent/routing.rs:466) excludes tools whose required params depend on routed guidance (resolve_query), and the observed fail-open turns additionally lacksearch_skills— confirmed the max observed count (12) matches14 − resolve_query − search_skillsexactly by diffing the observed 12-tool set against the full registry.Result:
Both fail-open turns are in the same run (
matrix-1917-schemafix/run3.json), scenarios 8d and 8e, bothroutingDecision: "failed". Critically, the same scenarios in the same matrix pass's run1 and run2 routed normally (8d: 9 tools in run1/run2 vs 12 in run3; 8e: 7 tools in run1/run2 vs 12 in run3) — this confirms fail-open is a genuine per-attempt routing-miss event, not a fixed property of scenario 8d/8e's prompt content, consistent with #1924's own framing ("a routing-miss symptom, not purely tool-description verbosity").Answer to the acceptance-criteria question: the one turn #1924 measured (20,005 chars, 12-tool fail-open) was not representative — it's rare (under 1% of turns that reach routing) across the available real matrix data, not a common steady-state condition. This means: fixing routing reliability, if pursued, would only shrink prompt size on <1% of turns — it is not a competitive alternative to a tool-schema trim as a general-purpose size reduction, though it's still worth having independently for correctness reasons unrelated to prompt size.
Caveat on this number: the 24 runs are drawn from one working session's WIP debugging directories (7 of 8 passes are
dirty=True, i.e., uncommitted local changes were present when captured) rather than a clean, purpose-built fail-open-frequency study — I did not run anything new, per the task's explicit instruction not to spend budget on a fresh matrix pass. Thedirtyflag doesn't invalidate the tool-count observation (that depends only on the registry + routing logic, both stable across these captures at the sameevalCommit), but it does mean this wasn't a controlled, single-purpose data collection — treat 0.69–0.90% as a reasonable point estimate from real (if incidentally-collected) data, not a designed study's result.What a properly-scoped trim should target (classification-derived, not implemented)
Real candidates, ranked by confidence:
search_semantic: drop top-level sentence 3 (near-verbatim duplicate ofinclude_markdown's own description) — highest-confidence, cleanest single deletion of the whole set.search_nodes: drop the trailing clause offilters.items.property's example ("— status is a property filter, not metadata") — fully covered byfilters.items.type.search_nodes: drop the top-level "Dates use YYYY-MM-DD" sentence — fully covered byfilters.items.value.create_schema: collapse the 3-way "fields are scalar, use relationships for type references" duplication (top-level sentence 8,fieldsparam,relationshipsparam) to one occurrence.create_schema: drop top-level sentence 7 ("Only define type-specific fields") — pure restatement of sentence 5.Not candidates — confirmed load-bearing, do not touch:
create_schema'stitle_template↔fieldscross-reference (both directions) — code-enforced constraint, not restatable via JSON Schema.search_nodes.filters.items.type's full property/metadata disambiguation — names an actual error message, prevents a real failure mode.search_semantic's "do not call get_node or search_nodes again" sentence — correctly-placed rule-2 content, arguably the tool's single most valuable sentence.node_type/schema_id"copy exactly, don't paraphrase" warnings — directly the kind of content ADR-064's evidence section measured as effective; also the strongest case that some redundancy here is cross-tool infrastructure (same warning needed at 3+ independent call sites) rather than waste, and better addressed by a structural fix (centralize into the ENTITY TYPES block renderer) than a per-sentence trim.update_schema'srename_fieldsordering/collision rules andadd_fields/create_schema.fieldsconditional-required-when-enum rules — all encode constraints no flat JSON Schemarequired/enumcan express.Net assessment: the classification does not support a large trim. The five items above are real but individually small (rough estimate: 150–250 chars combined across all 4 tools, well under 5% of the 11,787-char top-4 total) — most of the top-4 tools' bulk is legitimately-placed argument-shape content per ADR-064 rule 1, exactly as #1924's own "why this is not a simple trim" section already anticipated. The larger lever, if one exists, is the structural cross-tool
node_type-warning centralization noted above — a bigger design change than a wording trim and out of scope for this classification pass. Combined with the fail-open measurement above (routing-miss is <1% of turns, not the common case), neither lever available here would meaningfully reduce the 20,005-char worst case; a repaired-harness, non-adversarial before/after study per #1813's precedent (acceptance criterion 3) remains the right next step before cutting anything, and should be scoped against the ~150–250 char realistic trim budget this classification found rather than against the full 11,787-char top-4 total.WIP: matrix gate RESULTS for #1925's compaction fix (94e4aa2) — 9.0/1…
malibio commentedon Aug 3, 2026
Closing as a documented negative result. Independently verified: fail-open frequency measured at 0.69% (2 of 288 scenario-turns), and the classification pass found most of the tool-schema content is legitimately load-bearing per ADR-064 rule 1 (argument-shape constraints no flat JSON Schema can express) — the realistic trim budget is ~150-250 chars, nowhere near enough to meaningfully shrink the 20,005-char worst case. Neither lever (trimming redundancy or reducing fail-open frequency) pays off at the scale needed. A structural fix (centralizing the repeated node_type/schema_id warning across tools into the entity-types block renderer) was noted as the only lever with real potential, but that's a larger design change than a wording trim — worth its own issue if pursued, not a reason to keep this one open.