Repository navigation
Description
Overview
Gemma 4 E4B (the locked native model per ADR-056) scored 10/12 on scripts/aichat-matrix.ts. Two scenarios failed. Investigation showed they have different root causes than "prompt tuning," so this issue is narrowed to the one it actually fixes:
- Scenario 5 (List/query) — fixed here (see below).
- Scenario 6 (Update) — moved to resolve_query must return a resolved node, not query fragments #1637. Prompt-dump analysis proved this is not prompt-fixable: E4B constructs a malformed multi-word
search_nodesquery that fails to substring-match, and (separately) can stop after the read half of a read-then-write turn. resolve_query must return a resolved node, not query fragments #1637 now owns both halves (query decomposition + read-then-write turn completion).
Root cause of Scenario 5
"List all my invoices" expected search_nodes; E4B called execute_query. This was not an ambiguous tool description — it was an ambiguous tool boundary. The agent had two overlapping query tools: execute_query could list-by-type, filter by title/content, filter by property, and return properties, making it a near-superset of search_nodes. For "list all X" both tools were correct and execute_query returned more data, so no prompt prose gave the model a clean rule.
Fix: collapse the two agent tools into one
search_nodes is now the single agent query tool. It covers title/keyword lookup, listing all of a type, and typed property filtering (with operators + sorting), and always returns node properties. execute_query / Tool::ExecuteQuery are deleted. Internally search_nodes routes by capability: title/type listing via the title index (NodeService::query_nodes), property filters via QueryService SQL json_extract (query_ops::execute_query) — so property queries keep the correct SQL path. The backend query_ops::execute_query op, the daemon gRPC ExecuteQueryRequest, and the CLI query command are unchanged (separate layer). With one query tool the Scenario 5 ambiguity cannot occur.
Docs updated: architecture/data-layer.md (Query System section), architecture/prompt-skill-system.md (whitelist), ADR-056 (E4B-gaps consequence).
Acceptance Criteria
- Root cause identified for Scenario 5's
execute_queryvssearch_nodeschoice (ambiguous tool boundary, not description) - Root cause identified for Scenario 6's incomplete update turn — moved to resolve_query must return a resolved node, not query fragments #1637 (malformed query + read-then-write turn completion; not prompt-fixable)
- Tool-collapse change made; skills/guidance/tool-descriptions updated to the single
search_nodestool -
scripts/aichat-matrix.tsre-run againstgemma-4-e4b-q4km: Scenario 5 passes, no regression on the other passing scenarios. Scenario 6 remains the sole failure, tracked in resolve_query must return a resolved node, not query fragments #1637 (documented gap, per acceptance-criteria allowance) - Code passes
bun run quality:fix; tests pass
Related Issues
- Adopt Gemma 4 E4B as the locked native model (supersedes ADR-046's Ministral 8B lock) #1636 (adopted Gemma 4 E4B; ADR-056)
- resolve_query must return a resolved node, not query fragments #1637 (query decomposition + read-then-write turn completion — owns Scenario 6)
Activity
Address review: guard comment on recommended_model_id(), link follow-…
Address review: guard comment on recommended_model_id(), link follow-…
Adopt Gemma 4 E4B as the locked native model (supersedes ADR-046's Mi…
malibio commentedon Jul 17, 2026
Frontend baseline (worktree issue-1640-collapse-query-tool): 166 test files passed, 4104 tests passed. Duration 45.72s.