Skip to content

About

Semantic diff, intent coordination, and merge safety for multi-agent software engineering.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

38 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nexum Graph β€” semantic coordination for multi-agent software work

Coordinate agents around what code meansβ€”not merely which files they touched.

Install Β· Product surface Β· Latest release Β· Nexum Corpus


Nexum Graph is a GitHub-native merge gate and semantic control plane for AI-assisted software engineering. It turns a codebase into a semantic graph, coordinates multiple agents against declared intent, validates whether changes were authorized, and records the result in a replayable event log.

The fastest way to understand the product: install nex and run nex start inside any git repository. It indexes the repo, shows the latest semantic diff, and prints the next exact commands to run.

Release status (2026-10-19). The one-step installers fetch v0.2.0. It adds the nex github init / nex github status pull-request gate, the insights-json and sarif output formats, a working GitHub Action (action.yml), and the Night Adversary 0 fixes to cross-file dependency edges and conflict attribution. See NEWS.md for what changed since v0.1.0 (March 2026).

This repository is the full product codebase:

  • 8 Rust crates in one workspace
  • 15 CLI commands
  • Guided first run via nex start
  • TypeScript, Python, and Rust semantic extraction
  • Semantic diff, coordination, validation, event log, HTTP server, and LSP integration
  • 326 source-defined automated tests (280 Rust, 46 Python)
  • MIT licensed

⚑ Install in one step

macOS / Linux

curl -fsSL https://raw.githubusercontent.com/NexumCorpus/Nexum-Graph/main/install.sh | sh

Windows PowerShell

irm https://raw.githubusercontent.com/NexumCorpus/Nexum-Graph/main/install.ps1 | iex

Then run:

nex start

That gives you a guided first run with a semantic snapshot, recommended next commands, merge-hook status, and the shortest path to live coordination.

Release assets ship:

  • nex and nex-lsp bundled for Linux (x86_64), macOS (Intel and Apple Silicon), and Windows (x86_64)
  • a packaged VS Code extension .vsix
  • SHA256SUMS.txt for integrity verification

Linux note: the v0.2.0 Linux binaries were built on Ubuntu 24.04 and need glibc 2.38 or newer (Ubuntu 24.04+, Debian 13+, Fedora 39+). On older systems (Ubuntu 22.04, Debian 12) they fail to start with a GLIBC_2.38 not found error; build from source instead (see the prerequisites under "I want to build everything from source"). Check yours with ldd --version. The release workflow now builds the Linux bundle on Ubuntu 22.04, and CI fails if nex or nex-lsp needs a glibc newer than 2.35.

⚑ What You Get

  • 🧠 A semantic map of your codebase instead of a blind pile of files
  • 🀝 A coordination layer for multiple agents so they do not silently collide
  • βœ… Validation that checks whether a change was actually authorized
  • πŸ“œ An event log you can replay, inspect, and roll back
  • πŸ–₯️ Editor and server surfaces that make the system usable in real workflows

✨ Why It Feels Different

Most AI coding tools still coordinate at the file or patch level. That breaks down when multiple agents touch the same repo at once.

Nexum Graph coordinates at the semantic unit level instead:

  • Functions, methods, classes, traits, and other code units are first-class entities.
  • Dependencies between those entities are explicit.
  • Agents declare intent before writing.
  • Validation checks whether the resulting changes were actually authorized.
  • The system leaves behind an auditable trail instead of a pile of opaque patches.

The result is a foundation for multi-agent coding systems that need stronger guarantees than "hope the diffs merge."

In practice, that means a few almost-miraculous benefits:

  • πŸ” You can ask "what changed?" and get a semantic answer, not just a textual diff
  • πŸ›‘ You can stop two agents from corrupting the same part of the system before it happens
  • 🧾 You can prove who intended what, what was allowed, and what actually landed
  • 🧯 You can replay or roll back changes with context instead of panic-reverting commits
  • 🧭 You can turn a repo into something agents can navigate with rules instead of vibes

