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.
npx skills add KimYx0207/Kim_Service --skill memory-3layergit clone --depth 1 https://github.com/KimYx0207/Kim_ServiceWrote 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/skills/kimyx0207/kim_service/memory-3layer)<a href="https://agentmods.dev/skills/kimyx0207/kim_service/memory-3layer"><img src="https://agentmods.dev/badge/skills/kimyx0207/kim_service/memory-3layer/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/skills/kimyx0207/kim_service/memory-3layer"><img src="https://agentmods.dev/badge/skills/kimyx0207/kim_service/memory-3layer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.00115 | $0.02420 |
| Opus 5 | $0.00057 | $0.01210 |
| Sonnet 5 | $0.00023 | $0.00484 |
| Haiku 4.5 | $0.00012 | $0.00242 |
Grade A, and why
memory-3layer 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 9d 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 — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.
三层记忆
把会影响后续工作的知识保存为可检查、可迁移、可控制生命周期的项目资产。默认数据目录是项目根目录下的 .memory-3layer/;MEMORY_DIR 可以显式覆盖。
目标合同
为正在进行长期项目、会跨会话切换 Agent 的用户,生成一套人和 Agent 都能检查的三层记忆,并满足以下可观察标准:
- Layer 1 在
areas/topics/<topic>/items.json保存带状态的结构化事实。 - Layer 2 在
memory/YYYY-MM-DD.md保存按日期追加的工作轨迹。 - Layer 3 在
MEMORY.md保存人工确认的长期隐性知识。 - 新会话只加载受预算约束的 active 内容,不把整个历史塞进上下文。
- 旧知识可标记为
superseded,不靠删除历史来制造“最新事实”。 - Claude Code 与 Codex 的自动化都调用同一 Python 核心;其他平台不伪装成自动支持。
触发与非触发
使用本技能:
- 用户要求“记住这条规则”“下次继续”“跨会话保存”“查看/清理项目记忆”。
- 项目已有
.memory-3layer/,当前任务需要读取其中的长期上下文。 - 项目仍有
.claude/memory/,用户要迁移到平台中立目录。 - 需要为 Claude Code 或 Codex 接入三层记忆生命周期。
不要使用:
- 只需写一次性日志、缓存、构建输出或完整会话转储。
- 内容包含口令、令牌、私钥、支付信息、未脱敏个人数据或不应进入版本库的材料。
- 用户只想使用宿主自己的私有记忆,且不需要项目级共享与生命周期管理。
第一动作
在写入前先确认五项事实:项目根目录、当前宿主、.memory-3layer/ 是否存在、legacy .claude/memory/ 是否存在、当前任务是否授权写入。无法确认项目根目录或写入权限时,只报告发现,不创建或迁移文件。
输入与输出
输入:
- 项目根目录;默认当前 Git 根,非 Git 项目用当前工作目录。
- 当前运行平台:
claude、codex或manual。 - 用户明确要求记住的内容,或宿主 Hook 提供的事件负载。
- 可选环境变量:
MEMORY_DIR、MEMORY_MAX_ITEMS、MEMORY_DAILY_DAYS、MEMORY_TOPICS。
输出:
.memory-3layer/中变更后的三层记忆文件。- 本次动作摘要:读取了什么、写入了什么、跳过了什么、下一步是什么。
- 失败时给出具体失败路线,不把“Hook 已配置”说成“Hook 已运行”。
执行步骤合同
| 步骤 | 输入 | 动作 | 可观察输出 | 转移条件 | 失败路线 |
|---|---|---|---|---|---|
| 1. 定位 | cwd、Git 状态、宿主标识 | 确定项目根、运行平台、数据目录与写权限 | 输出四项定位结果 | 路径唯一且权限符合任务 | 路径不唯一则询问;无写权限则切换只读状态检查 |
| 2. 初始化或迁移 | 当前目录、legacy 目录、用户授权 | 新项目初始化 .memory-3layer/;legacy 仅在显式迁移时复制并校验,默认不覆盖 |
标准目录存在;迁移报告列出 copied/skipped/conflict | 结构校验通过 | 冲突或目标非空时停止,不删除源目录,转人工处理 |
| 3. 加载 | active facts、近期日记、MEMORY.md、预算参数 |
按 Layer 3 → Layer 2 → Layer 1 组装受限上下文 | loader 返回可读上下文和条目计数 | 输出未超预算且来源可追溯 | 文件损坏时跳过坏文件并报告;不得静默重写 |
| 4. 记录 | 用户明确记忆、受确认的记忆协议、现有条目 | 调用 scripts/record_memory.py,脱敏、分类、去重后追加 Layer 1/2;只把人工确认的长期结论提升到 Layer 3 |
文件 diff 显示新增或去重跳过 | 每条记录有来源、日期与状态 | 普通工具输出不自动持久化;内容含秘密、来源不明或只是推测时拒绝并说明原因 |
| 5. 会话保护 | PreCompact/等价事件或手动请求 | 保存最小可恢复状态,不保存完整聊天记录 | session state 可解析并含时间与摘要 | 写入原子完成 | 无对应事件的宿主降级为手动保存,不声称自动恢复 |
| 6. 复查 | 三层文件、日期、status | 识别重复、冲突、过时条目,提出 active → superseded 建议 | review 报告与逐项建议 | 用户确认后再改状态 | 无法判断新旧时保持原状并标记待确认 |
| 7. 验证 | 包文件、临时项目、宿主配置 | 运行包校验与目标平台测试;检查 Hook 是否实际触发 | 分别报告 artifact、adapter、runtime 三层结果 | 所需层级都有证据 | 只通过静态校验时只能称“配置完成”,不能称“自动运行已验证” |
What ships with it
36 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- CHANGELOG.md 1.1 KB
- commands/memory-review.md 920 B
- commands/memory-status.md 909 B
- docs/architecture.md 1.9 KB
- docs/images/alipay.jpg 163 KB
- docs/images/contact-qr.png 825 KB
- docs/images/wechat-pay.jpg 70 KB
- docs/platform-support.md 963 B
- docs/quickstart.md 2.3 KB
- evals/test_install_memory_3layer.py 13 KB runs code
- evals/test_migrate_legacy_memory.py 9.6 KB runs code
- evals/test_recording.py 5.5 KB runs code
- examples/manual-workflow.md 1.1 KB
- hooks/hook_io.py 1.8 KB runs code
- hooks/memory_extractor.py 9.9 KB runs code
- hooks/memory_loader.py 5.5 KB runs code
- hooks/memory_paths.py 4.7 KB runs code
- hooks/memory_store.py 2.2 KB runs code
- hooks/pre_compact.py 1.2 KB runs code
- hooks/session_state.py 3.3 KB runs code
- install.ps1 936 B runs code
- install.sh 1.4 KB runs code
- LICENSE 1.0 KB
- NOTICE 491 B
- README_CN.md 5.5 KB
- README.md 5.6 KB
- references/migration.md 1.6 KB
- references/operating-contract.md 3.1 KB
- references/runtime-adapters.md 3.0 KB
- scripts/check_memory_3layer.py 7.8 KB runs code
- scripts/install_memory_3layer.py 23 KB runs code
- scripts/migrate_legacy_memory.py 10 KB runs code
- scripts/record_memory.py 2.1 KB runs code
- templates/items.json 3 B
- templates/MEMORY.md 272 B
- templates/session_state.json 3 B
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.
- 9d ago First seen · 134 lines · 115 tokens per session scan A 0b1fa9241dc0
memory-3layer is a skill published in the GitHub repository KimYx0207/Kim_Service (169 stars, last pushed 27d ago), licensed MIT. It adds 115 tokens to every session and 2,420 once invoked, about $0.0006 per session on Opus 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 skills, from other repositories
media-ingest
Ingest video, audio, PDF, book, screenshot, and GitHub repo content into the brain. Multi-format handling with entity extraction and backlink propagation. Covers video-ingest, youtube-ingest, and book-ingest subtypes.
mem0-oss-to-platform
Plan and then execute a migration of a project from the mem0 open-source / self-hosted SDK (the local Memory class) to the mem0 Platform / hosted / managed SDK (the MemoryClient class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS/self-hosted to the hosted API — e.g.…
Cortex
Operate Cortex, the LifeOS memory system — the typed Knowledge Archive (People, Companies, Ideas, Research with typed related: links) plus recall of prior work sessions, ISAs, and conversations. Search, add, harvest, develop, ingest, distill, graph-navigate, recall. USE WHEN cortex, knowledge, knowledge base, search…
memory
Use when the user asks to remember, recall, forget, update, search, or inspect durable OpenSquilla memory, including profile facts in USER.md and long-term notes in MEMORY.md or memory//.md.
ha-data-stores
Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…
establishing-project-context
Use when the user asks to establish shared project language, or project work exposes a conflicting, renamed, or deprecated domain term that needs active semantic modeling. Routine small tasks stay on the fast path.