mex is a repository-local knowledge system for AI coding agents that turns codebase discoveries into connected Markdown documentation and a code graph. It helps agents and developers retain architectural decisions, conventions, edge cases, and project context across coding sessions while detecting documentation affected by code changes. The catalogue skills and instructions are add-ons for using mex with coding agents.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/mex-memory/mexWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/mex-memory/mex/windsurfrules)<a href="https://agentmods.dev/rules/mex-memory/mex/windsurfrules"><img src="https://agentmods.dev/badge/rules/mex-memory/mex/windsurfrules.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00030 | $0.00935 |
| Opus 5 | $0.00015 | $0.00467 |
| Sonnet 5 | $0.00006 | $0.00187 |
| Haiku 4.5 | $0.00003 | $0.00093 |
Grade A, and why
agents scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
86% identical to agents — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 59 lines — stays where its author put it; the contents beside it link to each section on GitHub.
[Project Name]
What This Is
Non-Negotiables
Commands
Code Graph
Use the smallest relevant structured resolver. For Inbox or Relay mutations, resolve only the intended action with mex inbox contract --action <command-id> --json or mex relay contract --action <command-id> --json; use mex capabilities --json only for broader capability discovery. If the user explicitly asks to create, save, or draft a checkout-local Inbox or Relay draft, preview and apply that exact draft without asking for redundant confirmation. Deleting a local draft, or publishing, approving, rejecting, withdrawing, marking stale, repairing, taking or acknowledging, or closing, requires fresh explicit confirmation after semantic preview. Treat Git commit, push, and pull as separate actions requiring their own authorization.
The repo is indexed into .mex/graph.db. Use it to avoid re-reading code you already have — it is one tool alongside Grep/Glob, not a replacement for them.
- If you know the symbol name, go straight to it:
mex graph query <who-calls|what-calls|where-defined> <symbol>andmex graph get <id>are exact and cheap. This is the strongest part of the graph. Give it exact names — an approximate name can return a confident wrong match. - Exploring an unfamiliar task?
mex graph scope "<task>"returns bounded, source-backed JSONL context plus trustworthy execution flows. Scope matches on words, not meaning, so treat it as starting evidence rather than a complete answer. - Treat source returned by the graph as ALREADY READ; do not re-open those files.
- Read the summary status and evidence.
status: "ok"remains usable whentruncated: true; only optional evidence was omitted. Forpartialordegraded, narrow the task or followsuggestedNextCommands. - Use
mex graph get <id> --detail sourceonly when source is missing, you need exact expansion, or a partial/degraded summary suggests it. Do not expand nodes by quota. - If the evidence is insufficient or the task wording does not match the code, use Grep/Glob instead. Do not re-run
scopewith reworded phrasing more than once. - Before editing a symbol, run
mex impact <symbol|file>to see affected callers and scaffold memory. - During
mex sync, adjudicate any AMBIGUOUS grounding; after repairs, ensure the refreshed grounding is re-emitted.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today First seen · 59 lines · 30 tokens per session scan A b5c9e50a497f
agents is a cursor rule published in the GitHub repository mex-memory/mex (1,544 stars, last pushed yesterday), licensed MIT. It adds 30 tokens to every session and 935 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 86% identical to agents, differing in 0 lines, and is treated as a copy.
Other cursor rules, from other repositories
cursorrules
You are assisting the Orbital engineering team — 5 backend engineers building a multi-tenant SaaS for logistics operations. TypeScript monorepo using NestJS, PostgreSQL (drizzle-orm), and BullMQ. All engineers use shared conventions.
session-preflight
Require a visible session preflight before side-effecting agent work.
bootstrap-alwayson
Minimal always-required LLM fixes.
reqforge-dev-build
Dev Builder — implementation execution. Build code phase by phase following DEV-PLAN, each Task goes through review → fix loop.
no-tool-contributors
Never add AI coding tools as contributors or co-authors.
tell-mission
Tell mission and golden rules — always apply.