claude-mem
Captures what your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions so work carries over. Works with Claude Code and several other coding agents.
Local-first memory, decision engine, and governance harness for AI agents, portable across any IDE. Own the state. Rent the intelligence.
Clone the repository
$ git clone https://github.com/winstonkoh87/Athena-Public

Local-first memory, decision engine, and governance harness for AI agents — portable across any IDE.
Own the state. Rent the intelligence. Persistent memory, structured reasoning, and governed AI agents that work across any LLM — stored as plain Markdown and JSONL on your disk across Claude Code, Antigravity, Cursor, Gemini CLI, and VS Code.
Quickstart · How It Works · Structure · SDK & MCP Tools · Docs · Why Athena? · Safety
Why do AI coding assistants still give generic, textbook answers? Because frontier LLMs are fundamentally stateless.
Every time you open a new session, the model starts from zero. It has no memory of your architecture, your past post-mortems, your risk tolerance, or your code invariants. To get useful work done, you are forced to pay an Amnesia Tax — spending 10 minutes writing prompt essays explaining your stack and constraints. Worse, platform memory is designed to agree with you faster (sycophancy), not to stress-test your assumptions when stakes are high.
Athena solves this by separating intelligence (the rented model) from state (your sovereign disk):
| Dimension | Stateless Chatbots (Rented RAM) | Stateful Agent with Athena (Owned Hard Drive) |
|---|---|---|
| Memory & Context | Amnesiac: starts from zero; 10-minute prompt prep tax | Continuous: /start restores active tasks & invariants in 1 wave (5.4 KB Turn-1 AGENTS.md, <1s via boot_status.py --bundle) |
| Response Depth | Generic median: broad consensus advice & textbook platitudes | Hyper-nuanced: conditioned on your real stack, balance sheet, & past post-mortems |
| Alignment & Rigor | Sycophantic: agrees with whatever you say, validating bad ideas | Governed: irreversible-ruin blocker (Law #1); consigliere flags repeated blind spots |
| Data Sovereignty | Vendor lock-in: cloud database fees, wiped on API deprecation | 100% Sovereign: local Git-tracked Markdown & SQLite on your machine |
| Model Agility | Trapped in one chat platform | Portable: switch between Claude Code, Antigravity, Gemini, or Ollama instantly |
Athena moves the memory, problem-framing, and decision layer to your machine: plain Markdown and JSONL ledgers that you own, git-version, and mount into any IDE. The model is just whoever's on shift.
git clone https://github.com/winstonkoh87/Athena-Public.git && cd Athena-Public
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[local]" # local install (no cloud API keys required)
athena init --ide claude # or: antigravity, cursor, gemini, vscode, kilocode, roocode
# Or start small without scaffolding the full tree:
# athena init --ide claude --profile minimal # 3 Markdown memory files + AGENTS.md
# athena init --profile hooks-only # standalone PreToolUse secret + ruin hooks
athena doctor # verify environment & workspace health
Then type /start in your IDE's AI chat panel. Work normally. Type /end to save.
No Python / CLI? Grab the copy-paste 0-code 3-file starter (
active_context.md,rules.md,decisions.md) for regular ChatGPT, Claude, or Gemini web chats. Full install (cloud sync + cross-encoder reranking):pip install -e ".[full]"See Getting Started for Windows, advanced config, and Supabase setup.
┌─────────────────────────────────────────────────────────────────────────┐
│ Your IDE (Claude Code / Antigravity / Cursor / Gemini / VS Code) │
└───────────────────────────────┬─────────────────────────────────────────┘
│ MCP Servers (20 Athena + 5 DuckDB tools) + Hooks
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ Athena SDK (src/athena/) │
│ ├── 1. Memory & Hybrid RAG: 1-Wave /start, 5-channel parallel RRF │
│ │ + exponential decay, speculative "auto" (<= 5.5s wall cap), │
│ │ ONNX mini-batch rerank, self-healing search_cache_vecs.db │
│ ├── 2. Problem Framing & Meta-Triage: Lite/Strict frame_open, VOI │
│ │ (EVI), R1-R14 gates, Semantic Meta-Triage in context_gate │
│ ├── 3. Decision, Wargaming & Calibration: fail-closed real=True MCDA, │
│ │ EEV/Kelly/Ruin (gto_engine.py), Wargame, Brier calibration │
│ └── 4. Governance & Telemetry: fail-closed PreToolUse (ruin, secrets, │
│ taint), diff-scoped Stop & doc-drift gates, Lambda router, │
│ Trade Guardian, and O(1) 64KB tail gates (jsonl_tail.py) │
└───────────────────────────────┬─────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────┐
│ Your Disk (Plain Markdown + SQLite/JSONL receipts — git-native) │
│ └── Optional: Supabase pgvector (cloud sync) + DuckDB (analytics) │
└─────────────────────────────────────────────────────────────────────────┘
Three operating modes, one compounding loop:
| Mode | Lifecycle | Token Budget | Retrieval & Compute Strategy |
|---|---|---|---|
Sniper (SNIPER, Lambda < 10) | Direct chat -> /end | ~500 tokens | vector_mode="local" (<50 ms local FTS5/lex/canonical, zero cloud RTT) |
MinMax v2.2 (Default) (STANDARD, Lambda 10–30) | 1-Wave /start -> work -> /end | 5.4 KB Turn-1 AGENTS.md (12.5 KB / ~3.1K full boot set) | <1.0s parallel scripts/boot_status.py --bundle + context_gate (<= 2 Turn-1 tool waves); speculative "auto" local+ONNX fast-path (Lambda 10–25, non-personal/non-web) escalating to "always" (Lambda > 25), hard 5.5s non-blocking wall cap |
MaxMax v4.0 (Curated Compute) (ULTRA, Lambda > 30) | /ultrastart -> /ultrathink -> /ultraend | <= 40K boot ceiling (< 20% of 200K context window) | Surgical canonical/project slice loading (~145K+ tokens reserved for multi-track synthesis), 3-query parallel adversarial knowledge-base (Exocortex) pre-warming, and 3-mode /ultrathink orchestration (Native Swarm / API / HITL) |
Standardized modular repository layout (Protocol 543):
Athena-Public/
├── src/athena/ # Core runtime (Memory, Intelligence/GTO, Governance, Lifecycle, Tools)
├── tests/ # Test suites (unit, integration, red-team, MinMax/MaxMax regression)
├── scripts/ # Batched boot, shutdown hygiene, benchmarks, and sync verification
├── docs/ # Architecture, guides, wiki mirror, roadmap, benchmarks, and specs
├── examples/ # Reference workflows, skills, protocols, scripts, templates, and demos/
├── supabase/ # Database schemas, migrations, edge functions, and vector RPCs
├── docker/ # Sandboxed container environments
├── data/ # Active datasets and public asset staging
├── .agent/ # Shipped agent workflows, hooks, scripts, and canonical config
├── .context/ # Workspace state templates, protocol summaries, and canonical view
├── .framework/ # Reference framework modules and legacy compatibility specs
├── .github/ # Workflows, CI scripts, security/contributing/support/CoC policies
├── AGENTS.md # Root agent entrypoint (symlinked by CLAUDE.md)
├── ARCHITECTURE.md # Narrative system architecture and memory layout
├── DATA_CONTRACT.md # Authoritative read/write boundary specification
├── SAFETY.md # Risk boundaries and crisis/harm safeguards
├── CHANGELOG.md # Root pointer to docs/CHANGELOG.md
├── athena.yaml # Machine-readable agent capability manifest
├── llms.txt # LLM-friendly index of public docs and specs
├── pyproject.toml # Package metadata, dependencies, and tool configuration
├── Makefile # Standard task runner (install, test, lint, typecheck, privacy-check)
├── LICENSE # MIT License
└── README.md # Project front door
Athena is not just a prompt pack — it ships executable Python engines and two Model Context Protocol (MCP) servers (athena.mcp_server and athena.duckdb_mcp_server):
| Subsystem | Module / MCP Tool | What It Computes / Enforces |
|---|---|---|
| Hybrid RAG & Speculative Context Gate | mcp_server.py (smart_search, context_gate), tools/search.py, core/cache.py | Concurrent 5-channel RRF fusion (BM25 FTS5 + pgvector + canonical/headers + filenames + local learnings) + continuous exponential recency decay (365.25d half-life) + length-sorted ONNX mini-batch rerank (MAX_LENGTH=256), "local"/"auto"/"always" vector routing (5.5s non-blocking cap), and self-healing SQLite search_cache_vecs.db |
| Memory Security & Lifecycle | cli/memory.py (athena memory eval|verify|forget|taint), core/taint.py, memory/{budgets,dream_verifier,forget,health,learnings}.py | Zero-token TTL (expires_at), pinned negative-guardrail immunity (pinned: true), role-scoped startup context budgets, monotonic inbound taint quarantine, zero-LLM /dream transcript verifier, atomic cross-layer erasure, and zero-token health eval |
| Problem Framing & Meta-Triage | intelligence/frame_ledger.py (frame_open, frame_validate, frame_resolve, frame_status), mcp_server.py (context_gate) | Lite (lite=True) + Strict framing, EVI stop-rule, reframe_prior, R1-R14 commitment gates (low-reversibility/ULTRA fail-closed), LUCK band gate, and Semantic Meta-Triage |
| Quantitative Decision & Calibration | intelligence/gto_engine.py (decision_screen), intelligence/calibration.py (calibration_status) | Fail-closed real=True MCDA (veto_floors/ruin_inputs, preference_provenance, status_quo baseline check), EEV, 1/3 Kelly, Ruin, Monte Carlo, Brier calibration, and SHA-256 receipts (.athena/decision_receipts.jsonl) |
| Adversarial Wargaming Engine | intelligence/wargame.py (athena-wargame) | Two-turn sequential Blue vs. Red game trees with intra-turn path-dependent trough ruin, Red best-response optimization, and tamper-evident run receipts (.athena/wargame_runs.jsonl) |
| Counterparty OSINT & Trade Governance | intelligence/ucds_validator.py, tools/trade_guardian.py | Deterministic Universal Counterparty Dossier Standard (audit_ucds_dossier) validator (Track A/B bifurcation, knockout gates, cashflow inversion) plus position/drawdown/sizing safety guards |
| Local Analytical SQL | duckdb_mcp_server.py (query, profile, list_tables, export_result) | Zero-dependency DuckDB engine for profiling and querying large CSV, JSON, and Parquet datasets without exhausting LLM context windows |
Captures what your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions so work carries over. Works with Claude Code and several other coding agents.
Gives Claude Code long-term memory through Hindsight. It recalls relevant past context before answering, retains durable facts as the agent learns them, and reflects over stored memory.
Local-first memory for Claude Code. It stores conversations verbatim in a private palace you can search before answering about past work, people, projects, or decisions, with optional shared-brain hub setup.
Gives Claude Code a private memory that stays on your machine. It stores past conversations word for word, so you can ask what was decided, what happened before, or who was involved and get the original context back. It can also hand tasks to other agents.
Local-first memory, decision engine, and governance harness for AI agents, portable across any IDE. Own the state. Rent the intelligence. Install it with the command on its page. Free and open source.
Is this plugin yours?
Claim it with GitHubSubmit a pluginPromote it