An open-source AI coding and security agent engine. Hybrid local + cloud execution, multi-agent orchestration, adaptive per-project learning, prompt optimization, full MCP integration, and multiple AI engines from local Ollama to hosted Claude, GPT, and Gemini.
Ships in darknode-cli as
darknode nexus.
This describes Nexus only; it makes no claims about other tools. Each capability is implemented in this repo (see the module tree below).
- Multi-engine: routes across local and hosted AI backends through one interface.
- Local/private AI: runs fully on-device via Ollama when nothing should leave the machine.
- Multi-agent orchestration with worktree isolation.
- Adaptive per-project learning that persists context across sessions.
- Smart model delegation (
cowork): mechanical steps on cheaper models, hard steps on stronger ones. - Prompt optimization.
- Full MCP client (25 servers available, 6 bundled by default).
- Knowledge graph of the codebase.
- Self-evaluation with automatic retry.
- Plugin system: custom tools, commands, hooks, intents.
- Response cache and context compaction to reduce token spend. Measured saving:
up to ~60% when context contains duplicated file blocks and 100% on exact
read-only cache hits, but ~0% on a typical single-pass turn — see
bench/. Treat the cost-saver as a reclaim of Nexus's own overhead, not as making Nexus cheaper than a bare engine call. - Lean path (
--lean): disables auto-context-gather, knowledge-graph injection, and chain-of-thought. Measured to cut ~96% of per-turn input overhead (~3,900 → ~164 estimated tokens on this repo). Use it when the engine's own context gathering is enough. - Live cost meter and
/undocheckpoints. - Built-in security scanning.
- Git intelligence: ownership and velocity signals.
- Autonomous
/loopwith goal tracking.
┌──────────────────────────── N E X U S ────────────────────────────┐
│ │
│ INPUT LAYER │
│ ├─ Intent Router classify → route to optimal handler │
│ ├─ Reasoning Engine 4 structured thinking modes │
│ └─ Adaptive Learner gets smarter per-project over time │
│ │
│ PLANNING LAYER │
│ ├─ Agentic Planner dependency-aware task graphs │
│ ├─ Workspace Intel auto-detect stack, framework, conventions │
│ └─ Cowork Engine delegate easy tasks to cheap/fast models │
│ │
│ EXECUTION LAYER │
│ ├─ Multi-Agent fan-out · debate · pipeline · review-loop │
│ ├─ Secure Sandbox blocked patterns, warnings, audit trail │
│ ├─ Codemod Engine rename, update imports, extract, rollback │
│ ├─ Code Actions docs, dead code, security scan, endpoints │
│ └─ Error Recovery classify → retry → backoff → escalate │
│ │
│ CONTEXT LAYER │
│ ├─ Prompt Engine attention-optimal structuring, CoT, MCP │
│ ├─ Context Engine auto-gather files, git, memories, TODOs │
│ ├─ Knowledge Graph code entities + relationships graph │
│ ├─ Session Manager persist, compress, resume across restarts │
│ └─ MCP Bridge full JSON-RPC client (2025-06-18 spec) │
│ │
│ QUALITY LAYER │
│ ├─ Self-Eval Engine grade output, auto-retry below threshold │
│ ├─ Code Review (auto) security + bugs + perf + style rules │
│ ├─ Code Radar complexity hotspots, tech debt map │
│ └─ Smart Test Gen structure-aware test generation │
│ │
│ OPS LAYER │
│ ├─ Telemetry duration, tokens, cost, quality tracking │
│ ├─ Git Intelligence ownership, velocity, merge risk, commit │
│ ├─ Cost Saver dedup, cache, squeeze (measured: bench/) │
│ ├─ Background Jobs async commands without blocking │
│ └─ Diff Explainer semantic diff → human explanation │
│ │
│ EXTENSION LAYER │
│ ├─ Plugin System custom tools, commands, hooks, intents │
│ ├─ MCP Catalog 25+ servers, 6 bundled by default │
│ ├─ Project Bootstrap scaffolds with CI/CD, tests, security │
│ └─ 8 AI Engines Claude · Gemini · Codex · Ollama · more │
│ │
│ 70 modules · ~13,200 lines · zero-dependency suite (npm run stats)│
└────────────────────────────────────────────────────────────────────┘
Nexus renders to a terminal through one design system in src/ui/:
a single palette (derived from the darknode-web stylesheet so the terminal, web
console, and desktop app read as one product), resolved to four color depths
(truecolor / 256 / 16 / NO_COLOR) and both light and dark backgrounds at WCAG AA.
The Claude Code–style rounded composer is the anchor. No color value or escape
sequence lives outside the theme module. See docs/UI-DESIGN.md,
the verified environment matrix, and the committed render
artifacts in docs/ui-evidence/ (npm run evidence).
| Engine | Kind | Context | Models |
|---|---|---|---|
| Claude Code | Stream (rich) | 200K | opus, sonnet, haiku, fable |
| Gemini CLI | CLI (JSON) | 1M | gemini-2.5-pro, gemini-2.5-flash |
| Codex CLI | CLI (JSON) | 272K | gpt-5-codex, gpt-5, o4-mini |
| OpenCode | CLI | 200K | any configured |
| Aider | CLI | 200K | any configured |
| Ollama (local) | In-process | 8-32K | any local model |
| Any OpenAI-compat | API | varies | OpenRouter, Groq, DeepSeek, vLLM... |
| Anthropic API | API | 200K | claude-* (native, in-process) |
darknode nexus "fix the login bug"
darknode nexus --engine ollama "explain this codebase"
darknode nexus run "build a REST API with auth"
darknode nexus agents "add tests" "write docs" "fix lint"
darknode nexus --engine hybrid "refactor auth module" # smart delegation| Command | Description |
|---|---|
/loop [rounds] |
Autonomous goal loop with completion tracking |
/undo |
Roll back the last checkpointed mutation |
/autocorrect [on|off] |
Toggle a local, zero-token prompt cleanup pass (default OFF). When on, before each send Nexus fixes common typos, collapses whitespace, and tightens filler in the natural-language parts of your prompt — never inside code, paths, URLs, quoted strings, or flags. It is rule-based (no LLM call, no tokens spent) and shows a one-line notice with the token delta. Savings are modest on clean prompts and larger on verbose/typo-heavy ones; it reports 0 tokens saved honestly when it changes nothing. |
See LICENSE.