Agent skill

Memory System

by kangarooking in kangarooking/system-prompt-skills

当需要为 AI 设计记忆存储、检索、应用和更新机制时调用此 skill。典型场景包括:设计持久化记忆架构(用户偏好、历史上下文、项目知识)、定义记忆的创建/读取/更新/删除生命周期、实现静默记忆应用(不在回复中透露记忆内容)、管理敏感记忆边界。

MITAuto-check passedAI & LLM Engineering

Install Memory System

skills CLI
$ npx skills add kangarooking/system-prompt-skills --skill memory-system -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install kangarooking/system-prompt-skills memory-system --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/kangarooking/system-prompt-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/memory-system .claude/skills/memory-system && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
memory-system
GitHub stars
205
Token cost
~1.2k tokens
SKILL.md length
326 words
Files
1
Skills in repo
15
Repo updated
First seen
Licence
MIT

At a glance

当需要为 AI 设计记忆存储、检索、应用和更新机制时调用此 skill。典型场景包括:设计持久化记忆架构(用户偏好、历史上下文、项目知识)、定义记忆的创建/读取/更新/删除生命周期、实现静默记忆应用(不在回复中透露记忆内容)、管理敏感记忆边界。

  • Works in 4 steps: Create (创建): 决定何时创建记忆。FlintK12… → Retrieve (检索): 在每轮对话开始时,将相关记忆注入 context… → Apply (应用):… → …
  • 信号:AI 需要跨会话记住用户信息、记忆内容可能敏感、需要在回复中隐式应用记忆而非显式引用、用户要求记住这个
  • SKILL.md covers R — 原文 (Reading), I — 方法论骨架 (Interpretation), A1 — 案例分析 (Past Application) and A2 — 触发场景 (Future Trigger) ★, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Memory System is an agent skill from kangarooking/system-prompt-skills. 当需要为 AI 设计记忆存储、检索、应用和更新机制时调用此 skill。典型场景包括:设计持久化记忆架构(用户偏好、历史上下文、项目知识)、定义记忆的创建/读取/更新/删除生命周期、实现静默记忆应用(不在回复中透露记忆内容)、管理敏感记忆边界。 不适用于:定义工具接口(tool-specification)、定义安全规则(safety-guardrails)、定义人格风格(personality-system)。 关键 trigger 信号:AI 需要跨会话记住用户信息、记忆内容可能敏感、需要在回复中隐式应用记忆而非显式引用、用户要求"记住这个"。

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering. The repository describes itself as: 从 165 个顶级 AI 产品系统提示词中蒸馏出的 15 个可执行 Agent skill. The licence is MIT.

When your agent uses it

  • 信号:AI 需要跨会话记住用户信息、记忆内容可能敏感、需要在回复中隐式应用记忆而非显式引用、用户要求记住这个

Example prompts

  • “/memory-system”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  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 系统都支持这一能力。

What it can do on your machine

Read from SKILL.md and the folder at commit 252cd52. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Memory System loads about 1.2k tokens when it runs. Until then it costs about 73 tokens; SKILL.md has 326 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~73
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from kangarooking/system-prompt-skills at commit 252cd52, republished under its MIT licence (© kangarooking). 326 words, ~1,152 tokens.

