session-to-memory
Use at the end of a non-trivial session, when winding down a task, or when the user asks to "remember this session" or "save what we learned". Extracts retention-worthy knowledge from the current sess
SKILL.mdskills/session-to-memory/SKILL.md
GitHubRequired <project-root>/docs reads
Read these project-root spec files before extracting or persisting session knowledge (use shell cat/ls — they may be in .gitignore, invisible to built-in search). Missing file → fall back to native tools, note the gap; never invent contents.
<project-root>/docs/memory-providers.md
This skill owns bulk extraction at session end. memory-usage owns write triggers, naming, entry format, and in-session maintenance — defer to it for each. The active memory-provider skill supplies driver mechanics (tool names, args; see <project-root>/docs/memory-providers.md in the project root).
When to Run
- End of a non-trivial session that produced reusable knowledge.
- User asks to save, remember, or persist the session's learnings.
- Before
handoffwhen the session uncovered invariants, pitfalls, or decisions worth keeping beyond the next agent.
Don't run for trivial sessions (single command, one-line answer, no investigation). If nothing cleared the memory-usage write bar, say so and stop.
Inputs
| Source | What to scan |
|---|---|
| Conversation history | User requests, decisions, corrections, surprises. |
| Tool output | Errors, root causes, schema facts, command results. |
| Files touched | Paths, patterns, conventions discovered. |
| Active artifacts | Plans, ADRs, PRDs, commits — reference, don't duplicate. |
Extraction Targets
Pull only what clears the memory-usage write bar: reusable, hard-won, non-obvious, not trivially greppable. Discard the rest.
| Category | Keep | Drop |
|---|---|---|
| Invariants | Non-obvious constraints the code enforces | Comments that restate code |
| Conventions | Naming, layout, and patterns the project mandates | Style recoverable from one file |
| Corrections | User corrections, written as the rule to follow next time | The mistake narrative itself |
| Preferences | How the user wants the agent to work or communicate | One-off phrasing choices |
| Pitfalls | Traps that required real investigation | One-off typos |
| Decisions | Architectural choices with lasting rationale | Reversible preferences |
| Module facts | Shape, seams, ownership, lifecycle | Trivial structure |
| External facts | API quirks, version-specific behavior, rate limits | Public doc defaults |
Procedure
- Survey + Filter — scan the session's conversation history, tool outputs, and touched file paths, including lessons the session never wrote down. Build a distilled candidate list of
(topic-path, one-line substance, source citation)entries that clear thememory-usagewrite bar. Discard the rest. - Dedupe — list existing memories (
memory-usageworkflow step 1; see<project-root>/docs/memory-providers.mdin the project root). For each candidate, edit the existing entry if it overlaps; write a new entry only if the topic path is absent. - Consolidate + Prune — leave the store better than you found it: merge overlapping entries, delete stale or transient ones, repair
mem:references, and update theproject_overviewindex. Preserve provenance and explicit user preferences during cleanup. - Structure — name entries with stable slash-separated topic paths (
modules/<name>/<subtopic>,pitfalls/<topic>,decisions/<topic>). Write entries as one-line bullets with— [source: <this session>; added: YYYY-MM-DD]. Cross-reference withmem:<name>. - Persist — hand each write to the active memory-provider skill's driver. The parent owns persistence.
- Report — one line per entry written, edited, consolidated, or deleted:
topic-path — verb — source citation. If nothing cleared the bar, say so.
Output Contract
Return a compact changelog listing entries written, edited, consolidated, or deleted with source citations. Do not paste memory bodies.
Hard Rules
- Never persist conversation state, task progress, or session scratchpads.
- Never duplicate codebase-readable truth — cite the file:line instead.
- Never paste full diffs, logs, or file contents into a memory. Distill.
- Never write secrets, credentials, or PII.
- One topic per entry. Split entries past ~100 lines.
- Edit over delete-and-recreate to keep
mem:references stable. - Preserve
[source: …; added: …]provenance and explicit user preferences when consolidating or pruning. - If the active memory provider is unavailable, report
BLOCKEDand stop. Don't invent a fallback store.