memory-sidecar

A set of rules for a memory sidecar, a separate helper that stores and recalls project or user knowledge.

In plain words
What is it for?
Use it to decide when to recall, store, update, or delete memories and how to apply them during coding work.
Why use it?
It reduces conflicts between remembered preferences, current code, and documentation by defining which source takes priority.

Cursor rule

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/jaychouya/memoryagent/memory-sidecar
Clone the repo
git clone --depth 1 https://github.com/jaychouya/MemoryAgent
Per session 775 This file is loaded in full into every session.
When invoked 775 The same file — it is already loaded in full.
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.00775 $0.00775
Opus 5 $0.00387 $0.00387
Sonnet 5 $0.00155 $0.00155
Haiku 4.5 $0.00077 $0.00077

Measured 2d ago against content hash 250835a8f924, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

memory-sidecar 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 2d 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.

integrations/cursor/memory-sidecar.mdc · 52 lines

What it actually says

MemoryAgent 侧车

MCP 已配置时,user_id / project_id 由工作区目录名自动推导(无需手填)。

MemoryAgent 侧车

权威层级(Ground Truth)

优先级 来源 用途
1 本轮已注入的记忆块(memory_recall / memory_exportprompt_block 用户偏好、项目决策、禁忌、可复用事实
2 当前工作区代码、终端输出、用户附件 运行时状态
3 官方文档、README API、版本、配置细节
4 模型训练知识 仅参考,须与 1-3 核对

冲突规则: 运行时状态以 2 为准;偏好与历史决策以 1 为准;版本敏感细节以 3 为准。注入记忆与主观假设冲突时,注入记忆优先

行动前检查(每轮最多 recall 一次)

  1. 清点:上下文中是否已有 [user] / [feedback] / [project] / [reference] 记忆块?
  2. 匹配:当前问题是否已被这些记忆覆盖?
  3. 决策:已覆盖 → 直接引用并回答,禁止为「验证」再调 memory_recall、搜仓库或读文件重找同一事实。
  4. 未覆盖或话题已切换 → 调用一次 memory_recall(query=用户当前问题)

每轮流程

  1. 按上文「行动前检查」决定是否需要 memory_recall(可省略 user_id / project_id,服务端从工作区自动推导)。
  2. 回答时:只引用 recall 结果;标记 is_stale 的记忆先核实再当事实。
  3. 回答后:用户明确偏好/禁忌/项目决策/链接时,调用 memory_storememory_type: user | feedback | project | reference)。
  4. 纠错:用户说「记错了」「忘记…」「不要再记住…」时,用 memory_deletememory_update 修正,并复述 ide_notice
  5. 需要整段注入系统提示时:memory_export → 使用 prompt_blockcursor_rules_block
  6. 上下文里出现 memory_retrieve_blob(ref_id=ccr_…) 时,用该工具取回完整 tool 输出再分析。

IDE 内可感知(记→用→信)

  • memory_recall / memory_store 返回里的 ide_notice 字段:用一句话告诉用户「召回了几条 / 是否写入」。
  • 项目内 .memoryagent/status.json 记录最近一次 recall/store(用户可在资源管理器打开查看)。
  • 写入或召回后,在回复末尾用一行中文复述 ide_notice,让用户知道记忆层在工作。

安装(本仓库未装时)

在 MemoryAgent 仓库根目录执行:

bash scripts/install-sidecar.sh /path/to/your/project --verify
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. 2d ago First seen · 52 lines · 775 tokens per session scan A 250835a8f924

Subscribe to this mod's changes

memory-sidecar is a cursor rule published in the GitHub repository jaychouya/MemoryAgent (68 stars, last pushed 2mo ago), licensed MIT. It adds 775 tokens to every session, about $0.0039 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.