analyze
CommandAnalyze user corrections and log them into the error notebook
After the user triggers this command, run Learning Loop steps 4-8. Two phases: first half (review + organize) completes, then automatically continues to second half (re-analyze + trim + wrap up).
After the user triggers this command, run Learning Loop steps 4-8. Two phases: first half (review + organize) completes, then automatically continues to second half (re-analyze + trim + wrap up).
1. **Read project index**: Read `~/.claude/sessions/project-index.md`
2. **Read session summaries**: Based on the index, read the last 7 days of session records (max 10) 3. **Read pitfall records**: Scan `~/.claude/skills/learned/auto-pitfall-*.md` 4. **Read memory files**: Scan all `memory/*.md` files 5. **Tag each item** (read-only, don't edit yet):
Run each item through four questions before acting — don't merge mechanically:
6. **Merge duplicates**: Find duplicate paragraphs in memory/*.md, condense using Q2 7. **Update outdated**: Items tagged "outdated" — use Q1 to decide if they still serve the core workflow 8. **Relocate**: Move misplaced content to the correct HOOK file
Runs automatically after first half completes. No need for the user to trigger again.
9. **Analyze patterns** (using the cleaned-up data):
10. **Compare**: This analysis vs. the last /reflect conclusion (if one exists)
11. **List removal candidates**:
12. **Show the list to the user for review** 13. **After user confirms, mark as "pending removal"** — actual deletion happens next /reflect
14. **Report**:
15. **Save conclusion**: Save to `~/.claude/sessions/reflect-{date}.md`
=== Learning Loop Reflection Report ({date}) ===
--- First Half: Review + Organize ---
Project stats:
- X sessions in the last 7 days, most active: {project name}
- Most used tools: {list}
Memory health:
- Active: X items / Outdated: X / Duplicate: X
- Actions: merged X, updated X, relocated X
Pitfall stats:
- Internalized: X / Still relevant: X / Can remove: X
--- Second Half: Re-learn + Trim + Wrap up ---
Patterns found:
1. {pattern} -> Suggestion: {action}
Removal candidates (pending user confirmation):
- [ ] {item 1}
- [ ] {item 2}
Conclusion:
- Learned: {summary}
- Changed: {summary}
- Next cycle watch: {summary}
Suggested updates:
- [ ] CLAUDE.md: add {new rule}
- [ ] MEMORY.md: update {which HOOK}Claude Code 的記憶系統 | A memory system built with hooks + markdown. Zero dependencies.
Analyze user corrections and log them into the error notebook
Pause the SessionEnd auto-commit hook when refactoring core engine files.
Help decide when to use `/compact` based on the current conversation state.
Review the error notebook — flip through past corrections before working
Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.