Cross-session learning via the Reflexion pattern—extract insights from Claude Code sessions into persistent memory.
/plugin marketplace add jongwony/epistemic-protocols/plugin install reflexion@epistemic-protocolsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
examples/worked-example.mdreferences/alignment-lenses.mdreferences/category-criteria.mdreferences/workflow-detail.mdExtract insights from Claude Code sessions and integrate into appropriate memory scope through structured review.
Transform session experiences into persistent knowledge by:
Locate session file using one of:
~/.claude/projects/*/[session-id].jsonlSession files are JSONL format, often large (500KB+). Delegate analysis to subagent.
Invoke AskUserQuestion to select extraction mode:
Call Task tool with general-purpose subagent to analyze session:
Analyze session file at [path] to extract key insights.
Task:
1. Read session in chunks (use offset/limit for large files)
2. Identify main topics, problems solved, decisions made
3. Extract actionable insights valuable as User Memory entries
Output format per insight:
- Category: (e.g., Prompt Design, Workflow Pattern, Technical Decision)
- Insight: Clear, concise statement
- Context: How this insight emerged
- Suggested Memory Entry: Compact, reusable form
Focus on patterns and principles over implementation details.
Present extracted insights in table format:
| # | Category | Insight | Rationale | Target |
|---|---|---|---|---|
| 1 | Prompt Design | [insight] | [consequence-oriented: Prevents/Enables/Catches...] | design.md |
| 2 | Communication | [insight] | [consequence-oriented] | communication.md |
For each insight, identify:
Executor: Main agent (not subagent)
Rationale: Main agent has system prompt in context; subagents cannot introspect tool descriptions.
Process:
For each extracted insight, compare against known tool behavioral directives:
Check for redundancy (semantic equivalence with tool description)
Check for alignment (quick heuristic):
Output table:
| # | Insight | Redundancy | Alignment | Note |
|---|---------|------------|-----------|------|
| 1 | ... | REDUNDANT | - | TodoWrite already enforces |
| 2 | ... | - | ALIGNED | Reinforces delegation model |
| 3 | ... | - | NEUTRAL | Novel pattern, no conflict |
| 4 | ... | - | UNCLEAR | Uses different vocabulary |
For Pattern insights with Medium or Low confidence:
Only High-confidence patterns or user-confirmed patterns proceed to Phase 5. Low-confidence patterns are documented only, never applied.
Present flagged insights with:
Apply Memory Scope Design principle before location selection:
| Insight Characteristic | Recommended Location |
|---|---|
| Tool-agnostic principle | User memory (~/.claude/rules/) |
| Tool-specific implementation | Project memory (.claude/rules/) |
| Domain-specific (tool names, project paths) | Project memory |
| Universal pattern (applies to all projects) | User memory |
| Session-scoped (unvalidated, experimental) | Verbal acknowledgment only (no file write) |
Invoke AskUserQuestion with two questions:
Pre-populate recommendation based on Generalizability from Phase 3.
Invoke Syneidesis protocol during selection to surface:
Transition: Only proceed to Phase 5 after user confirms scope selection via AskUserQuestion.
For selected insights:
call for tool invocationsAfter integration, verify changes don't conflict with Claude Code system prompt.
Structure: Prothesis Specialization—mandatory baseline + optional extension.
Trigger: When any insight was applied (Phase 5 completed with edits).
Process:
Mandatory Baseline (always executed):
Optional Extension: Invoke AskUserQuestion to offer additional perspectives derived from applied changes context. User may proceed with baseline only.
Spawn parallel Task subagents for all selected lenses (baseline ∪ extension).
Synthesize results:
If issues found, invoke AskUserQuestion with recommended fixes.
For detailed lens definitions and subagent prompts, see references/alignment-lenses.md.
For deferred/rejected insights:
~/.claude/docs/insights/YYYY-MM-DD-[topic].md---
date: YYYY-MM-DD
project: -Users-[user]-[path]
session: [session-id]
source: ~/.claude/projects/[project]/[session].jsonl
---
| Category | Description | Typical Target | Default Scope |
|---|---|---|---|
| Prompt Design | LLM instruction patterns | design.md | User |
| Workflow Pattern | Multi-step procedures | delegation.md | User |
| Communication | Interaction patterns | communication.md | User |
| Technical Decision | Implementation choices | Project CLAUDE.md | Project |
| Tool Usage | Tool-specific patterns | preferences.md | User/Project* |
| Boundary | Safety/security rules | boundaries.md | User |
Default Scope provides initial recommendation; user decision in Phase 4 can override based on context.
*Tool Usage: User if tool-agnostic pattern, Project if tool-specific implementation.
Before applying insights, verify alignment with:
call > invoke > use for tool invocationsWhen insight conflicts with existing rule:
Apply insights that are:
Semantic overlap across different pragmatic encodings ≠ information redundancy.
Different encoding (statement → question, positive → negative framing) targets different cognitive pathways. Measure functional dependency, not surface similarity.
# Session file locations
~/.claude/projects/-Users-[user]-[path]/[session-id].jsonl
# Debug files (alternative source)
~/.claude/debug/[session-id].txt
# Todo snapshots
~/.claude/todos/[session-id]-*.json
references/workflow-detail.md - Extended workflow with examplesreferences/category-criteria.md - Detailed categorization guidelinesreferences/alignment-lenses.md - Phase 6 lens definitions and subagent promptsexamples/worked-example.md - Complete reflection workflow from session to integrated insightsCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.