Skip to content

Verify tool name/description parity across all four ACP shim files #1560

Closed

Description

@malibio

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 registration
  • packages/skill/shims/codex/nodespace-plugin.ts — definePlugin({ tools: [...] })
  • packages/skill/shims/gemini/nodespace-tools.json — JSON manifest (source of truth for the Rust-side SHIM_TOOLS registry)
  • packages/skill/shims/opencode/nodespace-plugin.ts — plugin-style tool registration
  • packages/agent/src/acp/context_assembly.rs — SHIM_TOOLS registry and shim_tools_match_gemini_manifest test (the existing partial check this issue extends)

Related Issues

Activity

  1. self-assigned this
    on Aug 3, 2026
  2. deleted a comment from nbeai on Aug 3, 2026
  3. malibio commented on Aug 3, 2026

    @malibio
    CollaboratorAuthor

    Note for future readers — this issue's premise went stale before it was implemented, and the implementation is still fine.

    The SHIM_TOOLS framing above is out of date. This issue describes extending the SHIM_TOOLS registry and its shim_tools_match_gemini_manifest test in packages/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 via hook('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 standard bun 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions