n2n-nexus
CLAUDE.md12 starsChanged 6 months agoApache-2.0View on GitHub
Pre-commit runs lint; pre-push runs build && test (via lefthook). The daemon + MCP refactor is complete (v0.5.0). See REFACTOR_PLAN.md for the full rationale. Only the daemon process accesses SQLite directly. MCP processes go through HTTP.
In this repositoryOne other file it gives its agents.
- llms.txtllms.txt
The file
We split this CLAUDE.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 45
Only the daemon process accesses SQLite directly.
- Very specific: line 60
Test files run sequentially (fileParallelism: false) to avoid SQLite file conflicts
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Commands
npm run build # tsc → build/
npm run dev # tsc -w (watch mode)
npm test # vitest run (all tests)
npm run lint # eslint src/**
# Run a single test file
npx vitest run tests/daemon_messages.test.ts
# Run daemon locally
node build/index.js daemon --root /tmp/nexus-test --port 5688
# Run MCP server locally
NEXUS_ENDPOINT=http://127.0.0.1:5688 node build/index.js mcpPre-commit runs lint; pre-push runs build && test (via lefthook).
Architecture
The daemon + MCP refactor is complete (v0.5.0). See REFACTOR_PLAN.md for the full rationale.
Entry point
src/index.ts routes to runDaemon() (src/daemon/) or NexusServer().run() (src/server/nexus.ts) based on the first CLI argument (daemon or default).
Daemon (src/daemon/)
server.ts — plain http.Server with all REST endpoints. Contains TOOL_DEFINITIONS (20 tools with JSON Schema), per-instance session map (Map<instanceId, {currentProject}>), and individual tool handler functions. Routes: GET /api/tools, POST /api/tools/call, plus project/message/meeting/task/maintenance endpoints.
MCP Server (src/server/nexus.ts)
Pure stateless proxy. On startup: connects stdio transport, then tries GET /api/tools; if daemon unreachable, schedules 3-second retry loop. On connect: calls server.sendToolListChanged(). CallTool → POST /api/tools/call. No hardcoded tool names.
Storage layer (src/storage/) — unchanged
StorageManager(index.ts) is the single access point; delegates to sub-modulessqlite.ts+sqlite-meeting.ts— SQLite with WAL mode for meetings, tasks, read cursorsstore.ts(UnifiedMeetingStore) — auto-selects SQLite or JSON fallback for meetingsregistry.ts/projects.ts/logs.ts/docs.ts— JSON file-based storage for projects, global docs, logspaths.ts— all file paths derived fromgetRootPath()which readsNEXUS_ROOTenv or~/.n2n-nexus
Only the daemon process accesses SQLite directly. MCP processes go through HTTP.
Key SDK patterns
// Capability must declare listChanged for notifications to work
capabilities: { tools: { listChanged: true } }
// On daemon connect:
server.sendToolListChanged(); // triggers IDE to re-fetchTypeScript / Module Notes
- Project uses
"module": "NodeNext"— all internal imports must use.jsextension even for.tssource files - Tests use
port: 0for dynamic port allocation and write totests/tmp/(cleaned per test) - Test files run sequentially (
fileParallelism: false) to avoid SQLite file conflicts
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

