memory

A set of rules for recording reusable operational knowledge discovered during development, such as troubleshooting steps, environment requirements, and recurring setup problems.

In plain words
What is it for?
Use it to decide whether a discovery belongs in project rules or documentation, merge related notes, write symptoms and fixes clearly, and remove outdated guidance.
Why use it?
It prevents future agents from repeating the same investigation and helps keep project guidance focused on problems that are hard to see from the code alone.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/lawofall/agentcore/memory
Clone the repo
git clone --depth 1 https://github.com/Lawofall/AgentCore

Made for: Cursor.

Per session 61 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 503 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00061 $0.00503
Opus 5 $0.00030 $0.00251
Sonnet 5 $0.00012 $0.00101
Haiku 4.5 $0.00006 $0.00050

Measured yesterday against content hash 15ca4c9d1e8f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

memory 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 yesterday.

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.

.cursor/rules/memory.mdc · 36 lines

What it actually says

AI 操作记忆沉淀

把开发中发现的、跨会话复现、对下一个 AI 有省时价值的操作型知识主动写进文档,免得下一个 AI 从零摸索。

何时沉淀

判据:下一个 AI 不读这条,会不会重复踩坑 / 重复摸索很久?

  • 会(高复现 + 高摸索成本)→ 沉淀。
  • 读代码顺手就有 → 不沉淀。

正例:「环境必须先 X 再 Y,否则报 Z」「这类排查用这条命令/脚本」「某操作有隐藏前置依赖」。 反例:某功能的实现步骤、函数签名、框架标准用法(读代码可得)。

沉淀到哪

  • 可复用脚本/命令/排查配方/环境坑 → .cursor/rules/{关注点}.mdc(AI 直接消费);复杂细节落 docs/,rules 只短引用。
  • 架构/设计/为什么这么做 → docs/ 对应文档的「决策记录」小节。
  • 优先追加进已有规则/文档,主题相关就别新建文件。

怎么写

  • 可直接照做:命令可复制、路径用项目根相对路径、坑点按「症状 → 原因 → 对策」。
  • 只写代码看不出来的(承接 dev-process.mdc 内容策略);行为规则 ≤50 行,实现细节下沉 docs。

防膨胀(硬约束)

  • 沉淀前先搜同主题条目,有则合并,不新增文件。
  • 过时 / 被替代的记忆立即改或删,不留废弃条目。
  • 记忆是高价值精选,不是流水账;宁缺毋滥。
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. yesterday First seen · 36 lines · 61 tokens per session scan A 15ca4c9d1e8f

Subscribe to this mod's changes

memory is a cursor rule published in the GitHub repository Lawofall/AgentCore (78 stars, last pushed 2d ago), licensed MIT. It adds 61 tokens to every session and 503 once invoked, about $0.0003 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.