agentleFS
michellepellonmichellepellon/superpowers/skills/session-reflection/SKILL.md

session-reflection

Skill1 starsChanged 8 months agoMITView on GitHub

Analyze session history to identify inefficiency patterns and workflow gaps. Two modes: lightweight end-of-session reflection from conversation context, or comprehensive periodic analysis across multiple sessions via jq-extracted JSONL summaries. Produces structured reports with copy-paste-ready improvement proposals for CLAUDE.md, skills, commands, and automation.

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. jwilger/agent-skills★ 4same name
    2. metraton/gaia★ 4same name
    3. linxule/carrel★ 2same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository5 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After a particularly frustrating or inefficient session

    line 29
  2. Distinctive:

    When onboarding to a new project (analyze early sessions for missing docs)

    line 30
  3. Distinctive:

    No file I/O needed. The agent introspects on its own behavior.

    line 70
  4. Distinctive:

    Use a subagent (Agent tool) to perform the extraction and analysis, keeping the main context clean.

    line 76
  5. Distinctive:

    Key principle: All proposals are copy-paste ready with complete text/code.

    line 160

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Session Reflection

Overview

Analyze session history to find inefficiency patterns and workflow gaps, then propose concrete improvements. Two modes: quick end-of-session reflection or comprehensive periodic multi-session analysis.

Core principle: Evidence-based improvement. Quantify waste, propose specific fixes, implement nothing without approval.

When This Skill Activates

  • End of a session (user asks to reflect)
  • Periodic review (weekly/monthly)
  • After a particularly frustrating or inefficient session
  • When onboarding to a new project (analyze early sessions for missing docs)

Trigger phrases: "reflect on this session", "session review", "what went wrong", "workflow audit", "analyze my sessions", "how can we improve"

Mode Selection

SituationModeWhy
"Reflect on this session"SessionSingle session, context available
"What went wrong today"SessionCurrent work, immediate feedback
"Review my sessions this week"PeriodicCross-session patterns need JSONL data
"How can I improve my workflow"PeriodicPatterns emerge across sessions
"Analyze the last 3 days"PeriodicMulti-session, specific time range
Session modePeriodic mode
ScopeCurrent session context onlyJSONL files from last N days (default: 7, max: 14)
Data sourceAgent's own conversation contextjq-extracted summaries from ~/.claude/projects/
DepthQuick patterns, 5-10 minComprehensive cross-session analysis, 15-30 min
DependenciesNonejq must be installed

Process

  1. Determine mode — Session or periodic based on user request
  2. Gather data — From context (session) or JSONL extraction (periodic — see references/extraction-patterns.md)
  3. Detect patterns — Walk through all analysis categories below
  4. Score findings — High/Medium/Low impact based on frequency and token/time cost
  5. Generate report — docs/audits/SESSION_REFLECTION_YYYY-MM-DD.md
  6. Present findings — Summarize 3-5 key findings to the user
  7. User review gate — Implement only changes the user approves

Session Mode: Reflecting From Context

The agent reviews its own conversation history within the current session:

  • Tool call inventory — Which tools were called, how many times, on what targets
  • Decision trace — Where did the agent change direction, backtrack, or get corrected
  • User corrections — Any place the user said "no, not that" or redirected the approach
  • Time spent — Which steps took disproportionately long

No file I/O needed. The agent introspects on its own behavior.

Periodic Mode: JSONL Extraction

CRITICAL: Never read raw JSONL files directly. They are massive and will consume the entire context budget. Always use the jq summary extraction pipeline documented in references/extraction-patterns.md.

Use a subagent (Agent tool) to perform the extraction and analysis, keeping the main context clean.

Analysis Categories

Agent Behavior Patterns

PatternSignalImpactExample
Repeated file readsSame file read 3+ timesHigh — token wasteRead config.py 7 times across session
Wrong path takenImplementation then reversalHigh — time wasteBuilt feature, discovered existing code
Unnecessary tool callsRedundant or no-op callsMedium — token wasteGlob + Grep for something already in context
Context loss recoveryRe-discovering info after compactionHigh — fragile workflowsKey architecture detail lost mid-session
Assumption without verificationDecision made, then correctedHigh — reworkAssumed API shape, had to refactor

Workflow Gaps

PatternSignalImpactExample
Repeated manual stepsSame commands across sessionsMedium — automation opportunityRunning same 3-command setup sequence
Missing documentationAgent had to discover what should be documentedMedium — onboarding frictionFigured out test setup from scratch
Missing skill coverageAgent did something a skill should guideMedium — quality riskAd-hoc code review without fresh-eyes
Recurring blockersSame type of error/obstacle reappearingHigh — systemic issuePermission errors, env setup failures

Lightweight Skill Effectiveness

PatternSignalImpactExample
Skill ignoredAgent rationalized skipping an applicable skillHigh — skill needs stronger triggersFresh-eyes applicable but agent went straight to commit
Skill partially followedAgent started skill process but shortcut stepsMedium — skill may be too heavyStarted TDD but skipped red-green-refactor cycle
Skill foughtAgent followed skill but produced poor resultsMedium — skill content needs revisionDoc audit ran but missed obvious false claims

Report Format

Generate docs/audits/SESSION_REFLECTION_YYYY-MM-DD.md:

# Session Reflection: YYYY-MM-DD
Mode: session | periodic (N days, M sessions)
Generated: YYYY-MM-DD | Commit: abc123

## Summary
| Metric | Count |
|--------|-------|
| Sessions analyzed | 1 or N |
| Patterns detected | X |
| High impact | X |
| Medium impact | X |

## Findings

### High Impact

#### 1. [Pattern Title]
**Category:** Agent Behavior | Workflow Gap | Skill Effectiveness
**Frequency:** N occurrences across M sessions
**Evidence:** [Specific examples from session data]
**Estimated cost:** ~Nk tokens wasted | ~N minutes lost per session

---

### Medium Impact
...

## Proposed Changes

### CLAUDE.md Updates
| # | Change | Rationale | Priority |
|---|--------|-----------|----------|
| 1 | Add section on X | Discovered 3 times | High |

#### Change 1: [Title]
**Add to:** CLAUDE.md > [section]
[exact text to add — copy-paste ready]

### New Skills
[complete skill content if applicable]

### New Slash Commands
[complete command content if applicable]

### Automation (scripts, hooks)
[complete script/hook content if applicable]

Key principle: All proposals are copy-paste ready with complete text/code. No vague "consider adding documentation about X."

Anti-Patterns

Anti-PatternWhy It's Wrong
Reading raw JSONL filesWill consume entire context budget — always use jq extraction
Auto-implementing changesProposals need human review — reflection without consent is noise
Shallow pattern matching"Read file 3 times" might be intentional (file changed) — check context
Reflecting mid-taskReflection is a distinct activity, not a sidebar — finish work first
Boiling the oceanPeriodic mode across 30 days will still be too much — default 7, max 14

Resistance Patterns

RationalizationReality
"This session went fine"Fine sessions still have patterns worth catching
"I already know what went wrong"Intuition misses frequency — you remember the big blocker, not the 5 small wastes
"I'll just remember for next time"You won't. Write it down or it's lost
"The improvements are too small to bother"500 tokens saved x 50 sessions = 25k tokens. Small compounds.
"I don't have time to reflect"10 minutes of reflection prevents 60 minutes of repeated mistakes

Detailed References

  • references/extraction-patterns.md — JSONL schema, jq extraction commands, session file discovery for periodic mode

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.