AXME Code is an MCP server plugin for Claude Code that gives your AI coding agent persistent memory, architectural decisions, and safety guardrails — across every session, automatically. Stop re-explaining your architecture on session 47. Stop losing context between sessions. Stop hoping the agent won't run git push --force to main. AXME Code handles context engineering, session continuity, and ha
Add this skill
npx mdskills install AxmeAI/axme-codeComprehensive persistent memory and safety system with pre-execution hooks and structured knowledge base
1# AXME Code23### Claude Code forgets your project every session. We fixed it.45AXME Code is an [MCP server](https://modelcontextprotocol.io/) plugin for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) that gives your AI coding agent **persistent memory**, **architectural decisions**, and **safety guardrails** — across every session, automatically.67Stop re-explaining your architecture on session 47. Stop losing context between sessions. Stop hoping the agent won't run `git push --force` to main. AXME Code handles context engineering, session continuity, and hard safety enforcement so you can focus on building.89You keep using Claude Code exactly as before. AXME Code works transparently in the background.1011[]()12[](https://github.com/AxmeAI/axme-code/releases)13[](LICENSE)14[]()1516**[Quick Start](#quick-start)** · **[Before & After](#before--after)** · **[How It Works](#how-it-works)** · **[Architecture](docs/ARCHITECTURE.md)** · **[Website](https://code.axme.ai)**1718---19202122## Before & After2324<table>25<tr>26<th width="50%">Without AXME Code</th>27<th width="50%">With AXME Code</th>28</tr>29<tr>30<td>3132**Session 1**: "We use FastAPI, not Flask. Deploy only via GitHub Actions. Never push to main directly."3334**Session 2**: "Like I said yesterday, we use FastAPI..."3536**Session 7**: "For the third time this week, we use FastAPI..."3738**Session 47**: *gives up, mass-pastes 200 lines into CLAUDE.md*3940</td>41<td>4243**Session 1**: Agent learns your stack, saves decisions.4445**Session 2**: Agent calls `axme_context` → already knows FastAPI, deploy rules, what happened yesterday.4647**Session 47**: Agent has your full project history: 30 decisions, 15 memories, safety rules, and a handoff from session 46.4849</td>50</tr>51<tr>52<td>5354Agent runs `git push --force` to main. Your Friday is ruined.5556</td>57<td>5859Hook intercepts the command **before execution** and blocks it. Not a prompt — hard enforcement at the harness level.6061</td>62</tr>63<tr>64<td>6566Agent says "Done!" — but tests don't pass, half the code is stubbed, and the deploy is broken.6768</td>69<td>7071Decisions enforce verification requirements: agent must run tests and show proof before reporting completion.7273</td>74</tr>75</table>7677---7879## Quick Start8081**Requires [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (CLI or VS Code extension).**8283```bash84curl -fsSL https://raw.githubusercontent.com/AxmeAI/axme-code/main/install.sh | bash85```8687Installs to `~/.local/bin/axme-code`. Supports Linux, macOS, and Windows (x64 and ARM64).8889### Setup9091```bash92cd your-project # or workspace root for multi-repo93axme-code setup94claude # that's it — use Claude Code as usual95```9697`axme-code setup` does three things:981. **Scans your project** and builds the knowledge base — oracle (stack, structure, patterns, glossary), extracts decisions, memories, and safety rules from your code, configs, CLAUDE.md, and session history992. **Installs safety hooks** that intercept dangerous commands before execution1003. **Configures the MCP server** in Claude Code settings (`.mcp.json`)101102After setup, every Claude Code session automatically loads the full knowledge base. No config, no manual steps.103104---105106## What You Get107108### Persistent Knowledge Base109Your agent starts every session with full context: stack, decisions, patterns, glossary, and a handoff from the previous session. No more re-explaining your architecture on session 47.110111| Category | What it stores | Example |112|----------|---------------|---------|113| **Oracle** | Project structure, tech stack, coding patterns, glossary | "TypeScript 5.9, Node 20, ESM, esbuild" |114| **Decisions** | Architectural decisions with enforcement levels | "All deploys via CI/CD only" [required] |115| **Memory** | Feedback from mistakes, validated patterns | "Never use sync HTTP in async handlers" |116| **Safety** | Protected branches, denied commands, filesystem restrictions | `git push --force` → BLOCKED |117| **Backlog** | Persistent cross-session task tracking | "B-003: migrate auth to OAuth2 [in-progress]" |118| **Handoff** | Where work stopped, blockers, next steps | "PR #17 open, waiting on review. Next: fix flaky test." |119| **Worklog** | Session history and events | Timeline of all sessions and what was done |120121### Safety Guardrails (100% Reliable)122Hooks intercept tool calls **before execution** — not prompts. Even if the agent hallucinates a reason to run `rm -rf /`, the hook blocks it. This is hard enforcement at the Claude Code harness level, not a suggestion in a system prompt.123124Blocked by default:125- `git push --force`, `git reset --hard`, direct push to `main`/`master`126- `rm -rf /`, `chmod 777`, `curl | sh`127- `npm publish`, `git tag`, `gh release create`128- Writing to `.env`, `.pem`, `.key` files129130You can add your own custom rules via `axme_update_safety` or by editing `.axme-code/safety/rules.yaml` directly.131132### Automatic Knowledge Extraction133The agent saves discoveries during work via MCP tools. At session close, a structured checklist ensures nothing is missed. If you just close the window — a background auditor extracts memories, decisions, and safety rules from the full session transcript.134135### Multi-Repo Workspaces136Each repo gets its own knowledge base (`.axme-code/`). Workspace-level rules apply to all repos. Repo-specific rules stay scoped. The agent sees merged context — workspace safety floor + repo-specific decisions.137138Supports 14 workspace formats: VS Code multi-root, pnpm/npm/yarn workspaces, Nx, Gradle, Maven, Rush, git submodules, and more.139140### Why Not Just CLAUDE.md?141142CLAUDE.md is great for simple projects with a few rules. But it doesn't scale:143144| | CLAUDE.md | AXME Code |145|---|---|---|146| **Memory** | Static, manual | Automatic, accumulates across sessions |147| **Decisions** | Flat text, no enforcement | Structured, required/advisory levels |148| **Safety** | Prompt-based (~80% compliance) | Hook-based (100% enforcement) |149| **Session continuity** | None | Handoff + background auditor |150| **Scales to** | ~50 lines | Hundreds of decisions, memories, rules |151152AXME Code complements CLAUDE.md — it reads your existing CLAUDE.md during setup and extracts decisions and rules from it.153154---155156## Comparison157158| | AXME Code | MemPalace | Mastra | Zep | Mem0 | Supermemory |159|---|---|---|---|---|---|---|160| **Capabilities** | | | | | | |161| Structured decisions w/ enforce levels | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |162| Pre-execution safety hooks | ✅ | ❌ | ⚠️ | ❌ | ❌ | ❌ |163| Structured session handoff | ✅ | ❌ | ❌ | ❌ | ⚠️ | ❌ |164| Automatic knowledge extraction | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |165| Project oracle (codebase map) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |166| Multi-repo workspace | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |167| Local-only storage | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |168| Semantic memory search | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |169| Multi-client support | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |170| **Capabilities total** | **9/9** | 3/9 | 4/9 | 3/9 | 3/9 | 3/9 |171| **Benchmarks** | | | | | | |172| ToolEmu safety (accuracy) | **100.00%** | — | — | — | — | — |173| ToolEmu safety (FPR) | **0.00%** | — | — | — | — | — |174| LongMemEval E2E | **89.20%** | — | 84.23% / 94.87% | 71.20% | 49.00% | 85.40% |175| LongMemEval R@5 | **97.80%** | 96.60% | — | — | — | — |176| LongMemEval tokens/correct | **~10K** ✓ | — | ~105K–119K | ~70K | ~31K | ~29K |177178### Token efficiency179180181182AXME uses **~10× fewer tokens per correct answer** than Mastra at competitive accuracy. The memory system runs only 2 LLM calls per question (reader + judge) — competitors run dozens (Observer per turn, Reflector periodically, graph construction, fact extraction).183184See [benchmarks/README.md](benchmarks/README.md) for full methodology, per-category breakdowns, footnotes, and reproduction instructions.185186---187188## How It Works189190191192### Session Flow1931941. **Session starts** → agent calls `axme_context`, loads full knowledge base1952. **During work** → agent saves discoveries via `axme_save_memory`, `axme_save_decision`. Hooks enforce safety on every tool call.1963. **Session close** → ask your agent to close the session → agent calls `axme_begin_close`, gets a checklist. Reviews the session for missed memories, decisions, safety rules. Calls `axme_finalize_close` — MCP writes handoff, worklog, and extractions atomically.1974. **Fallback** → if you just close the window, the background auditor extracts everything from the transcript.1985. **Next session** → `axme_context` returns everything accumulated. Handoff says exactly where to continue.199200> **Tip**: You can save at any time — just tell the agent "remember this" or "save this as a decision". You don't have to wait for session close.201202---203204## Storage205206All data lives in `.axme-code/` in your project root (gitignored automatically):207208```209.axme-code/210 oracle/ # stack.md, structure.md, patterns.md, glossary.md211 decisions/ # D-001-slug.md ... D-NNN-slug.md (with enforce levels)212 memory/213 feedback/ # Learned mistakes and corrections214 patterns/ # Validated successful approaches215 safety/216 rules.yaml # git + bash + filesystem guardrails217 backlog/ # B-001-slug.md ... persistent cross-session tasks218 sessions/ # Per-session meta.json (tracking, agentClosed flag)219 plans/220 handoff-<id>.md # Per-session handoff (last 5 kept)221 worklog.jsonl # Structured event log222 worklog.md # Narrative session summaries223 config.yaml # Model settings, presets224```225226Human-readable markdown and YAML. No database, no external dependencies.227228---229230## AXME Platform231232AXME Code is the developer tools layer of the [AXME platform](https://github.com/AxmeAI) — durable execution infrastructure for AI agents.233234---235236<details>237<summary><strong>Components</strong></summary>238239AXME Code has three components:240241### 1. MCP Server (persistent, runs while VS Code is open)242243Provides tools for the agent to read and write the knowledge base. All writes go through MCP server code (atomicWrite, correct append) — the agent never writes storage files directly.244245### 2. Hooks (fire on every tool call)246247**pre-tool-use**: Checks every Bash command, git operation, and file access against safety rules. Blocks violations before execution. Also creates/recovers session tracking.248249**post-tool-use**: Records which files the agent changed (for audit trail).250251### 3. Background Auditor (runs after session close)252253A detached process that reads the session transcript and catches anything the agent forgot to save. Two modes:254- **Full extraction** — when the agent crashed or user closed without formal close255- **Verify-only** — when the agent completed the close checklist (lighter, cheaper)256257</details>258259<details>260<summary><strong>Available MCP Tools (19 tools)</strong></summary>261262| Tool | Description |263|------|-------------|264| `axme_context` | Load full knowledge base (oracle + decisions + safety + memory + handoff) |265| `axme_oracle` | Show oracle data (stack, structure, patterns, glossary) |266| `axme_decisions` | List active decisions with enforce levels |267| `axme_memories` | Show all memories (feedback + patterns) |268| `axme_save_decision` | Save a new architectural decision |269| `axme_save_memory` | Save feedback or pattern memory |270| `axme_safety` | Show current safety rules |271| `axme_update_safety` | Add a new safety rule |272| `axme_backlog` | List or read backlog items |273| `axme_backlog_add` | Add a new backlog item |274| `axme_backlog_update` | Update backlog item status, priority, or notes |275| `axme_status` | Project status (sessions, decisions count, last activity) |276| `axme_worklog` | Recent worklog events |277| `axme_workspace` | List all repos in workspace |278| `axme_begin_close` | Start session close — returns extraction checklist |279| `axme_finalize_close` | Finalize close — writes handoff, worklog, extractions atomically |280| `axme_ask_question` | Record a question for the user |281| `axme_list_open_questions` | List open questions from previous sessions |282| `axme_answer_question` | Record the user's answer |283284</details>285286<details>287<summary><strong>CLI Commands</strong></summary>288289```bash290axme-code setup [path] # Initialize project/workspace with LLM scan291axme-code serve # Start MCP server (called by Claude Code automatically)292axme-code status [path] # Show project status293axme-code stats [path] # Worklog statistics (sessions, costs, safety blocks)294axme-code audit-kb [path] # KB audit: dedup, conflicts, compaction295axme-code hook pre-tool-use # PreToolUse hook handler (called by Claude Code)296axme-code hook post-tool-use # PostToolUse hook handler297axme-code hook session-end # SessionEnd hook handler298axme-code audit-session # Run LLM audit on a session transcript299```300301</details>302303<details>304<summary><strong>Preset Bundles</strong></summary>305306During `axme-code setup`, preset bundles provide curated best-practice rules:307308| Preset | What it adds |309|--------|-------------|310| **essential-safety** | Protected branches, no secrets in git, no force push, fail loudly |311| **ai-agent-guardrails** | Verification requirements, no autonomous deploys, proof before done |312313Additional presets available: `production-ready`, `team-collaboration`.314315</details>316317---318319<details>320<summary><strong>Telemetry</strong></summary>321322axme-code sends anonymous usage telemetry to help us improve the product. We collect:323324- **Lifecycle events**: install, startup, version update325- **Product health events**: setup completion, audit completion (counts of memories/decisions/safety extracted, duration, cost, error class)326- **Errors**: category and bounded error class for failures in audit, setup, hooks, and auto-update327328What we **never** send:329- Hostnames, usernames, file paths, working directories330- Source code, transcripts, decisions, memories, or any project content331- IP addresses (stripped at the server)332- Raw exception messages (we map to a small set of error classes)333334Each install gets a random 64-character machine ID stored in `~/.local/share/axme-code/machine-id`. The ID is not derived from hardware and cannot be linked back to you.335336**To disable telemetry**, set either of these environment variables:337338```bash339export AXME_TELEMETRY_DISABLED=1340# or the industry-standard:341export DO_NOT_TRACK=1342```343344When disabled, no network requests are made and no machine ID is generated.345346</details>347348---349350## Contributing351352See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.353354## License355356[MIT](LICENSE)357358---359360[Website](https://code.axme.ai) · [Issues](https://github.com/AxmeAI/axme-code/issues) · [Architecture](docs/ARCHITECTURE.md) · contact@axme.ai361
Full transparency — inspect the skill content before installing.