memory-writeback

A rule for saving important project knowledge after meaningful changes. It explains when information should be added to the project’s durable memory and when no update is needed.

In plain words
What is it for?
Use it after making changes to decide whether to record new knowledge, where to record it, and how to state that no memory update was needed.
Why use it?
It prevents future coding sessions from losing architectural decisions, conventions, discovered problems, or other facts that remain useful later.

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/robotaitai/project-bedrock/memory-writeback
Clone the repo
git clone --depth 1 https://github.com/robotaitai/project-bedrock
Per session 805 This file is loaded in full into every session.
When invoked 805 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.00805 $0.00805
Opus 5 $0.00402 $0.00402
Sonnet 5 $0.00161 $0.00161
Haiku 4.5 $0.00081 $0.00081

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

Security

Grade A, and why

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

assets/rules/memory-writeback.mdc · 92 lines

How it starts

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

Memory Writeback

After any meaningful project change, evaluate whether durable project understanding changed. If yes, update the correct memory branch before ending the session. If no, say so explicitly.


Evaluation -- ask after every meaningful task

"Did this session change what future sessions should understand about this project?"

Write to memory if the answer is yes for any of:

  • An architectural decision was made or reversed
  • A new pattern or convention was confirmed
  • A critical gotcha was discovered (build, DB, API, environment, path)
  • A feature area was substantially completed or its design changed
  • A recurring mistake was corrected (record the lesson)
  • A dependency or external constraint changed

Skip writeback if:

  • The session was read-only exploration with no new conclusions
  • The change is already captured in git or inline documentation
  • The fact is session-specific and won't matter in a future session
  • The fact is speculative and not yet confirmed
  • The work changed code but not project understanding

When skipping, state it: Memory writeback: none needed.


What to write and where

Fact type Target
Architectural decision Memory/decisions/decisions.md (append numbered entry) + optionally Memory/decisions/YYYY-MM-DD-slug.md for a deep-dive
New pattern or convention relevant branch note -> Current State
Gotcha or constraint relevant branch note -> Current State
Stack change relevant branch note -> Current State + Recent Changes
Completed feature area relevant branch note -> Current State
Lesson from a mistake relevant branch note -> Current State, with Why: and How to apply:

If no existing branch fits the fact, create a new branch note using the same-name convention. Use the project's own terminology for branch names.


How to write

  1. Identify the target branch note.
  2. Read its current content.
  3. Preserve YAML frontmatter and add or update the fact in the correct section.
    • Current State: what is true now (replace stale entries, don't append duplicates)
    • Recent Changes: YYYY-MM-DD -- what changed (prune entries older than ~4 weeks)
    • Decisions: link to decision file
    • Open Questions: add unresolved items only if they remain open after verification
  4. Use emojis in section headers to improve scannability. Pick an emoji that matches the section's purpose (e.g. ## 🔄 Recent Changes, ## 🔗 See Also, ## ⚠️ Gotchas, ## 📦 Build, ## 🔍 Detection, ## 🧩 Patterns). Keep existing headers consistent.
  5. If the branch now exceeds ~150 lines, follow the memory-compaction skill.
  6. If branch summaries changed, update agent-knowledge/Memory/MEMORY.md.

Read the full file on GitHub · 92 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. 2d ago First seen · 92 lines · 805 tokens per session scan A d013cad76543

Subscribe to this mod's changes

memory-writeback is a cursor rule published in the GitHub repository robotaitai/project-bedrock (44 stars, last pushed 12d ago), licensed MIT. It adds 805 tokens to every session, about $0.0040 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.