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.
npx skills add mex-memory/mex --skill mex-statechartgit 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/skills/mex-memory/mex/mex-statechart)<a href="https://agentmods.dev/skills/mex-memory/mex/mex-statechart"><img src="https://agentmods.dev/badge/skills/mex-memory/mex/mex-statechart/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/mex-memory/mex/mex-statechart"><img src="https://agentmods.dev/badge/skills/mex-memory/mex/mex-statechart.svg" alt="Reviewed on agentmods" width="80" 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.00073 | $0.01194 |
| Opus 5.5 | $0.00029 | $0.00478 |
| Sonnet 5.5 | $0.00015 | $0.00239 |
| Haiku 4.5 | $0.00007 | $0.00119 |
Grade A, and why
mex-statechart 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.
How it starts
The opening of the file, as written. The whole thing — 21 lines — stays where its author put it; the contents beside it link to each section on GitHub.
MEX statechart
Make behavior easier for a human to understand. Generate only on user intent. If a diagram would obscure the explanation, use a better explanation. A prior agent answer identifies the subject; verify it independently against current code.
- Identify the bounded subject, reader, and implemented/proposed/agreed-model scope. Read current source and useful tests. Query
mex wiki query "<subject>" --limit 5 --jsonbefore broad knowledge discovery; inspect matched terms and grounding health, then read live records. Fall back to Router-directed Markdown if unavailable. Use boundedmex timeline --query "subject" --file known/path --limit 10 --jsononly when history might matter. Verify historical applicability. Fresh Graph may locate evidence; call edges are not state transitions. Never refresh indexes on a read. - Retain context only when it changes or explains a state, event, condition, rule, exception, recovery, or abstraction. Record the precise connection and provenance. Keep source/requirement conflicts visible. Omit irrelevant context; do not manufacture a MEX contribution.
- Read the baseline modeling workflow and runtime instructions. Preserve TLA+ and real TLC checks in normal generation. Reuse agreed rules with provenance; seek agreement only for new inferred rules or material conflicts. Never weaken a rule to get a passing result.
- Work outside the repository in scratch space. Use the bounded
scripts/runtime.mjs workflowentry, not the unbounded original scripts directly. Preserve existing TLA+ reference specifications and their authored configurations unchanged. Both from-spec and agreed-chart directions, settled-state rules, narrower observation points, projected overviews, independent regions, goals, proposed fixes and reference comparisons remain available. - Assemble and validate the v1 artifact described in artifact contract. Retain models, configs, mapping, rules, raw temporal traces, omissions, toolchain and regeneration. Use stable identities, not captions. Run
checkon the artifact to record actual TLC results. For finite traces, map every numbered state/action back to the same graph and retain raw counterexamples. Goals are expected reachability witnesses, never product bugs. Use runtime summary counts, not counts inferred from the drawing. Missing mappings leave alignment unverified.Projection.jsonis optional: without it, or whencheckleaves the diagram unverified, accept and disclose that; never write your own TLC output parsers to force a projection. If TLC is unavailable (runstatus), still assemble the artifact with the check leftunavailableand continue to step 7: the picture never depends on Java or TLC. - Attempt each modeled implementation bug through real observable code entry points. Separate what execution reproduced, what source inspection supports, and what was not reproduced. Revisit the model when reproduction disagrees. A passing model proves only the configured model and bounds; unavailable/cancelled/resource-limited checking is never success.
- Run
show <artifact> <scratch-dir>once: it prints the deterministic text view and writes the artifact's owndiagram.mmdanddiagram.png. Deliver by client:- Claude Code (terminal and desktop app) does not render Mermaid. Paste the text view in a fenced
textblock, then always open the printeddiagram.pngwith your file-reading tool, unasked: the desktop app shows it inline. Make that read its own step: first write one short sentence such as "Here is the diagram:", then read the PNG with no other tool call before or after it, because the desktop app collapses grouped tool calls into a small thumbnail. Do not embed the image as Markdown; local image links do not render. In the terminalshowalso opens the image in the system viewer; tell the user, and give the path. Never present raw Mermaid as the diagram there. - Clients with native Mermaid, such as Codex: deliver the artifact's fenced Mermaid first, and the text view for nested or parallel charts.
Never hand-draw the diagram as text art;
showproduces both views. If the image is unavailable, say so and give the.mmdpath. Keep domain labels readable; details belong beside the overview. Disclose every material omission. Inspect the image and numbered paths as generation QA. State diagram validity, checker outcome, implementation reproduction, and evidence freshness separately.
- Claude Code (terminal and desktop app) does not render Mermaid. Paste the text view in a fenced
registerthe validated artifact into the repository's ignored temporary preview store; this is checkout-only and nothing is shared. Keep its returned route and 24-hour expiry. Offer to open the specific diagram in Hub: for example, "Want me to open this in Hub? I can start it for you." When this repository's live Hub URL is already known, provide a clickable "View this diagram in Hub" link directly to the preview. Otherwise offer to start Hub; do not make the user run a command and find Diagrams themselves. Accepting the offer, or directly asking to open it, authorizes normal Hub startup and browser opening without another confirmation. Follow Opening the preview in Hub to preserve authentication and open the returned preview route. Generation alone does not launch Hub; never invent a localhost URL. Hub Save still requires its own exact review; commit/push remains separate. Regeneration creates a new preview and never updates old evidence baselines.
What ships with it
29 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- agents/openai.yaml 207 B
- PROVENANCE.md 1.4 KB
- references/artifact.md 6.3 KB
- references/example.json 3.2 KB
- references/toolchain.md 6.5 KB
- references/upstream-workflow.md 7.5 KB
- upstream/LICENSE 1.0 KB
- upstream/scripts/bug-states.mjs 3.0 KB runs code
- upstream/scripts/chart-edges.mjs 2.4 KB runs code
- upstream/scripts/chart-parts.mjs 613 B runs code
- upstream/scripts/chart-to-tla.mjs 7.7 KB runs code
- upstream/scripts/compare-charts.mjs 2.2 KB runs code
- upstream/scripts/lib.mjs 33 KB runs code
- upstream/scripts/map-view.mjs 3.4 KB runs code
- upstream/scripts/property-loop.mjs 2.3 KB runs code
- upstream/scripts/read-check.mjs 2.8 KB runs code
- upstream/scripts/regions-chart.mjs 11 KB runs code
- upstream/scripts/render.mjs 19 KB runs code
- upstream/scripts/rule-book.mjs 3.3 KB runs code
- upstream/scripts/second-replay.mjs 4.7 KB runs code
- upstream/scripts/snapshot.mjs 2.0 KB runs code
- upstream/scripts/spec-text.mjs 5.7 KB runs code
- upstream/scripts/statechart-help.mjs 26 KB runs code
- upstream/scripts/statechart.mjs 35 KB runs code
- upstream/scripts/tlc-to-chart-args.mjs 2.1 KB runs code
- upstream/scripts/tlc-to-chart.mjs 29 KB runs code
- upstream/scripts/tlc-tools.mjs 3.3 KB runs code
- upstream/scripts/ways-in.mjs 3.0 KB runs code
- upstream/SHA256.json 2.1 KB
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 · 21 lines · 73 tokens per session scan A 3ba7d54cf357
mex-statechart is a skill published in the GitHub repository mex-memory/mex (1,781 stars, last pushed today), licensed MIT. It adds 73 tokens to every session and 1,194 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-29.
Other skills, from other repositories
systematic-debugging
4-phase root cause process + passive behavior auto-detection + L1→L4 pressure escalation (includes root-cause-tracing, defense-in-depth, condition-based-waiting techniques).
build-error-resolver
Build and TypeScript error resolution specialist. Use PROACTIVELY when build fails or type errors occur.
trace
Evidence-driven tracing lane that orchestrates competing tracer hypotheses in Claude built-in team mode.
debugging
Use this skill when diagnosing and fixing bugs. It provides a structured approach to identify root causes and verify fixes.
ai-tracing-requests
See exactly what your AI did on a specific request. Use when you need to debug a wrong answer, trace a specific AI request, profile slow AI pipelines, find which step failed, inspect LM calls, view token usage per request, build audit trails, or understand why a customer got a bad response. Covers DSPy inspection…
dspy-assertions
Legacy reference for dspy.Assert and dspy.Suggest, both removed in DSPy 3.x - use dspy.Refine or dspy.BestOfN instead. Use when maintaining a legacy DSPy 2.x codebase that uses dspy.Assert or dspy.Suggest, or migrating from Assert/Suggest to DSPy 3.x. Also used for dspy.Assert, dspy.Suggest, runtime validation for LLM…