πŸš€ What You Can Do Today

  • Start from zero with nex start.
  • Get an immediate semantic snapshot of a repo with nex demo.
  • Compute semantic diffs between refs with nex diff.
  • Detect merge-risk conflicts between branches with nex check.
  • Install a local semantic merge gate with nex check --install-hook.
  • Generate visual HTML reports for onboarding, repo snapshots, and PR review with nex demo --format html, nex start --format html, and nex check --format html.
  • Gate pull requests in GitHub Actions with uses: NexumCorpus/Nexum-Graph@v0.2.0.
  • Acquire semantic locks on specific units with nex lock.
  • Validate lock coverage before commit with nex validate.
  • Run a local coordination server with nex serve.
  • Bootstrap secure remote access with nex auth.
  • Verify the tamper-evident audit trail with nex audit verify.
  • Stream coordination signals into editors through nex-lsp.

πŸš€ Quickstart

1. Install Nexum Graph

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/NexumCorpus/Nexum-Graph/main/install.sh | sh

Windows PowerShell:

irm https://raw.githubusercontent.com/NexumCorpus/Nexum-Graph/main/install.ps1 | iex

2. Prove the product in one command

nex start

You will immediately see:

  • 🌐 languages detected
  • 🧩 indexed files, semantic units, and dependency edges
  • πŸ”„ the current HEAD~1 -> HEAD semantic diff
  • πŸ” current lock, event-log, and auth state
  • πŸͺœ the next exact commands to run

If you prefer to build from source instead, jump to I want to build everything from source below.

3. See it catch a break that git merges cleanly

nex check compares two branches. To see it work before you pick branches of your own, run the bundled demo. It builds a throwaway repo in a temp directory with two branches: feature/a adds a parameter to compute_total and renames format_name; feature/b adds new code that calls both the old way. Git merges them without a conflict. A third branch, feature/c, makes an unrelated change and is the control. Needs git and nex on PATH.

curl -fsSL https://raw.githubusercontent.com/NexumCorpus/Nexum-Graph/main/examples/merge-risk-demo.sh | sh
# or, from a clone:  sh examples/merge-risk-demo.sh

On Windows, run it from Git Bash. Captured output (v0.2.0; the merge-base hash differs on every run):

== git merge-tree feature/a feature/b (does git see a conflict?)
git: merges cleanly

== nex check feature/a feature/b (expected: exit 1, 3 errors)
Conflict Check: feature/a vs feature/b
Merge base: f956212548e5d33f91999a64e4c4b7c620835a82
=====================================
Merge risk: High merge risk (100/100)
Summary: 3 blocking semantic error(s) detected across feature/a and feature/b.
Errors:   3
Warnings: 0

Why this scored this way:
  - 3 blocking semantic error(s) must be resolved before merge.
  - Callers on one branch expect outdated function signatures (2 cases), including `compute_total`.
  - One branch removed units that the other branch still depends on, including `format_name`.

Recommended next actions:
  - Resolve blocking semantic conflicts before merge.
  - Update or restore callers and dependents that still point at removed units.
  - Rebase the caller branch and update call sites to the current signature.
  - Rerun `nex check feature/a feature/b` after rebasing or reconciling the branches.

Conflicts:

[ERROR] SignatureMismatch: Branch A changed signature of `compute_total` but branch B calls it
  Suggestion: Update callers in branch B to match new signature

[ERROR] SignatureMismatch: Branch A changed signature of `compute_total` but branch B calls it
  Suggestion: Update callers in branch B to match new signature

[ERROR] DeletedDependency: Branch A deleted `format_name` but branch B depends on it via `report`
  Suggestion: Consider keeping `format_name` or updating callers in branch B

Exit code: 1

exit 1

== nex check feature/b feature/c (control; expected: exit 0)
Conflict Check: feature/b vs feature/c
Merge base: f956212548e5d33f91999a64e4c4b7c620835a82
=====================================
Merge risk: Clean semantic check (0/100)
Summary: No blocking semantic conflicts detected between feature/b and feature/c.
Errors:   0
Warnings: 0

