Hindsight
Record session outcomes, patterns, and scores to build a persistent knowledge base across all Claude Code sessions.
File Location
All learnings are stored in ~/.claude/LEARNINGS.md (user-level, shared across all projects).
When to Record
Record a session entry when:
- •The user explicitly asks to end/wrap up a session
- •The user asks for a session review or to record learnings
- •The user invokes
/session-learnings
Session Entry Format
Append each entry to ~/.claude/LEARNINGS.md, creating the file if it doesn't exist.
markdown
--- ## Session: YYYY-MM-DD HH:MM — [Brief Title] **Project:** [repo/project name or "General"] **Branch:** [git branch if applicable] **Duration estimate:** [short/medium/long based on conversation length] ### What Worked - [Specific thing that went well — be concrete] - [Tool/approach/pattern that was effective] ### What Didn't Work - [What failed, was slow, or caused friction] - [Approaches that were abandoned and why] ### Key Learnings - [Reusable insight for future sessions] - [Pattern discovered, gotcha avoided, or technique learned] ### Session Score: X/10 | Dimension | Score | Notes | |-------------------|-------|------------------------------| | Task completion | X/10 | [Did we finish what was asked?] | | Code quality | X/10 | [Clean, tested, follows patterns?] | | Efficiency | X/10 | [Minimal tool calls, no wasted effort?] | | Communication | X/10 | [Clear, concise, helpful?] | | **Overall** | **X/10** | | ### Follow-ups - [ ] [Any unfinished work or next steps]
Score Dimensions
- •Task completion (40%): Did the session accomplish what was asked? 10 = fully done, 1 = nothing completed.
- •Code quality (25%): Is the code clean, tested, following repo conventions? 10 = production-ready, 1 = broken.
- •Efficiency (20%): Minimal unnecessary steps? 10 = direct path, 1 = excessive searching/retries.
- •Communication (15%): Clear, concise, helpful? 10 = perfect clarity, 1 = confusing/verbose.
- •Overall: Weighted average, rounded to nearest 0.5.
Process
- •Read
~/.claude/LEARNINGS.mdif it exists (check format and see past entries) - •Reflect on the current session: what was accomplished, what tools/approaches worked, what caused friction
- •Generate the entry using the template
- •If the file doesn't exist, create it with this header before the first entry:
markdown
# Session Learnings Persistent record of Claude Code session outcomes, patterns, and scores. | Date | Project | Score | Title | |------|---------|-------|-------|
- •Add a row to the summary table at the top for the new session
- •Append the full entry after the table (newest entries first, right after the table)
- •Show the user a summary of the entry
Querying Past Learnings
When the user asks "show my learnings", "what patterns have I seen", or "learnings summary":
- •Read
~/.claude/LEARNINGS.md - •Summarize: average scores, recurring themes in "What Worked" / "What Didn't", top learnings
- •Highlight score trends (improving/declining over time)