Skill.md
Compact with Memory
Standard /compact replaces conversation history with a summary — fast, but lossy. The architectural decisions you spent hours reasoning through, the approaches you tried and abandoned, the rules the user corrected you on — all flattened. The next session starts blind.
This skill adds two things before compression: a memory pre-pass that extracts institutional knowledge to durable files, and a structured 8-section summary that gives a fresh session exactly what it needs to continue the work. Core principle: only persist what can't be derived from reading the code or git history — everything else is noise.
Four Signal Types
| Type | Content | Example |
|---|---|---|
feedback | Collaboration rules (corrections AND confirmations) | "Don't auto-retry Stripe calls"; "yes, keep doing it this way" |
project | In-progress work, decision rationale, eliminated approaches | "Chose optimistic locking because pessimistic locks deadlock at this scale" |
user | Role, domain expertise, preferences | "Senior backend engineer, first time touching the React side" |
reference | Pointers to external systems | "Bugs tracked in Linear project INGEST" |
How to Execute
Step 1 — Memory pre-pass
Scan the conversation for signals that can't be derived from code or git history. Write them to memory files now — they will be gone after compaction. Quality bar: if a signal lacks a Why:, skip it. One good entry beats five generic ones.
Step 2 — Generate the summary
The summary replaces the entire conversation history. It must be self-contained: a fresh session with only this summary should be able to continue the work without asking what happened.
Eight sections — write every one that has content:
- Task — What was being worked on and why — the goal, not the steps taken
- Current state — Exactly where things stand at the end of this session: done, not done, in progress. Most critical section — must reflect the conversation endpoint, not the starting point
- Key decisions — Choices made and the reasoning behind them; non-obvious decisions especially
- Eliminated approaches — What was tried and ruled out, and why; prevents re-exploring dead ends
- Open questions / blockers — Unresolved issues the next session needs to address first
- Files changed — Which files were modified and what changed in each
- Next steps — Concrete actions remaining, in priority order
- Context for next session — Anything a fresh session needs that didn't fit the above
Quality criteria:
- A fresh session reading only this summary can continue the work
- Reasoning over facts: why decisions were made, not just what was decided
- Current state accurately reflects where the conversation ends
- No padding: omit any section that genuinely has nothing to say
Step 3 — Execute /compact
Run /compact. In the summary note, reference what was persisted to memory: "Key decisions written to memory — see [filename] for [topic]."
Step 4 — Confirm
Report:
- Compact: completed, with a one-line description of what the summary covers
- Memory: how many files were written/updated and which files
- MEMORY.md line count: current count (must stay under 200 lines)
When to Use
- Type
/compactor "compress context" - When the context window indicator is approaching the limit
- At natural session checkpoints after significant decisions
What NOT to Save
- Code patterns, file paths, architecture overviews — read the code
- Git history or who changed what —
git logis authoritative - Debugging steps or fix recipes — the code is the record; commit messages have context
- Anything already in CLAUDE.md files
- Ephemeral task status, in-progress work from this session
Boundary test: "Would a fresh session benefit from knowing this before reading any code?" If no — skip it.
Relationship with memory-architect
compact-with-memory is the write path: it extracts knowledge at each compression point. memory-architect is the cleanup path: when MEMORY.md has accumulated redundant, duplicate, or stale entries, use it for structural reorganization. They work best together.
Limitations
This skill depends on what was explicitly discussed in the session. If architectural decisions were made without stating the "why," the extracted memory will lack a Why: rationale. For best results, state your reasoning out loud when making important decisions — it makes the compact extraction substantially more useful.