Why this scored this way:
  - No blocking semantic conflicts detected.

Recommended next actions:
  - Merge is a good candidate; keep the semantic hook and PR check enabled.
Exit code: 0

exit 0

compute_total is reported twice for its one call site in report.py. The rename shows up as a deletion of format_name, which is what it means for feature/b.

Inside that demo repo, nex diff prints this and exits 0:

$ nex diff main feature/a
Semantic Diff Summary
=====================
Added:    1
Removed:  1
Modified: 1
Moved:    0

Added:
  + Function full_name (lib.py)

Removed:
  - Function format_name (lib.py)

Modified:
  ~ Function compute_total [signature, body]

and nex start (exit 0):

$ git checkout feature/a && nex start
Nexum Graph Start
=================
Repo: .
Languages: Python
Indexed files: 2
Semantic units: 3
Dependency edges: 1
Current diff preview: ready (1 added, 1 modified, 1 removed, 0 moved)
Merge guard: not installed (<repo>/.git/hooks/pre-merge-commit)
Server auth: not configured

Next steps
----------
1. [ready] Inspect the current semantic diff
   See the exact semantic changes behind the current repo snapshot.
   nex diff HEAD~1 HEAD
2. [recommended] Install the semantic merge guard
   Install a local pre-merge hook so merge commits run `nex check` before they land.
   nex check --install-hook
3. [recommended] Install the GitHub pull request gate
   Write the reusable GitHub workflow so pull requests get semantic comments, SARIF, and merge-risk artifacts.
   nex github init --gate-mode errors-only
4. [recommended] Turn on multi-agent coordination
   Bootstrap auth once, then start the coordination server for multi-agent work.
   nex auth init --agent alice --agent bob && nex serve --host 127.0.0.1 --port 4000

Snapshot highlights
-----------------
  + Function full_name (lib.py)
  ~ Function compute_total [signature, body]
  - Function format_name (lib.py)

4. Run it on your own repo

In your own repository, use two of your own branch names:

nex diff HEAD~1 HEAD
nex check <your-branch> <other-branch>
nex serve --host 127.0.0.1 --port 4000
nex demo --format html > nex-demo-report.html

What those do:

  • nex diff shows semantic changes between refs
  • nex check shows branch-to-branch merge risk before merge time (exit 1 when it finds blocking errors)
  • nex serve turns Nexum Graph into a live coordination service

5. Add the editor experience

  1. Download nexum-graph-vscode-X.Y.Z.vsix from the latest GitHub Release.
  2. In VS Code, open Extensions.
  3. Select ....
  4. Choose Install from VSIX....
  5. Pick the downloaded .vsix.

🧭 Choose Your Path

I just want proof this is real

nex start

I want to inspect a real change

nex diff HEAD~1 HEAD

I want to see merge-risk before merge time

sh examples/merge-risk-demo.sh              # self-contained demo, see Quickstart step 3
nex check <your-branch> <other-branch>      # then two of your own branches
nex check --install-hook

I want to run it as coordination infrastructure

nex auth init --agent alice --agent bob
nex serve --host 127.0.0.1 --port 4000

I want to build everything from source

Prerequisites (matched to CI):

  • Rust stable via rustup (CI uses current stable; 1.89 and 1.97 both build v0.2.0)
  • a C compiler (build-essential on Debian/Ubuntu, Xcode Command Line Tools on macOS, MSVC Build Tools on Windows) for the tree-sitter grammars and git2
  • git
  • Node.js 22+ and npm, only for the VS Code extension
  • Python 3.12+, only for the repo tools under tools/

A cold cargo build --release took about 5 minutes on 4 cores in a clean-machine run.

git clone https://github.com/NexumCorpus/Nexum-Graph.git
cd Nexum-Graph
cargo build --release
npm --prefix extensions/vscode ci
npm --prefix extensions/vscode run package

πŸ› οΈ Product Surface

CLI commands

