memory-system

memory-system is a skill for Claude Code, Codex from kangarooking/system-prompt-skills. It costs 166 tokens per session (2,515 once invoked), scanned A, original, MIT.

Design guidance for giving an AI a persistent memory system. It covers storing, finding, using, changing, and deleting information such as user preferences and project knowledge.

In plain words
What is it for?
Use it when designing memory storage, retrieval, updates, privacy boundaries, or quiet use of remembered information.
Why use it?
It helps an AI retain useful context across conversations while avoiding irrelevant or sensitive memories.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Claude Code; mentions Gemini CLI.

Good fit Use it when designing memory storage, retrieval, updates, privacy boundaries, or quiet use of remembered information.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kangarooking/system-prompt-skills/memory-system
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 kangarooking/system-prompt-skills --skill memory-system
Clone the repo
git clone --depth 1 https://github.com/kangarooking/system-prompt-skills

Made for: Claude Code, Codex.

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-system

README.md
[![agentmods](https://agentmods.dev/badge/skills/kangarooking/system-prompt-skills/memory-system.svg)](https://agentmods.dev/skills/kangarooking/system-prompt-skills/memory-system)
Your own site
<a href="https://agentmods.dev/skills/kangarooking/system-prompt-skills/memory-system"><img src="https://agentmods.dev/badge/skills/kangarooking/system-prompt-skills/memory-system.svg" alt="Measured on agentmods" height="20"></a>
Per session 166 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,515 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.
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.00166 $0.02515
Opus 5 $0.00083 $0.01257
Sonnet 5 $0.00033 $0.00503
Haiku 4.5 $0.00017 $0.00251

Measured 8d ago against content hash 8e7c88f4aefd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

memory-system 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 8d 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.

memory-system/SKILL.md · 117 lines

How it starts

The opening of the file, as written. The whole thing — 117 lines — stays where its author put it; the contents beside it link to each section on GitHub.

记忆与个性化架构 (Memory System)

R — 原文 (Reading)

Claude Web: userMemories 注入 + memory_user_edits tool + 选择性应用规则 + 静默归因 + 边界示例 Claude Code: File-based persistent memory with typed memories (user, feedback, project, reference) + MEMORY.md index Claude Opus 4.7: "NEVER reference sensitive memories in unrelated contexts" + bad example (proactively mentioning deceased pet) GPT-4o/GPT-4.5: bio tool for persistence + sensitive data prohibition FlintK12: Pedagogical memory (interests, preferences, grade level) + mandatory create_memory call Gemini CLI: save_memory tool + GEMINI.md files for project context

I — 方法论骨架 (Interpretation)

记忆系统的核心设计模式围绕"生命周期管理"和"边界控制"两个轴展开:

记忆生命周期 (CRUL 模型):

  1. Create (创建): 决定何时创建记忆。FlintK12 采用"强制创建"策略(mandatory create_memory call),确保关键教学信息不被遗漏。Claude Web 采用"选择性创建"——只在用户明确表达偏好时创建。
  2. Retrieve (检索): 在每轮对话开始时,将相关记忆注入 context window。关键设计决策是"注入多少"和"注入什么"——全部注入会消耗上下文窗口,选择性注入需要相关性判断。
  3. Apply (应用): 静默地应用记忆内容来调整回复,而不在回复中显式引用。Claude Opus 4.7 的反面教材极为重要:如果用户曾提到宠物去世,AI 不应在无关对话中主动提及。
  4. Update (更新): 允许用户编辑或删除已存储的记忆。Claude Web 的 memory_user_edits 工具和 Claude Code 的 typed memory 系统都支持这一能力。

类型化记忆 (Typed Memory): Claude Code 将记忆分为四类:user(用户偏好)、feedback(交互反馈)、project(项目上下文)、reference(参考文档)。不同类型有不同的存储策略、检索优先级和应用规则。

边界控制: 记忆系统最大的风险不是"记不住",而是"在不该记住的时候记住了"或"在不该引用的时候引用了"。

A1 — 案例分析 (Past Application)

案例 1: Claude Web 的静默记忆应用

  • 问题: 如何让 AI 利用用户记忆但不让对话变得尴尬或侵犯隐私?
  • 设计模式的使用: Claude Web 实现了"静默归因"策略——记忆被注入 context 后,AI 在回复中不应透露"根据我的记忆"或"我记得你说过"等表述。配合边界示例(如"不要在无关上下文中提及用户已故宠物"),确保记忆应用既有效又不突兀。
  • 结论: 记忆系统的用户体验质量取决于"隐性应用"而非"显性提及"。

案例 2: Claude Code 的文件型持久记忆

  • 问题: 编程 agent 如何在长项目中保持上下文连贯性?
  • 设计模式的使用: 采用文件型持久记忆,将记忆存储为 typed 文件(user/feedback/project/reference),并使用 MEMORY.md 作为索引文件。每次会话开始时通过读取 MEMORY.md 恢复项目上下文。这种方式比数据库存储更透明、更可编辑、更易于版本控制。
  • 结论: 在专业工具场景中,记忆的透明性和可编辑性比自动化程度更重要。

案例 3: FlintK12 的教学记忆强制创建

  • 问题: AI 如何在有限的对话轮次中积累足够的学生画像以实现个性化教学?
  • 设计模式的使用: 实现 mandatory create_memory call——在每次教学交互中,AI 必须调用记忆创建工具记录学生的兴趣、理解水平和学习偏好。Pedagogical memory 存储兴趣、偏好、年级等信息,用于后续教学内容的个性化适配。
  • 结论: 在高价值场景中(教育效果直接取决于个性化程度),强制创建记忆优于等待显式触发。

Read the full file on GitHub · 117 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. 8d ago First seen · 117 lines · 166 tokens per session scan A 8e7c88f4aefd

Subscribe to this mod's changes

memory-system is a skill published in the GitHub repository kangarooking/system-prompt-skills (182 stars, last pushed 4mo ago), licensed MIT. It adds 166 tokens to every session and 2,515 once invoked, about $0.0008 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.