跳到正文
Skillpedia
智能体48k · #3661

agent-memory-discipline

它能做什么

这个技能教 AI 智能体如何聪明地使用记忆。它规定了智能体在行动前何时应该查找旧信息,以及在行动后何时应该保存新信息或修正内容。

适用场景

  • ✓当助手忘记你的偏好或过去的决定时。
  • ✓当你希望 AI 记住某些对未来项目重要的内容时。
  • ✓当助手重复已经解决过的错误或问题时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/agent-memory-discipline/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/agent-memory-discipline/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请记住,我们决定在项目 Y 中使用库 X。”

每周 5 个新技能,1 分钟读完。

工作原理

在做重要决定之前,AI 会在记忆中搜索相关信息。做出决定、修正错误或发现新内容后,AI 会把它记录到记忆中,供以后使用。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Agent Memory Discipline

Overview

Connecting a memory tool does not make an agent use it: tools register, the session runs, and nothing gets recalled or saved. This skill supplies the missing part, standing rules for when to read memory and when to write it.

The problem it solves is specific. An agent with memory available still repeats settled questions, reverts corrected habits, and loses decisions between sessions, because nothing tells it when recall and save are due. The rules below make both moments explicit.

When to Use This Skill

  • Use when a memory tool or MCP memory server is connected but the agent is not using it consistently.
  • Use when the user complains that the assistant loses preferences, conventions or past decisions between sessions.
  • Use when setting up persistent memory for a project and the agent needs standing rules for reading and writing it.
  • Use when the user says "remember this", "what did we decide", "recall", or "save this for next time".

How It Works

Before You Start: Any Memory Backend

The agent needs a memory tool it can call. Any backend works, and the rules are identical for each:

  • Files. A memory/ folder of Markdown notes, one fact per file. No dependencies, fully greppable, versionable in git.
  • A local MCP memory server. Keeps everything on the local machine; several open-source options exist.
  • A hosted memory service over MCP. Adds portability across tools and machines at the cost of the data living elsewhere.

Authentication is whatever the chosen backend requires: none for a local folder, the server's own configuration for a local MCP server, an API key or OAuth sign-in for a hosted service. This skill never handles credentials itself and never writes them into memory.

Step 1: Recall Before Acting

Read memory before doing any of these, not after:

  • starting work on a project touched before
  • choosing a library, pattern, or tool
  • writing tests, commits, or documentation, where conventions apply
  • answering "how do we usually do X here"
  • anything the user phrases as "again", "like last time", or "as we agreed"

Skip recall for one-off factual questions, arithmetic, or anything fully specified in the current message. Recall costs a tool call and context; spending it on a self-contained question is waste.

Search with the words the user actually used, plus the project or repository name. If the first search returns nothing useful, try one broader query, then stop and proceed without memory rather than looping.

Step 2: Save After Deciding

Write to memory when one of these has just happened:

  • a decision was made and will still matter next week ("we use pnpm", "the billing module stays untouched")
  • the user corrected the agent, which is the strongest signal there is
  • an approach failed, and why it failed
  • a preference was stated that applies beyond this task
  • a fact about the environment was discovered the hard way (a port, a flag, a service that must be running)

Do not save: the contents of files that can be read again, restatements of the current task, transient state, anything the user marked as temporary, and anything containing secrets, tokens, or personal data.

One memory, one fact. A paragraph containing four decisions cannot be superseded cleanly when one of them changes.

Step 3: Write It So It Survives

A memory that is useless in three weeks was written wrong. Give each entry, in the text if the backend has no fields for it:

  • what was decided or observed, in one sentence
  • why, briefly, because the reason outlives the decision
  • when it became true, and when it stopped being true if it has
  • where it came from: a file, a commit, a conversation, a test run

Prefer the user's own words over a paraphrase. Paraphrase drifts.

Step 4: Close the Past Instead of Overwriting It

When something changes, the old memory is not wrong. It is closed.

If the project moved from Redux to Zustand, "we use Redux" was true from January to June. Deleting it destroys the explanation for every component written in that window. Mark it superseded, keep its validity window, and write the new one alongside.

This is the single most destructive habit in agent memory, and it stays invisible until someone asks a question about old code.

Step 5: Keep Contradictions Visible

…

常见问题

如果 AI 找到了过时的、相互矛盾的信息,会怎样?

AI 会同时展示这些旧信息及其日期,并请你确认哪一条是正确的或更新的。

AI 会保存我说的每一句话吗?

不会。AI 只保存重要的决定、你做出的修正,或者出现过的失败。它不会保存临时信息或密码等敏感数据。

AI 是如何保存信息的?

AI 会记下决定了什么或学到了什么、为什么重要、发生的时间,以及信息的来源。如果内容有变化,旧信息不会被删除,而是标记为“已被取代”,以便日后参考。

详情

作者的原始描述

Rules for when an agent should recall from long-term memory before acting and when it should save decisions, corrections and failures afterwards. Works with any memory backend.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#3661
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能