session-learning
This skill should be used when the user asks about "session learning", "learn from session", "improve future sessions", "session reflection", "session metrics", "session analysis", "/session-reflect", "req learning", "learning updates", "rollback learning", or wants to understand how Claude Code can get smarter over time by learning from sessions.
What this skill does
# Session Learning Guide
The session learning system helps Claude Code improve over time by analyzing your sessions and suggesting updates to memories, skills, and commands.
## Quick Start
### Enable Session Learning
Add to your `.claude/requirements.yaml` or `.claude/requirements.local.yaml`:
```yaml
hooks:
session_learning:
enabled: true
prompt_on_stop: true # Prompts for review when ending session
```
### Review a Session
```bash
/session-reflect # Full analysis with recommendations
/session-reflect quick # Quick summary statistics
/session-reflect analyze-only # Analysis without applying changes
```
### Manage Learning
```bash
req learning stats # Show learning statistics
req learning list # List recent updates
req learning rollback 3 # Undo update #3
req learning disable # Disable learning for this project
```
## How It Works
### 1. Data Collection
During your session, the framework collects metrics:
- **Tool usage**: Which tools you use, how often, which files
- **Requirement flow**: What gets blocked, how long to satisfy
- **Errors**: What errors occur and how they're resolved
- **Skills/Agents**: Which skills and agents you run
Metrics are stored in `.git/requirements/sessions/<session_id>.json`.
### 2. Pattern Analysis
When you run `/session-reflect`, the session-analyzer agent looks for:
- **Workflow patterns**: Common sequences, TDD cycles, etc.
- **Friction points**: High time-to-satisfy, repeated blocks
- **Knowledge gaps**: Repeated lookups, error patterns
- **Automation opportunities**: Manual steps that could be automated
### 3. Recommendations
Based on analysis, the system suggests:
- **Memory updates**: Add project conventions to Serena memories
- **Skill updates**: Improve trigger patterns
- **Command updates**: Add frequently used arguments
Each recommendation has a confidence score (0-1).
### 4. User Approval
You review and select which recommendations to apply. All changes are:
- Recorded in `.git/requirements/learning_history.json`
- Rollback-capable via `req learning rollback`
- Version-controlled (memories in `.serena/memories/`)
## Configuration Options
```yaml
hooks:
session_learning:
enabled: true # Enable the learning system
prompt_on_stop: true # Show review prompt when session ends
min_tool_uses: 5 # Minimum activity before prompting
max_recommendations: 5 # Max recommendations per session
confidence_threshold: 0.7 # Only show high-confidence items
update_targets:
- memories # .serena/memories/ files
- skills # Plugin skill files
- commands # Plugin command files
```
## Example Session Flow
```
1. You work normally through a session...
2. When ending the session, Stop hook prompts:
"Session had 47 tool uses. Review for learning?
Run /session-reflect to analyze and improve future sessions."
3. You run /session-reflect
4. Analyzer detects patterns:
- TDD Workflow (HIGH confidence)
- Repeated ADR lookup (MEDIUM confidence)
- Useful command pattern (MEDIUM confidence)
5. You select which to apply
6. Updates are written with version tracking:
- .serena/memories/workflow-patterns.md (appended)
- .serena/memories/frequently-referenced.md (created)
7. Next session benefits from these learnings
```
## Best Practices
1. **Run at end of productive sessions** - More data = better patterns
2. **Use `analyze-only` first** - Preview before committing
3. **Review confidence scores** - Higher = more reliable
4. **Check learning stats** - Track what's been learned over time
5. **Rollback if needed** - `req learning rollback` reverses mistakes
## Troubleshooting
### No session metrics found
```bash
# Check if metrics directory exists
ls -la .git/requirements/sessions/
# Sessions are collected automatically when framework is enabled
# Run some commands first, then try again
```
### Learning not prompting at session end
Check configuration:
```yaml
hooks:
session_learning:
enabled: true # Must be true
prompt_on_stop: true # Must be true
min_tool_uses: 5 # Session must have at least this many tool uses
```
### Rollback not available
Some updates (like creates) don't have previous content to restore.
Use git to restore:
```bash
git checkout -- .serena/memories/filename.md
```
## Process Skill Recommendations
The session analyzer may recommend process skills based on session patterns:
| Session Pattern | Recommended Skill |
|----------------|-------------------|
| High test failures | `systematic-debugging` |
| Code before tests | `test-driven-development` |
| Multiple plan revisions | `brainstorming` |
| Incomplete verification | `verification-before-completion` |
| Sequential independent tasks | `dispatching-parallel-agents` |
## Related Commands
| Command | Description |
|---------|-------------|
| `/session-reflect` | Analyze session and apply learning |
| `req learning stats` | Show learning statistics |
| `req learning list` | List recent updates |
| `req learning rollback <id>` | Undo a specific update |
| `req learning disable` | Disable learning for project |
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.