by mex-memory
Persistent project memory for AI coding agents. Structured scaffold + drift detection CLI.
# Add to your Claude Code skills
git clone https://github.com/mex-memory/mexLast scanned: 6/22/2026
{
"issues": [
{
"type": "npm-audit",
"message": "brace-expansion: brace-expansion: Large numeric range defeats documented `max` DoS protection",
"severity": "medium"
},
{
"type": "npm-audit",
"message": "esbuild: esbuild allows arbitrary file read when running the development server on Windows",
"severity": "low"
},
{
"type": "npm-audit",
"message": "postcss: PostCSS has XSS via Unescaped </style> in its CSS Stringify Output",
"severity": "medium"
},
{
"type": "npm-audit",
"message": "simple-git: simple-git is vulnerable to Remote Code Execution",
"severity": "high"
},
{
"type": "npm-audit",
"message": "vite: launch-editor: NTLMv2 hash disclosure via UNC path handling on Windows",
"severity": "high"
},
{
"type": "npm-audit",
"message": "vitest: When Vitest UI server is listening, arbitrary file can be read and executed",
"severity": "critical"
},
{
"type": "npm-audit",
"message": "ws: ws: Memory exhaustion DoS from tiny fragments and data chunks",
"severity": "high"
}
],
"status": "FAILED",
"scannedAt": "2026-06-22T09:48:30.396Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}mex is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by mex-memory. Persistent project memory for AI coding agents. Structured scaffold + drift detection CLI. It has 1,404 GitHub stars.
mex failed SkillsLLM's automated security scan, which flagged one or more high-severity issues. Review the Security Report section carefully before using it.
Clone the repository with "git clone https://github.com/mex-memory/mex" and add it to your Claude Code skills directory (see the Installation section above).
mex is primarily written in TypeScript. It is open-source under mex-memory on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh mex against similar tools.
No comments yet. Be the first to share your thoughts!
Requires a passing catalog security scan. Resolve the flagged issues and resubmit to enable featuring.
A living wiki for your codebase, maintained by your AI coding agents.
English | 简体中文 | Español | Português (Brasil)
mex maps your code, turns what agents learn into structured Markdown, and keeps that knowledge connected to the implementation it describes.
Every coding session starts with relevant architectural context instead of another full-repository scan.
New in v0.7.0: deterministic local code graphs, symbol-grounded knowledge, compact agent retrieval, and Python/Rust support alongside TypeScript and JavaScript.
💬 Join the mex community on Discord — discuss ideas, get help, share feedback, and contribute to the project.
npx mex-agent setup
Architecture, conventions, edge cases, and past decisions are scattered across source code, pull requests, chat histories, and individual contributors.
AI coding agents rediscover that knowledge every session. A giant instruction file helps at first, but eventually floods the context window, becomes stale, and drifts away from the implementation.
mex creates a living, repo-local wiki that grows as agents work:
The code remains the source of truth. The wiki becomes its maintained explanation.
| Ordinary project documentation | The mex living wiki |
|---|---|
| Written once and gradually forgotten | Grows from real coding work |
| Disconnected from the implementation | Claims can point to exact code symbols |
| Loaded as one giant instruction file | Context is routed by task |
| Refactors silently invalidate docs | Changed, moved, and missing symbols are detected |
| Every agent rediscovers the architecture | Agents inherit previous discoveries and decisions |
| Knowledge disappears between sessions | Decisions and reusable patterns persist in the repository |
mex builds a deterministic local code graph using Tree-sitter and SQLite. It indexes symbols and relationships across TypeScript, TSX, JavaScript, JSX, Python, and Rust, including framework-aware Express route-to-handler relationships.
mex graph
During setup, your coding agent uses the graph to understand the project and populate a structured Markdown wiki:
.mex/
├── AGENTS.md
├── ROUTER.md
├── context/
│ ├── architecture.md
│ ├── stack.md
│ ├── setup.md
│ ├── decisions.md
│ └── conventions.md
├── patterns/
│ ├── INDEX.md
│ └── ...
└── events/
└── decisions.jsonl
These remain ordinary Markdown files: readable, reviewable, version-controlled, and editable by humans or agents.
Agents begin with a small anchor file instead of loading the entire wiki. The anchor points to ROUTER.md, which selects the architecture notes, decisions, conventions, and task patterns relevant to the current job.
Agent task
↓
Small always-loaded anchor
↓
ROUTER.md
↓
Relevant wiki pages
↓
Compact code-graph neighborhood
↓
Targeted source expansion
Editable source: docs/diagrams/context-routing.excalidraw
After meaningful work, the agent updates project state, records decisions, and captures reusable patterns. mex checks that the wiki still agrees with the repository:
mex check
mex sync
mex check validates paths, commands, dependencies, links, indexes, staleness, tool configuration, and grounded code symbols without spending AI tokens. When repairs are needed, mex sync gives the agent targeted context instead of asking it to rediscover the whole project.
Editable source: docs/diagrams/drift-sync.excalidraw
Wiki pages can connect important claims to exact graph nodes. A behavioral claim can be grounded through frontmatter:
---
grounds_to:
- node: "function:a3f8...c21"
fingerprint: "mh:64:9f2a..."
---
Load-bearing symbol references can also be navigable inline:
Authentication is enforced by
[`requireSession()`](mex://function:a3f8...c21).
When that function changes, moves, or disappears, mex can identify the affected knowledge. Confident renames and moves are durably rebound during sync; ambiguous changes are surfaced for the agent to resolve.
This lets agents read broadly to understand a behavior while grounding only the few symbols that actually support what they write.
The graph is also a compact agent-retrieval layer:
mex graph scope "trace the authentication flow"
Instead of returning a large source dump, mex produces a scored neighborhood of relevant symbols under a hard estimated-token budget. The default response contains compact signatures, relationships, node IDs, and selection reasons.
Agents can then expand only the symbols they need:
mex graph get <node-id>
Structural queries and impact analysis are available directly:
mex graph query where-defined authenticate
mex graph query who-calls requireSession
mex graph query what-calls createServer
mex impact requireSession
Agent-facing graph commands use deterministic JSONL envelopes so tools can reliably distinguish metadata, results, and summaries.
On the mex repository benchmark:
| Measurement | Result |
|---|---|
| Full repository corpus ÷ graph scope | 916.38× |
| Grep top-3 output ÷ graph scope | 10.74× |
| Expected-symbol recall | 100% |
| Minimal-context agent tasks completed | 5/5 |
| Minimal-context tasks requiring fallback Read/Grep | 0/5 |
| Inline-source tasks requiring fallback Read/Grep | 4/5 |
The measured repository contained:
These are directional results from one repository, six scripted retrieval tasks, and five real-agent tasks. They demonstrate compact retrieval behavior, not a universal end-to-end graph-versus-no-graph token-savings claim.
See the benchmark results and evaluation harness for the methodology, raw results, caveats, and reproduction commands.
mex requires Node.js 22.5 or newer. The npm package is named mex-agent because mex was already taken; the CLI command is still mex.
npx mex-agent setup
Setup inspects the repository, builds the local code graph, creates the Markdown wiki, asks your coding agent to populate it from graph evidence, installs the right project anchor, and validates the result.
After setup:
mex check # Check wiki health and code grounding
mex sync # Repair drift with targeted agent prompts
mex graph scope "<task>" # Retrieve compact task context
If you skipped global installation, use npx mex-agent in place of mex. Install globally at any time with:
npm install -g mex-agent
The recommended npx mex-agent setup flow runs in Command Prompt, PowerShell, or WSL and does not require bash.
If you use the legacy setup.sh flow, run install, build, and CLI commands in the same environment. Do not build in WSL and then run the CLI from a native Windows terminal. See issue #10 for context.
All commands run from the project root. Replace mex with npx mex-agent if it is not installed globally.
| Command | What it does |
|---|---|
mex / mex tui |
Open the interactive terminal dashboard |
mex setup |
Create and populate the living wiki |
mex check |
Check wiki health and calculate a drift score |
mex sync |
Repair stale or inconsistent knowledge |
mex graph |
Build or refresh the local code graph |
mex graph scope <task> |
Retrieve compact, task-relevant context |
| `mex graph get <node-id... |