|
| 1 | +--- |
| 2 | +name: session-retrospective |
| 3 | +description: Document lessons learned after completing work, especially when the user corrected planning documents or implementation. Creates and maintains a persistent lessons file in .ai/memory/ that future agents read at session start. |
| 4 | +--- |
| 5 | + |
| 6 | +# Session retrospective |
| 7 | + |
| 8 | +## Mindset |
| 9 | + |
| 10 | +You are a continuous improvement engineer. Every correction the user makes is signal, not noise. Capture it while the context is fresh — a two-sentence lesson now prevents hours of repeated mistakes in every future session. |
| 11 | + |
| 12 | +## When to use |
| 13 | + |
| 14 | +**Triggered by:** |
| 15 | + |
| 16 | +- User corrects your work — wrong path, wrong assumption, wrong approach |
| 17 | +- User says "document what you learned", "add to lessons", or "remember this" |
| 18 | +- You encounter a tool limitation, surprising behavior, or non-obvious constraint |
| 19 | +- End of a session where substantial work was done and corrections were made |
| 20 | + |
| 21 | +**Proactively suggest** when the user corrects the same type of mistake more than once in a session. |
| 22 | + |
| 23 | +## When NOT to use |
| 24 | + |
| 25 | +- Trivial typo fixes with no future relevance |
| 26 | +- Corrections that are specific to a one-off task and won't recur |
| 27 | +- Preserving project state for continuing work — use `session-handoff` for that |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Workflow |
| 32 | + |
| 33 | +### 1. Identify what to capture |
| 34 | + |
| 35 | +For each correction or surprise, ask: **what would have prevented this mistake?** |
| 36 | + |
| 37 | +| What happened | What to document | |
| 38 | +| ------------------------------- | --------------------------------------------------- | |
| 39 | +| Wrong file path | The correct path and why the wrong one seemed right | |
| 40 | +| Wrong tool usage | The correct usage and the constraint | |
| 41 | +| Misunderstood project structure | Where things actually live | |
| 42 | +| Tool limitation hit | What the tool can't do and the workaround | |
| 43 | +| Assumption that didn't hold | The actual rule or constraint | |
| 44 | + |
| 45 | +Skip corrections that are one-offs or already obvious from the error message. |
| 46 | + |
| 47 | +### 2. Check existing lessons first |
| 48 | + |
| 49 | +Read `.ai/memory/lessons.md` before writing. Update an existing lesson if the new information adds nuance or corrects it. Never create a duplicate entry. |
| 50 | + |
| 51 | +### 3. Write to `.ai/memory/lessons.md` |
| 52 | + |
| 53 | +Group lessons by **category**, not by date. Categories: |
| 54 | + |
| 55 | +- **File operations** — tool behavior, read-before-edit, parallel edit failures |
| 56 | +- **Path resolution** — relative vs absolute, directory depth, symlinks |
| 57 | +- **Project structure** — where things actually live vs where they seem to be |
| 58 | +- **Tool limitations** — what tools can/can't do, workarounds |
| 59 | +- **CI / build** — what passes/fails, why, which scripts exist |
| 60 | +- **Component patterns** — SWC-specific conventions (tags, stories structure, etc.) |
| 61 | +- **Agent tooling** — `.ai/` rules, `AGENTS.md`, skills behavior, config |
| 62 | + |
| 63 | +Add new categories when none of the above fit. |
| 64 | + |
| 65 | +### 4. Format |
| 66 | + |
| 67 | +Each lesson is **one or two sentences**: |
| 68 | + |
| 69 | +1. **Bold subject** — the trigger condition or context |
| 70 | +2. Plain sentence — what to do (or not do) |
| 71 | + |
| 72 | +**Good:** |
| 73 | + |
| 74 | +> **Edit tool requires a prior read**: The Edit tool fails with "file not read yet" if the file wasn't read in the current conversation. Read all files you plan to edit before starting work. |
| 75 | +
|
| 76 | +**Bad:** |
| 77 | + |
| 78 | +> We had an issue with editing files. |
| 79 | +
|
| 80 | +Lessons should be actionable. A future agent reading them should know exactly what to do differently. |
| 81 | + |
| 82 | +### 5. Keep it scannable |
| 83 | + |
| 84 | +- Max 1–2 sentences per lesson |
| 85 | +- Update existing lessons rather than appending duplicates |
| 86 | +- If a lesson turns out to be wrong, remove or correct it — stale lessons cause the same problems they were meant to prevent |
| 87 | +- Keep the total file under ~100 lines; if it grows past that, consolidate or remove stale entries |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +## Output location |
| 92 | + |
| 93 | +**`.ai/memory/<descriptor>-lessons.md`** — co-located with agent tooling, readable by all agents regardless of tool. Use a descriptor that reflects the theme of the lessons (e.g. `agnostic-lessons.md` for tool-agnostic AI setup work, `migration-lessons.md` for migration-specific patterns). Create a new file when lessons belong to a clearly distinct topic rather than appending to an existing one. |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## Checklist |
| 98 | + |
| 99 | +- [ ] Lessons are in `.ai/memory/<descriptor>-lessons.md`, not in a session-specific file |
| 100 | +- [ ] Each lesson is in the correct category |
| 101 | +- [ ] Each lesson is 1–2 sentences and actionable |
| 102 | +- [ ] No duplicates — existing entries were checked and updated if needed |
| 103 | +- [ ] Stale or incorrect lessons were removed or corrected |
| 104 | + |
| 105 | +--- |
| 106 | + |
| 107 | +## Quality gate |
| 108 | + |
| 109 | +A retrospective is complete when: |
| 110 | + |
| 111 | +> Every significant correction from the session is captured as an actionable lesson in the correct category; no duplicates exist; lessons are scannable in under 60 seconds. |
0 commit comments