Update project memory and implementation rules after completing work. Use when asked to "remember", "save what we learned", "update memory", "update rules", "capture learnings", or at the end of a multi-step implementation session to persist insights. Also auto-invoked after completing significant multi-step implementations. Writes to memory.md and implementation-rules.md at the project root.
Persist project knowledge into two root-level files after completing work. This keeps future sessions informed about what was built, why, and how.
| File | Purpose | Content type |
|---|---|---|
memory.md | What was done and why | What was built, why decisions were made, how features relate to each other, domain context, gotchas encountered |
implementation-rules.md | How to implement features correctly | Coding conventions, patterns, architectural rules, API design, data model semantics, technical constraints |
Read both files in full to understand what is already captured:
memory.md (project root)implementation-rules.md (project root)Review the conversation history and recent changes. Extract:
For memory.md (narrative context — what and why):
For implementation-rules.md (technical rules — how):
Before writing anything, present the extracted candidates to the user for review. Format them as a numbered list grouped by target file:
Proposed additions to memory.md:
Proposed additions to implementation-rules.md:
Proposed updates (replacing existing content):
Ask the user to confirm, remove items, or suggest edits before proceeding. Only write the entries the user approves.
Edit each file, adding only the user-approved entries.
For memory.md: Use a dated log format:
## YYYY-MM-DDFor implementation-rules.md: Follow the existing numbered section structure. Add new rules (patterns, conventions, workarounds with technical steps) to the relevant section, or create a new numbered section if needed.
Each file must stay under 10,000 tokens (~7,500 words). Only compact when the file is actually approaching this limit — do not compact proactively.
When compaction is needed for memory.md:
## YYYY-MM-DD headings into combined headings (e.g., ## 2026-03-10 – 2026-03-14) until enough space is recovered.memory.md.When compaction is needed for implementation-rules.md:
Summarize what was written to each file so the user has a final record of what was persisted.
implementation-rules.md.## YYYY-MM-DD heading. Never insert entries above existing ones.memory.md.