Repository navigation
Closed
Description
Overview
Implement NodeSpace's two-tier agent architecture: an embedded local agent (Tier 1) for knowledge graph manipulation and external agent support via ACP (Tier 2) for coding tasks.
This epic covers the complete implementation from shared interface contracts through to end-to-end integration testing, organized for maximum parallel development.
Architecture
Tier 1 — Local Agent (always available, embedded):
- In-process knowledge graph copilot using llama-cpp-2 with Ministral GGUF models
- ReAct loop with direct Rust calls to NodeService/NodeEmbeddingService
- Auto-selects model based on system RAM (>16GB -> 8B, <=16GB -> 3B)
- Tools: search_nodes, search_semantic, get_node, create_node, update_node, create_relationship, get_related_nodes
Tier 2 — External Agents via ACP (optional, on demand):
- Claude Code, Gemini CLI, Mistral Vibe spawned as ACP subprocesses
- NDJSON over stdio (bidirectional JSON-RPC 2.0)
- Context assembly from knowledge graph at session start + ongoing MCP access
UX Entry Point:
- Side nav AI item opens AI panel
- First-launch modal: choose between existing LLM provider (ACP) or download local model
- Subsequent visits go straight to chat panel
AI Chat as Node:
- Conversations stored as
ai-chatnodes withmessages[]in nested properties (same pattern as playbookrules[]) - Both local and ACP conversations captured for end-to-end development traceability
- Behavior-owned embedding:
get_embeddable_content()extracts user + assistant text, skips tool calls - Permissions via Stamped ACL (
access_tags), sync as regular nodes
Child Issues
Foundation
- Shared types, traits, and interface contracts for agent subsystems #998 — Shared types, traits, and interface contracts
- AI Chat node type: schema, behavior, plugin, and viewer #1017 — AI Chat node type: schema, behavior, plugin, and viewer
- Refactor embedding service to use NodeBehavior via NodeService for content extraction #1018 — Wire embedding service to use NodeBehavior methods
Phase 2 - Parallel Implementation (5 streams, zero cross-dependencies)
- NLP Engine: Chat inference with streaming and tool-call parsing #999 — NLP Engine: Chat inference with streaming and tool-call parsing
- GGUF Model Manager with download, verification, and lifecycle #1000 — GGUF Model Manager with download, verification, and lifecycle
- ACP stdio NDJSON transport layer #1001 — ACP stdio NDJSON transport layer
- ACP agent registry with binary detection and health checking #1002 — ACP agent registry with binary detection and health checking
- Frontend: Chat UI, agent panel, model settings, and AI onboarding #1003 — Frontend: Chat UI, agent panel, model settings, AI onboarding
Phase 3 - Dependent Implementation (4 streams)
- ACP session state machine and orchestration #1004 — ACP session state machine and orchestration
- Context assembly: build rich prompts from knowledge graph #1005 — Context assembly: build rich prompts from knowledge graph
- Local agent ReAct loop with history management and context budgeting #1006 — Local agent ReAct loop with history management
- Agent tool executor: graph operation tools for local agent #1007 — Agent tool executor: graph operation tools
Phase 4-5 - Integration
- Tauri command layer: wire frontend to agent backend services #1008 — Tauri command layer: wire frontend to backend
- End-to-end integration tests for agent subsystems #1009 — End-to-end integration tests
Dependency Graph
#998 Foundation Types
/ | | | \
v v v v v
#999 #1000 #1001 #1002 #1003
NLP Chat Model ACP ACP Frontend
Inference Mgr Transport Registry Chat UI
\ | | | /
\ | v v /
\ | #1004 #1005 /
\ | ACP Context /
\ | Session Assembly /
v v \ /
#1006 Local Agent Loop
|
v
#1007 Agent Tools
|
v
#1008 Tauri Command Wiring
|
v
#1009 E2E Integration Tests
Independent (can run anytime after #998):
#1017 AI Chat Node Type
#1018 Embedding Service Refactor
Parallel Lanes After #998
| Lane | Issues | Focus |
|---|---|---|
| A | #999, #1000 | NLP Engine + Model Manager |
| B | #1001, #1002, #1004, #1005 | ACP stack |
| C | #1003, #1017 | Frontend + AI Chat node type |
| D | #1006, #1007 | Local Agent (mock inference) |
| E | #1018 | Embedding refactor (independent) |
Critical path: #998 -> #999 -> #1006 -> #1008 -> #1009
Key Architecture References
nodespace-docs/architecture/acp-integration.md— Complete ACP specnodespace-docs/decisions/008-nlp-engine-architecture.md— NLP engine ADRnodespace-docs/architecture/mcp-integration.md— MCP server specnodespace-docs/architecture/cloud-sync.md— Stamped ACL permissions and syncpackages/nlp-engine/— Existing embedding service (foundation for chat)packages/core/src/behaviors/mod.rs— NodeBehavior trait (embedding ownership)
Design Decisions
- Auto-select model based on system RAM (not user picker on first launch)
- Agent services live OUTSIDE AppServices (survive database hot-swaps)
- Knowledge graph is the coordination layer between tiers (no agent-to-agent RPC)
- Local-first guarantee: NodeSpace fully functional with zero models and zero agents
- Chat messages as nested properties (playbook rules pattern), not child nodes
- Behavior-owned embedding: types decide what content to embed via
get_embeddable_content() - ACP conversations captured as ai-chat nodes for development traceability
Activity
malibio commentedon Apr 5, 2026
All 14 sub-issues completed and closed (#998, #999, #1000, #1001, #1002, #1003, #1004, #1005, #1006, #1007, #1008, #1009, #1017, #1018). Epic done.