akm-mcp
This MCP server enables AI agents to manage artifacts across sessions by providing tools for searching, retrieving, and registering entries in a persistent ledger, ensuring consistency and traceability of agent outputs.
README
akm — the artifact management layer for AI agents
English | 中文
Your agent produces dozens of files and hundreds of conclusions every day — and forgets all of it the moment the session ends. Three weeks later you say "continue where we left off," and it re-derives everything from scratch. Fast, sure. But two things can never be bought back by re-running:
- Consistency: this run's methodology differs from last run's. Two reports disagree, and you don't know which one to trust
- Verified results: last time's conclusion was human-checked and actually shipped; the re-run produces a fresh claim with its verification bit reset to zero
akm gives agent outputs a management layer. Three things happen automatically, without changing a single habit:
When files are written → auto-capture (journal append, zero LLM, zero interference)
When the session ends → auto-distill (background process + debounce: deliverables,
decisions with rationale, work preferences)
When a new session opens → inject your work preferences + a ledger overview
After your first message → local relevance search over the ledger, inject matching
history (hard token budget)
Is this for you?
Built for you if you match "solo + heavy agent use + your outputs are your livelihood + your work is a series, not one-offs":
- Content creators / serial writers — when chapter 45 starts, the agent already knows the character sheets, the open foreshadowing, and why that plan was rejected last time. No re-feeding 44 chapters
- Independent analysts / recurring research — re-run this month's analysis next month and the numbers reconcile: the methodology lives in the ledger, not in one session's luck
- Vibe coders (you ship with AI but don't use git) — which file is the live version, which approach was proven dead three weeks ago: akm remembers (note: it records which version is final, it does not store file contents — it is not a backup)
- Multi-agent / multi-model users — what Claude Code accumulates, Codex/ZCode can query out of the box via MCP
Not for you if your sessions are one-off tasks (value delivered on the spot, nothing worth keeping — that's fine), chat-only consultations (no files written, nothing recorded), or a heavyweight engineering team (git + CI is already the better artifact layer; that's their home turf).
How it differs from what you already have
| Versus | The one-line boundary |
|---|---|
| Just re-running | Re-runs can't buy back consistency or verified status — no model speed fixes two reports that disagree |
| claude-mem & memory frameworks | They record the process (what happened in a session); akm records the results (what assets remain, what superseded what, what's been verified) |
| CLAUDE.md / platform memory | Platforms remember facts about you, locked inside their own fence; akm records your outputs, in plain files you can walk away with |
| git | akm's territory is exactly git's blind spot: decision rationale, rejected alternatives, and outputs that never enter a repo (research, strategy, methodology) |
Three promises
- Your data stays in plain files you can grep — the ledger is a folder of markdown and jsonl. Delete akm and everything is still there; you lose convenience, not assets
- Never interfere with the host — hooks fail silently, the write path makes zero LLM calls. If akm breaks, your sessions keep working
- Wrong provenance is worse than no provenance — when the supersede relationship between entries is uncertain, it stays blank. No guessing, ever
Install (< 5 minutes)
Requires bun and a logged-in Claude Code.
git clone https://github.com/An-idd/akm && cd akm
bun install
bun build --compile packages/cli/src/main.ts --outfile ~/.akm/bin/akm
~/.akm/bin/akm init # pick a ledger location (default ~/Documents/akm-ledger) + register hooks
Then just work as usual. After your first file-writing session ends, run akm status — entries should appear. In your next session, the agent starts working with the relevant history already in context after your first message.
Daily use
Most of the time you do nothing. When you want to look things up:
| Command | What it does |
|---|---|
akm search <keywords> |
Search (relevance × freshness × trust; superseded/quarantined hidden by default) |
akm get <id> |
Full entry + metadata + provenance (and reinforces the entry — use it or lose it) |
akm verify <id> |
Human endorsement: verified conclusions rank higher and never decay to zero |
akm status |
Ledger health report: entry breakdown, stale warnings, failed-distill alerts |
akm compact [--dry] |
Consolidate same-topic entries. Conservative — uncertain clusters are left alone; sources become superseded, never deleted |
akm export <session-id> |
Export a session transcript as readable markdown (--out to save) |
akm init --project |
Enable project scope in a directory: its entries won't leak into other projects' sessions |
akm rebuild |
Rebuild the index from scratch (the index is always a disposable cache) |
akm migrate |
Migrate legacy flat entry bodies into coordinate directories (entries/self/<name>/v<N>-….md) |
akm uninstall |
Remove the hooks. Ledger files stay untouched; run akm init to re-enable |
You can also just ask your agent — the injected context includes akm search / akm get usage, and agents use them on their own.
What gets recorded, what doesn't
- Recorded: deliverables that still matter when the session ends (final docs, code, data) + conclusions/decisions (with rationale and rejected alternatives) + work preferences you've expressed. The first entry is always a session summary: what happened, what came out of it
- Not recorded: intermediate artifacts, drafts, replaced versions, chat-only sessions (sessions that write no files cost nothing and record nothing) — capture everything, distill little; forgetting is a feature, not a bug
- Automatic metabolism: new versions supersede old ones (uncertain cases coexist; entries you've verified are never auto-superseded); entries unretrieved for 30 days get demoted and flagged in
status(staleness is computed at query time — ledger files are never rewritten); frequently used entries rank up; preference entries never decay. Files over 4MB are recorded by path without a content hash
Where the data lives, and what it looks like
~/Documents/akm-ledger/ # truth layer; picked at init — put it in a synced folder for free multi-device
journal/
<session-id>.jsonl # per-session write log (append-only)
<session-id>.transcript.md # distillation evidence archive (provenance survives host cleanup)
entries/self/<name>/v<N>-<id8>.md # conclusion/decision bodies — directories are coordinates, human-browsable
manifests.jsonl # all metadata, one line per entry, git-diff friendly
~/.akm/ # cache layer: config, index, access stats — rebuildable
One line of manifests.jsonl (machine-written, machine-read, human-auditable):
{"id":"8e54cce1287e0f72","coords":{"namespace":"self","name":"topic-scan","version":2},
"type":"file","status":"final","summary":"Topic scan update: direction A confirmed, C added as candidate",
"provenance":{"host":"claude-code","session":"…","inputs":["…"]},
"verified_by":[],"scope":"user","created":"2026-07-16T…","path":"…","content_hash":"sha256:…"}
The fields are the product: coords is a stable address (same topic iterates under the same name, version bumps), provenance answers "which session produced this, from what inputs," verified_by separates what you checked from what the AI said, status drives the lifecycle (draft / final / superseded / quarantined).
Cost & privacy
- The write path is free: capture is a local append; no model is called
- Distillation cost, honestly: distillation calls haiku via
claude -p, on your own Claude login (no API key). Trigger rule: at turn end, if the session added ≥5 file writes or 15+ minutes passed since the last distill, one background distill runs; session end always distills once. Sessions that write nothing cost nothing. A long, busy session may distill several to a dozen times a day — one haiku call each - Zero waiting: hooks return in milliseconds; distillation runs in a detached background process
- Everything local: ledger, index, and archives live on your disk; the only network call is the distillation above, on your own account
- Archive disclosure (important): distillation archives a plaintext excerpt of the conversation into the ledger (
journal/<session>.transcript.md) for provenance audits. If your ledger sits in a cloud-synced folder, that sync includes conversation text. Disable with"archive_transcripts": falsein~/.akm/config.json(trade-off: provenance breaks once the host cleans up old sessions) - Prompt-injection status, honestly: third-party content your agent processes (web pages, external files) flows into distillation input. Three hard defenses exist (file-path allowlist, verification bits force-cleared by the pipeline, human-verified entries never auto-superseded), but injected content is not yet fully sanitized — the threat model is limited while you're single-user on your own data, and full hardening lands before external content-pack imports ship. Don't blindly trust a distill run right after your agent processed untrusted content
- Walk away anytime:
akm uninstallremoves the hooks and leaves you a plain folder
Cross-host (MCP)
The same ledger is readable and writable by other agents. akm-mcp exposes three tools: akm_search / akm_get / akm_register (hosts without hooks register explicitly).
bun build --compile packages/mcp/src/server.ts --outfile ~/.akm/bin/akm-mcp
# Codex: ~/.codex/config.toml
[mcp_servers.akm]
command = "/absolute/path/.akm/bin/akm-mcp"
Point ZCode / Cowork at the same binary in their MCP settings. Honest note: automatic distillation currently happens on the Claude Code side only (it depends on its hooks and claude -p); other hosts get read-everything + manual register. Decoupling the write side is on the roadmap.
Architecture at a glance
L5 interface CLI + MCP server (three tools, never more than five)
L4 assembly hydration: scope filter × ranking × hard token budget — inject nothing rather than noise
L3 index SQLite FTS5 (works for CJK and English), disposable & rebuildable
L2 metadata manifests.jsonl: coordinates / provenance / lifecycle / verification
L1 storage plain files. Artifacts never move; the ledger records path + content hash
L0 capture hooks: PostToolUse capture / Stop+SessionEnd distill / SessionStart+UserPromptSubmit hydrate
The kernel makes zero assumptions about the host; all logic lives in a single akm executable and host adapters are thin shells. Deliberately not built: daemons (event-driven, run-and-exit), vector search (FTS + good summaries suffice until ~10k entries), accounts/sync services (the filesystem and your cloud drive are the sync layer), UI (markdown out; let the agent narrate).
Full design rationale (Chinese): docs/2026-07-15-agent-km-产品调研与设计.md. A usage story (Chinese): docs/我如何用akm.md.
Development
bun test # golden fixtures: journal in, entries out, mocked LLM
bash scripts/e2e.sh # full chain: init→capture→distill→supersede→compact→export→uninstall
bun scripts/harvest.ts <session.jsonl> <outdir> # real session → golden fixture material
bun scripts/eval.ts <session.jsonl…> # distillation quality review: batch-distill real sessions → grading sheet
Distillation quality is this product's lifeline. eval.ts turns your real sessions into a review sheet (incrementally cached; only failures re-run). The current version passed 10/10 on ten real-session samples, reviewed by the project author (n=10, not blinded, single reviewer — stated as is; run it on your own sessions and grade it yourself).
Roadmap
- Write-side decoupling: distillation provider via API key / other host CLIs, so "switch models without losing your accumulation" holds on both sides
- P2 teams:
akm sync(git under the hood, git vocabulary hidden from creators), shared namespaces, explicit publishing - P3 public packs:
.akmpack(entries + manifests + signature), import-as-PR (quality / overlap / conflict checks; adopt / endorse / reject / quarantine) - Full backlog (Chinese): docs/2026-07-15-akm-开发计划.md
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。