Skip to content

Commit 5a5fb1b

Browse files
committed
config: record learning M230 - all task work in worktree
Root cause: Workflow allowed parent STATE.md rollup updates to happen in main workspace after merge, causing separate commits requiring manual squash. Prevention: Updated work.md workflow to require parent STATE.md updates happen IN THE WORKTREE before merge/cleanup. Step 15 now precedes step 16 and includes explicit git commit --amend instruction. Correct behavior: All task-related changes (implementation + task STATE.md + parent STATE.md rollup) complete IN THE WORKTREE before merge.
1 parent de32fc7 commit 5a5fb1b

3 files changed

Lines changed: 65 additions & 15 deletions

File tree

.claude/cat/retrospectives/mistakes.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3010,6 +3010,33 @@
30103010
"catches_variations": true
30113011
},
30123012
"correct_behavior": "Squash all related commits (implementation + STATE.md updates) into a single commit BEFORE presenting the approval gate to user"
3013+
},
3014+
{
3015+
"id": "M230",
3016+
"timestamp": "2026-01-24T13:00:00Z",
3017+
"category": "protocol_violation",
3018+
"description": "Made plugin changes directly in main workspace instead of task worktree, causing separate commits that required manual squashing",
3019+
"root_cause": "Workflow allowed parent STATE.md rollup updates to happen in main workspace after merge, instead of requiring all changes happen in worktree before merge",
3020+
"rca_method": "A",
3021+
"rca_method_name": "5-whys",
3022+
"prevention_type": "skill",
3023+
"prevention_path": "${CLAUDE_PROJECT_DIR}/plugin/.claude/cat/workflows/work.md",
3024+
"pattern_keywords": [
3025+
"worktree",
3026+
"workspace",
3027+
"squash",
3028+
"STATE.md",
3029+
"merge"
3030+
],
3031+
"prevention_implemented": true,
3032+
"prevention_verified": false,
3033+
"recurrence_of": null,
3034+
"prevention_quality": {
3035+
"verification_type": "positive",
3036+
"fragility": "low",
3037+
"catches_variations": true
3038+
},
3039+
"correct_behavior": "Complete ALL task-related changes (implementation + task STATE.md + parent STATE.md rollup) IN THE WORKTREE before merge, ensuring single squashed commit"
30133040
}
30143041
]
30153042
}

.claude/cat/retrospectives/retrospectives.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"last_retrospective": "2026-01-23T19:15:39-05:00",
3-
"mistake_count_since_last": 1,
3+
"mistake_count_since_last": 2,
44
"config": {
55
"mistake_count_threshold": 10,
66
"trigger_interval_days": 7

plugin/.claude/cat/workflows/work.md

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -628,30 +628,27 @@ git push . "HEAD:${BASE_BRANCH}"
628628

629629
**Anti-pattern (M070):** Committing STATE.md update as separate "planning:" commit after merge.
630630

631-
### 15. Cleanup
631+
### 15. Update Parent State (Rollup Only) - IN WORKTREE
632632

633633
**Batched into Finalization subagent** - see Subagent Batching Standards above
634634

635-
```bash
636-
# MANDATORY: Return to main workspace before removing worktree
637-
cd /workspace
638-
pwd # Verify we're in main workspace (not worktree)
635+
**CRITICAL (M230): Parent STATE.md updates MUST happen IN THE WORKTREE before merge.**
639636

640-
# Task worktree and branch (subagent already cleaned in step 10)
641-
git worktree remove ../cat-worktree-{task-name}
642-
git branch -d {task-branch}
643-
```
637+
All related changes (implementation + task STATE.md + parent STATE.md rollup) must be committed
638+
together in the worktree. This ensures a single squashed commit contains all task-related updates.
644639

645-
### 16. Update Parent State (Rollup Only)
640+
**Still in task worktree** (NOT main workspace):
646641

647-
**Batched into Finalization subagent** - see Subagent Batching Standards above
648-
649-
**NOTE**: Minor version CHANGELOG.md was already updated in step 13 with the implementation commit.
642+
```bash
643+
pwd # Verify still in worktree: .worktrees/{task-branch}
644+
```
650645

651-
This step handles only:
646+
This step handles:
652647
1. Parent STATE.md progress rollup (minor/major)
653648
2. Major version CHANGELOG.md (if minor version completes)
654649

650+
**NOTE**: Minor version CHANGELOG.md was already updated in step 13 with the implementation commit.
651+
655652
**MANDATORY: Validate Before Marking Minor Version Complete (M150)**
656653

657654
Before setting a minor version's STATE.md to `status: completed`, verify all nested tasks are complete:
@@ -708,6 +705,32 @@ If CHANGELOG.md doesn't exist yet, create it using the template format with:
708705
- Empty Tasks Completed table with correct column order
709706
- Placeholder sections
710707

708+
**Commit parent STATE.md updates in worktree:**
709+
710+
```bash
711+
# Still in worktree - include parent STATE.md in the squashed commit
712+
git add .claude/cat/issues/v${MAJOR}/STATE.md
713+
git add .claude/cat/issues/v${MAJOR}/v${MAJOR}.${MINOR}/STATE.md
714+
git commit --amend --no-edit # Include in the same commit as implementation
715+
```
716+
717+
**Anti-pattern (M230):** Updating parent STATE.md AFTER merge in main workspace. This creates a
718+
separate commit that requires manual squashing.
719+
720+
### 16. Cleanup
721+
722+
**Batched into Finalization subagent** - see Subagent Batching Standards above
723+
724+
```bash
725+
# MANDATORY: Return to main workspace before removing worktree
726+
cd /workspace
727+
pwd # Verify we're in main workspace (not worktree)
728+
729+
# Task worktree and branch (subagent already cleaned in step 10)
730+
git worktree remove ../cat-worktree-{task-name}
731+
git branch -d {task-branch}
732+
```
733+
711734
## Error Recovery
712735

713736
### Subagent Failure

0 commit comments

Comments
 (0)