Documentation
Nexus Docs
Technical reference for the Nexus project intelligence layer — MCP server, CLI client, plugins, and platform API.
MCP Server Reference
The nexus-mcp server exposes 58 tool actions across 16 endpoints via the Model Context Protocol (stdio transport). It communicates exclusively with the Nexus HTTP API and holds no direct database credentials.
Architecture
Identity is resolved once at startup via GET /api/mcp/identity using a NEXUS_PRIVATE_TOKEN (nxs_pat_* format) as a Bearer token. All subsequent API calls reuse this token for authentication. The Nexus backend resolves the token to a user identity and enforces project-scoped RBAC.
Tool Layers
- Layer 1 — Knowledge Access (5 tools): kb_search, kb_memory, kb_get, kb_related, project_list
- Layer 2 — Coordination (42 tools): Vault letters (vl_*), tasks (task_*), sessions (session_*), decision comments (dc_*), document ingestion (doc_*), project directives (pd_*, directive_export), skills (sk_*), agent files (af_*)
- Layer 3 — Governance (3 tools): ADR lifecycle — adr_create, adr_submit, adr_decide
- Layer 4 — Reviews (5 tools): Entity reviews — rv_list, rv_get, rv_create, rv_decide, rv_comment
- Utility (3 tools): identity, cost_summary, show_plugins
Tool Naming Convention
All tools follow the {domain}_{operation} pattern. Domain prefixes:
| Prefix | Domain |
|---|---|
kb_* | Knowledge |
vl_* | Vault Letters |
task_* | Tasks |
session_* | Sessions |
dc_* | Decision Comments |
doc_* | Documents |
sk_* | Skills |
adr_* | ADR Governance |
rv_* | Reviews |
af_* | Agent Files |
directive_* | Directives (export) |
pd_* | Project Directives (CRUD) |
project_* | Projects |
Environment Variables
| Variable | Required | Description |
|---|---|---|
NEXUS_API_URL | Yes | Nexus API base URL (e.g. https://nexus.gatewarden.eu) |
NEXUS_PRIVATE_TOKEN | Yes | nxs_pat_* API token for identity resolution |
Skill Lifecycle
Skills are managed centrally in the Nexus platform and delivered to agents at runtime. Understanding the lifecycle helps avoid confusion about when updates take effect.
How skills are loaded:
- When an agent invokes a skill command (e.g.
/nexus-sec-scan), the skill body is loaded live from the Nexus backend via the MCP server — not from local files. - Skill updates pushed via
sk_updatetake effect immediately for all projects the skill is assigned to. No pull, restart, or re-deployment required. - The local
.nexus/skills/directory is a workspace cache written bynexus pull. It exists for offline reference and IDE autocompletion, but is never the authoritative source.
When to run nexus pull:
- To update local
.nexus/cache files (AGENTS.md, skill files, agent files) for reference - After adding new skill assignments in the dashboard
- Not required for skill content updates — agents always fetch the latest version at invocation time
Scope:
- Core skills (
project_id = NULL) are tenant-wide and available to all projects. Only platform owners and admins can create or modify them. - Project-scoped skills (
project_id = UUID) belong to a single project and are managed by project admins. They do not appear in other projects unless explicitly promoted to core.
Auto-Ingested Scan Reports
When agents append a session entry with entry_type set to security_scan or performance_scan, the platform automatically creates a knowledge-base document from the entry summary.
- The ingest document is classified as
scan_reportand tagged with sourceauto-scan. - The summary field of the session entry becomes the document body — skills instruct agents to write the complete structured report into this field.
- Scan reports appear in the project knowledge base under the scan report classification and are searchable via
kb_search.
CLI Reference
The nexus CLI is a native Rust binary that manages project scaffolding, authentication, agentic file import, and project binding for agentic workflows. It maintains a local .nexus/ workspace cache (automatically excluded from Git via .git/info/exclude) and uses the same API token model as the MCP server.
Commands
nexus loginAuthenticate with a Nexus API tokennexus init [path]Initialize a customer project repository for agentic workflowsnexus init --shadowed-ai[DEPRECATED v0.6.4] Flag accepted but ignored; .git/info/exclude is always managed automatically. Will be removed in v0.8.0nexus importScan workspace for existing agentic files, extract directives, and import into the linked Nexus projectnexus logoutRemove stored credentialsnexus link [--project-id <id>]Bind a project to the current workspacenexus unlinkRemove project binding from the workspacenexus pull [--project-id <id>]Pull skills, agent files, and MCP config from the platformnexus deinit [--force]Remove all AI scaffold files (.nexus/, .claude/, .opencode/, etc.)nexus skills exportExport enabled skills for the linked project as JSONnexus statusShow auth, project, and workspace statusnexus preflightRun environment readiness checks (git, node, API, MCP)nexus config showDisplay current configurationnexus config set K=VUpdate a configuration valuenexus config pathShow the config file pathnexus shadow on|off|status[DEPRECATED v0.6.4] Superseded by direct agentic root targeting and nexus import. Will be removed in v0.8.0 (ADR-0029)nexus upgradeUpgrade the Nexus CLI to the latest release versionImport Workflow
nexus import scans the current workspace for pre-existing agentic configuration files (CLAUDE.md, AGENTS.md, .cursorrules, copilot-instructions.md, .windsurf/rules/*.md, GEMINI.md) and imports them into the linked Nexus project. This is the recommended way to onboard existing projects alongside the platform-managed workflow.
What happens:
- Detected agentic files are ingested as unclassified items for review and promotion
- Directive-like sections (rules, guidelines, conventions) are extracted and created as disabled project directives
- Markdown links to local documents (e.g.
docs/*.md) are resolved and ingested as referenced documents - Exported agent files (.nexus/CLAUDE.md, .nexus/AGENTS.md) automatically include a cross-reference block pointing to the original customer files
During nexus init, the CLI automatically detects existing agentic files and offers to run the import. The import can also be triggered manually at any time via nexus import.
Workspace Cache
The CLI creates a .nexus/ directory in your project root to store workspace metadata, project bindings, and cached configuration. This directory is automatically excluded from Git via .git/info/exclude (not .gitignore) to avoid polluting the shared ignore file. The nexus deinit command cleans up both the cache directory and the exclude entries.
OpenCode Plugins
Nexus ships open-source OpenCode plugins that extend the editor runtime with Nexus-aware behavior. Plugins are distributed as TypeScript source files via nexus init / nexus pull and load automatically from the .opencode/plugins/ directory at startup. No npm publish or manual install required.
nexus-compaction-plus (v1.8.0)
Preserves Nexus session context across OpenCode compaction events and records each compaction as an auditable entry in the active Nexus session. Ensures resuming agents have full context even after context window compaction.
Hooks:
experimental.session.compacting— injects active session/project IDs into the compaction promptevent (session.compacted)— records compaction entry in the Nexus session via REST API
nexus-cost-control (v2.0.0)
Tracks token usage and estimated cost for the current Nexus session by aggregating data from OpenCode's native AssistantMessage objects. No external dependencies — all data is sourced locally from the OpenCode session.
Custom Tools:
nexus_cost_summary— on-demand cost snapshot with input/output/reasoning/cache token counts and estimated cost in USDnexus_show_plugins— discovers all loaded Nexus plugins, versions, API connection status, and registered hooks
Events:
session.idle— auto-appends cost snapshots to the active Nexus session timeline (debounced: 5 min)
Startup Notification
On load, each plugin shows a TUI toast confirming its name, version, and API connection status. Use the /nexus-show-plugins command to display detailed plugin information on demand.
Distribution & Requirements
The plugin is distributed as a code-mirror— the TypeScript source lives in each project's .opencode/plugins/ directory. It is not published to npm. Updates are synced via nexus pull (agent files mechanism). Requires @opencode-ai/plugin as a dependency (auto-managed via .opencode/package.json).
Auto-Assignment Rules
OpenCode plugins are only distributed to projects where the agent owner is set to opencode or both. Projects using claude-cli exclusively will not receive plugin files during nexus pull.
Platform API
The Nexus platform exposes a RESTful API under /api/ for all MCP server and CLI communication. The API enforces tenant isolation, project-scoped RBAC, and token-based authentication.
Authentication Model
API tokens use the nxs_pat_* prefix and are passed as Bearer tokens in the Authorization header. Tokens are SHA-256 hashed at rest and resolve to a user identity with tenant and project scope.
RBAC Model
Nexus uses a dual-layer RBAC model: (1) platform-level roles via app_metadata.platform_role (platform_owner, platform_admin), and (2) project-scoped roles via project_memberships (owner, admin, developer, viewer). Customer-level access is managed through customer_memberships.
OpenAPI Schema
A downloadable OpenAPI schema for the Nexus platform API is planned for a future release.
Coming soonWorkspaces
Nexus Workspaces provide reproducible, version-controlled development environments using Devbox 0.17. Workspaces follow a Blueprint + Fork architecture: admins create global blueprints, and projects receive independent deep-copy forks that can be customized without affecting the source.
Blueprint + Fork Architecture
A Workspace Blueprint is a global template that defines a complete dev environment. It combines a baseline (core packages like go, node, python), a flavor (curated package sets like nexus-dev), and optional post-init scripts and metadata variables.
When assigned to a project, Nexus creates a Fork — a deep copy of the blueprint at its current version. Forks are fully independent: changes to the composed body, post-init script, or meta variables do not propagate back to the blueprint. A database trigger tracks upstream changes so you can pull updates when ready.
Baselines & Flavors
Baselines provide the foundation packages for a workspace. Flavors add curated tool sets on top. Both are admin-seeded and read-only.
| Type | Examples | Purpose |
|---|---|---|
| Baseline | go-1.23, node-22, python-3.12 | Core language runtime |
| Flavor | nexus-dev, web-frontend, data-science | Curated package bundle |
CLI Integration
The Nexus CLI pulls workspace forks and materializes them as local Devbox configuration files:
nexus pull --scope workspaceDownload the active workspace fork and write devbox.json + init scriptsnexus statusShows workspace fork status including upstream change detectionThe CLI uses the v2 fork API with automatic fallback to v1 for backwards compatibility. Upstream changes are surfaced during nexus status so you can decide when to sync.
Wizard & UI
Creating a blueprint uses a 5-step wizard: Type (Devbox 0.17, with Dev Containers and devenv coming soon), Baseline, Flavor, Post-Init Script, and Metadata. Blueprints can be activated, deactivated, or archived. Only active blueprints appear in the project assignment modal.
Upstream Change Detection
When a blueprint is updated after a fork has been created, a database trigger sets upstream_changed = true on all forks of that blueprint. This flag is visible in both the UI and the CLI, letting project teams decide when to pull the latest changes.
devbox.json Reference
The devbox.json file is the heart of every Nexus workspace. It defines a reproducible, Nix-based development environment that is consistent across all team members and CI pipelines. When a workspace fork is pulled via the CLI, Nexus materializes this file in your project root.
Structure
{
"packages": [], // Nix packages (array or object)
"env": {}, // Environment variables
"shell": {
"init_hook": [], // Commands run on shell start
"scripts": {} // Named scripts (devbox run <name>)
},
"include": [] // Plugin references
}Key Sections
packages — List or map of Nix packages. Supports version pinning (go@1.23), flake references (github:org/repo#pkg), and per-platform filtering via platforms /excluded_platforms.
env — Key-value pairs set as environment variables inside the Devbox shell. Supports $PWD and $PATH.
shell.init_hook — Shell commands that run before every devbox shell or devbox run. Use this for aliases, env overrides, or quick setup steps.
shell.scripts — Named commands runnable via devbox run <name>. Each script can be a string or an array of commands.
include — References to Devbox plugins (GitHub repos, local paths, or built-in plugins).
Best Practices
- Pin package versions explicitly (e.g.
node@22instead ofnode@latest) for reproducible builds. - Keep
init_hookfast — move long-running setup into named scripts. - Use
envfor project-specific config; use.envfiles (viaenv_from) for secrets. - Prefer the map format for
packageswhen using platform-specific or plugin options. - Document custom scripts with clear names (e.g.
dev,test,build). - Use Nexus Meta Variables (
C_DBX_*) to inject project-level config into the environment at fork level.
Validation
The Nexus workspace editor validates your devbox.json in real-time: JSON syntax errors are caught immediately, and devbox-specific rules (valid top-level keys, package format, platform names, shell structure) are checked before saving. Errors block the save; warnings are informational.
See the official Devbox configuration reference for the full specification.
Additional Topics
Getting Started
SoonSet up your first project, connect agents via the MCP server, and understand the core concepts.
Architecture Guide
SoonDeep dive into the platform architecture, entity hierarchy, data model, and design decisions.
ADR Governance
SoonUnderstand the ADR lifecycle, state machine, and governance workflows for architectural decisions.
Entity Review System
SoonLearn how the multi-entity review workflow handles approvals, rejections, and comments.