Command Purpose
nex start Guided first run with next-step recommendations
nex demo One-command semantic snapshot of the current repository
nex diff Semantic diff between two git refs
nex check Conflict detection between two branches
nex lock Acquire a semantic lock
nex unlock Release a semantic lock
nex locks List active locks
nex validate Validate lock coverage against a base ref
nex log Show semantic event history
nex rollback Generate a rollback event
nex replay Replay semantic state to an event boundary
nex auth Bootstrap and manage server auth
nex audit verify Verify the tamper-evident audit trail
nex serve Start the coordination server
nex github Scaffold the GitHub pull request workflow (nex github init)

LSP surface

The nex-lsp binary provides editor integration with:

  • nex/semanticDiff
  • nex/activeLocks
  • nex/agentIntent
  • nex/validationStatus
  • nex/eventStream

It also proxies standard LSP requests to an upstream server and merges Nexum Graph overlays into the editor experience.

VS Code extension

The repo now includes a release-packaged VS Code extension plus the source under extensions/vscode. It:

  • auto-starts nex-lsp for TypeScript, Python, and Rust workspaces
  • supports per-language upstream server configuration
  • falls back to overlay-only mode when an upstream command is not installed
  • exposes a Nexum Graph: Show Semantic Diff for Current File command

🧭 Developer Review Map

If you are reviewing the codebase rather than just using the product, start here:

File Why it matters
CORE_INVARIANTS.md Frozen behavioral contracts for semantic identity, graph diffing, coordination, and persistence
crates/nex-core/src/semantic.rs Shared semantic contracts used everywhere else; changes here ripple across the whole product
crates/nex-parse/src/lib.rs Extractor registry and shared semantic-id formula
crates/nex-graph/src/lib.rs CodeGraph construction and the diff algorithm
crates/nex-coord/src/coordinator.rs Low-level lock engine and transitive conflict rules
crates/nex-coord/src/service.rs Protocol-facing coordination service, TTL handling, and CRDT-backed reconciliation
crates/nex-cli/src/coordination_pipeline.rs Repo-local lock persistence, graph loading, and validation lock remapping
crates/nex-cli/src/output.rs All public text, JSON, GitHub, and HTML report rendering
tools/project_facts.py Canonical generated repo facts used to keep README stats and public copy from drifting
action.yml Public GitHub Action entrypoint for semantic PR checks
FUZZING.md How the parse/build/diff fuzz surface is intended to be exercised

Recommended reading order for a new developer:

  1. CORE_INVARIANTS.md
  2. crates/nex-core/src/semantic.rs
  3. crates/nex-graph/src/lib.rs
  4. crates/nex-coord/src/coordinator.rs
  5. crates/nex-coord/src/service.rs
  6. crates/nex-cli/src/coordination_pipeline.rs

If you are only validating the current release surface, focus on:

πŸ—οΈ Architecture

Nexum Graph is built as a five-layer chassis:

  1. Semantic Code Graph Parses source into semantic units and dependency edges.
  2. Intent Coordination Declares intent, grants locks, detects conflicts, and converges distributed state with CRDTs.
  3. Continuous Validation Checks whether modifications and deletions are covered by locks and flags broken references.
  4. Immutable Event Log Records semantic mutations for replay and rollback.
  5. IDE and Server Integration Exposes the system through CLI, HTTP, WebSocket, and LSP surfaces.

Workspace map

Crate Purpose
nex-core Shared contracts, types, errors, persistence helpers
nex-parse Tree-sitter extraction and language-specific semantic extractors
nex-graph Semantic graph construction and graph diffing
nex-coord Coordination engine, conflict detection, service layer, CRDT state
nex-validate Lock coverage and semantic validation rules
nex-eventlog Event storage, replay, rollback, backend abstraction
nex-lsp Editor integration and upstream LSP proxy
nex-cli CLI, server, auth, audit, and operator workflows

🌍 Supported Languages

Language Current extractor coverage
TypeScript / TSX Functions, classes, methods, interfaces, enums, type aliases
Python Functions, classes, methods, decorators, async variants
Rust Functions, structs, enums, traits, impl methods, inline modules

