Skip to content

NodeSpace agent-tools package: gRPC client library for all PTY agent extensions #830

Closed

Description

@malibio

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-tools npm package created at packages/agent-tools/
  • gRPC client connects to nodespaced on localhost:50051 using @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 nodespaced and 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.proto

Tool 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

Activity

  1. added
    enhancement
    on Jan 26, 2026
  2. changed the title [-]NodeSpace Skill for Claude Code - Documentation Search and Node Operations[/-] [+]NodeSpace agent-tools package: gRPC client library for all PTY agent extensions[/+] on May 17, 2026
  3. malibio commented on May 17, 2026

    @malibio
    CollaboratorAuthor

    Architecture update: MCP replaced by gRPC + PTY (ADR-031, ADR-032)

    Completely redesigned under the new architecture:

    • Before: MCP-based Claude Code skill calling HTTP endpoints (Claude Code only)
    • After: @nodespace/agent-tools TypeScript gRPC package supporting all 5 PTY agents (Claude Code, Codex, Gemini CLI, Pi, OpenCode) via native extension APIs

    The MCP server is deleted. All tool access goes directly to nodespaced on localhost:50051 via @grpc/grpc-js. Each agent gets a thin shim that registers the shared tool functions using each agent's own native extension mechanism.

  4. added and removed
    enhancement
    on May 17, 2026
  5. malibio commented on May 18, 2026

    @malibio
    CollaboratorAuthor

    Closing as duplicate of #1122, which was implemented and merged in PR #1146.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions