|
1 | 1 | # AXME Code |
2 | 2 |
|
3 | | -MCP server plugin for Claude Code CLI. Provides persistent project knowledge, architectural decisions, memory, and safety rules. |
| 3 | +**Persistent memory, decisions, and safety guardrails for Claude Code.** |
| 4 | + |
| 5 | +[]() []() [](LICENSE) |
| 6 | + |
| 7 | +**[Quick Start](#quick-start)** · **[How It Works](#how-it-works)** · **[Architecture](docs/ARCHITECTURE.md)** |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## The Problem |
| 12 | + |
| 13 | +- **Agents forget everything between sessions** - your stack, conventions, past decisions, all gone |
| 14 | +- **Agents can run dangerous commands** - `rm -rf`, `git push --force`, `npm publish` with no guardrails |
| 15 | +- **No one tracks decisions** - why was this library chosen? what deploy procedure was agreed on? |
| 16 | +- **You re-explain the same things every session** - "we use FastAPI, not Flask", "never push to main" |
| 17 | +- **No continuity** - what was done yesterday? what's blocked? what's next? |
| 18 | + |
| 19 | +AXME Code fixes all of this. You just work with Claude Code as usual - AXME Code handles the rest transparently. |
| 20 | + |
| 21 | +--- |
4 | 22 |
|
5 | 23 | ## Quick Start |
6 | 24 |
|
7 | 25 | ```bash |
| 26 | +# Install globally |
8 | 27 | npm install -g @axme/code |
9 | 28 |
|
10 | | -# In your project: |
| 29 | +# Initialize in your project (or workspace root for multi-repo) |
| 30 | +cd your-project |
11 | 31 | axme-code setup |
12 | 32 |
|
13 | | -# Then use Claude Code as usual: |
| 33 | +# That's it. Use Claude Code as usual: |
14 | 34 | claude |
15 | 35 | ``` |
16 | 36 |
|
17 | | -## What It Does |
| 37 | +`axme-code setup` does three things: |
| 38 | +1. Scans your project and builds the knowledge base (oracle, stack, structure) |
| 39 | +2. Installs hooks for safety enforcement |
| 40 | +3. Configures the MCP server in Claude Code settings |
18 | 41 |
|
19 | | -AXME Code runs as an MCP (Model Context Protocol) server inside Claude Code. It gives Claude persistent memory about your project: |
| 42 | +--- |
20 | 43 |
|
21 | | -- **Oracle** - project structure, stack, patterns, glossary (auto-detected) |
22 | | -- **Decisions** - architectural decisions with enforcement levels |
23 | | -- **Memory** - learned feedback and successful patterns |
24 | | -- **Safety** - git, bash, and filesystem safety rules |
25 | | -- **Worklog** - session event log |
| 44 | +## What You Get |
26 | 45 |
|
27 | | -## Available Tools |
| 46 | +### Persistent Knowledge Base |
28 | 47 |
|
29 | | -| Tool | Description | |
30 | | -|------|-------------| |
31 | | -| `axme_init` | Initialize project knowledge base | |
32 | | -| `axme_context` | Read full project context | |
33 | | -| `axme_oracle` | Show oracle data | |
34 | | -| `axme_decisions` | Show decisions | |
35 | | -| `axme_save_memory` | Save feedback or pattern | |
36 | | -| `axme_search_memory` | Search memories by keywords | |
37 | | -| `axme_save_decision` | Save architectural decision | |
38 | | -| `axme_update_safety` | Add safety rule | |
39 | | -| `axme_safety` | Show safety rules | |
40 | | -| `axme_status` | Project status | |
41 | | -| `axme_worklog` | Recent events | |
42 | | - |
43 | | -## Preset Bundles |
44 | | - |
45 | | -During initialization, preset bundles provide curated best-practice rules: |
46 | | - |
47 | | -- **essential-safety** - git protection, no secrets, fail loudly |
48 | | -- **ai-agent-guardrails** - verification requirements, no autonomous deploys |
49 | | -- **production-ready** - staging-first, health checks, CI/CD only |
50 | | -- **team-collaboration** - conventional commits, PR size limits |
| 48 | +Your agent starts every session with full context - project stack, architecture decisions, coding patterns, glossary, and what happened in the last session. No more "what framework do we use?" on session 47. |
| 49 | + |
| 50 | +### Safety Guardrails (100% Reliable) |
| 51 | + |
| 52 | +Safety rules are enforced by **hooks that intercept tool calls before execution** - not by prompts. Even if the agent hallucinates a reason to run `rm -rf /` or `git push --force origin main`, the hook blocks it. This is hard enforcement at the Claude Code harness level, not a suggestion in a system prompt. |
| 53 | + |
| 54 | +### Automatic Knowledge Extraction |
| 55 | + |
| 56 | +During work, the agent saves important discoveries (decisions, patterns, feedback) via MCP tools. At session close, a structured checklist ensures nothing is missed. And if you forget to close the session - a background auditor reads the transcript and extracts what the agent didn't save. |
| 57 | + |
| 58 | +### Multi-Repo Workspaces |
| 59 | + |
| 60 | +Each repo has its own knowledge base (`.axme-code/`). Workspace-level rules apply to all repos. Repo-specific rules stay scoped. The agent sees merged context - universal rules plus the repo it's working in. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Knowledge Categories |
| 65 | + |
| 66 | +| Category | What it stores | Example | |
| 67 | +|----------|---------------|---------| |
| 68 | +| **Oracle** | Project structure, tech stack, coding patterns, glossary | "Python 3.11, FastAPI, PostgreSQL" | |
| 69 | +| **Decisions** | Architectural decisions with enforcement levels (required/advisory) | "All deploys via GitHub Actions only" (required) | |
| 70 | +| **Memory** | Feedback from mistakes, validated patterns | "Never use sync httpx in async handlers" | |
| 71 | +| **Safety** | Protected branches, denied commands, filesystem restrictions | git push --force -> BLOCKED | |
| 72 | +| **Handoff** | Where work stopped, blockers, next steps | "PR#17 open, needs review" | |
| 73 | +| **Worklog** | Session history, audit results, events | Timeline of all sessions | |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## How It Works |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | +### Session Flow |
| 82 | + |
| 83 | +1. **Session starts** - agent calls `axme_context`, gets full knowledge base |
| 84 | +2. **During work** - agent saves discoveries via `axme_save_memory`, `axme_save_decision`. Hooks enforce safety on every tool call. |
| 85 | +3. **Session close** - user asks to close. Agent calls `axme_begin_close`, gets a checklist. Reviews the session for missed memories, decisions, safety rules. Checks for duplicates against loaded context. Calls `axme_finalize_close` with all data - MCP writes handoff, worklog, extractions atomically. Agent outputs storage summary and startup text for next session. |
| 86 | +4. **Fallback** - if the user just closes the window, the auditor runs in background and extracts everything from the transcript. |
| 87 | +5. **Next session** - `axme_context` returns everything accumulated. Handoff says where to continue. |
| 88 | + |
| 89 | +> **Tip**: You can trigger saving at any time - just ask the agent "remember this" or "save this as a decision". You don't have to wait for session close. |
| 90 | +
|
| 91 | +--- |
51 | 92 |
|
52 | 93 | ## Storage |
53 | 94 |
|
54 | | -All data is stored in `.axme-code/` in your project root: |
| 95 | +All data lives in `.axme-code/` in your project root (or workspace root for multi-repo): |
55 | 96 |
|
56 | 97 | ``` |
57 | 98 | .axme-code/ |
58 | | - oracle/ stack.md, structure.md, patterns.md, glossary.md |
59 | | - decisions/ D-001-slug.md, index.md |
60 | | - memory/ feedback/*.md, patterns/*.md |
61 | | - safety/ rules.yaml |
62 | | - sessions/ <uuid>/meta.json |
63 | | - config.yaml |
64 | | - worklog.jsonl |
| 99 | + oracle/ # stack.md, structure.md, patterns.md, glossary.md |
| 100 | + decisions/ # D-001-slug.md ... D-NNN-slug.md (with enforce levels) |
| 101 | + memory/ |
| 102 | + feedback/ # Learned mistakes and corrections |
| 103 | + patterns/ # Validated successful approaches |
| 104 | + safety/ |
| 105 | + rules.yaml # git + bash + filesystem guardrails |
| 106 | + sessions/ # Per-session meta.json (tracking, agentClosed flag) |
| 107 | + plans/ |
| 108 | + handoff.md # Session handoff (Source: agent or auditor) |
| 109 | + worklog.jsonl # Structured event log |
| 110 | + worklog.md # Narrative session summaries |
| 111 | + config.yaml # Model settings, presets |
65 | 112 | ``` |
66 | 113 |
|
67 | | -## Development |
| 114 | +--- |
| 115 | + |
| 116 | +## Related |
| 117 | + |
| 118 | +| Repository | Description | |
| 119 | +|-----------|-------------| |
| 120 | +| [axme](https://github.com/AxmeAI/axme) | AXME platform - durable execution for AI agents | |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | +<details> |
| 125 | +<summary><strong>Components</strong></summary> |
| 126 | + |
| 127 | +AXME Code has three components: |
| 128 | + |
| 129 | +### 1. MCP Server (persistent, runs while VS Code is open) |
| 130 | + |
| 131 | +Provides 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. This guarantees format consistency. |
| 132 | + |
| 133 | +### 2. Hooks (fire on every tool call) |
| 134 | + |
| 135 | +**pre-tool-use**: Checks every Bash command, git operation, and file access against safety rules. Blocks violations before they execute. Also creates/recovers session tracking. |
| 136 | + |
| 137 | +**post-tool-use**: Records which files the agent changed (for audit trail). |
| 138 | + |
| 139 | +### 3. Background Auditor (runs after session close) |
| 140 | + |
| 141 | +A detached process that reads the session transcript and catches anything the agent forgot to save. Two modes: |
| 142 | +- **Full extraction** - when the agent crashed or the user closed the window without formal close |
| 143 | +- **Verify-only** - when the agent completed the close checklist (lighter, cheaper) |
| 144 | + |
| 145 | +</details> |
| 146 | + |
| 147 | +<details> |
| 148 | +<summary><strong>Available MCP Tools</strong></summary> |
| 149 | + |
| 150 | +| Tool | Description | |
| 151 | +|------|-------------| |
| 152 | +| `axme_context` | Load full project knowledge base (oracle + decisions + safety + memory + plans + handoff) | |
| 153 | +| `axme_oracle` | Show oracle data (stack, structure, patterns, glossary) | |
| 154 | +| `axme_decisions` | List active decisions with enforce levels | |
| 155 | +| `axme_save_decision` | Save a new architectural decision | |
| 156 | +| `axme_save_memory` | Save feedback or pattern memory | |
| 157 | +| `axme_search_memory` | Keyword search across memories | |
| 158 | +| `axme_safety` | Show current safety rules | |
| 159 | +| `axme_update_safety` | Add a new safety rule | |
| 160 | +| `axme_status` | Project status (sessions, decisions count, last activity) | |
| 161 | +| `axme_worklog` | Recent worklog events | |
| 162 | +| `axme_workspace` | List all repos in workspace | |
| 163 | +| `axme_begin_close` | Start session close - returns extraction checklist | |
| 164 | +| `axme_finalize_close` | Finalize close - writes handoff, worklog, extractions atomically | |
| 165 | +| `axme_ask_question` | Record a question only the user can answer | |
| 166 | +| `axme_list_open_questions` | List open questions from previous sessions | |
| 167 | +| `axme_answer_question` | Record the user's answer to an open question | |
| 168 | + |
| 169 | +</details> |
| 170 | + |
| 171 | +<details> |
| 172 | +<summary><strong>CLI Commands</strong></summary> |
68 | 173 |
|
69 | 174 | ```bash |
70 | | -npm install |
71 | | -npm run build |
72 | | -npm run lint # TypeScript type check |
| 175 | +axme-code setup [path] # Initialize project/workspace KB with LLM scan |
| 176 | +axme-code serve # Start MCP server (called by Claude Code automatically) |
| 177 | +axme-code status [path] # Show project status (sessions, decisions, memories) |
| 178 | +axme-code hook pre-tool-use # PreToolUse hook handler (called by Claude Code) |
| 179 | +axme-code hook post-tool-use # PostToolUse hook handler (called by Claude Code) |
| 180 | +axme-code hook session-end # SessionEnd hook handler (called by Claude Code) |
| 181 | +axme-code audit-session # Run LLM audit on a session transcript |
73 | 182 | ``` |
74 | 183 |
|
75 | | -## License |
| 184 | +</details> |
| 185 | + |
| 186 | +<details> |
| 187 | +<summary><strong>Preset Bundles</strong></summary> |
| 188 | + |
| 189 | +During `axme-code setup`, preset bundles provide curated best-practice rules: |
| 190 | + |
| 191 | +| Preset | What it adds | |
| 192 | +|--------|-------------| |
| 193 | +| **essential-safety** | Protected branches, no secrets in git, no force push, fail loudly | |
| 194 | +| **ai-agent-guardrails** | Verification requirements, no autonomous deploys, proof before done | |
| 195 | + |
| 196 | +</details> |
| 197 | + |
| 198 | +--- |
76 | 199 |
|
77 | | -MIT |
| 200 | +hello@axme.ai |
0 commit comments