Install
openclaw skills install apply-learningsAnalyze Claude Code session history to extract learnings that would have been helpful if provided earlier, then persist them for future sessions. Use when the user asks to "apply learnings", "extract learnings", "what did we learn", "save session learnings", or "analyze session".
openclaw skills install apply-learningsAnalyze Claude Code session history to extract learnings that would have been helpful if provided earlier, then persist them for future sessions.
This skill performs comprehensive analysis of session transcripts to identify:
python3 ~/.claude/skills/apply-learnings/scripts/analyze_session.py --scope current
python3 ~/.claude/skills/apply-learnings/scripts/analyze_session.py --scope all
python3 ~/.claude/skills/apply-learnings/scripts/analyze_session.py --project /path/to/project
When the user invokes this skill:
Ask which scope to analyze:
Execute the analysis script:
python3 ~/.claude/skills/apply-learnings/scripts/analyze_session.py --scope <scope>
Present findings organized by category:
Conventions and idioms specific to the codebase/framework:
Where different concerns should be handled:
From the original tool-self-improver:
Information that would have helped earlier:
For each learning, determine the best destination. Do NOT put everything in CLAUDE.md — route to the most specific location:
| Destination | When to Use | Example |
|---|---|---|
| ~/.claude/MEMORY.md | Cross-machine context: SRE tools, key people, tool conventions — anything useful on both Mac AND devpods | SRE MCP session protocol, .env default paths, key people/Slack IDs |
| ~/.claude/CLAUDE.md | Cross-project behavioral rules, hard constraints, coding preferences | "Always use double quotes for SSH commands" |
| Existing skill reference | Learning directly relates to a specific skill's domain | Glue logger pattern → /verification references; rebase tips → /arh-pr-workflow |
| Project CLAUDE.md | Learning is specific to one project/repo | "This repo uses custom test helpers in pkg/testutil" |
| New skill | Learning represents a reusable workflow or substantial domain knowledge not covered by existing skills | A complete debugging workflow for a specific system |
Classification rules:
~/.claude/MEMORY.md (synced via TerraBlob to all machines)~/.claude/skills/ — if a learning fits an existing skill, add it as a reference file or append to existing referencesCLAUDE.md (at repo root or ~/.claude/projects/)~/.claude/CLAUDE.mdPresent findings grouped by destination using AskUserQuestion:
I've identified the following learnings and where they should go:
**→ ~/.claude/CLAUDE.md** (global)
- [learning 1]
- [learning 2]
**→ ~/.claude/skills/verification/references/** (existing skill)
- [learning 3: web-code specific lint pattern]
**→ ~/.claude/skills/arh-pr-workflow/references/** (existing skill)
- [learning 4: rebase conflict resolution tip]
**→ ./CLAUDE.md** (this project only)
- [learning 5: project-specific convention]
**→ New skill: `debug-m3`** (proposed)
- [learning 6, 7, 8: related M3 debugging workflow]
Then ask user per destination group:
For each approved group:
references/learnings.md file in that skill's directory. Use ## Auto-learned (YYYY-MM-DD) header.~/.claude/skills/<name>/SKILL.md with proper structure (description, when to use, the learned workflow/knowledge).is_error: true**Logger usage:**
- Use `ctx.Logger()` from the glue context instead of injecting logger via DI
- The context logger automatically includes request tracing
**Mapper conventions:**
- Mappers should only do type conversion, no business logic
- Return errors for invalid conversions, not validation errors
**Validation at edges:**
- Validate request payloads in handler layer (mapper or validation package)
- Controllers receive pre-validated entities
- Gateway responses should be validated/transformed at gateway layer
**BUILD.bazel:**
- Run `gazelle <directory>` after adding new imports
- Never run `bazel build //...` from root
**Testing:**
- Use table-driven tests
- Mocks generated with `mockgen` or `bin/glue mock`