Repository navigation
Description
Overview
Build @nodespace/agent-tools, a TypeScript npm package that gives all PTY-based agents native access to NodeSpace's knowledge graph. Each supported agent (Claude Code, Codex, Gemini CLI, Pi, OpenCode) gets a thin extension shim that registers tool functions from this shared package using each agent's native extension API.
This replaces the earlier MCP-based approach. There is no MCP server; all tool access goes through gRPC directly to nodespaced on localhost:50051.
Problem Statement
PTY-spawned agents (under ADR-032) have no built-in awareness of the NodeSpace knowledge graph. Without tool access, agents must work from only the context written to their CLAUDE.md / AGENTS.md file at session start — they cannot search nodes, create notes, or update the graph during a session.
Proposed Solution
A single npm package exposes all NodeSpace graph operations as callable functions. Per-agent shims register these as native tools using each agent's extension API, so the agent sees them as first-class tools indistinguishable from built-ins.
Acceptance Criteria
Package core
-
@nodespace/agent-toolsnpm package created atpackages/agent-tools/ - gRPC client connects to
nodespacedonlocalhost:50051using@grpc/grpc-js - Implements:
searchSemantic,getNode,createNode,updateNode,getChildren - Connection error surfaces as a clear tool error (not a crash)
- Package builds cleanly with
bun run build
Per-agent extension shims
- Claude Code: hooks-based shim in
.claude/hooks/— registers tools via Claude Code hook system - Codex: plugin shim in appropriate Codex plugin directory
- Gemini CLI: tool definitions written to Gemini tools directory
- OpenCode: OpenCode plugin adapter
- Pi:
registerTool()adapter
Integration
- Each shim tested with its respective agent binary in a PTY session
- Tool calls from agents reach
nodespacedand return correct results - Tests pass (
bun run test:all) - Code passes
bun run quality:fix)
Technical Specifications
Package structure
packages/agent-tools/
├── package.json
├── src/
│ ├── client.ts # gRPC client (nodespaced localhost:50051)
│ ├── tools.ts # searchSemantic, getNode, createNode, updateNode, getChildren
│ └── index.ts
├── shims/
│ ├── claude-code/ # Claude Code hooks integration
│ ├── codex/ # Codex plugin
│ ├── gemini/ # Gemini CLI tools directory
│ ├── opencode/ # OpenCode plugin
│ └── pi/ # Pi registerTool() adapter
└── tsconfig.json
gRPC client
Uses @grpc/grpc-js (no native bindings, pure JS):
import * as grpc from '@grpc/grpc-js';
// Connects to nodespaced at localhost:50051
// Uses NodeService proto definition from packages/daemon/proto/node_service.protoTool surface
| Function | gRPC call | Description |
|---|---|---|
searchSemantic(query, limit?) |
NodeService.SearchNodes (semantic mode) |
Semantic search across knowledge graph |
getNode(nodeId) |
NodeService.GetNode |
Retrieve node by ID with full content |
createNode(type, content, parentId?) |
NodeService.CreateNode |
Create new node |
updateNode(nodeId, content) |
NodeService.UpdateNode |
Update node content |
getChildren(nodeId) |
NodeService.GetChildren |
List child nodes |
Claude Code shim
Claude Code exposes a hooks system; the shim registers tools via that API so they appear as native Claude tools to the model.
Reference files
packages/agent/src/acp/context_assembly.rs— existing context assembler (adapted under ADR-032)packages/agent/src/acp/registry.rs— agent catalog (updated under ADR-032)- Daemon proto:
packages/daemon/proto/node_service.proto(created in daemon foundation issues)
Dependencies
- Daemon foundation issues (nodespaced gRPC server must be running for integration)
- ADR-032 PTY session issues (agent catalog and context assembly)
Related Issues
- Unify agent guidance rules into a single source for local agent and gRPC tool layer #1089 (agent guidance rules — guidance content injected into context files)
Activity
Add lifecycle_status to MCP tools and enhance docs import script (#770)
Migrate project documentation to NodeSpace collections (#831)
Migrate project documentation to NodeSpace collections (#831)
Migrate project documentation to NodeSpace collections (#831)
Migrate project documentation to NodeSpace collections (#831)
[-]NodeSpace Skill for Claude Code - Documentation Search and Node Operations[/-][+]NodeSpace agent-tools package: gRPC client library for all PTY agent extensions[/+]malibio commentedon May 17, 2026
Architecture update: MCP replaced by gRPC + PTY (ADR-031, ADR-032)
Completely redesigned under the new architecture:
@nodespace/agent-toolsTypeScript gRPC package supporting all 5 PTY agents (Claude Code, Codex, Gemini CLI, Pi, OpenCode) via native extension APIsThe MCP server is deleted. All tool access goes directly to
nodespacedonlocalhost:50051via@grpc/grpc-js. Each agent gets a thin shim that registers the shared tool functions using each agent's own native extension mechanism.malibio commentedon May 18, 2026
Closing as duplicate of #1122, which was implemented and merged in PR #1146.