shine-retro
Cross-session retrospective — review learning-log.jsonl and propose memory updates
This is a read + propose skill. It never overwrites memory without explicit user approval — unless --apply is passed, in which case it writes a single ~/.claude/memory/external-retro-<date>.md summary (never touches existing files).
</objective>
<execution_context> @~/.claude/shine/references/ui-brand.md </execution_context>
<context> Flags: - `--days N` — only consider entries from the last N days (default: 7). - `--apply` — write a new `external-retro-<YYYY-MM-DD>.md` memory file with the approved findings. Does **not** modify any other memory file.Data sources (both metadata-only, PII-free):
~/.claude/memory/learning-log.jsonl— one JSONL entry per Claude turn (per-turn analytics).~/.claude/memory/learning-log.md— one human-readable block per session (written by theshine-session-summaryhook at SessionEnd). Contains placeholders the user and Claude fill in during this retro:Task,Outcome,Preference observed.
If both logs are missing or empty, exit politely: nothing to review. </context>
<execution_flow>
-
Locate and read the logs.
JSONL="$HOME/.claude/memory/learning-log.jsonl" MD="$HOME/.claude/memory/learning-log.md" test -s "$JSONL" || test -s "$MD" || { echo "No learning-log yet — run a few sessions first."; exit 0; }Read the last N days of JSONL (turn-level metadata) and the session blocks in learning-log.md (including any unfilled
Task / Outcome / Preference observedplaceholders — those become the first questions for the user). -
Filter by window. Use
--days N(default 7). Parsets(ISO-8601) and keep entries wherets >= now - N days. -
Aggregate patterns. Compute:
- Total turns, unique
cwdroots, busiest day. last_toolfrequency (top 10).- Average/median transcript size; count of turns crossing the soft token threshold (proxy for long sessions).
- Repeated
cwdpaths that don't have a matchingproject-*.mdin memory.
- Total turns, unique
-
Read current memory index.
ls ~/.claude/memory/*.mdand categorize by prefix (preference-,client-,project-,style-,external-). -
Generate a retrospective report — markdown, concise, 4 sections:
- Activity snapshot (counts, top tools, top cwds).
- Gaps detected (cwds with no matching project memory; overused tools that could be templated into a skill; long sessions suggesting a missing
/compacthabit). - Proposed memory updates — concrete diffs: "Add
project-<slug>.mdwith … " / "Extendpreference-stack.mdwithtool X used 42× this week". - Open questions — things that need the user's input before any change lands.
-
Present the report to the user and ask: "Apply these as a new
external-retro-<date>.mdmemory file? (y/N)" -
If
--applyor user confirms: write~/.claude/memory/external-retro-<YYYY-MM-DD>.mdwith today's findings. Never edit existing memory files — propose, don't overwrite. -
Log outcome. Print a 1-line summary and stop. </execution_flow>
<error_handling>
- Log missing: print "No learning-log yet — run a few sessions first." and exit 0.
- Log malformed: skip bad lines, continue with the rest, note the count of skipped lines in the report.
- Memory dir missing: print "No ~/.claude/memory/ directory found. Run
shine-tools.cjs onboardfirst." and exit 0. - --apply but no log entries in window: refuse to write an empty retro file. </error_handling>
<output_format> Report markdown structure (always):
## SHINE Retro — <YYYY-MM-DD>
**Window:** last N days · **Turns:** X · **Unique projects:** Y
### Activity snapshot
- …
### Gaps detected
- …
### Proposed memory updates
- [ ] …
### Open questions
- …
</output_format>
<structured_returns> On success: prints the report and (if applied) the path to the new external-retro file. On no-op: single line "No learning-log yet — run a few sessions first." </structured_returns>