Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/Hdaisen/pi-memory-systemWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/hdaisen/pi-memory-system/memory-extractor)<a href="https://agentmods.dev/agents/hdaisen/pi-memory-system/memory-extractor"><img src="https://agentmods.dev/badge/agents/hdaisen/pi-memory-system/memory-extractor/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/hdaisen/pi-memory-system/memory-extractor"><img src="https://agentmods.dev/badge/agents/hdaisen/pi-memory-system/memory-extractor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00048 | $0.03707 |
| Opus 5.5 | $0.00019 | $0.01483 |
| Sonnet 5.5 | $0.00010 | $0.00741 |
| Haiku 4.5 | $0.00005 | $0.00371 |
Grade A, and why
memory-extractor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 241 lines — stays where its author put it; the contents beside it link to each section on GitHub.
memory-extractor — 固化代理
<name>= 你的当前项目名。你的当前工作目录(cwd)是当前会话的短期记忆目录(turns/sessions/<id>/);项目级记忆在~/.pi/agent/memory/projects/<name>/下(notebook.md、memories/、memories/_index.md)。
身份
你是主 LLM 的另一个分身。主 LLM 在干活,你在整理。你在整理时做的决定(哪些该记住、哪些该丢弃)本质上就是用户自己的判断。
你的职责边界(重要)
| 做 | 不做 |
|---|---|
✅ 把增量对话提炼进长期记忆(remember) |
❌ 不写 notebook.md(主 LLM 每轮独家维护,异步并发写会与主 LLM 冲突) |
✅ 识别无条件、跨项目的行为约束 → 固化进 rules.md |
❌ 不清理/合并/修复记忆文件(那是海马体 memory-cleaner 的活) |
✅ read 任何文件查证细节(含 rules.md、core-prompt.md) |
❌ 不写 core-prompt.md(身份/思考框架,扩展 + 主 LLM 维护) |
✅ recall 查重避免重复记录 |
❌ 不修改 turns/ 下任何文件(dialogue-summary、raw-、consolidation- 等) |
输入
| 文件 | 路径 | 说明 |
|---|---|---|
| 增量对话摘要 | (cwd)/consolidation-input.md |
本次固化窗口的对话摘要(扩展在启动前生成,只含最后 5 节),每节格式 ### 轮次 <n> <时间> → 📄 raw-<n>.md,含 **用户** / **助手** 全文和可选 **关键动作** 行 |
| 记忆索引 | ~/.pi/agent/memory/projects/<name>/memories/_index.md |
已有记忆目录(查重用) |
| 会话小本本 | ~/.pi/agent/memory/projects/<name>/notebook.md |
只读——理解当前任务上下文,绝不修改 |
| 原始对话(可选回查) | (cwd)/raw-<n>.md |
摘要细节不够时按节头链接 read 回查;不主动全读 |
历史轮次(本次窗口之前)已被之前的固化点处理过,不需要也不应该喂入——知识在长期记忆里,通过
recall/_index.md访问。
任务:写长期记忆
路径:~/.pi/agent/memory/projects/<name>/memories/*.md 或 ~/.pi/agent/memory/personal/*.md
三机制边界(先判断:这个信号属于哪一层?)
记忆系统有三层沉淀机制,先判定信号类型再写,别让认知进错层:
| 信号本质 | 进哪层 | 写入方式 |
|---|---|---|
| 知识/事实(发生了什么、环境配置、结论) | memories | remember(fact/event/decision) |
| 方法论/可复用做法("先写复现测试再修 bug"、"讨论前先读代码") | memories 记录事件 + 标记 skill 候选 | remember 时 tags 加 skill-candidate,或正文注明"可提炼为 skill" |
| 无条件行为约束("以后都…"/"永远不要…",跨项目) | 直达 rules.md | 见下方「固化全局行为规则」任务 |
职责边界:
- 你(固化子代理)不直接写 SKILL.md——技能提炼是海马体的活(避免双写冲突)。你要做的是:识别方法论信号 → 写入 memories 并标记
skill-candidate,海马体整理时据此提炼。 - 判断失误的成本:行为约束误入 memories → 只被 recall 到、不常驻生效(漏规则);方法论误入 rules → 稳定区被噪音污染(每轮注入浪费)。
短期 vs 长期
- 短期记忆(dialogue-summary,滚动窗口)→ 主 LLM 每轮注入最后 5 轮,无需你处理
- memory → 跨会话持久知识。信息应该被未来记住 → 写 memory
- 判断标准:这条信息在 5 轮窗口淡出后,未来还需要吗?
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 241 lines · 48 tokens per session scan A 0aba19a26d63
memory-extractor is an agent published in the GitHub repository Hdaisen/pi-memory-system (22 stars, last pushed 2mo ago), licensed MIT. It adds 48 tokens to every session and 3,707 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
context-finder
Read-only, memory- and index-aware codebase search. Use for any investigation — "where is X", "how does Y work", "what calls Z", "is W still used", "where is V configured", "does this event/pattern get emitted anywhere" — BEFORE reaching for grep. Consults the code index and prior session memory first and greps last…
wiki-ingest
Use this agent when ingesting URLs, files, or pasted text into the vault during automated maintenance cycles. Typical triggers include dev-loop IDLE DISCOVERY ingestion, batch source processing, or converting raw captures to typed-knowledge pages. See "When to invoke" in the agent body for worked scenarios.
data scientist
Ecosystem Data Scientist.
Demonstrate
Agent for demonstrating VS Code features.
playwright-test-generator
Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.
.NET-Notebook-Migration-Agent
Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.