
Peon Mem
io.github.VineetV2由 GitHub 帳號 VineetV2 發布v1.0.9更新於 Oct 24, 2026
Local-first memory brain for AI coding agents: hooks capture sessions, beliefs injected per prompt.
概覽
Peon Mem 是面向 AI 程式助手的本地優先記憶伺服器,記錄工作階段、濃縮為信念,並在每次提示中注入相關記憶。
- 可以做什麼
- 啟動、記錄並結束工作階段,把訊息、事件與工具呼叫寫入依專案劃分的記憶庫。檢索與搜尋記憶,包含跨專案與全域搜尋,並建構注入提示的上下文區塊。檢視記憶庫、產生品質報告與評估,並觸發或依條件執行記憶整併。寫入與匯入全域記憶,讓偏好跨專案沿用。
- 適用情境
- 適合長期使用 Claude Code、Codex 等程式助手、希望決策、偏好與踩坑經驗能跨工作階段保留並自動召回的情境。也適合想讓多個助手共用同一專案記憶、同時把資料留在本機的使用者。
- 執行需求
- 以本機 Node.js 20+ 程序執行於 macOS 或 Linux,並需要搭配守護程序(預設位址由 PEON_DAEMON_URL 指定),通常註冊為 launchd 或 systemd 服務。建議提供 OPENROUTER_API_KEY 等模型金鑰用於整併與語意嵌入;沒有時僅支援詞彙檢索,也可改用本機 Ollama。安裝程式會修改助手設定檔並建立備份。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Peon Mem,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
🧠 Peon — a memory brain for your AI coding agents
[npm] [downloads] [license] [tests] [MCP Registry] [Star on GitHub]
Local-first, hierarchical, self-improving memory for Claude Code, Codex, and any MCP client.
Your AI forgets everything between sessions. Peon doesn't. It records your sessions, uses an LLM to consolidate them into typed beliefs, and injects the relevant ones back into every prompt. It runs as a daemon on your machine, and nothing leaves it.
Why Peon
- Hierarchical brains. One global parent brain holds who you are, your rules, and your tools. Each project gets an isolated child brain. Every injection carries both.
- Two memory layers, honestly measured. Consolidated beliefs (decisions, preferences,
facts, artifacts) give you the gist. An episodic verbatim layer recovers the exact details
that lossy summaries drop. In my own LongMemEval run, raw-episodic recall scored 61% where
belief-only scored 17% — self-measured, not an independent benchmark; reproduce it with
npm run eval. - Automatic capture and injection. Claude Code hooks record messages and events, then
inject a query-ranked memory block (with an
⚠ MOST RELEVANTheadline) into every prompt. You never have to remember to save anything. - Cost-gated consolidation. An LLM distills sessions into beliefs only once enough new memory accumulates. It can supersede, merge, and flag conflicts. Nothing is destructively deleted.
- Hybrid retrieval. Lexical and semantic RRF fusion, MMR diversity, reinforcement, and recency. Query embeddings are cached to disk, so repeat prompts cost nothing.
- The Neural Universe. A live monitor at
localhost:3737/monitorrenders every belief as a star. Projects are galaxies, search makes matches flare, and autonomous curation pulses. - A daily self-audit (STL). Peon checks itself every day: what it recorded, what it injected, what failed, what consolidation did. Then it files a report with a verdict.
- Eval-gated development. A committed results ledger (git SHA, qrels, and brain fingerprint per row) means retrieval changes are proven, not asserted. Negative results stay documented.
- Local-first and locked down. Plain JSONL you can read, a loopback-only daemon with DNS-rebinding protection, secret redaction at the injection boundary, and path-traversal guards.
[The Neural Universe — every belief is a star, projects are galaxies] The live monitor: 18k real beliefs rendered as stars. Type to make matching beliefs flare; click one to inspect it.
[Search flare — type a query and matching beliefs light up across every galaxy]
Ask the field: typing "wulver cluster" makes 400+ matching beliefs flare while the rest dim, and the camera flies to them.
Why "Peon"?
The name comes from Indian offices. Every office had a peon, the person who walked desk to desk all day: collect a file from this table, note who needs what, carry it to the next table, remember where everything is. He wasn't the boss or the star, but the whole office quietly ran on him. Nothing moved without him, and he never forgot where anything was.
That's this framework, with AI. Peon walks between your sessions and your projects. It collects what happened at one desk (a session), files it in the right cabinet (a project brain), carries the relevant papers to the next desk before you ask (injection), and keeps the master ledger upstairs (the global brain). Quiet clerk. Perfect memory. The office runs on him.
How Peon differs from existing memory tools
The short version: mem0 and Zep are memory platforms for products you build. Peon is memory for the coding agents you already use. It plugs into Claude Code or Codex in about five minutes, and you can watch it think and audit every number it claims.
Your agents share one brain
If you run more than one coding agent — Claude Code and Codex, say — they usually each live in their own bubble. Whatever you work out with one is gone when you switch to the other.
Point them at the same project and Peon dissolves that wall. Both agents resolve to the same
.peon/ brain (Peon canonicalizes the project path, so the hook, a direct MCP call, and Codex
all land on one store). So the memory flows between them:
- Codex works out how your build pipeline runs and records it. Next time you open Claude Code in that repo, it's already in the injected context.
- Claude Code hits a gotcha and files it. Codex sees it the moment it calls
get_contextorsearch_memory. - The global brain sits above both, so your preferences and rules follow you into every agent, in every project.
They aren't chatting in real time. It's a shared notebook both write in and both read from, so a decision made in one agent shows up in the other without you re-explaining it. One project, one memory, however many agents.
Quickstart
Requirements: Node 20+, macOS or Linux. An OpenRouter API key is recommended (consolidation + semantic embeddings); without one Peon still works lexical-only.
One line:
(no Node? curl -fsSL https://raw.githubusercontent.com/VineetV2/peon-mem/main/install.sh | bash)
The guided setup asks four things:
- Where your global brain lives (default:
~/Library/Application Support/Peon) - Which LLM: OpenRouter (one key, any model) · OpenAI · Anthropic · Ollama (100% local & free) · or skip
- Installs the daemon as an auto-start service (launchd on macOS, systemd user unit on Linux)
- Detects your AI apps and wires the MCP server (plus hooks for Claude Code) into the
ones you pick. Auto-configured: Claude Code, Claude Desktop, Codex, Gemini CLI, Cursor,
Windsurf, Cline, VS Code (Copilot MCP), Zed, LM Studio. Detected with in-app instructions: ChatGPT
Desktop, Perplexity Desktop. Every touched config gets a
.peon-backup.
That builds the package, starts the daemon as a service, wires your Claude Code hooks + MCP
server (with a backup of your settings), and writes a config template. Then add your key to
~/Library/Application Support/Peon/.env and open the monitor. peon-mem install --dry-run
shows every action first; peon-mem uninstall reverses it (memory data is never touched).
Or manually:
Create .env in the repo root:
Start the daemon (the installer prints a launchd/systemd recipe, or just):
Then wire your agent (the installer prints these filled in for your paths):
- Claude Code: add the hook to
~/.claude/settings.json(SessionStart / UserPromptSubmit / SessionEnd →scripts/claude-peon-hook.mjs) and the MCP server (dist/index.js). - Codex / any MCP client: register
dist/index.jsas a stdio MCP server; 16 tools (start_session,get_context,search_memory,record_message,process_memory, …).
Open http://127.0.0.1:3737/monitor and watch your brain grow.
How it works
- Record. Hooks stream messages, events, and tool calls into
<project>/.peon/raw/(append-only). - Consolidate. Past a size gate, an LLM turns the session delta into typed belief records
in
.peon/brain/memories.jsonl(importance/confidence scores, entities, provenance pointers), reconciling against existing beliefs: supersede, merge, conflict-flag. Recoverable, never deleted. - Retrieve + inject. On every prompt, beliefs are ranked (RRF lexical+semantic, MMR, reinforcement) and injected alongside episodic verbatim matches and inherited global beliefs.
- Self-curate. A background brain pass reinforces recalled beliefs, compresses stale clusters, and resolves duplicates. Every action is logged and undoable.
- Self-audit (STL). A daily job reports what was recorded, what was injected, what went wrong, and whether consolidation behaved, with serve-latency telemetry and a health verdict.
Full install (copy-paste)
1. Daemon (always-on, macOS launchd)
Or manually — ~/Library/LaunchAgents/com.peon.daemon.plist:
Linux: the installer writes ~/.config/systemd/user/peon-mem.service and enables it. Manual
equivalent: systemctl --user enable --now peon-mem.service, plus loginctl enable-linger $USER
so it survives logout. (Linux support is young — issue #1 tracks real-machine reports.)
2. Claude Code — hooks (auto capture + injection)
Merge into ~/.claude/settings.json (replace the path):
3. Claude Code — MCP server (search/inspect tools)
4. Codex / any MCP client
~/.codex/config.toml:
Codex has no hooks, so add usage rules to ~/.codex/AGENTS.md telling it to call
start_session + get_context at session start and record_message for durable facts
(example block in docs/).
5. Verify
Start a Claude Code session in any project, say something decision-shaped, and end the session. Within a minute the monitor shows the belief. The next session injects it.
MCP tools exposed
start_session · record_message · record_event · end_session · get_context ·
search_memory · inspect_brain · build_injection · query_projects (cross-project search) ·
quality_report · remember_global · search_global_memory · import_global_memory ·
evaluate_project · process_memory · maybe_process_memory
Uninstall
Troubleshooting / FAQ
- No injection appearing?
curl http://127.0.0.1:3737/health; check the hook is registered (run any prompt inclaude, then look at the monitor's Systems page for the request). - 431 errors on huge prompts? Handled. The hook caps the retrieval query at 2k chars.
- No OpenRouter key? Everything still runs; retrieval is lexical + episodic only
(semantic ranking and consolidation need a model).
PEON_EMBEDDING_MODE=ollamaworks too. - Cost? Consolidation is gated (default: fires per ~6k new chars, around cents/day with flash-lite). Query embeddings are cached to disk, so repeats are free.
- Multiple machines? Brains are plain files in your repos. Commit
.peon/if you want memory to travel (redact first: the raw layer contains session text). - Is my data sent anywhere? Only consolidation/embedding calls to your configured model provider. No telemetry, no cloud store. The daemon rejects non-loopback callers.
Configuration (env)
Project brains
- A brain lives in
<project>/.peon/as human-readable JSONL and markdown. Commit it or ignore it; your choice (.gitignoreships ignoring it). .peon/rootmarks a brain boundary. New brains are born rooted, so a parent directory can never swallow a project's memory.- The global brain lives in
~/Library/Application Support/Peon/global/(macOS).
Using Peon with NO AI at all
Some people want a memory system that never calls a model: no API keys, no local LLM, no
embeddings. Peon supports that. Pick skip in the install wizard, or set two env vars in
<memory-home>/.env:
The pipeline looks like this without a model. Hooks still capture everything you do into
<project>/.peon/raw/ as plain JSONL. As each event arrives, rule-based extraction files it
into readable brain files: a line that starts with "we decided" or "always use" lands in
decisions.md, preferences land in preferences.md, file paths land in artifacts.md. No
model reads it; it's pattern matching, and you can open the files to see exactly what it
caught. At your next session start, the hook asks the daemon for context, the daemon ranks
those records by keyword match, recency, and importance, and injects the best ones into your
prompt. The only step that disappears entirely is consolidation, the nightly LLM pass that
compresses raw history into deduplicated beliefs. Without it your memory is a well-indexed
journal instead of a distilled one. Search still finds things; nothing summarizes them.
What still works (all of it deterministic code, no model anywhere):
- Capture. Hooks record every prompt, tool call, and session event to plain JSONL in
<project>/.peon/raw/. - Real-time brain files. Decisions, preferences, open questions, and artifacts are written
live to readable
.mdfiles by rule-based extraction as events arrive. - Injection. Session-start context comes from those real-time files, query-focused and budgeted, same as always.
- Search. Lexical retrieval (RRF over keyword rank, recency, importance, and type priors). No embeddings needed. This is the same degrade path the semantic stack falls back to, so it gets exercised constantly.
- Episodic recall. Verbatim what-was-said lookup is lexical by design, so it is unaffected.
- Monitor UI, token tracking, cross-project search, backups. All model-free.
What you give up: consolidation (raw events are never distilled into deduplicated beliefs, so memory grows as an append-only journal), semantic search (paraphrased queries need shared keywords), automatic entity extraction, and stale-shadow demotion (it compares embeddings).
Two escape hatches if you want curation without external AI:
process_memoryaccepts a pre-builtaiResult. The coding agent you already run (Claude Code, Codex) can do the distillation itself in-session and hand Peon the structured result. Memory stays curated, and Peon itself never spends a token.- Everything is plain JSONL/Markdown on disk. You can edit beliefs by hand or through the monitor's memory endpoints, and Peon backs up before every mutation.
Measured: does memory actually save tokens?
A/B test with real claude -p sessions: one question per session, same repo, same model.
ON means Peon hooks active (memory injected at session start). OFF means PEON_DISABLED=1,
so the agent falls back to reading files. 20 questions across procedures, past results,
decisions, and current-state facts; 15 clean ON/OFF pairs survived tooling issues. Token
counts come from Claude Code's own session transcripts.
Answer quality, graded against repo ground truth: 8 ties, 1 clear Peon win, 5 baseline wins, 1 where both were weak. The Peon win is the interesting one. A rule that was only ever stated in a conversation (a professor's citation policy, from an email) got "no such rule found" from the baseline; Peon recited it exactly. Conversation-borne knowledge has no file to grep.
Honest caveats: the test repo has unusually good docs (a maintained research log), which makes the baseline strong, and most repos aren't like that. n=15 is small. Questions were picked to have known answers, not sampled from real usage. The test also exposed two real bugs in Peon itself: a stale superseded belief outranking the newer truth, and token rows getting lost when consolidation outlived the hook timeout. Both are fixed (stale-shadow demotion at retrieval; usage logged before consolidation).
Honesty section
Peon's development is eval-gated and keeps its negative results. An associative entity graph
was built, measured (−2.9% Recall@10), and turned OFF by default. Consolidation is lossy by
design; that's why the episodic layer exists and is regression-tested. The eval harness and
committed ledger (npm run eval) let you verify retrieval changes on your own brain.
Security
- The daemon binds
127.0.0.1only and rejects non-loopbackHost/Originheaders (DNS-rebinding defense). - Secrets (API keys, tokens, JWTs) are redacted at the injection boundary.
- Path traversal is guarded. Writes use per-project locks and atomic tmp+rename, with automatic backups before anything destructive-adjacent. Nothing is hard-deleted.
License
MIT © Vineet Vora
Contributing — I'd love your help
Peon is built and maintained by one person, and I'm open to help making it better. Issues, PRs, ideas, criticism of the architecture, or just telling me where it broke on your machine: all of it is useful.
Where help would matter most right now:
- Windows & Linux support. The daemon install is macOS launchd today. The systemd and Task Scheduler equivalents need real users to test them.
- More agent integrations. The wizard covers 11 apps, but hooks-level capture (like the Claude Code integration) for Codex, Cursor, and others would make memory richer everywhere.
- Retrieval quality. The eval harness (
npm run eval) makes experiments cheap: better consolidation prompts, smarter staleness handling, local embedding models worth defaulting to. - Benchmarks. Run the token A/B on your repo and share the numbers, especially where Peon loses. Negative results are first-class here.
- Docs and onboarding. If the README or the wizard confused you, that confusion is a bug report.
Open an issue at github.com/VineetV2/peon-mem/issues or send a PR directly.
Rules of the house: every retrieval/quality change ships with a test and an eval-ledger run
(npm run eval); negative results get documented, not deleted; nothing may hard-delete user
memory. npm test must stay green.
If Peon is useful to you, ★ star it on GitHub — it is how other people building with coding agents find it.
來源:README.md,提交 8858bb4
工具
0版本歷史
1- v1.0.9最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分