Download SKILL.mdSave it as .claude/skills/memory-system/SKILL.md (or your agent's skills folder).
name
memory-system
description
当需要为 AI 设计记忆存储、检索、应用和更新机制时调用此 skill。典型场景包括:设计持久化记忆架构(用户偏好、历史上下文、项目知识)、定义记忆的创建/读取/更新/删除生命周期、实现静默记忆应用(不在回复中透露记忆内容)、管理敏感记忆边界。 不适用于:定义工具接口(tool-specification)、定义安全规则(safety-guardrails)、定义人格风格(personality-system)。 关键 trigger 信号:AI 需要跨会话记住用户信息、记忆内容可能敏感、需要在回复中隐式应用记忆而非显式引用、用户要求"记住这个"。
tags
memory, personalization, persistence, context-management
related_skills
persona-design, safety-guardrails

记忆与个性化架构 (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 存储兴趣、偏好、年级等信息,用于后续教学内容的个性化适配。
  • 结论: 在高价值场景中(教育效果直接取决于个性化程度),强制创建记忆优于等待显式触发。

A2 — 触发场景 (Future Trigger) ★

用户会在什么情境下需要这个 skill?
  1. AI 需要跨会话记住用户偏好、历史或上下文
  2. 产品需要"个性化"体验但不确定如何实现记忆架构
  3. 记忆内容可能包含敏感信息,需要设计访问控制
  4. AI 在回复中暴露了不该暴露的记忆内容
  5. 需要决定记忆的存储方式(文件、数据库、向量存储)
语言信号
  • "AI 需要记住用户的偏好"
  • "跨会话保持上下文"
  • "用户说'记住这个'时该怎么处理"
  • "记忆中包含敏感信息"
  • "如何设计个性化推荐"
与相邻 skill 的区分
  • 与 persona-design 的区别: persona-design 定义"AI 是谁"(静态身份),memory-system 定义"AI 知道用户什么"(动态信息)。身份不变,记忆不断积累。
  • 与 safety-guardrails 的区别: safety-guardrails 约束 AI 的行为边界,memory-system 中敏感记忆的处理需要 safety-guardrails 的支持,但记忆系统本身是数据管理而非行为约束。
  • 与 personality-system 的区别: personality-system 定义可切换的风格叠加层,memory-system 存储用户的风格偏好(如"用户喜欢简洁回复"),这些偏好可以触发特定人格变体的选择。

E — 可执行步骤 (Execution)

  1. 步骤 1: 定义记忆类型体系

    • 识别产品需要记忆的信息类别:用户偏好、交互历史、项目上下文、领域知识等
    • 为每个类别定义创建触发条件、存储格式和过期策略
    • 完成标准: 每种记忆类型有明确的边界定义,不同类型之间不重叠
  2. 步骤 2: 设计创建机制

    • 确定创建策略:强制创建(FlintK12 模式,适合高价值场景)或选择性创建(Claude Web 模式,适合通用场景)
    • 定义创建触发器:显式触发("记住这个")+ 隐式触发(检测到偏好表达)
    • 完成标准: 创建机制在 95% 的情况下能正确判断是否需要创建记忆
  3. 步骤 3: 实现静默应用规则

    • 编写核心应用规则:记忆内容应隐性影响回复,不应显式引用
    • 编写反面教材:列出不应在回复中出现的行为(如"根据我的记忆"、"我记得你之前说过")
    • 完成标准: 用户在对话中感受不到"被记忆"的不适感,但能体验到个性化的便利
  4. 步骤 4: 设计边界控制

    • 定义敏感记忆类别(健康、财务、家庭变故等)并制定特殊处理规则
    • 实现跨上下文隔离:Claude Opus 4.7 的规则"绝不在无关上下文中引用敏感记忆"
    • 设计记忆编辑/删除机制,允许用户查看和管理已存储的记忆
    • 完成标准: 敏感记忆不会被错误引用,用户有完全的记忆控制权
  5. 步骤 5: 选择存储策略

    • 文件型存储(Claude Code 的 MEMORY.md):适合专业工具,透明可编辑
    • 结构化存储(Claude Web 的 userMemories):适合消费产品,高性能检索
    • 向量存储:适合大规模知识和语义检索场景
    • 完成标准: 存储策略与产品的记忆规模、检索需求和用户期望一致

B — 边界 (Boundary) ★

不要在以下情况使用此 skill
  • AI 产品不需要任何跨会话持久化(纯一次性对话)
  • 记忆需求实际上可以通过简单的 system prompt 配置解决(如"始终用中文回复")
  • 试图用记忆系统替代知识库或 RAG(记忆是用户相关的个性化数据,不是通用知识)
  • 没有设计记忆删除/编辑机制就上线记忆功能(这会严重损害用户信任)
常见失败模式
  • 记忆过度引用: AI 在回复中频繁使用"根据我的记忆"等表述,让用户感到被监视。应严格执行静默应用规则。
  • 敏感记忆泄露: 在无关对话中主动提及用户的敏感信息。Claude Opus 4.7 明确指出这是严重错误——如果用户提到宠物去世,AI 不应在后续关于"周末计划"的对话中说"考虑到你的宠物刚去世..."。
  • 记忆膨胀: 创建过多低价值记忆(如"用户使用了感叹号"),导致记忆存储膨胀且检索效率下降。应设置严格的创建门槛。
  • 记忆冲突: 存储了相互矛盾的记忆(如用户在不同时间表达了不同偏好),没有设计冲突解决策略。应采用"最新优先"或"显式覆盖"策略。
  • 忽略记忆透明性: 用户不知道 AI 记住了什么、无法查看或删除记忆。应提供记忆管理界面。

© kangarooking, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in memory-system of kangarooking/system-prompt-skills.

Open the folder on GitHubat commit 252cd52

Compare with similar skills

Memory System next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Memory System compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Memory System this skillkangarooking/system-prompt-skills205—~1.2kAutomated safety check: PassMIT
Agent BuildershareAI-lab/learn-claude-code78k6 repos~1.2kAutomated safety check: PassMIT
Add Uint Supportpytorch/pytorch104k2 repos~2.3kAutomated safety check: PassCustom licence
Peft Fine TuningOrchestra-Research/AI-Research-SKILLs13k9 repos~3.1kAutomated safety check: PassMIT
Segment Anything Model GuideOrchestra-Research/AI-Research-SKILLs13k9 repos~3.3kAutomated safety check: PassMIT
1passwordtrpc-group/trpc-agent-go1.8k13 repos~656Automated safety check: PassApache-2.0

Similar skills

  • Agent Builder

    shareAI-lab/learn-claude-code

    Design and build AI agents for any domain. An agent skill from shareAI-lab/learn-claude-code.

    78k GitHub starsUsed in 6 repos~1.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Add Uint Support

    pytorch/pytorch

    Add unsigned integer (uint) type support to PyTorch operators by updating ATDISPATCH macros.

    104k GitHub starsUsed in 2 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Peft Fine Tuning

    Orchestra-Research/AI-Research-SKILLs

    Parameter-efficient fine-tuning for LLMs using LoRA, QLoRA, and 25+ methods.

    13k GitHub starsUsed in 9 repos~3.1k tokens
    AI & LLM EngineeringAuto-check passed
  • Segment Anything Model Guide

    Orchestra-Research/AI-Research-SKILLs

    Guide to using Meta's Segment Anything Model for zero-shot image segmentation with point, box or mask prompts, or automatic mask generation.

    13k GitHub starsUsed in 9 repos~3.3k tokens
    AI & LLM EngineeringAuto-check passed
  • 1password

    trpc-group/trpc-agent-go

    Set up and use 1Password CLI (op). An agent skill from trpc-group/trpc-agent-go.

    1.8k GitHub starsUsed in 13 repos~656 tokens
    AI & LLM EngineeringAuto-check passed
  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 8 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed

More from kangarooking/system-prompt-skills

All 15 skills in this repo
  • Persona Design

    kangarooking/system-prompt-skills

    当需要为 AI 产品定义核心身份、角色声明和能力边界时调用此 skill。典型场景包括:设计新 AI 产品的 system prompt 首段、为不同场景创建差异化角色(如教学助手 vs 编程代理)、重新定义 AI 与用户的关系框架。

    205 GitHub starsUsed in 1 repo~956 tokens
    Auto-check passed
  • Tool Specification

    kangarooking/system-prompt-skills

    当需要为 AI 定义工具接口、设计调用规范、实现工具发现与编排机制时调用此 skill。典型场景包括:设计 AI agent 的工具集、定义 JSON Schema/XML/TypeScript 格式的工具描述、实现工具权限控制与并行调度、设计子代理委托架构。

    205 GitHub starsUsed in 1 repo~1.1k tokens
    Auto-check passed
  • Personality System

    kangarooking/system-prompt-skills

    当需要在基础身份之上叠加可切换的人格风格层时调用此 skill。典型场景包括:为同一产品提供多种人格选项(如 GPT-5.1 的 friendly/professional/quirky 模式)、设计人格切换机制、防止人格泄露到用户内容中。

    205 GitHub stars~1k tokensUpdated 5 mo ago
    Auto-check passed
  • Conversation Flow

    kangarooking/system-prompt-skills

    当系统提示词需要定义 AI 如何分类用户意图、路由到不同处理流程、决定澄清策略和自主度级别时调用此 Skill。适用于多任务型 AI 助手、客服机器人、编程工具、研究助手等需要结构化对话管理的场景。不适用于:纯问答型系统(无任务执行)、单轮交互(无对话状态)、简单的 prompt 模板(无路由逻辑)。当需求仅涉及"输出什么格式"而非"如何决定输出什么"时,应该用…

    205 GitHub starsUsed in 1 repo~788 tokens
    Auto-check passed
  • Safety Guardrails

    kangarooking/system-prompt-skills

    当需要为 AI 系统设计多层安全防线、内容过滤策略和伦理边界时调用此 skill。典型场景包括:设计拒绝策略与升级机制、防御 prompt 注入攻击、实现领域特定安全规则(教育、医疗、金融等)、定义 AI 的价值观锚点。

    205 GitHub stars~1.2k tokensUpdated 5 mo ago
    Auto-check passed
  • Agent Delegation

    kangarooking/system-prompt-skills

    当系统提示词需要设计多代理协作架构、子代理专业化分工、代理间上下文隔离与传递机制、任务生命周期管理时调用此 Skill。适用于 AI Agent 平台、多工具编排系统、代码审查流水线、跨应用协作场景等。不适用于:单代理系统(无委派需求)、简单工具调用(无子代理概念)、纯 API 编排(无 AI 决策)。当需求聚焦于"单代理内的对话路由"而非"多代理间的任务分配"时,应该用…

    205 GitHub stars~897 tokensUpdated 5 mo ago
    Auto-check passed

Questions about Memory System

What does Memory System do?

当需要为 AI 设计记忆存储、检索、应用和更新机制时调用此 skill。典型场景包括:设计持久化记忆架构(用户偏好、历史上下文、项目知识)、定义记忆的创建/读取/更新/删除生命周期、实现静默记忆应用(不在回复中透露记忆内容)、管理敏感记忆边界。. Memory System is an agent skill from kangarooking/system-prompt-skills.

When should I use Memory System?

Memory System fits situations like: 信号:AI 需要跨会话记住用户信息、记忆内容可能敏感、需要在回复中隐式应用记忆而非显式引用、用户要求记住这个.

How do I install Memory System in Claude Code?

Run `npx skills add kangarooking/system-prompt-skills --skill memory-system -a claude-code`. Or copy the skill folder (memory-system in kangarooking/system-prompt-skills) into .claude/skills/memory-system in your project. Claude Code loads it when a task matches its description.

How do I install Memory System in Codex?

Run `npx skills add kangarooking/system-prompt-skills --skill memory-system -a codex`. Or copy the skill folder (memory-system in kangarooking/system-prompt-skills) into .agents/skills/memory-system in your project. Codex loads it when a task matches its description.

Can I use Memory System in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add kangarooking/system-prompt-skills --skill memory-system -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/memory-system, .gemini/skills/memory-system, .github/skills/memory-system and .opencode/skills/memory-system in your project.

What does Memory System need to run?

SKILL.md names no scripts, command-line tools or credentials: Memory System is instructions for the agent only.

Does Memory System access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Memory System safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Memory System use?

Memory System is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Memory System use?

About 1.2k tokens (SKILL.md is roughly 4.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Memory System?

Skills that share tags, products or a category with Memory System: Agent Builder (shareAI-lab/learn-claude-code, 78k stars), Add Uint Support (pytorch/pytorch, 104k stars), Peft Fine Tuning (Orchestra-Research/AI-Research-SKILLs, 13k stars) and Segment Anything Model Guide (Orchestra-Research/AI-Research-SKILLs, 13k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Memory System?

kangarooking (a GitHub user) maintains it in kangarooking/system-prompt-skills, which has 205 GitHub stars. The repository holds 15 skills in this directory. The repository was last updated on May 4, 2026.

Source: kangarooking/system-prompt-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.