From alm
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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/alm:reflectThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyze accumulated outcomes and corrections, update playbooks, and retrain the TF-IDF classifier.
Analyze accumulated outcomes and corrections, update playbooks, and retrain the TF-IDF classifier.
You are orchestrating a reflection cycle. Follow these steps precisely:
Read ~/.claude/alm/state.json and ~/.claude/alm/confidence.json to understand current state.
Read all .jsonl files in ~/.claude/alm/evaluations/. For each evaluation record, note its taskType. A task type needs reflection if:
confidence.json[taskType].lastReflection)~/.claude/alm/reflect-queue.jsonIf $ARGUMENTS specifies a task type, only reflect on that type. If "all" or empty, reflect on all eligible types.
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.
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.
Synthesize updated playbook: Using your analysis capabilities:
~/.claude/alm/playbooks/{task-type}.mdUpdate confidence: After writing the playbook, update ~/.claude/alm/confidence.json for this type:
lastReflection to current ISO timestampsource to "personalized"correctionRateAtLastReflect from recent evaluationsAfter 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.
Run this command to retrain the classifier from all evaluations:
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')
"
~/.claude/alm/reflect-queue.json (write {})~/.claude/alm/state.json: set lastReflection to current ISO timestampSummarize what changed:
_global.mdnpx claudepluginhub sfw/alm --plugin almExtracts session patterns into reusable learnings with analyze, review, and list modes. Manages .orchestrator/metrics/learnings.jsonl.
Analyzes Claude Code sessions to improve CLAUDE.md instructions and capture learnings. Quick mode suggests CLAUDE.md tweaks; deep mode reviews problems, patterns, preferences, and gaps.
Analyzes session history via ccrecall.db or in-context to extract learnings from corrections, discoveries, and failures, then proposes persistent skill updates. Invoke /reflect post-session.