Skip to main content
Glama

NEXUS Context (nexus-context)

CI License: MIT Node.js >= 24

Zero-dependency local context & evidence layer in Node.js 24+ (node:sqlite + native FTS5) for verifiable token reduction, deterministic evidence selection with expandable originals, and project-scoped versioned agent memory via MCP (stdio) and CLI.

What It Solves

  1. Deterministic reduction with provenance (select / expand): Filters bulky logs (including numeric HTTP status codes such as 503 without relying on the word ERROR), compacts and projects JSON while preserving critical values, counts, and pagination metadata, slices code by line range, and stores recoverable originals (ev_...) with TTL, per-project LRU quotas, source-change detection (sourceModified), and prior secret redaction.

  2. Versioned memory and compact resume (memory / checkpoint): Strictly isolates records by projectId, tracks active decisions, rejected approaches with rationale, optimistic concurrency control (expectedRevision), idempotency (eventId), explicit historical queries, transactional forgetting across tables + FTS5 + blobs, and a resume card capped at ~500 tokens with branch/HEAD drift warnings.

  3. Ultra-lean MCP server (stdio JSON-RPC 2.0): Exposes 3 tools (nexus_evidence, nexus_memory, nexus_record) to minimize catalog overhead, protects prompt caching with on-demand retrieval, and requires human approval (candidate -> active) by default.

  4. Honest metrics: Separates filtered bytes, local token estimates, re-queries, and p50/p95 latency, explicitly noting that actual billing cost depends on official provider telemetry.

Related MCP server: @centr-ai/mcp

Prerequisites & Quick Start

Requires Node.js >= 24.0.0 (for built-in node:sqlite and FTS5 support).

# Filter logs for HTTP 503 with 3 context lines
node bin/nexus-context.js select --project my-app --file .\app.log --status 503 --context-lines 3 --max-tokens 300

# Expand the original content of a returned evidence item
node bin/nexus-context.js expand ev_<id> --project my-app --start-line 120 --end-line 150

# Record a decision and query active project memory
node bin/nexus-context.js memory record --project my-app --kind decision --title "Use SQLite FTS5" --content "Local lexical search without external services" --source "ADR-004"
node bin/nexus-context.js memory query --project my-app --query "FTS5"

# Save and resume a task checkpoint (<= 500 estimated tokens)
node bin/nexus-context.js checkpoint save --project my-app --task t-1 --objective "Fix 503" --pending "Validate retry"
node bin/nexus-context.js checkpoint resume --project my-app --task t-1

# Generate ready-to-use MCP client config (invokes node directly with bin/nexus-context-mcp.js, no cmd.exe)
node bin/nexus-context.js install-config openbot --project my-app
node bin/nexus-context.js install-config codex --project my-app
node bin/nexus-context.js install-config claude-code --project my-app
node bin/nexus-context.js install-config gemini-cli --project my-app

Windows Security: Configs generated by install-config invoke node.exe directly with bin/nexus-context-mcp.js (without cmd.exe or .cmd wrappers), mitigating CVE-2024-24576, & command injection, and %VAR% expansion. When passing untrusted or arbitrary content to the CLI, prefer stdin or direct invocation via node bin/nexus-context.js.

Documentation & Contract

Tests & Benchmarks

npm run check
npm test
node benchmarks/validate-report.js
node benchmarks/run-benchmark.js

License

MIT — Emerson Almeida (@deusbr).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI coding agents to retrieve token-budgeted project context, search code symbols, look up definitions, and access project memory and cross-project learnings through local MCP tools. It reduces redundant exploration by supplying the smallest useful context from a deterministic, local-first index.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides coding agents with structured planning, persistent project memory, automated verification, and safety permission controls through MCP tools, enabling better planning, context retention, self-checking, and guarded execution.
      MIT