Extract learnings from user corrections in this session
Extracts learnable rules from user corrections during conversation.
/plugin marketplace add panayiotism/claude-harness/plugin install claude-harness@claude-harnessReflect on user corrections and extract learnable rules:
Arguments: $ARGUMENTS
Learn from user corrections. When a user explicitly corrects Claude's approach, that correction should be captured as a rule to prevent repeating the mistake.
Parse optional flags:
--auto: Skip interactive confirmation (for checkpoint integration)--dry-run: Show what would be extracted without saving--since="timestamp": Only analyze conversation since timestampRead .claude-harness/config.json for reflection settings:
reflection.enabled is trueautoApproveHighConfidence settingminConfidenceForAuto settingScan the current conversation for correction patterns:
Explicit corrections (high confidence):
Preference statements (medium confidence):
For each detected correction, extract:
Filter out non-learnable corrections:
Check for duplicates:
.claude-harness/memory/learned/rules.jsonCategorize each learning:
If not --auto mode, present each learning for user approval:
┌─────────────────────────────────────────────────────────────────┐
│ 📚 POTENTIAL RULE EXTRACTED │
├─────────────────────────────────────────────────────────────────┤
│ Title: {short actionable title} │
│ Category: {project-specific|general} | Confidence: {high|med} │
│ │
│ Source: "{user's original correction}" │
│ │
│ Description: │
│ {detailed explanation of what to do} │
│ │
│ Applies to: {file patterns or "all files"} │
│ │
│ Example: │
│ ✗ {incorrect}: {example of wrong way} │
│ ✓ {correct}: {example of right way} │
├─────────────────────────────────────────────────────────────────┤
│ [A]pprove [E]dit [R]eject [S]kip │
└─────────────────────────────────────────────────────────────────┘
Handle user response:
If --auto mode:
minConfidenceForAutoFor each approved rule:
rule-{NNN} (based on count of existing rules)createdAt, updatedAtactive: trueusageCount: 0Update rules file:
.claude-harness/memory/learned/rules.jsonrules arraymetadata:
totalRulesprojectSpecific or general countlastReflection to current timestamplastUpdatedDisplay reflection summary:
┌─────────────────────────────────────────────────────────────────┐
│ 📚 REFLECTION COMPLETE │
├─────────────────────────────────────────────────────────────────┤
│ Corrections analyzed: {count} │
│ Rules extracted: {count} │
│ Approved: {N} | Rejected: {N} | Skipped: {N} │
│ │
│ New rules: │
│ • rule-{NNN}: {title} │
│ • rule-{NNN}: {title} │
│ │
│ Total rules in memory: {total} │
└─────────────────────────────────────────────────────────────────┘
If --dry-run:
┌─────────────────────────────────────────────────────────────────┐
│ 📚 DRY RUN - No changes saved │
├─────────────────────────────────────────────────────────────────┤
│ Would extract {N} rules: │
│ • {title} (confidence: {level}) │
│ • {title} (confidence: {level}) │
│ │
│ Run without --dry-run to save these rules │
└─────────────────────────────────────────────────────────────────┘
If changes were made (not dry-run):
git add .claude-harness/memory/learned/rules.jsonDo NOT auto-commit. Let /checkpoint handle commits to include rules
in the same commit as other session work.
If reflection is disabled in config:
Reflection is disabled in config.json
Set reflection.enabled: true to enable
If no corrections detected:
┌─────────────────────────────────────────────────────────────────┐
│ 📚 NO CORRECTIONS DETECTED │
├─────────────────────────────────────────────────────────────────┤
│ No user corrections found in this session. │
│ │
│ Corrections are captured when you explicitly correct Claude: │
│ • "No, use X instead of Y" │
│ • "Always do X in this project" │
│ • "Our convention is..." │
└─────────────────────────────────────────────────────────────────┘
If rules file doesn't exist:
{
"id": "rule-001",
"title": "Always use absolute imports",
"description": "Use @/components/... instead of relative paths like ../../../",
"category": "project-specific",
"scope": "coding-style",
"confidence": "high",
"source": {
"type": "user-correction",
"timestamp": "2026-01-06T12:00:00Z",
"context": "User corrected import pattern in component file",
"conversationExcerpt": "Please use @/ imports, not relative paths"
},
"applicability": {
"filePatterns": ["*.ts", "*.tsx"],
"features": [],
"always": false
},
"examples": {
"correct": "import { Button } from '@/components/ui/Button'",
"incorrect": "import { Button } from '../../../components/ui/Button'"
},
"tags": ["imports", "typescript", "code-style"],
"active": true,
"usageCount": 0,
"lastApplied": null,
"createdAt": "2026-01-06T12:00:00Z",
"updatedAt": "2026-01-06T12:00:00Z"
}
/claude-harness:checkpoint to commit rules with your work/claude-harness:start/reflectReflect on previus response and output, based on Self-refinement framework for iterative improvement with complexity triage and verification