Repository navigation
Description
Overview
scripts/aichat-matrix.ts runs the #1329 end-to-end scenario matrix (greeting, schema creation, instance creation, list/query, update, empty-result, multi-type CRUD) and captures per-scenario results for a human to read — but its expect field is a prose string, not a machine assertion. It cannot fail CI on a behavioral regression.
Now that the full skill-mediated routing architecture has shipped (ADR-036: #1351, #1352, #1353, #1355, #1356, #1357), end-to-end agent behavior is the one layer without an enforced eval. This issue turns the matrix into assertable pass/fail, complementing the two evals that already exist.
Existing eval coverage (do not duplicate)
- ✅ Tool-call parsing regressions — pinned fixtures in
chat::parser::tests(Upgrade vendored llama.cpp so local models route tools reliably (gates the skill-routing redesign; supersedes #1329 verdict) #1355). - ✅ Routing accuracy (which skill for which intent) —
scripts/routing-eval.ts/bun run eval:routing(Routing eval harness: repeatable fixtures for skill-discovery accuracy (indirect phrasing, clarification, mis-route) #1357). ⚠️ End-to-end behavior (this issue) —aichat-matrix.tsis observation-only.
These are distinct layers: parser tests assert tool-call shape, routing-eval asserts skill selection, and this asserts the agent did the right thing end-to-end (right tool fired the right number of times with the right effect).
Problem Statement
aichat-matrix.tsGROUPS[].expectare descriptive strings ("exactly one create_schema, no extra related types"), parsed by humans, never asserted.- A regression in agent behavior (e.g. proactive extra schema creation, retry-on-empty, wrong tool) would not fail any automated check.
Proposed Solution
Add a machine-checkable expectation per scenario and a pass/fail runner (mirror routing-eval.ts's structure: per-case assertions, exit 0/1, optional baseline regression via an env-set baseline file). Expose as bun run eval:agent (or fold into the existing matrix script with an --assert mode).
Assertion model (account for the pull routing flow)
Under ADR-036's pull model the model calls search_skills before acting, so search_skills will appear in the tool sequence. Assertions must check for the TARGET tool, not total tool count. For each scenario assert on a small structured expectation, e.g.:
noTools(conversational) — no graph-action tools fired (search_skills tolerated only if the model over-routes; ideally none on greetings)toolOnce: "create_schema"— the target tool fired exactly once (ignoring search_skills)toolSequence: ["search_nodes", "update_*"]— search-then-update orderingnoRetry— the same failing tool is not called repeatedly (empty-result scenario)noExtraTypes— exactly one create_schema, not several (no proactive related-type creation)
Scenarios to assert (from the current matrix)
- Greeting ("Hi there") → no graph-action tools, short reply
- Capability ("What can you do?") → no tools, concise, no trailing reasoning
- Schema creation ("Create an invoice tracking database") → create_schema exactly once, no extra types
- Instance creation ("Add an invoice for $500 due next Friday") → create_node against the new schema
- List/query ("List all my invoices") → search_nodes (type-filtered)
- Update ("Mark the $500 invoice as paid") → search-then-update
- Empty-result ("Find my invoice for one million dollars") → single statement, no retry
- Multi-type CRUD (book + contact create/instance/query) → one create_schema each, instances created, cross-type query
Acceptance Criteria
- Each scenario has a structured, machine-checkable expectation (not a prose string).
- A runner asserts per-scenario pass/fail and exits non-zero on any failure.
- Assertions check for the target tool (tolerating the
search_skillsrouting call), not raw tool count. - The empty-result and no-extra-types scenarios are explicitly asserted (the historically-regressing behaviors).
- Exposed as a bun script; runnable locally and in CI against the upgraded engine.
- Baseline-comparison mode (like
routing-eval.ts) records and diffs results. - Documented in
nodespace-docs/development/alongside the routing-eval and prompt-dump tools. - Code passes
bun run quality:fix.
Technical Specifications
Reference Files
scripts/aichat-matrix.ts— the observation harness to upgrade (scenarios atGROUPS, turn parsing inrunTurn).scripts/routing-eval.ts— the assertion/baseline/exit-code pattern to mirror.scripts/aichat.ts— the underlyingsendturn driver (unchanged; Skill-mediated tool routing: LLM-judged two-stage retrieval pipeline with clarification fallback #1352 routing is internal to onesend).
Notes
- Skill-mediated tool routing: LLM-judged two-stage retrieval pipeline with clarification fallback #1352 (skill-mediated routing) is internal to a single
sendcall — the matrix's one-send-per-scenario contract is unchanged. Only the assertion layer is new. - The daemon/socket/DB are caller-managed (same as routing-eval.ts); skills must be seeded before running.
Related Issues
- ADR-036 (the shipped architecture this guards)
- Routing eval harness: repeatable fixtures for skill-discovery accuracy (indirect phrasing, clarification, mis-route) #1357 (routing eval — the sibling harness to mirror)
- Upgrade vendored llama.cpp so local models route tools reliably (gates the skill-routing redesign; supersedes #1329 verdict) #1355 (parser regression fixtures — the third eval layer)
- A/B test Gemma 4 12B (Q4_K_M) vs E4B for the local ai-chat agent #1329 (original scenario matrix source)
Non-Goals
- Routing-accuracy testing (covered by Routing eval harness: repeatable fixtures for skill-discovery accuracy (indirect phrasing, clarification, mis-route) #1357).
- Tool-call-shape regression testing (covered by Upgrade vendored llama.cpp so local models route tools reliably (gates the skill-routing redesign; supersedes #1329 verdict) #1355).
Activity
malibio commentedon Jul 5, 2026
Architecture-review cross-link: automating agent-flow stuck-state coverage as e2e with a stub model is tracked in #1526, and the CI that would run it in #1495. This scenario matrix is the natural content for that suite.
malibio commentedon Jul 11, 2026
Frontend baseline: 159 test files passed, 4031 tests passed (44.74s)
Adopt Gemma 4 E4B as the locked native model, replacing Ministral 8B (c…
Adopt Gemma 4 E4B as the locked native model (supersedes ADR-046's Mi…