Skip to content

A question about a type is routed to write tools and answered from memory by the local agent #4200

Closed

Description

@malibio

Overview

In a chat bound to the Software Project type, the local agent answered "Does this type extend another type?" with an invented parent and answered "Explain this type" by rewriting a correct description incorrectly. Neither turn made a tool call. The second turn was also offered write tools for a read-only question. The correct answer was available in the conversation and in the stored schema both times.

Problem Statement

Evidence is from NODESPACE_PROMPT_DUMP on the local native model (gemma-4-e4b-q4km), on a fresh database. Reproduce by opening the Software Project type chat and asking the two questions.

Turn 1, "Explain this type"

  • The prompt (about 36 KB, 17 KB of instructions before the tool block) already contained the correct description as the chat's first assistant turn: "It extends project, so it has that type's fields as well", six fields, "From project" on the inherited ones.
  • The skill "Understanding and Changing a Type" was Candidate 1 of 2, including "READ THE TYPE FIRST". All six read tools were offered, including get_node.
  • The system prompt opens with "Call exactly one tool. Do not answer the user in prose when a tool applies." An explain request has no applicable tool, so the instruction conflicts with the request.
  • The model made zero tool calls and returned a degraded paraphrase: "extending the build-in link type", LaTeX markup, and a recommendation to call update_schema directly.

Turn 2, "Does this type extend another type?"

  • Routing selected skills in this order: Relationship Management, Organization, Node Creation, Researching, then Understanding and Changing a Type fifth.
  • The tool set was 11 tools: search_nodes, search_semantic, get_node, create_node, update_node, update_schema, update_task_status, create_relationship, get_related_nodes, route_clarify, delete_relationship. A question about a type's definition was offered write tools, and was not offered run_query or get_node_context.
  • Zero tool calls again. The answer ("extends from $\text{Project}$") was right only because the correct text was earlier in the history.

Proposed Solution

In a chat bound to a node, treat a question about that node as a read request: rank the skill for that node type's explanation first, offer only read tools unless the user asks for a change, and make the reply grounded in the stored definition. Resolve the "call exactly one tool" instruction for requests that need no tool.

Documentation

  • Prompt & Skill System - skill retrieval, ranking, pinned skills and prompt assembly; the routing described here governs which skills and tools a turn gets.
  • ADR-038 - tools are offered through the routed skills.
  • ADR-100 §3-4 - asking about a node comes first; a change is described and confirmed before it is written.
  • ADR-056 - the locked native model, which limits what a prompt can ask of it.

Acceptance Criteria

  • In a bound type chat, "Does this type extend another type?" and "Explain this type" both rank the type-explanation skill first.
  • Those turns are offered read tools only (no create_node, update_node, update_schema, delete_relationship, update_task_status). A request to change the type still gets the write tools, after the description and confirmation ADR-100 §4 requires.
  • The answer to "does this extend another type?" for Software Project names project, and for a type that extends nothing says so.
  • "Explain this type" does not contradict the opening description already in the conversation.
  • The system prompt no longer instructs the model to call a tool for a request that has no tool to call.
  • Verified against a fresh prompt dump of both questions on the local model, not only by the eval suite, and an eval scenario for the two questions is added.
  • Prompt snapshots are regenerated (UPDATE_GOLDEN=1) and the diff reviewed. Code passes bun run quality:fix; bun run test:changed passes.

Technical Specifications

Reference Files

  • packages/agent/src/skill_pipeline.rs - skill seeds, their tools lists, applies_to and ranking
  • packages/agent/src/local_agent/routing.rs, agent_loop.rs - routing, tool selection, prompt assembly
  • packages/agent/tests/golden/prompt_assembly/ - snapshot gate for model-facing text
  • packages/nlp-engine/src/inference/prompt_dump.rs - NODESPACE_PROMPT_DUMP, which records the full prompt and raw response per call

Implementation Details

The daemon must have the embedding model loaded when reproducing, or skill routing differs from what a user sees.

Related Issues

  • None

Activity

  1. added
    bug
    on Oct 31, 2026
  2. self-assigned this
    on Nov 3, 2026
  3. mstomar125 commented on Nov 3, 2026

    @mstomar125
    Contributor

    Picking this up (sweep drain).

  4. mstomar125 commented on Nov 3, 2026

    @mstomar125
    Contributor

    Merged: a typed question in a chat bound to a node now takes a read-only lookup route led by the pinned skill (change requests and non-English or polite requests keep the old route and their write tools); the type skill now says to answer from the stored schema, which is read first. Still open and unverified because they need a live model: the prompt dump, an eval scenario for the two example questions, and the check that 'Does this type extend another type?' names the parent and 'Explain this type' does not contradict the opening description.

    🤖 Generated with Claude Code

  5. mstomar125 commented on Nov 5, 2026

    @mstomar125
    Contributor

    Closing: the routing fix is merged (a typed question in a bound chat takes a read-only lookup route; the type skill answers from the stored schema). The prompt dump, eval scenarios and live check, which need the local model, are tracked in #4245.

    🤖 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

Labels

aibackendbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions