memory-3layer

memory-3layer is a skill for Claude Code from KimYx0207/Kim_Service. It costs 115 tokens per session (2,420 once invoked), scanned A, original, MIT.

A project memory system with three layers: structured facts, dated work notes, and manually confirmed long-term knowledge. It is designed to share useful context across coding-agent sessions.

In plain words
What is it for?
Use it to load project context, save confirmed reusable facts, record daily progress, migrate older Claude memory, or review and clean outdated entries.
Why use it?
It prevents important project rules and decisions from being lost between sessions while keeping old facts traceable.

Skill for Claude Code

Written for Claude Code: PreCompact hook event. Also seen: reads .claude/ paths; mentions Claude Code; mentions Codex.

Good fit Use it to load project context, save confirmed reusable facts, record daily progress, migrate older Claude memory, or review and clean outdated entries.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kimyx0207/kim_service/memory-3layer
Install

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.

Any agent
npx skills add KimYx0207/Kim_Service --skill memory-3layer
Clone the repo
git clone --depth 1 https://github.com/KimYx0207/Kim_Service

Made for: Claude Code.

Wrote 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.

agentmods badge for memory-3layer

README.md
[![agentmods](https://agentmods.dev/badge/skills/kimyx0207/kim_service/memory-3layer/github.svg)](https://agentmods.dev/skills/kimyx0207/kim_service/memory-3layer)
Your own site
<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.

agentmods 80×15 button for memory-3layer

Your own site · 80×15
<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>
Per session 115 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,420 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 9d ago against content hash 0b1fa9241dc0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

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.

The scan reads SKILL.md. This mod also ships 16 executable files (evals/test_install_memory_3layer.py, evals/test_migrate_legacy_memory.py, evals/test_recording.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

skills/memory-3layer/SKILL.md · 134 lines

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 项目用当前工作目录。
  • 当前运行平台:claudecodexmanual
  • 用户明确要求记住的内容,或宿主 Hook 提供的事件负载。
  • 可选环境变量:MEMORY_DIRMEMORY_MAX_ITEMSMEMORY_DAILY_DAYSMEMORY_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 三层结果 所需层级都有证据 只通过静态校验时只能称“配置完成”,不能称“自动运行已验证”

Read the full file on GitHub · 134 lines

Changes

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.

  1. 9d ago First seen · 134 lines · 115 tokens per session scan A 0b1fa9241dc0

Subscribe to this mod's changes

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.

Related

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.

garrytan/gbrain · 52 tokens

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.…

mem0ai/mem0 · 273 tokens

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…

danielmiessler/LifeOS · 196 tokens

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.

opensquilla/opensquilla · 44 tokens

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…

shiwenwen/hope-agent · 115 tokens

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.

GanyuanRan/Aegis · 45 tokens