# MEX

> Shared project memory for engineers and their coding agents — Markdown in the repo, local indexes, shared through Git

- Category: Agents & Automation / Agent Memory
- Language: TypeScript
- Licence: MIT
- Repository: https://github.com/mex-memory/mex
- Website: https://mexmemory.com
- Canonical page: https://ai-tldr.dev/tools/mex/
- Updated: 2026-09-27

## In short

MEX starts from a familiar problem: one engineer knows why a constraint exists, another has the debugging history, and a coding agent found an important edge case in a session nobody else will read. It sits in the Agent Memory category of the Agents & Automation tools and is open-source, written in TypeScript and licensed MIT.

## Overview

MEX starts from a familiar problem: one engineer knows why a constraint exists, another has the debugging history, and a coding agent found an important edge case in a session nobody else will read. The next teammate has to piece it all together again. MEX gives that knowledge a durable home inside the repository itself — readable Markdown for architecture, decisions, conventions, requirements and handoffs — so what one engineer and their agent learn becomes context the next person (or the same person in a new session) can build on.

The design splits shared meaning from local machinery. Canonical records live under `.mex/` and travel with ordinary Git commit, push and pull; the Code Graph and Wiki search index are rebuildable SQLite files that each checkout builds for itself and never commits. There is no hosted MEX service, Docker, proxy, MEX account or MEX-owned model key. People explore and review the memory in the Project Hub, a browser UI that listens on `127.0.0.1` against their own checkout; agents reach it through the `mex` CLI plus the project instructions and skills that setup installs for Claude Code, Codex, Cursor, Windsurf, GitHub Copilot and OpenCode.

Two views of the codebase sit side by side. The Wiki explains architecture, conventions, decisions and patterns in language people can review, while the Code Graph uses bundled Tree-sitter grammars to map symbols and relationships (TypeScript/TSX, JavaScript/JSX, Python and Rust, with partial C#) for bounded retrieval such as `mex graph scope` or `who-calls` queries. A Wiki claim can be grounded to a graph node, so when the code changes MEX flags the explanation as drifted for review. The project is explicit that drift is a review signal, not proof the prose is wrong, and that Wiki search is full-text and Graph retrieval lexical/structural rather than a vector engine.

On top of that sit team workflows with a human in the loop. Inbox turns a discussion into one proposed addition or correction to existing knowledge that a person approves; a Relay packages what the next engineer needs — progress, blockers, evidence, next actions and the observed branch and `HEAD` — as a durable handoff an agent drafts and a person publishes. Agents can prepare drafts and previews, but publishing, approving and committing stay with people. MEX is MIT-licensed and written in TypeScript; note that it ships pseudonymous CLI and Hub usage telemetry that is on by default and can be turned off with `mex telemetry disable`, `MEX_TELEMETRY=0` or `DO_NOT_TRACK=1`.

## What it does

- Repository-native memory: architecture, decisions, conventions, patterns, Specs, Members and Activity stored as Markdown under `.mex/` and shared through normal Git
- Local Code Graph built with bundled Tree-sitter grammars, queryable by task (`graph scope`), relationship (`where-defined`, `who-calls`) and impact (`mex impact`), with bounded resolvers for Express, Next.js App Router, FastAPI, Flask and NestJS
- Grounding that links Wiki claims to code symbols and flags intact, changed, moved, missing or ambiguous references when the implementation drifts
- Project Hub on loopback for exploring the Context graph, Wiki and code, reviewing Inbox proposals and taking Relays, plus a `mex tui` terminal dashboard
- Agent integrations: project anchors and `/mex-inbox` / `/mex-relay` skills for Claude Code and `$mex-inbox` / `$mex-relay` for Codex, with instruction templates for Cursor, Windsurf, GitHub Copilot and OpenCode
- Human approval boundaries: agents draft and preview, while people publish proposals, approve canonical changes and commit — MEX never pushes or pulls

## Getting started

MEX needs Node.js 22.5 or newer with SQLite FTS5 support, and a Git repository. The npm package is `mex-agent`; the installed command is `mex`. The README pins every command to its release, so swap in the version it shows.

1. Run setup from the repository root

   Setup opens in your local browser Hub: choose your AI tools, watch the scaffold and indexes build, and let a selected Claude Code or Codex CLI populate project memory. Add `--cli` for a terminal-only setup (for example over SSH), or `--no-open` to just print the local link.

```bash
npx mex-agent@0.8.3 setup

# terminal setup instead of the browser
npx mex-agent@0.8.3 setup --cli
```

2. Review and commit the setup

   Review the exact setup-file diff in the Hub and choose Commit setup to create a local commit (MEX never pushes or pulls). Push it through your normal Git workflow so teammates get the same memory and agent instructions, and add participants in Team/Members.

3. Or install the CLI globally

```bash
npm install -g mex-agent@0.8.3
mex setup
```

4. Join a repository that already uses MEX

   Pull the team's branch, then build the derived indexes in your own checkout and open the Hub. Reuse the shared memory rather than regenerating it.

```bash
npx mex-agent@0.8.3 graph rebuild
npx mex-agent@0.8.3 wiki rebuild-index
npx mex-agent@0.8.3 hub
```

5. Query the Wiki and the Code Graph

```bash
mex wiki query "authentication"
mex graph scope "trace the authentication flow"
mex graph query who-calls requireSession
mex impact requireSession
```

6. Sync agent skills and record notes

   Preview and install the Claude Code or Codex integration for an existing setup (`--tool claude` for Claude Code), then log decisions that future agents can retrieve with `mex timeline`.

```bash
mex skills sync --dry-run --tool codex
mex skills sync --tool codex
mex log "<message>"
mex timeline --query "retry" --type decision --limit 20 --json
```

## When to use it

- Keep architecture, decisions and conventions next to the code so every engineer's coding agent starts from the same reviewed context
- Hand unfinished work to a teammate with a Relay that records progress, tests run, blockers and where to look next
- Catch explanations that have gone stale when the code they describe changes, via grounding drift
- Give a long-running operational agent a Git-tracked memory workspace with the separate `agent-memory` setup mode

## Version history

- 2026-09-27 v0.8.3: Graph refresh becomes incremental, reusing unchanged file extractions, and grounding links survive more code changes; adds FastAPI, Flask and NestJS routes, scaffold export and Markdown timelines.
- 2026-09-13 v0.8.2: Setup moves into the local browser Hub: choose integrations, follow agent population, review the setup diff and commit it in one flow, with terminal setup still available.
- 2026-09-09 v0.8.1: Adds the explorable Context graph in the Hub, Inbox proposals for additions and corrections to existing knowledge, and open-to-team Relays.
- 2026-09-02 v0.8.0: Connects repository memory, the local Code Graph and Wiki, and the Project Hub into one team workflow with Members, Activity, Inbox proposals and Relay handoffs.