The extractor trait is intentionally extensible, so more languages can be added without changing the rest of the chassis.

πŸ”„ Core Workflows

Semantic diff

nex diff main feature/refactor --format text
nex diff v0.1.0 HEAD --format json

Conflict detection

feature/a and feature/b are the branches examples/merge-risk-demo.sh creates; use your own in your repo.

nex check feature/a feature/b
nex check --install-hook
nex check feature/a feature/b --format html > nex-check-report.html

nex check --install-hook installs a pre-merge-commit git hook for the current repo. On local merges, Git will run nex check HEAD MERGE_HEAD before the merge commit is created.

GitHub pull request gate

Fast local path:

nex github init --gate-mode errors-only
nex github status
nex github status --require-current
nex github status --require-current --min-gate-mode errors-only
nex github status --require-current --min-gate-mode errors-only --require-pr-comment --require-sarif

That writes .github/workflows/nexum-graph-semantic-check.yml into the current repo and points it at the reusable workflow published from Nexum Graph. nex github status tells you whether that workflow is missing, custom, managed, or pinned to an older Nexum Graph release. Add --require-current when you want CI or local checks to fail on stale workflow pins, --min-gate-mode errors-only when you want to reject advisory-only rollout posture, and --require-pr-comment --require-sarif when you want to enforce the full review surface as well.

If you prefer to wire it manually, the reusable workflow looks like this:

Fastest path: use the reusable workflow.

name: Semantic Check

on:
  pull_request:

jobs:
  semantic-check:
    uses: NexumCorpus/Nexum-Graph/.github/workflows/reusable-semantic-check.yml@v0.2.0
    with:
      format: github
      gate-mode: errors-only
      post-pr-comment: true
      upload-sarif: true

The reusable workflow checks out the target repo, runs the Nexum Graph action, uploads HTML/SARIF/insights artifacts, optionally uploads SARIF into GitHub code scanning, and keeps a sticky PR comment in sync.

For advanced/custom workflows, you can still use the composite action directly:

- id: semantic
  uses: NexumCorpus/Nexum-Graph@v0.2.0
  with:
    format: github
    gate-mode: errors-only

The action exports structured outputs for downstream workflows: risk-score, risk-label, blocking-conflicts, warning-conflicts, gate-status, gate-exit-code, insights-path, and sarif-report-path.

gate-mode controls rollout posture:

  • strict: block on errors and warnings
  • errors-only: block on errors, keep warnings advisory
  • advisory: never fail the action for semantic conflicts

If you upload the generated SARIF file, GitHub code scanning can surface semantic merge conflicts as native review findings instead of only as a PR comment or artifact.

For exact rollout recipes, see docs/github-rollout.md.

Locking and validation

nex lock alice validate write
nex validate alice --base HEAD~1
nex unlock alice validate

Secure server bootstrap

nex auth init --agent alice --agent bob
nex serve --host 0.0.0.0 --port 4000
nex audit verify

One-command repo demo

nex demo
nex demo --base origin/main --head HEAD
nex demo --format html > nex-demo-report.html

Guided first run

nex start
nex start --base origin/main --head HEAD
nex start --format html > nex-start-report.html

nex start is the hand-hold path for new users. It shows the current repo snapshot, tells you whether the semantic merge hook is installed, tells you whether auth is configured, and prints the next exact commands to run.

πŸ” Security and Operations

Nexum Graph now includes operator-oriented hardening out of the box:

  • Remote binds are rejected unless auth is configured or explicitly bypassed.
  • Repo-local auth config stores BLAKE3 token hashes at rest, not raw bearer secrets.
  • Raw auth tokens are only shown once at issue time.
  • Server audit records are hash chained and anchored by .nex/server-audit.head.json.
  • nex audit verify detects record edits, missing anchors, and tail truncation.
  • Existing plaintext auth configs are still readable for migration compatibility.

State lives under .nex/:

File Purpose
coordination.loro CRDT coordination state
locks.json Compatibility snapshot of active locks
events.json Local event log when using the file backend
server-auth.json Reloadable auth config with token hashes at rest
server-audit.jsonl Hash-chained server audit trail
server-audit.head.json Audit head anchor for integrity verification
cache/ Local tool caches

