Repository navigation
Description
Overview
The ACP shim tool definitions are hand-duplicated across four files with no automated check that they agree with each other.
Problem Statement
packages/skill/shims/ contains four per-agent shim implementations (claude-code/nodespace-hook.ts, codex/nodespace-plugin.ts, gemini/nodespace-tools.json + nodespace-handler.ts, opencode/nodespace-plugin.ts), each hand-authoring the same 5 tool definitions (nodespace_search_semantic, nodespace_get_node, nodespace_create_node, nodespace_update_node, nodespace_get_children) with matching names, descriptions, and parameter schemas. This duplication is a deliberate, documented constraint — the shims are copied as standalone scripts into agent session temp directories with no shared module resolution at runtime — not something to collapse into one file.
packages/agent/src/acp/context_assembly.rs introduced a SHIM_TOOLS registry (closing #1509) as the source of truth for the ACP-injected tool list, with a test (shim_tools_match_gemini_manifest) asserting it matches gemini/nodespace-tools.json — the one shim that is machine-readable JSON. The other three shims are hand-authored .ts files with no test-time parsing, so nothing currently verifies they match SHIM_TOOLS or each other. Today all four match (verified by hand during #1509's review), but nothing prevents future drift if a tool is renamed, added, or removed in one shim without updating the rest.
Proposed Solution
Add a lightweight script (a bun script is a natural fit — no need for a Rust test, since three of the four shims are TypeScript) that extracts tool name + description from all four shim files and asserts they match each other. Candidate extraction approaches:
gemini/nodespace-tools.json— parse directly as JSON.claude-code/nodespace-hook.ts,codex/nodespace-plugin.ts,opencode/nodespace-plugin.ts— these declare tool metadata as inline object literals (name: '...',description: '...'); a regex or lightweight AST walk (e.g. via the TypeScript compiler API, already a project dependency) can extract the same fields without needing a full interpreter.
Wire the script into bun run test (or a dedicated bun run test:shims script) so drift fails CI the same way shim_tools_match_gemini_manifest does today for the Rust side.
Acceptance Criteria
- A script verifies tool name + description parity across all four files in
packages/skill/shims/ - The script runs as part of the standard test suite (or a clearly-documented dedicated command)
- Introducing a mismatch between any two shims causes a test failure
- Code passes
bun run quality:fix; tests pass
Technical Specifications
Reference Files
packages/skill/shims/claude-code/nodespace-hook.ts— hook-style tool registrationpackages/skill/shims/codex/nodespace-plugin.ts—definePlugin({ tools: [...] })packages/skill/shims/gemini/nodespace-tools.json— JSON manifest (source of truth for the Rust-sideSHIM_TOOLSregistry)packages/skill/shims/opencode/nodespace-plugin.ts— plugin-style tool registrationpackages/agent/src/acp/context_assembly.rs—SHIM_TOOLSregistry andshim_tools_match_gemini_manifesttest (the existing partial check this issue extends)
Related Issues
- Derive the ACP tool list from the Tool enum to stop three-way drift #1509 (introduced the
SHIM_TOOLSregistry and the Gemini-only drift test this issue extends to all four shims)
Activity
Address review: cross-reference the drift test from ShimTool's doc co…
Derive ACP's TOOLS_LIST from a shim-tool registry to stop the drift (#…
malibio commentedon Aug 3, 2026
Note for future readers — this issue's premise went stale before it was implemented, and the implementation is still fine.
The
SHIM_TOOLSframing above is out of date. This issue describes extending theSHIM_TOOLSregistry and itsshim_tools_match_gemini_manifesttest inpackages/agent/src/acp/context_assembly.rs. That registry was removed in ee3d5e0 (#1633) on 2026-07-12, six days after this issue was filed. Neither symbol exists in the Rust source today, so the "extends the existing partial check" framing no longer describes anything real.What actually shipped in #1936 is still correct and worth keeping. The guard compares the four shims in
packages/skill/shims/against each other — gemini's JSON manifest as the reference, codex and opencode on name + description, claude-code on names only (it registers viahook('name', …)and carries no per-tool descriptions). Mutation-tested: drifting a codex description, renaming a claude-code tool, and reformatting quote style each fail the suite, so it does not pass vacuously. Runs in ~5ms as part of the standardbun run test:skill.What it does not cover, and deliberately so: nothing anchors the shims to what the Rust ACP layer injects at runtime, because that anchor no longer exists. Shim-to-shim parity is the whole guarantee.
ACP is on hold for now, so this is not a gap to go fix. The
acp/module is still wired in (pub mod acp) and the shims still ship — leaving both in place is intentional. If ACP work resumes, the open question to revisit is whether the shims need re-anchoring to a Rust-side source of truth, and that should be filed fresh rather than derived from this issue's stale description.Not reopening — the implementation is complete.