Repository navigation
Description
Overview
Agent tool names are written down in four separate places that must stay in agreement. Drift-detector tests exist solely to keep them aligned, which signals the design wants a single registry. This issue introduces one source of truth from which the definitions, display names, and baseline membership are derived.
Problem Statement
The same set of tool names is hand-maintained in four locations:
- Tool definitions —
all_tool_definitions()inpackages/agent/src/local_agent/tools.rs - Humanized display names —
humanize_tool_name()inpackages/agent/src/local_agent/agent_loop.rs - Baseline always-on tools —
BASELINE_TOOLSinpackages/agent/src/local_agent/tools.rs - Per-skill tool whitelists —
tool_whitelistproperties inpackages/agent/src/skill_pipeline.rs
A drift-detector test (humanize_tool_name_covers_all_registered_tools) exists only to assert these lists agree. Adding or renaming a tool requires editing several places; forgetting one is caught (if lucky) by a test rather than by the compiler.
Proposed Solution
Define a single registry (e.g. an enum or a const table) that is the authoritative list of tools. Derive from it: the tool definition/JSON schema, the humanized display name, and baseline membership. Skill whitelists should reference registry entries rather than free-form strings where practical. Once derived, the drift-detector tests become unnecessary.
Acceptance Criteria
- A single registry defines the canonical set of agent tools
- Tool definition, humanized name, and baseline membership are derived from the registry (not maintained as separate lists)
- Adding a tool requires editing exactly one place
- Drift-detector tests that only existed to keep the lists aligned are removed (their guarantee now holds by construction)
- Skill
tool_whitelistreferences are validated against the registry (unknown tool names are rejected or flagged) - Code passes `bun run quality:fix`
- Tests pass (`bun run test:all`)
Technical Specifications
Reference Files
- Tool definitions / BASELINE_TOOLS: `packages/agent/src/local_agent/tools.rs`
- humanize_tool_name: `packages/agent/src/local_agent/agent_loop.rs`
- Skill whitelists: `packages/agent/src/skill_pipeline.rs`
Parallelization
Scoped to the agent crate's tool registry surface. It touches tools.rs, agent_loop.rs (only humanize_tool_name), and skill_pipeline.rs. It does not change message types, prompt assembly, or daemon wiring, so it runs in parallel with the related issues. Coordinate on agent_loop.rs edits with any concurrent message-type work.
Activity
ai-chat agent quality: fix runaway/hang + tool-call template leaks, t…
malibio commentedon Jun 5, 2026
Baseline (agent crate, the crate this issue touches): cargo test -p nodespace-agent --lib → 234 passed, 0 failed. Starting work in worktree issue-1326-tool-registry.
Single tool registry as the source of truth for agent tool name lists (…
ai-chat agent quality: fix runaway/hang + tool-call template leaks, t…
Single tool registry as the source of truth for agent tool name lists (…