winstonkoh87/Athena-Public
À propos
Transforme des LLM sans état en un agent d’IA avec état, qui accumule ses connaissances au fil du temps. Comprend une mémoire persistante privilégiant l’exécution locale, des écrans de décision quantitative et un cadre d’exécution pour la gouvernance, compatibles avec Claude Code, Antigravity, Cursor et VS Code. Vous gardez la maîtrise de l’état et louez l’intelligence.
Outils de développementProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- +2
- in 15 days
- +27
- in 1 month
- +37
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalAthena
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
The Problem: Stateless AI is an Amnesiac Bottleneck
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.
Quickstart
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.
How It Works
┌─────────────────────────────────────────────────────────────────────────┐
│ 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), PostToolUse lint & 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) |
Repository Structure
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
What Ships in the SDK
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 |
| Runtime Governance & Batched Telemetry | core/governance.py, scripts/boot_status.py, scripts/check_doc_drift.py, .agent/scripts/hook_*.py, .agent/scripts/security/block_*.py, .agent/scripts/lib/jsonl_tail.py |
Fail-closed PreToolUse guards ("onFailure": "block" — ruin, secrets, tainted memory), PostToolUse edit linter (hook_post_edit_lint.py), CI doc-drift gate, concurrent <1.0s boot_status.py --bundle, O(1) 64KB EOF tail gates, capability permissions, and Protocol 509 crisis screen |
What's enforced in code vs. by prompt
Most AI-agent READMEs state every claim in the same confident voice. This one doesn't.
| Claim | Status | Evidence |
|---|---|---|
| Storage & hybrid retrieval — memories stored and surfaced when relevant | ✅ Shipped (code-enforced) |
Hybrid 5-channel RRF + exponential recency decay + ONNX mini-batch rerank + self-healing SQLite cache, hardened through logged regressions |
| Portability — Markdown and JSONL on your disk, movable across models | ✅ Shipped (structural) |
Plain files on disk — inspect the repo |
| Quantitative decision screening & wargaming — EEV, 1/3 Kelly, Ruin, MCDA, 2-turn game trees | ✅ Shipped (code-available) |
gto_engine.py & wargame.py emit SHA-256 receipts (107 tests); quicksave emits non-blocking warnings on unreceipted engine claims (Stop hooks removed) |
Pre-registered problem framing — Lite/Strict frame_open, R1–R14 gates & holdout eval |
✅ Shipped (code-available) |
frame_ledger.py & tests/test_problem_solving_holdout.py (30-case holdout + calibration) |
| Governed autonomy — hooks block destructive commands, ungrounded claims, and secrets | ✅ Shipped (partial) | Fail-closed PreToolUse hooks ("onFailure": "block", exit 2 on malformed input) guard shlex-tokenized ruin (rm -rf / find -delete / mv / force-push / reset --hard / shutil.rmtree), secrets, and tainted-memory writes (tests/test_ruin_structured.py, tests/test_memory_hardening.py); shell indirection bypasses are known and tracked |
| Claim & citation tracing — verifying numeric claims, denials, and cited repo paths | 🟡 Partial | GTO GTO-xxxxxxxx numeric receipts, opt-in universal-negative gate (.agent/scripts/hook_epistemic_gate.py), and PostToolUse diff lint (.agent/scripts/hook_post_edit_lint.py); general prose claim-entailment is not solved |
| Compounding personalization — session 2,000 recalls session 5 | 🟡 N=1 evidence | 2,100+ sessions, 410 active protocols, and 642 case studies by the author; no multi-user study |
| Anti-sycophancy — personalization doesn't silently increase agreement | 🟡 Partial mitigation | Code-enforced meta-awareness gate (Claude Code hook + MCP context_gate bridge; 24-case holdout in tests/test_sycophancy_holdout.py verifies 18/18 bait kernel injection & 0/6 false positives); downstream LLM behavior & hookless IDEs remain partial — see honest limits |
Why publish this table? Because the failure mode of this product category is self-mythologizing — describing aspirations in the present tense. Athena's own convention (Epistemic Status) requires labeling every mechanism as
code-enforced,code-available,agent-discretion, oraspirational. This table is that convention applied to the README.
Measured, Not Claimed
# Run the batched 1-wave boot status bundle (<1.0s concurrent telemetry; or --json)
python3 scripts/boot_status.py --bundle
# Run the test suite (including frame_ledger, gto_engine, and MinMax/MaxMax suites)
pytest tests/ -v --tb=short
# Screen a decision quantitatively (EEV / 1/3 Kelly / Ruin / MCDA / Monte Carlo)
python -m athena.intelligence.gto_engine --action mcda --help
# Adjudicate a 2-turn adversarial wargame with path-dependent trough ruin screening
python -m athena.intelligence.wargame --help
# Validate a pre-registered problem frame and inspect Brier calibration
python -m athena.intelligence.frame_ledger calibrate
python3 examples/scripts/calibration_score.py
# Run the 30-case problem-solving holdout gate & dry-run A/B evaluation harness
pytest tests/test_problem_solving_holdout.py -v
python3 scripts/eval_problem_solving_ab.py --dry-run
# Run the 24-case profile-conditioned sycophancy holdout & zero-token memory health eval
pytest tests/test_sycophancy_holdout.py tests/test_memory_hardening.py -v
python3 scripts/memory_eval.py --fixtures
# Run the local KV cache & TTFT benchmark (Ollama / llama.cpp)
python scripts/benchmark_kv_cache.py --model qwen2.5-coder:14b
# Run the retrieval evaluator yourself (requires Supabase keys + golden_queries.json)
python examples/scripts/evaluator.py --k 5 --rerank
| Metric | Value | Verification Command |
|---|---|---|
| MinMax v2.2 Boot, ONNX Rerank & Warm Gate | < 1.0s boot / < 2.0s 50-doc ONNX batch / < 10 ms warm gate | pytest tests/test_minmax_remediation.py tests/test_embedding_cache_resilience.py -v |
| Local TTFT Scaling (2K–3.6K Boot) | ~35x–50x speedup vs 32K | python scripts/benchmark_kv_cache.py |
| Retrieval Hit@5 (Strict) | 0.569 (37 / 65) | python examples/scripts/evaluator.py |
| Retrieval MRR@5 (Strict) | 0.472 | python examples/scripts/evaluator.py |
| Retrieval Hit@5 (Lenient) | 0.892 (deprecated) | Partial substring match (inflated) |
| Problem-Solving Holdout Benchmark | 30 / 30 (20 traps caught, 0 false ULTRA) | pytest tests/test_problem_solving_holdout.py -v |
| Sycophancy Gate Holdout (24-case) | 18 / 18 bait recall, 0 / 6 false positives | pytest tests/test_sycophancy_holdout.py -v |
| Memory Security & Lifecycle Fixtures | 15 / 15 passed (TTL, taint quarantine, forget, budgets) | pytest tests/test_memory_hardening.py -v |
| Unit & Red-Team Tests | 920+ passed (100% of runnable local suite) | pytest tests/ |
| Secret Leaks (970+ public commits) | 0 detected | Gitleaks + privacy_scan.py in CI |
| Code Quality & Lints | 0 ruff findings | ruff check src/ scripts/ tests/ |
Anti-Goodhart Invariant: Why did our reported Hit@5 shift from 0.89 to 0.57? Lenient substring matchers count partial word overlaps as "hits," inflating benchmark scores by ~36% without improving retrieval. We killed the lenient matcher because vanity metrics mask regressions. See the full breakdown: Anti-Goodhart Benchmarking in RAG.
Agent Compatibility
| IDE | Config file | Tested |
|---|---|---|
| Claude Code | CLAUDE.md |
✅ |
| Antigravity | AGENTS.md |
✅ |
| Cursor | .cursor/rules.md |
✅ |
| Gemini CLI | .gemini/AGENTS.md |
✅ |
| VS Code + Copilot | .vscode/settings.json |
✅ |
| Kilo Code | .kilocode/rules/athena.md |
✅ |
| Roo Code | .roo/rules/athena.md |
✅ |
Documentation
| Doc | What it covers |
|---|---|
| Getting Started | Install, configure, first session |
| Your First Session | 20-minute guided tutorial |
| How It Works | 4-pillar architecture, search pipeline, and decision gates |
| Why Athena? | Philosophy, problem classification, use cases, cost analysis |
| Engineering Depth | Technical deep dives and honest limits |
| CLI Reference | All commands |
| FAQ | Common questions |
| Safety | Limitations and responsible use |
| Changelog | Release history |
Contributing
PRs welcome. Please read CONTRIBUTING.md first.
The codebase uses ruff for linting, pytest for tests, and CI must pass before merge (make check-all).
MIT License · Contributing · Safety · Security Policy · Security Model · Code of Conduct · Support · Accessibility
Built and battle-tested solo across 2,100+ sessions by Winston Koh.
Clone it. Boot it. Make it yours.
Explorer des projets similaires
Chargement…