# mex

> Shared, validated memory layer for AI coding agents that keeps team knowledge in sync, governed, and grounded in real code.

mex is an open-source CLI tool that creates a living, repo-local wiki for AI coding agents, maintained by those agents as they work. Built by Daksh Jaitly under the MIT license, it addresses the problem of fragmented, stale per-developer agent memory on engineering teams. The core CLI (`mex-agent` on npm) is live today, and a team dashboard for shared memory governance is in early access.

## What It Is

mex sits between your codebase and your AI coding agents — tools like Cursor, Claude Code, Codex, Windsurf, GitHub Copilot, and OpenCode. Instead of each developer maintaining their own rules file that drifts from the real code, mex builds a deterministic local code graph (using Tree-sitter and SQLite) and turns what agents learn into structured Markdown. That wiki stays connected to the exact symbols it describes, so when code changes, mex can detect which knowledge is now stale. The result is a shared, governed source of truth that every agent on the team reads from and writes back to.

## How the Living Wiki Works

Setup runs `npx mex-agent setup`, which inspects the repository, builds the code graph, creates a `.mex/` directory of Markdown files (architecture, stack, decisions, conventions, patterns), and installs the right project anchor for whichever agent the developer uses. After that, agents begin each session with a small anchor file rather than a full-repository scan.

Context routing is task-aware: the anchor points to `ROUTER.md`, which selects only the architecture notes, decisions, and patterns relevant to the current job. The README reports a benchmark on the mex repository itself showing a 916× reduction in corpus size versus graph scope, 100% expected-symbol recall, and 5/5 minimal-context agent tasks completed without fallback reads or greps — the project labels these directional results from one repository, not a universal claim.

## Drift Detection and Code Grounding

A key differentiator is that wiki pages can be grounded to exact graph nodes via frontmatter `grounds_to` entries and inline `mex://` symbol references. When a grounded function changes, moves, or disappears, `mex check` flags the affected knowledge without spending AI tokens. `mex sync` then gives the agent targeted repair context instead of asking it to rediscover the whole project. Supported languages for graph indexing include TypeScript, TSX, JavaScript, JSX, Python, and Rust, with framework-aware Express route-to-handler relationships.

## Team Memory and Governance

The homepage describes a forthcoming team layer (currently in early access) built on top of the open-source CLI. In that model, a server-hosted collective context replaces per-developer rules files. An admin dashboard lets team leads see aggregate drift scores across every developer and repo, review what gets promoted into shared memory, and govern access and policy. Individual developers still keep local context but push to and pull from the shared layer. The project positions this as memory infrastructure that survives team growth and turnover.

## Update: v0.7.1 and Recent Releases

The latest release is **v0.7.1** (published August 5, 2026), described as "Improved agent guidance for graph commands." The preceding **v0.7.0** introduced deterministic local code graphs, symbol-grounded knowledge, compact agent retrieval, and Python/Rust support alongside TypeScript and JavaScript. Earlier milestones include v0.6.2 (Windows support fixes, cross-platform path handling), v0.3.0 (agent-memory mode, heartbeat health checks, event log, interactive TUI dashboard, package renamed to `mex-agent`), and v0.2.0 (initial release with 8 drift checkers and multi-tool support). The GitHub repository shows 1,400+ stars and active development with frequent pushes.

## MCP Server and Ecosystem

mex includes a `packages/mex-mcp` package that exposes wiki and event-log functionality as Model Context Protocol tools, sharing the same implementation as the CLI. The MCP package is not yet published to npm as of the v0.7.0 release. The project is provider-neutral and documents integration guides for Neovim users alongside the primary agent targets. An agent-memory mode (`mex setup --mode agent-memory`) extends the same routing model to operational environments like homelabs and long-running infrastructure agents.

## Features
- Shared team memory layer for AI coding agents
- Deterministic local code graph using Tree-sitter and SQLite
- Living Markdown wiki grounded to exact code symbols
- Drift detection without spending AI tokens (mex check)
- Task-aware context routing via ROUTER.md
- Symbol-grounded knowledge with mex:// references
- Compact agent retrieval with hard token budget
- Admin dashboard for team memory governance
- Support for TypeScript, TSX, JavaScript, JSX, Python, and Rust
- Multi-agent tool support: Cursor, Claude Code, Codex, Windsurf, Copilot, OpenCode
- MCP server package for Model Context Protocol integration
- Agent-memory mode for operational/homelab environments
- Interactive TUI dashboard
- Heartbeat health checks
- Event log and timeline
- Shell completions
- Anonymous opt-out telemetry

## Integrations
Cursor, Claude Code, Codex, Windsurf, GitHub Copilot, OpenCode, Neovim, Avante.nvim, Copilot.vim, Model Context Protocol (MCP), npm, Tree-sitter, SQLite

## Platforms
WINDOWS, WEB, API, CLI

## Pricing
Open Source, Free tier available

## Version
v0.7.1

## Links
- Website: https://mexmemory.com
- Documentation: https://github.com/mex-memory/mex
- Repository: https://github.com/mex-memory/mex
- EveryDev.ai: https://www.everydev.ai/tools/mex-memory
