@kodevibe/harness 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ko.md +351 -0
- package/README.md +314 -0
- package/bin/cli.js +4 -0
- package/harness/agent-memory/architect.md +42 -0
- package/harness/agent-memory/planner.md +47 -0
- package/harness/agent-memory/reviewer.md +46 -0
- package/harness/agent-memory/sprint-manager.md +49 -0
- package/harness/agents/architect.md +177 -0
- package/harness/agents/planner.md +320 -0
- package/harness/agents/reviewer.md +273 -0
- package/harness/agents/sprint-manager.md +250 -0
- package/harness/core-rules.md +136 -0
- package/harness/dependency-map.md +58 -0
- package/harness/failure-patterns.md +63 -0
- package/harness/features.md +53 -0
- package/harness/project-brief.md +145 -0
- package/harness/project-state.md +85 -0
- package/harness/skills/bootstrap.md +326 -0
- package/harness/skills/code-review-pr.md +141 -0
- package/harness/skills/deployment.md +144 -0
- package/harness/skills/feature-breakdown.md +136 -0
- package/harness/skills/impact-analysis.md +110 -0
- package/harness/skills/investigate.md +172 -0
- package/harness/skills/learn.md +308 -0
- package/harness/skills/pivot.md +171 -0
- package/harness/skills/security-checklist.md +101 -0
- package/harness/skills/test-integrity.md +94 -0
- package/package.json +53 -0
- package/src/init.js +772 -0
- package/templates/agent.template.md +56 -0
- package/templates/skill.template.md +54 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Feature Breakdown
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Decompose a feature into implementation tasks ordered by dependency.
|
|
6
|
+
Ensures bottom-up implementation: foundations first, then layers that depend on them.
|
|
7
|
+
|
|
8
|
+
## Invoked By
|
|
9
|
+
|
|
10
|
+
- **planner** agent — Step 8: Create ordered task list for new features
|
|
11
|
+
- **architect** agent — when structural validation requires task decomposition review
|
|
12
|
+
|
|
13
|
+
> **Note**: feature-breakdown is responsible for task decomposition only. It does NOT invoke `impact-analysis`. The planner calls both skills independently: feature-breakdown (Step 8) for task ordering, then impact-analysis (Step 9) for blast radius analysis.
|
|
14
|
+
|
|
15
|
+
## When to Apply
|
|
16
|
+
|
|
17
|
+
- Starting a new feature or Story
|
|
18
|
+
- A feature touches 3+ modules
|
|
19
|
+
- Unsure which module to build first
|
|
20
|
+
- After the Planner agent creates a high-level plan
|
|
21
|
+
|
|
22
|
+
## Procedure
|
|
23
|
+
|
|
24
|
+
1. **Describe the feature** in one sentence
|
|
25
|
+
2. **Read docs/project-brief.md** — verify the feature aligns with Goals and does not violate Non-Goals. If project-brief.md is empty (bootstrap hasn't run), skip this check but warn the user. If it conflicts with Non-Goals, **stop and warn the user** before proceeding. (Direction Guard — prevents breakdown of out-of-scope features even when invoked directly without planner)
|
|
26
|
+
3. **Read docs/dependency-map.md** to understand current module relationships
|
|
27
|
+
4. **Identify affected modules**: List every module that needs changes
|
|
28
|
+
5. **Classify changes per module**:
|
|
29
|
+
- NEW_MODULE: Entirely new module to create
|
|
30
|
+
- INTERFACE_CHANGE: Existing module's public interface changes
|
|
31
|
+
- INTERNAL_CHANGE: Only internal implementation changes
|
|
32
|
+
- TEST_ONLY: Only test updates needed
|
|
33
|
+
6. **Build dependency order**:
|
|
34
|
+
- List modules topologically: modules with zero dependencies first, then modules depending on first layer, etc.
|
|
35
|
+
- Example: Module A (no deps) → Module B (depends A) → Module C (depends A, B)
|
|
36
|
+
- Group into implementation waves (parallel-safe batches)
|
|
37
|
+
7. **Create task sequence**: Convert waves into numbered tasks
|
|
38
|
+
8. **Annotate each task** with:
|
|
39
|
+
- Module name
|
|
40
|
+
- Change type (from step 5)
|
|
41
|
+
- Files to create/modify
|
|
42
|
+
- Tests to write
|
|
43
|
+
- Dependency (which prior task must finish first)
|
|
44
|
+
- ⚠️ Relevant failure patterns (check docs/failure-patterns.md)
|
|
45
|
+
|
|
46
|
+
## Output Format
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## Feature: [one-sentence description]
|
|
50
|
+
|
|
51
|
+
### Wave 1 (no dependencies)
|
|
52
|
+
- [ ] Task 1: [Module A] — Create entity + repository interface
|
|
53
|
+
- Files: <!-- list files to create/modify -->
|
|
54
|
+
- Tests: <!-- list test files -->
|
|
55
|
+
- Depends on: none
|
|
56
|
+
|
|
57
|
+
### Wave 2 (depends on Wave 1)
|
|
58
|
+
- [ ] Task 2: [Module B] — Implement use case
|
|
59
|
+
- Files: <!-- list files to create/modify -->
|
|
60
|
+
- Tests: <!-- list test files -->
|
|
61
|
+
- Depends on: Task 1
|
|
62
|
+
|
|
63
|
+
### Wave 3 (depends on Wave 2)
|
|
64
|
+
- [ ] Task 3: [Module C] — Add API endpoint / UI integration
|
|
65
|
+
- Files: <!-- list files to create/modify -->
|
|
66
|
+
- Tests: <!-- list test files -->
|
|
67
|
+
- Depends on: Task 2
|
|
68
|
+
|
|
69
|
+
### Dependency Map Updates
|
|
70
|
+
- [ ] Register Module A in docs/dependency-map.md
|
|
71
|
+
- [ ] Update Module B's "Depends On" column
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Rules
|
|
75
|
+
|
|
76
|
+
- Never implement a module before its dependencies exist
|
|
77
|
+
- Each task should be completable in one session
|
|
78
|
+
- Every task must include its test files
|
|
79
|
+
- New modules MUST be registered in docs/dependency-map.md (Iron Law #6) — the breakdown OUTPUT section lists these registrations, and planner (or the user, if invoked directly) is responsible for executing the actual state file writes
|
|
80
|
+
- If a task exceeds Story scope, stop and report to user
|
|
81
|
+
|
|
82
|
+
## State File Updates (mandatory — Step 9)
|
|
83
|
+
|
|
84
|
+
After completing the breakdown, update these files in the same session:
|
|
85
|
+
|
|
86
|
+
- [ ] **docs/dependency-map.md**: Register all NEW_MODULE entries. Update "Depends On" / "Depended By" for INTERFACE_CHANGE entries.
|
|
87
|
+
- [ ] **docs/features.md**: Add a new row for the feature with Status `🔧 active`, Key Files from Wave tasks, and Test Files.
|
|
88
|
+
- [ ] **docs/project-state.md**: Add Stories to the Story Status table for each Wave.
|
|
89
|
+
|
|
90
|
+
### 🧭 Navigation — After Feature Breakdown
|
|
91
|
+
|
|
92
|
+
Feature-breakdown is invoked BY planner (Step 8), so the 🧭 returns control to planner's flow.
|
|
93
|
+
If invoked directly by the user, append:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
---
|
|
97
|
+
🧭 Next Step
|
|
98
|
+
→ Next: `planner`
|
|
99
|
+
→ Prompt: "breakdown을 기반으로 Sprint Story를 생성해줘"
|
|
100
|
+
→ Why: Tasks are defined — planner will register Stories and update state files
|
|
101
|
+
→ Pipeline: 🟢 Step 2/6 (returns to planner)
|
|
102
|
+
---
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Anti-patterns
|
|
106
|
+
|
|
107
|
+
| Anti-pattern | Correct Approach |
|
|
108
|
+
|---|---|
|
|
109
|
+
| Start from UI, work backward | Start from domain, work forward |
|
|
110
|
+
| One giant task for the whole feature | Break into single-module tasks |
|
|
111
|
+
| Skip dependency-map registration | Register immediately when creating module |
|
|
112
|
+
| Tests "later" | Tests in the same task |
|
|
113
|
+
| Produce breakdown but skip state file updates | State file updates are part of the breakdown, not a separate step |
|
|
114
|
+
|
|
115
|
+
## Related Failure Patterns
|
|
116
|
+
|
|
117
|
+
- FP-001: Interface changed, mock not updated → When creating tasks that modify interfaces, include "Update mock" as an explicit sub-task
|
|
118
|
+
- FP-002: Type confusion → When annotating tasks, specify expected types for new interfaces
|
|
119
|
+
- FP-003: Scope drift → If the breakdown exceeds the current Story scope, stop and report
|
|
120
|
+
|
|
121
|
+
<!-- TEAM_MODE_START -->
|
|
122
|
+
## Team Mode: Feature Breakdown
|
|
123
|
+
|
|
124
|
+
### Pre-Pull
|
|
125
|
+
Before updating shared state files, run `git pull` on the default branch to get the latest docs/features.md and docs/dependency-map.md (per project-brief.md → Key Technical Decisions; default: main).
|
|
126
|
+
|
|
127
|
+
### Owner Assignment
|
|
128
|
+
- When adding new rows to docs/features.md, set the Owner column to your name
|
|
129
|
+
- When adding new modules to docs/dependency-map.md, set the Owner column to your name
|
|
130
|
+
- Do NOT modify rows owned by other developers — if there is a dependency, note it in your task description instead
|
|
131
|
+
|
|
132
|
+
### Cross-Developer Dependencies
|
|
133
|
+
If your feature depends on a module owned by another developer:
|
|
134
|
+
1. Note the dependency in the task description (e.g., "Depends on [module] owned by [dev]")
|
|
135
|
+
2. Coordinate with the module owner before implementation
|
|
136
|
+
<!-- TEAM_MODE_END -->
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Impact Analysis
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Before modifying any module, trace all affected modules to prevent cascade failures.
|
|
6
|
+
The most common cause of regressions in growing projects is changing one module without updating its dependents.
|
|
7
|
+
|
|
8
|
+
## Invoked By
|
|
9
|
+
|
|
10
|
+
- **planner** agent — Step 10: for each existing module being modified
|
|
11
|
+
- **reviewer** agent — Step 7: when interface changes affect 2+ dependent modules
|
|
12
|
+
- **architect** agent — when structural validation requires blast radius analysis
|
|
13
|
+
|
|
14
|
+
## When to Apply
|
|
15
|
+
|
|
16
|
+
- Adding, removing, or changing a module's public interface
|
|
17
|
+
- Modifying shared types, entities, or DTOs
|
|
18
|
+
- Refactoring that touches more than 2 files
|
|
19
|
+
- When a test fails in a module you didn't directly change
|
|
20
|
+
|
|
21
|
+
## Procedure
|
|
22
|
+
|
|
23
|
+
1. **Identify the target module**: Which module are you about to change?
|
|
24
|
+
2. **Read docs/dependency-map.md**: Find the target module's row
|
|
25
|
+
3. **Read docs/failure-patterns.md**: Check if any active patterns (FP-001, FP-002, etc.) apply to the target module or change type. If FP-001 frequency > 0, flag mock updates as mandatory in step 6.
|
|
26
|
+
4. **List dependents**: Read the "Depended By" column — these are the blast radius
|
|
27
|
+
5. **Read docs/features.md**: Identify which features include the target module in their Key Files column. These features may need status or Key Files updates.
|
|
28
|
+
6. **Check interface impact**: Does your change affect the module's public interface?
|
|
29
|
+
- If NO (internal-only change) → proceed, but still run dependent tests
|
|
30
|
+
- If YES → continue to step 7
|
|
31
|
+
7. **Trace each dependent** (direct dependents only):
|
|
32
|
+
- List files in each dependent module that import from the target
|
|
33
|
+
- Identify which functions/types they use
|
|
34
|
+
- Determine if the interface change breaks them
|
|
35
|
+
- Note: Transitive dependents (modules importing from a dependent, not the target) are not traced here. Check them later if direct dependent interfaces also change.
|
|
36
|
+
8. **Plan updates**: Create a task list of all files that need modification
|
|
37
|
+
9. **Verify scope**: Confirm all files are within the current Story scope (docs/project-state.md)
|
|
38
|
+
|
|
39
|
+
## Checklist
|
|
40
|
+
|
|
41
|
+
- [ ] Target module identified in docs/dependency-map.md
|
|
42
|
+
- [ ] docs/failure-patterns.md checked for active patterns
|
|
43
|
+
- [ ] All dependent modules listed
|
|
44
|
+
- [ ] Affected features identified from docs/features.md
|
|
45
|
+
- [ ] Interface vs internal change classified
|
|
46
|
+
- [ ] Files importing from target module enumerated
|
|
47
|
+
- [ ] Mock/test updates planned for each dependent (FP-001)
|
|
48
|
+
- [ ] All changes within current Story scope
|
|
49
|
+
- [ ] Escalated to user if scope exceeds current Story
|
|
50
|
+
|
|
51
|
+
## Example
|
|
52
|
+
|
|
53
|
+
### Good
|
|
54
|
+
```
|
|
55
|
+
Target: auth module
|
|
56
|
+
Change: Added `resetPassword(email: string): Promise<void>`
|
|
57
|
+
Dependents: api, admin
|
|
58
|
+
Impact:
|
|
59
|
+
- api/routes/auth.ts imports AuthService → needs new route
|
|
60
|
+
- admin/controllers/user.ts imports AuthService → needs admin endpoint
|
|
61
|
+
- tests/__mocks__/AuthService.ts → needs new mock method
|
|
62
|
+
Plan: 4 files to update, all within S3-2 scope
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Bad
|
|
66
|
+
```
|
|
67
|
+
"I'll just add this method and see what breaks."
|
|
68
|
+
→ Tests fail in 3 modules, mock out of sync, 2 hours wasted
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## State File Updates (mandatory)
|
|
72
|
+
|
|
73
|
+
After completing the analysis, update these files:
|
|
74
|
+
|
|
75
|
+
- [ ] **docs/dependency-map.md**: Update the Interface Change Log table with: Date, Module, Change description, Affected Modules, Status ("In Progress" until all dependents updated, then "Updated"). **This is mandatory for ALL interface changes** — do not skip even if the change seems minor. **Status transition**: impact-analysis sets the initial status to "In Progress". After all dependent modules are verified updated (by reviewer Step 7 or test-integrity), update Status to "Updated".
|
|
76
|
+
- [ ] **docs/features.md**: If the interface change affects a feature's Key Files, update the Key Files column. If test files change, update the Test Files column.
|
|
77
|
+
- [ ] **docs/project-state.md**: If scope exceeds current Story, add a note to Recent Changes.
|
|
78
|
+
|
|
79
|
+
### 🧭 Navigation — After Impact Analysis
|
|
80
|
+
|
|
81
|
+
Impact-analysis is invoked BY `planner` (Step 9) or `reviewer` (Step 7). After completion, control returns to the caller's flow.
|
|
82
|
+
If invoked directly by the user, append:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
---
|
|
86
|
+
🧭 Next Step
|
|
87
|
+
→ Next: `planner` or `reviewer`
|
|
88
|
+
→ Prompt: "영향도 분석 결과를 반영해줘"
|
|
89
|
+
→ Why: Blast radius mapped — incorporate into plan or review
|
|
90
|
+
→ Pipeline: N/A (utility skill — invoked by planner Step 9 or reviewer Step 7)
|
|
91
|
+
---
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Related Failure Patterns
|
|
95
|
+
|
|
96
|
+
- FP-001: Interface changed, mock not updated → Checklist item 7 (mock/test updates planned)
|
|
97
|
+
- FP-002: Type confusion across modules → Step 7 (trace each dependent, verify types)
|
|
98
|
+
|
|
99
|
+
<!-- TEAM_MODE_START -->
|
|
100
|
+
## Team Mode: Impact Analysis
|
|
101
|
+
|
|
102
|
+
### Owner-Aware Blast Radius
|
|
103
|
+
- When listing affected modules from docs/dependency-map.md, check the Owner column
|
|
104
|
+
- If a dependent module is owned by another developer, the blast radius extends to their scope
|
|
105
|
+
- Flag cross-owner impacts: "⚠️ Module [X] owned by [dev] will be affected"
|
|
106
|
+
|
|
107
|
+
### Notification
|
|
108
|
+
- For interface changes affecting modules owned by other developers, **list them explicitly** in the analysis output
|
|
109
|
+
- Recommend notifying affected module owners before proceeding with changes
|
|
110
|
+
<!-- TEAM_MODE_END -->
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# Investigate
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Debug bugs systematically. Prevent "symptom patching" — fixing without understanding root cause.
|
|
6
|
+
4-phase debugging process inspired by gstack's /investigate.
|
|
7
|
+
|
|
8
|
+
## Invoked By
|
|
9
|
+
|
|
10
|
+
- **User** (direct) — "이 버그 조사해줘", "왜 실패하는지 찾아줘"
|
|
11
|
+
- **sprint-manager** — bug blocking progress 시 권장
|
|
12
|
+
- **core-rules** (3-Failure Stop) → investigate Recalculating Mode
|
|
13
|
+
|
|
14
|
+
## When to Apply
|
|
15
|
+
|
|
16
|
+
- Test failures with unclear cause
|
|
17
|
+
- Runtime errors
|
|
18
|
+
- Regression bugs ("it worked yesterday")
|
|
19
|
+
- Unexplained behavior
|
|
20
|
+
|
|
21
|
+
### Edge Case: No Reproducible Error
|
|
22
|
+
|
|
23
|
+
If the user reports "weird behavior" but there is no error message or stack trace:
|
|
24
|
+
1. Ask the user to clarify: (A) Performance issue? (B) Logic error — show expected vs actual output? (C) Intermittent/race condition?
|
|
25
|
+
2. For (A): Profile or add timing logs, then proceed to Phase 1 with timing data as "evidence"
|
|
26
|
+
3. For (B): Use expected vs actual output as the error evidence for Phase 1
|
|
27
|
+
4. For (C): Add logging to capture the intermittent state, attempt reproduction 3 times before escalating.
|
|
28
|
+
**Async race condition example**:
|
|
29
|
+
```
|
|
30
|
+
Evidence: "Data shows stale value intermittently (1 in 5 runs)"
|
|
31
|
+
Logging: Add timestamp + thread/event-loop ID at read/write points
|
|
32
|
+
Reproduction: Run 5 times with logging enabled
|
|
33
|
+
If reproduced: capture the interleaving sequence → Phase 2
|
|
34
|
+
If not reproduced after 5 attempts: escalate to user with collected logs
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Procedure
|
|
38
|
+
|
|
39
|
+
### Phase 1: Evidence Collection (NO FIXES)
|
|
40
|
+
|
|
41
|
+
> **failure-patterns.md responsibility**: investigate READS patterns (Phase 1) to see if this is a known bug, and WRITES updates (Phase 4) to record new patterns. The `reviewer` agent only READS patterns (Step 5) as a warning check. The `learn` skill WRITES patterns only for failures NOT already recorded by investigate in the same session.
|
|
42
|
+
|
|
43
|
+
1. Record the full error message (first 500 chars) and top 5-10 stack frames
|
|
44
|
+
2. Trace the code path backwards from the error
|
|
45
|
+
3. Check recent changes: `git log --oneline -20 -- <related files>`
|
|
46
|
+
4. Verify the bug is reproducible
|
|
47
|
+
|
|
48
|
+
**Do NOT modify code in this phase.**
|
|
49
|
+
|
|
50
|
+
### Phase 2: Scope Lock
|
|
51
|
+
|
|
52
|
+
1. Identify the module/directory containing the root cause
|
|
53
|
+
2. **Read docs/dependency-map.md**: Find the target module's row. Check "Depended By" column to understand which other modules might be affected by the same root cause or by your fix.
|
|
54
|
+
3. **Read docs/project-state.md**: Verify the fix scope is within the current Story scope. If the root cause is in a module outside the current Story, **STOP and ask the user**: (1) expand scope to include the module, or (2) report to the module owner. Do not proceed without user approval (Iron Law #3: Scope Compliance).
|
|
55
|
+
4. Exclude files outside that scope from modification
|
|
56
|
+
5. Check docs/failure-patterns.md for matching patterns
|
|
57
|
+
|
|
58
|
+
### Phase 3: Hypothesis + Fix
|
|
59
|
+
|
|
60
|
+
1. State the root cause hypothesis:
|
|
61
|
+
- **Simple bugs**: One sentence is sufficient (e.g., "findById returns null but no null check exists")
|
|
62
|
+
- **Complex bugs** (race conditions, multi-module cascades): One-sentence SUMMARY followed by supporting context (reproduction steps, timing data, affected modules). Max 5 lines total.
|
|
63
|
+
2. Implement the minimal fix based on the hypothesis
|
|
64
|
+
3. Verify the fix does not break existing tests
|
|
65
|
+
|
|
66
|
+
### Phase 4: Verify + Record
|
|
67
|
+
|
|
68
|
+
1. Run all related tests after the fix
|
|
69
|
+
2. Add a regression test (prevent the same bug from recurring)
|
|
70
|
+
3. Decide if the pattern should be recorded in docs/failure-patterns.md
|
|
71
|
+
|
|
72
|
+
## Checklist
|
|
73
|
+
|
|
74
|
+
- [ ] Root cause hypothesis is stated explicitly
|
|
75
|
+
- [ ] Did NOT skip Phase 1 (evidence collection) and jump straight to fixing
|
|
76
|
+
- [ ] docs/dependency-map.md consulted for blast radius understanding
|
|
77
|
+
- [ ] Fix scope verified against current Story in docs/project-state.md
|
|
78
|
+
- [ ] Fix scope is limited to the problem's scope
|
|
79
|
+
- [ ] All related tests pass after the fix
|
|
80
|
+
- [ ] Regression test is added
|
|
81
|
+
- [ ] Escalated to user after 3 failed attempts
|
|
82
|
+
|
|
83
|
+
## Example
|
|
84
|
+
|
|
85
|
+
### Good
|
|
86
|
+
```
|
|
87
|
+
Phase 1: TypeError: Cannot read property 'id' of undefined at UserService.ts:45
|
|
88
|
+
Phase 2: Scope → src/application/services/UserService.ts, src/domain/entities/User.ts
|
|
89
|
+
Phase 3: Hypothesis — findById returns null but no null check exists
|
|
90
|
+
Fix — add null guard at UserService.ts:44
|
|
91
|
+
Phase 4: Tests pass, null case test added
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Bad
|
|
95
|
+
```
|
|
96
|
+
"Error occurred so I added an if statement."
|
|
97
|
+
→ Root cause unknown, no reproduction conditions recorded, same error possible elsewhere
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## State File Updates (mandatory)
|
|
101
|
+
|
|
102
|
+
After the fix is verified (Phase 4):
|
|
103
|
+
|
|
104
|
+
- [ ] **docs/failure-patterns.md**: If the root cause is a repeatable pattern, add a new FP-NNN entry or increment the Frequency of an existing one. Increment Frequency if the ROOT CAUSE is the same (e.g., all SQL injection bugs = same FP-NNN regardless of which module). Different root causes = different patterns. This is NOT optional. **Note**: When investigate updates failure-patterns.md here, the `learn` skill (Step 3) will skip re-incrementing this same pattern for this session to avoid double-counting.
|
|
105
|
+
- [ ] **docs/project-state.md**: Add the fix to Recent Changes with the root cause hypothesis.
|
|
106
|
+
|
|
107
|
+
## Recalculating Mode (invoked by 3-Failure Stop)
|
|
108
|
+
|
|
109
|
+
When investigate is triggered by another skill/agent's 3-Failure Stop (not by a user-reported bug):
|
|
110
|
+
|
|
111
|
+
**Required input**: The caller MUST provide a failure context summary:
|
|
112
|
+
```
|
|
113
|
+
[Recalculating Mode]
|
|
114
|
+
Failed Attempt 1: [approach] → [error message]
|
|
115
|
+
Failed Attempt 2: [approach] → [error message]
|
|
116
|
+
Failed Attempt 3: [approach] → [error message]
|
|
117
|
+
```
|
|
118
|
+
This input is mandatory — if not provided, ask the caller to supply it before proceeding.
|
|
119
|
+
|
|
120
|
+
1. **Read the failure context first** — understand what was already tried and why it failed
|
|
121
|
+
2. Skip Phase 3 (Hypothesis + Fix) — do NOT attempt a fix
|
|
122
|
+
3. Complete Phase 1 (Evidence) and Phase 2 (Scope Lock) to diagnose the blocker
|
|
123
|
+
4. Propose 1-2 **alternative approaches** that are fundamentally different from ALL 3 failed attempts
|
|
124
|
+
5. Present to the user for decision — do not auto-execute the alternatives
|
|
125
|
+
6. If investigate itself hits 3 failures in this mode → **full stop**, no further recursion
|
|
126
|
+
|
|
127
|
+
## Enforced Rules
|
|
128
|
+
|
|
129
|
+
- **3-Failure Stop**: If the same fix approach fails 3 times, stop and report to the user. Do not keep trying.
|
|
130
|
+
- **Concreteness**: Specify exact file paths and line numbers. Quote error messages. Specify expected vs actual types.
|
|
131
|
+
- **Scope Lock**: Do not modify files outside the identified problem scope (Phase 2).
|
|
132
|
+
|
|
133
|
+
### 🧭 Navigation — After Investigate
|
|
134
|
+
|
|
135
|
+
After investigation and fix, always append a 🧭 block:
|
|
136
|
+
|
|
137
|
+
| Investigate Result | 🧭 Next Step |
|
|
138
|
+
|---|---|
|
|
139
|
+
| Fix applied, tests pass | `reviewer` — "수정한 코드를 리뷰해줘" |
|
|
140
|
+
| Root cause found but fix is out of scope | User decision — "수정 범위가 Story 밖입니다. scope를 확장하겠습니까?" |
|
|
141
|
+
| 3 attempts failed | 🛑 User escalation — "3회 시도 실패. 다른 접근법을 논의합시다" |
|
|
142
|
+
| Invoked by 3-Failure Recalculating | Diagnose blocker → propose 1-2 alternative routes → user decides |
|
|
143
|
+
|
|
144
|
+
Example 🧭 block:
|
|
145
|
+
```
|
|
146
|
+
---
|
|
147
|
+
🧭 Next Step
|
|
148
|
+
→ Next: `reviewer`
|
|
149
|
+
→ Prompt: "수정한 코드를 리뷰해줘"
|
|
150
|
+
→ Why: Bug fix applied — review before commit
|
|
151
|
+
→ Pipeline: 🔴 Step 3/4
|
|
152
|
+
---
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Related Failure Patterns
|
|
156
|
+
|
|
157
|
+
- FP-001: Mock not updated → Phase 4 requires checking mock sync
|
|
158
|
+
- FP-002: Type confusion → Phase 1 requires verifying actual types
|
|
159
|
+
- FP-003: Scope drift → Phase 2 Scope Lock must verify fix is within current Story scope
|
|
160
|
+
|
|
161
|
+
<!-- TEAM_MODE_START -->
|
|
162
|
+
## Team Mode: Investigation
|
|
163
|
+
|
|
164
|
+
### Owner Awareness
|
|
165
|
+
- In Phase 2 (Scope Lock), check docs/dependency-map.md Owner column for the affected module
|
|
166
|
+
- If the root cause module is owned by another developer, **notify them** before applying a fix
|
|
167
|
+
- If the bug is in a shared module (no single Owner), document the fix in your PR description so the team can review
|
|
168
|
+
|
|
169
|
+
### Personal State
|
|
170
|
+
- Record new failure patterns in your personal .harness/failure-patterns.md
|
|
171
|
+
- If the pattern affects the whole team, promote it (see learn skill Team Mode section)
|
|
172
|
+
<!-- TEAM_MODE_END -->
|