For repo security policy and reporting guidance, see SECURITY.md.

πŸ§ͺ Developer Workflow

The repo includes a small toolchain for spec-driven, slice-based development:

  • tools/release_tools.py Validates version parity, packages release bundles, and writes checksum manifests.
  • tools/spec_query.py Searches the Markdown implementation spec and whitepapers, with .docx fallback for archival sources.
  • tools/export_spec_markdown.py Regenerates the public Markdown spec docs from the archival Word sources in the repo root.
  • tools/github_release_watch.py Checks the public GitHub repo state and watches tagged release workflows until assets are actually published.
  • tools/verify_slice.py Runs tests, Clippy, and format checks only for changed crates and downstream dependents.
  • tools/workspace_doctor.py Checks repo health, tool availability, and skill sync state.
  • tools/sync_nex_skills.py Installs repo-managed Codex skills into $CODEX_HOME.
  • tools/tool_selftest.py Runs the Python tool regression suite and skill checks. The skill checks need Codex skills under $CODEX_HOME (default ~/.codex); without them they report SKIP and the script still exits 0.

Typical workflow:

python tools/release_tools.py assert-version-parity --tag v0.2.0
python tools/verify_slice.py --changed
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --check
npm --prefix extensions/vscode test

If you plan to contribute, start with CONTRIBUTING.md.

πŸ“š Architecture Docs

The readable architecture docs live in:

The .docx files in the repo root remain as archival source documents. If you need to refresh the Markdown exports after an edit to those source files, run:

python tools/export_spec_markdown.py

If you plan to cut releases, use RELEASING.md. If you want the public-facing update log, use NEWS.md.

For contract-heavy review work, also use:

πŸ“ˆ Project Status

Implemented and usable today:

  • Semantic extraction for TypeScript, Python, and Rust
  • Graph-based diffing
  • Coordination engine and CRDT-backed lock state
  • Validation engine
  • Event log with replay and rollback
  • Local coordination server
  • Auth bootstrap, rotation, revocation, and audit verification
  • LSP shim with upstream proxy support

Active expansion areas:

  • More language extractors
  • Stronger remote trust anchoring for audit provenance
  • Broader editor packaging and distribution
  • Distributed backend and deployment ergonomics

🧠 Philosophy

Nexum Graph is opinionated:

  • Semantic units matter more than raw files.
  • Deterministic contracts matter more than agent improvisation.
  • Compiler and validator feedback should be part of the agent loop.
  • Operational safety has to be part of the product, not an afterthought.

This repo is also a live example of spec-driven multi-agent Rust development. The codebase itself is part of the thesis.

Evidence and limits

  • Tests. cargo test --workspace --locked runs the Rust suite. CI runs it on Linux, Windows and macOS, plus Clippy, a version-parity check, the VS Code extension tests and an installer smoke test on Linux and Windows.
  • Adversarial check. "Night Adversary 0" (Oct 2026) planted semantic breaks in 30 real, merged AI-agent PRs, with ground truth checked on the merged tree. Before and after its fix (#5): real breaks caught 6/7 -> 9/9 (git alone catches 4/9), false alarms on controls 1/29 -> 0/30. Same 30 PRs, small n. Still open: Python module paths are not in qualified names, so some checks match on bare names.
  • Not claimed. Extraction covers TypeScript, Python and Rust only. Conflict detection is semantic over those extractors, not a proof that a merge is safe. No production deployment at scale is claimed. The server is meant for a trusted local network unless you configure auth (see SECURITY.md).

Where it sits

Nexum Graph is the developer product of Nexum Corpus: instruments for verifiable machine work. Built by Claude, directed by Nexum Corpus.

Contributing

Please read CONTRIBUTING.md before opening a pull request.

License

This project is licensed under the MIT License. See LICENSE.

About

Semantic diff, intent coordination, and merge safety for multi-agent software engineering.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages