Persistent project memory for AI coding agents. Structured scaffold + drift detection CLI.
Persistent project memory for AI coding agents. Structured scaffold + drift detection CLI.
One engineer knows why a constraint exists. Another has the debugging history. A coding agent found an important edge case in a session nobody else will read. The next teammate has to piece it together again.
What one engineer and their agent learn should become context the next teammate can use. MEX gives that knowledge a durable home in the repository: readable Markdown, code-linked explanations, reviewed knowledge contributions, and structured handoffs. People explore and review it in a local Hub; agents retrieve and help maintain it through project instructions and the CLI.
[!IMPORTANT] MEX 0.8.2 brings setup into the Hub: choose integrations, follow your agent, review and commit setup, then finish with optional global installation and contact details. Terminal setup remains available with
mex setup --cli.
Join the MEX community on Discord — discuss ideas, get help, share feedback, and show what you're building.
| What the team needs to retain | Where it lives in MEX |
|---|---|
| How the system works, and why | Wiki architecture, decisions, conventions, and patterns, with Code Graph grounding |
| A decision or explanation worth sharing | An Inbox proposal that adds to or corrects existing Wiki knowledge |
| Product requirements already captured | Existing Specs, requirements, constraints, and acceptance criteria remain supported |
| Where another engineer should continue | Relays with progress, decisions, blockers, evidence, and next actions |
| Earlier workflow context | Existing Workstream records remain readable |
| Who is involved, and what MEX recorded | Members and Activity history |
Canonical memory travels with ordinary Git commit, push, and pull. Each teammate keeps their own local indexes, drafts, identity selection, and Hub. No hosted MEX service, Docker, proxy, MEX account, or MEX-owned model key is required.
Working solo? The next person using that memory can be you in a new session.
An example: Alex changes webhook retry handling, and Sam will continue the work. Both are active MEX Members in a repository their team has already set up.
$mex-relay to draft a Relay for Sam: what changed, which tests ran, what remains, and where to look next. She reviews the draft and publication preview in Hub, explicitly publishes it, then reviews, commits, and pushes the code and canonical MEX files through Git.The Relay carries the explanation and observed repository state—not the uncommitted code. Publishing writes files to Alex's checkout; it does not notify Sam or deliver anything until they share through Git. See Relay boundaries for lifecycle and concurrency details.
The Hub is where people explore and review their team's memory. Open it to explore connected project knowledge and code, review a proposed knowledge change, find an eligible handoff, or see recorded team history.
After setup, run mex hub. Each engineer's Hub reads their own checkout and listens on 127.0.0.1; it is not a shared hosted dashboard. Git brings the team's canonical records into that checkout. Hub protects mutations with a server-side session and CSRF token. Playbook and Catch Up product workflows remain future work.
MEX requires Node.js 22.5 or newer, SQLite FTS5 support in that Node build, and a Git repository. See runtime compatibility. The normal npm flow works on macOS, Linux, Windows Command Prompt, PowerShell, and WSL.
Run from the repository root:
npx [email protected] setupThis opens setup in your local browser Hub. Choose your AI tools, watch the scaffold and indexes build, and let an available selected Claude Code or Codex CLI populate project memory. If the agent is unavailable or fails, copy the population prompt into your agent, then continue. Existing instructions are preserved; any manual integration pointers appear as advisory guidance.
Review the exact setup-file diff in the Hub and choose Commit setup to create a local commit. A manual Git checkpoint remains available. MEX preserves unrelated staged work and never pushes or pulls.
The completion screen explains how to start a fresh agent session and verify that it reads your project memory. It also offers two optional steps: install the mex command globally at the version running setup, and leave an email (plus an optional name) for follow-up about MEX. Contact details are sent through the embedded Web3Forms service and stay out of the repository and usage telemetry. Only a submitted/skipped preference is remembered on this computer. Choose Open Hub when ready; the Hub's introductory tour starts there.
Connected agents have their own installation, account, and network requirements. To print the local browser link without opening it, use npx [email protected] setup --no-open; add --port to choose a loopback port.
Prefer terminal setup or working over SSH?
npx [email protected] setup --climex setup --dry-run remains a terminal preview without changes. Once installed, bare mex opens the Hub (or setup for an incomplete project), while mex tui opens the terminal dashboard.
[!NOTE] The full Hub opens when the current
.mex/config.jsonis committed atHEAD. Its setup wizard can commit the reviewed setup files on your explicit request, preserving unrelated staged work. Repositories with unsupported Git hooks or content filters keep the manual checkpoint. MEX never pushes or pulls.
Push the reviewed setup commit through your team's normal Git workflow so teammates receive the same project memory and selected agent instructions. In Hub's Team/Members page, add the people who will participate and choose your local identity. Review and apply those actions explicitly; commit and push new Member records too. Your current-member selection stays local.
Clone or pull the team's repository and branch through Git. For a completed, committed 0.8 setup, build the derived indexes in your own checkout and open Hub:
npx [email protected] graph rebuild
npx [email protected] wiki rebuild-index
npx [email protected] hubReuse the shared project memory; do not regenerate it just to join. In Team/Members, check the effective identity and, if needed, choose your existing Member record as a local override. If you do not have a record yet, explicitly create one through the reviewed workflow and share its canonical files. Members are attribution, not a sign-in or permission system.
The committed instruction files and skill directories are reusable by the agents they target. Install the agent separately and start a new session in the repository. If your chosen integration was not included in the shared setup, coordinate adding it with the team; see agent integrations. After later pulls or branch changes, inspect Graph/Wiki health and run the indicated explicit maintenance—reads do not silently update indexes.
Older or incomplete setups should follow upgrade and compatibility first. Keep CLI versions aligned before exchanging new Relays.
Prefer a global installation?
npm install -g [email protected]
mex setupThe npm package is named mex-agent; the installed command is mex. Complete the review and commit checkpoint above before running mex hub.
Both the Hub and terminal completion flows offer an optional global installation pinned to the running MEX version. If it fails, setup remains complete and you can retry the command above. Open a new terminal afterward and run mex --version.
Using MEX for a persistent operational agent?
npx [email protected] setup --mode agent-memoryThis separate template applies MEX's routing and maintenance model to homelab, infrastructure, and long-running agent workspaces. It adds a HEARTBEAT.md contract and cleanup conventions; the Code Graph, Wiki, and team-Hub flow described in this README is the default code-repo mode.
Examples use mex for readability. Install it globally as above or replace it with npx [email protected].
The team's memory is shared; the machinery that retrieves it stays local. MEX separates canonical repository files from rebuildable indexes so each engineer and agent can work against their own checkout.
Canonical knowledge is structured Markdown with metadata, relations, sources, provenance, and code groundings; accepted Wiki writes append audit records. The Code Graph and Wiki search index are rebuildable local SQLite views, not shared sources of truth.
In 0.8.1, ordinary Wiki creation and synthesis capture the operation's recorded actor, time, and session as creation provenance while preserving any supplied original attribution. Migration leaves unknown, untyped context/*.md files untouched; supply an explicit entity type before migrating them instead of relying on an architecture default.
| Commit and push to share | Keep local or ephemeral; never commit |
|---|---|
.mex/config.json, .mex/.gitignore |
.mex/graph.db* |
.mex/AGENTS.md, .mex/ROUTER.md, .mex/SETUP.md, .mex/SYNC.md |
.mex/wiki.db* |
.mex/context/**, .mex/patterns/**, .mex/specs/**, .mex/topics/** |
.mex/local/**: drafts, current-member selection, jobs, cursors, recovery state, signing key |
.mex/team/members/**, .mex/workstreams/**, .mex/inbox/**, .mex/relays/** |
Process-memory Hub session registry and browser-held session/CSRF state |
.mex/events/activity/**, .mex/events/operations.jsonl, .mex/events/decisions.jsonl |
— |
Setup-selected agent instruction files and .agents/skills/mex-* or .claude/skills/mex-* |
— |
Git carries the meaning; setup or explicit maintenance commands rebuild the indexes against each checkout's own branch and working tree. Code remains authoritative, and grounding drift flags code-linked explanations that need review.
Shared memory needs both the team's explanation and evidence from the implementation. MEX combines two complementary views of a repository:
No open issues yet, or sync has not completed.