English | 简体中文
An event-driven, dual-engine Super-Agent control plane and polymorphic worker runtime in Rust.
Nexus unifies messaging channels (Feishu, DingTalk, Telegram, Slack, WeChat), code collaboration (GitHub Issues, PRs, Reviews, CI), and workspace suites (Google Workspace) into a single event stream. A resident dual-engine router coordinates isolated background workers across multiple coding harnesses (codex, claude-code, pi-native, pi-rpc, opencode), shifting human involvement from monitoring individual sessions to making decisions and reviewing deliverables.
- Minimize attention overhead: Nexus stays quiet while workers progress in the background and surfaces notifications only when deliverables are ready (
Ready), decisions are needed (Blocked/Waiting), or failures occur. - Cross-channel continuity: Conversations across Feishu group topics, DingTalk chats, GitHub Issue/PR threads, and the Web workspace share persistent long-term memory (
.nexus/MEMORY.md), while worker history injection (src/workers/history.rs) strictly isolates thread context by(source, kind, conversation path). - Host vs. agent identity isolation: Nexus runs workers inside an isolated credential sandbox (
.nexus/agent-home/and.nexus/worker-bin/) with dedicated Git authorship (.nexus/worker-gitconfig) and scrubbed subprocess environments (*_SECRET*,*_TOKEN*,*_KEY*,*_PASSWORD*). An explicituse_host_ghoption allows reusing hostghcredentials when an agent account only has read access. - Strict worker workspace boundary: Worker prompts prohibit probing or scanning host personal directories outside the assigned
git worktreeand.nexus/MEMORY.md, preventing macOS TCC / iCloud Drive popups and cross-repo leakage. - Tiered filtering and orchestration: Deterministic admission rules (
Gate) and a discriminative triage classifier (Jev) filter noise and prompt-injection payloads before escalating cross-task coordination to the generativeRouter. - Decoupled tickets and execution targets: Each
Ticketowns its worktree and history independently of any single session and can hot-switchHarness x Provider x Model x ThinkEffortmid-flight viaHandoffCard.
flowchart TD
subgraph Peripherals["Sources and Channels"]
IM["IM Channels: Feishu / DingTalk / Slack / Telegram / WeChat"]
GH["Code Collaboration: GitHub Issues / PRs / Reviews / CI"]
GWS["Workspace Suite: Google Workspace Gmail / Calendar / Drive"]
WEB["Web Workspace: Slack-style Console #workspace"]
end
subgraph Intake["Three-Tier Event Intake"]
Gate["Tier-0 Gate: Allowlist / Wake Words / Idempotency"]
FanOut["Thread Fan-out: Subscribed Threads Route Directly to Ticket"]
Triage["Tier-1 Jev Triage: Injection Firewall / Proactive Rules / Complexity"]
end
subgraph Brain["Router Control Plane"]
Router["Tier-2 Router: Auto-Batching / Chain of Recall / Channel Formatting"]
Memory["Persistent Memory: .nexus/MEMORY.md"]
end
subgraph Hands["Polymorphic Worker Pool and Sandbox"]
Dispatcher["Dispatcher: Hot-Switch Harness x Provider x Model x ThinkEffort"]
Shims["Identity Sandbox: .nexus/agent-home and .nexus/worker-bin"]
Workers["Worktree Pool: codex / claude-code / pi-native / pi-rpc / opencode"]
Traces["Execution Traces: .nexus/traces/*.jsonl"]
end
subgraph Foundation["Persistence and Watchdog"]
Store[("SQLite WAL Store: .nexus/nexus.db")]
Watchdog["Watchdog: Liveness / Semantic Loop Detection / Auto-Escalation"]
end
Peripherals -->|"Events"| Gate
Gate -->|"Subscribed Thread"| FanOut
Gate -->|"Candidate Batch"| Triage
Triage -->|"Fast-Accept"| Dispatcher
Triage -->|"Escalation"| Router
Router -->|"Dispatch or Resume"| Dispatcher
Router <-->|"Read and Append"| Memory
FanOut -->|"Direct Input"| Dispatcher
Dispatcher --> Shims
Shims --> Workers
Workers -->|"Stream Steps"| Traces
Workers -->|"Report or Question"| Router
Router -->|"Channel Reply"| Peripherals
Router <--> Store
Dispatcher <--> Store
Watchdog -.->|"Inspect and Escalate"| Dispatcher
-
Three-Tier Routing & Context Locality
- Tier-0 (
Gate): Runs in sub-millisecond Rust code to enforce actor/bot allowlists, wake keywords, self-echo filtering,(sourceId, externalId)idempotency, inline target directives ([harness:provider/model:think]), and direct Subscription Fan-out for active tickets. - Tier-1 (
Jev): Discriminative classifier evaluatinginjection_risk(>= 0.80blocked), parallel proactive rules, route actions (ignore,new_ticket,attach_ticket,stop_ticket,needs_llm_router),task_kind, andcomplexity. Falls back toHeuristicJevClassifierwhen no remote Jev endpoint is configured. - Tier-2 (
Router): Resident orchestrator using Inline & Spill budgeting plus Chain of Recall (trigger/<id>,thread/<key>,ticket/<id>,ticket/<id>/report/<assignmentId>,decision/<id>) and Auto-Batching acrossoff,observe, andautoaccept modes. See docs/001-domain.md and docs/002-router-and-jev.md.
- Tier-0 (
-
Polymorphic Worker Pool & Priority Concurrency
- Every ticket operates in an isolated
git worktree(.nexus/worktrees/<short_name>) on branchagent/<short_name>. - Priority-aware
WorkerSlots(max_concurrent_workers, default4) reserves at least one slot for human wakeups whenN >= 2so interactive follow-ups never queue behind background tasks. - Unified
WorkerHarnessDriversupportscodex,claude-code,pi-native(in-process ReAct loop with automaticPlanning -> Implementationeffort downgrade after the first file edit),pi-rpc, andopencode. GET /api/worker/modelsmerges installed catalogs frompi --list-models,~/.pi/agent/{models.json,settings.json,models-store.json},~/.codex/{config.toml,models_cache.json},~/.claude/settings.json, and~/.config/opencode/opencode.json. See docs/003-worker-harnesses.md.
- Every ticket operates in an isolated
-
Identity Sandbox, Shims & Rich Channel Delivery
<state_dir>/worker-bin/exposesgh-agent(plusgh),lark-bot(pluslark-cli),gws-agent(plusgws),dws-agent(plusdws), andnexus-worker, backed by<state_dir>/worker-gitconfig(GIT_CONFIG_GLOBAL).- Supports
AgentIdentityConfig.use_host_ghwhen workers need hostghwrite access while retaining isolated commit identity or Feishu/DingTalk profiles. - Supports Markdown rich text and local/web image delivery through DingTalk (
dws-agent) and Feishu (lark-bot). See docs/004-persistence-and-shims.md and docs/005-adapters-matrix.md.
-
Dual-Mode Web Console (
127.0.0.1:3082)- Built with React 19 + TypeScript + Vite + Tailwind CSS v4 (
web/):- Collaborative Workspace (
#workspace, default): Slack-style channel view (Inbox,General,Active, per-repository#repochannels, per-source channels), status filters, inline engine/model/think picker (POST /api/triggers), and a slide-over Thread + Worker Trace Drawer. - Control Plane Admin (
#admin): Ticket dashboard with mid-flight hot-switching, live Worker Trace studio (.nexus/traces/*.jsonl), conversation stream, Dual-Engine Router & Jev tester,MEMORY.mdeditor, identity isolation matrix, and toolchain configuration.
- Collaborative Workspace (
- Built with React 19 + TypeScript + Vite + Tailwind CSS v4 (
- Build & Runtime: Rust
1.85+(Edition 2024), Node.js20+(for buildingweb/),git2.32+ - Optional Channel & Harness CLIs:
gh,lark-cli,dws,gws,codex,claude,pi,opencode
git clone https://github.com/xdlkc/nexus.git
cd nexus
# 1. Build the Web console bundle (outputs to web/dist)
cd web && npm install && npm run build && cd ..
# 2. Build the Rust daemon and CLI
cargo build --release# Probe local tools, provision .nexus/worker-bin shims, and write .nexus/config.json
./target/release/nexus setup --state-dir .nexus
# Authenticate an isolated GitHub CLI identity (separate from ~/.config/gh)
GH_CONFIG_DIR="$PWD/.nexus/agent-home/gh" gh auth login -h github.com -p https -w
# Start the daemon and HTTP/Web console on http://127.0.0.1:3082
./target/release/nexus start --state-dir .nexusUseful CLI subcommands:
nexus start --state-dir .nexus --once: Run a single deterministic poll + effect-drain cycle and exit with JSON summary.nexus status --api-url http://127.0.0.1:3082: Query live state from a running daemon.nexus worker report|read|handback|switch-target: Callback commands used by worker harnesses vianexus-worker.
# Run all unit, integration, and end-to-end simulation tests
cargo test
# Verify frontend TypeScript types and production bundle
cd web && npm run build- 001 — Domain Model & State Contracts
- 002 — Dual-Engine Router & Context Cache
- 003 — Polymorphic Worker Pool & Harnesses
- 004 — Persistence, Credential Shims & Watchdog
- 005 — Peripheral Adapters Matrix
MIT (as declared in Cargo.toml)