reflect
Analyze ALM outcomes and corrections to update playbooks and retrain classifier.
Skill by sfw
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/sfw-reflect
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/reflect
What's inside
- Skill name
reflect- Description
- Analyze ALM outcomes and corrections to update playbooks and retrain classifier. Use when asked to reflect, improve, learn from past sessions, or when correction rates are high.
- License
- MIT
- Instructions
- 97 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# ALM Reflection
Analyze accumulated outcomes and corrections, update playbooks, and retrain the TF-IDF classifier.
## Instructions
You are orchestrating a reflection cycle. Follow these steps precisely:
### Step 1: Load State
Read `~/.claude/alm/state.json` and `~/.claude/alm/confidence.json` to understand current state.
### Step 2: Find Task Types Needing Reflection
Read all `.jsonl` files in `~/.claude/alm/evaluations/`. For each evaluation record, note its `taskType`. A task type needs reflection if:
- It has 5+ evaluations since the last reflection for that type (check `confidence.json[taskType].lastReflection`)
- OR it appears in `~/.claude/alm/reflect-queue.json`
If `$ARGUMENTS` specifies a task type, only reflect on that type. If "all" or empty, reflect on all eligible types.
### Step 3: For Each Task Type Needing Reflection
1. **Gather data:** Collect all evaluations for this type. Separate corrections (`correctionDetected: true`) from successes. Pay special attention to `correctionContext` fields (before/after pairs) and `learning` fields.
2. **Load current playbook:** Check `~/.claude/alm/playbooks/{task-type}.md` first. If not found, check `${CLAUDE_PLUGIN_ROOT}/seed-playbooks/{task-type}.md` for the seed version.
3. **Synthesize updated playbook:** Using your analysis capabilities:
- Identify recurring correction patterns (must appear 3+ times for promotion)
- Extract concrete anti-patterns from before/after pairs
- Preserve useful existing advice unless contradicted
- Keep under 800 tokens
- Write to `~/.claude/alm/playbooks/{task-type}.md`
4. **Update confidence:** After writing the playbook, update `~/.claude/alm/confidence.json` for this type:
- Set `lastReflection` to current ISO timestamp
- Set `source` to `"personalized"`
- Compute `correctionRateAtLastReflect` from recent evaluations
### Step 4: Cross-Type Pattern Detection
After processing individual types, scan ALL corrections across ALL types. If the same pattern appears in 3+ different task types (e.g., "user always wants terse commit messages"), extract it to `~/.claude/alm/playbooks/_global.md`. The `_global.md` playbook is always injected regardless of task classification.
### Step 5: Retrain TF-IDF Classifier
Run this command to retrain the classifier from all evaluations:
```bash
python3 -c "
import sys, os, json
sys.path.insert(0, os.path.expanduser('${CLAUDE_PLUGIN_ROOT}/scripts'))
from lib.tfidf import TFIDFClassifier
eval_dir = os.path.expanduser('~/.claude/alm/evaluations')
training_data = []
for fname in sorted(os.listdir(eval_dir)):
if not fname.endswith('.jsonl'):
continue
with open(os.path.join(eval_dir, fname)) as f:
for line in f:
line = line.strip()
if not line:
continue
try:
record = json.loads(line)
text = record.get('promptFingerprint', record.get('promptText', ''))
task_type = record.get('taskType', '')
if text and task_type and task_type not in ('trivial', 'unknown'):
training_data.append((text, task_type))
except json.JSONDecodeError:
continue
if len(training_data) >= 10:
classifier = TFIDFClassifier()
classifier.fit(training_data)
classifier.save(os.path.expanduser('~/.claude/alm/classifier/model.json'))
print(f'Trained TF-IDF model on {len(training_data)} examples across {len(classifier.task_types)} task types')
else:
print(f'Only {len(training_data)} training examples — need 10+ to train classifier')
"
```
### Step 6: Cleanup
1. Clear `~/.claude/alm/reflect-queue.json` (write `{}`)
2. Update `~/.claude/alm/state.json`: set `lastReflection` to current ISO timestamp
### Step 7: Report
Summarize what changed:
- Which task types were reflected on
- How many evaluations and corrections were analyzed per type
- Key patterns discovered
- Whether the TF-IDF classifier was trained/updated
- Any cross-type patterns extracted to `_global.md`
- Suggested next actionsFrom sfw/ALM, MIT.
More from sfw/ALM
- 0.406score
review
sfw
View and correct recent ALM evaluations.
SkillDFreshness: DClaude Code +9 - 0.404score
export
sfw
Export ALM playbooks as standalone markdown for sharing, version control, or manual editing.
SkillDFreshness: DClaude Code +9 - 0.404score
forget
sfw
Hard reset for a specific task type.
SkillDFreshness: DClaude Code +9 - 0.404score
reset
sfw
Nuclear option — clear all ALM learning data and start fresh.
SkillDFreshness: DClaude Code +9 - 0.404score
status
sfw
Show ALM learning progress dashboard with session counts, confidence scores, classifier status, and suggested actions.
SkillDFreshness: DClaude Code +9 - 0.399score
resume
sfw
Re-enable ALM evaluation and playbook injection after pausing.
SkillDFreshness: DClaude Code +9 - 0.396score
pause
sfw
Temporarily disable ALM evaluation and playbook injection.
SkillDFreshness: DClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Feb 7, 2026 (8 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/sfw/ALM
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from sfw
- 0.406score
review
sfw
View and correct recent ALM evaluations.
SkillDFreshness: DClaude Code +9 - 0.404score
export
sfw
Export ALM playbooks as standalone markdown for sharing, version control, or manual editing.
SkillDFreshness: DClaude Code +9 - 0.404score
forget
sfw
Hard reset for a specific task type.
SkillDFreshness: DClaude Code +9 - 0.404score
reset
sfw
Nuclear option — clear all ALM learning data and start fresh.
SkillDFreshness: DClaude Code +9 - 0.404score
status
sfw
Show ALM learning progress dashboard with session counts, confidence scores, classifier status, and suggested actions.
SkillDFreshness: DClaude Code +9 - 0.399score
resume
sfw
Re-enable ALM evaluation and playbook injection after pausing.
SkillDFreshness: DClaude Code +9
Cite this page
reflect skill. Agent Mart. https://agentmart.dev/skills/sfw-reflect (last updated 2026-10-24)