k-harness 0.9.0 → 0.9.2

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.
@@ -18,6 +18,7 @@ The Planner is the entry point for new features — use it BEFORE writing code.
18
18
  - docs/dependency-map.md
19
19
  - docs/project-state.md
20
20
  - docs/failure-patterns.md
21
+ - docs/agent-memory/planner.md — Past estimation accuracy and architecture insights
21
22
 
22
23
  ## Input
23
24
 
@@ -38,6 +39,17 @@ Before proceeding, verify that required state files have content (not just TODO
38
39
  If ALL files are empty/placeholder-only → **Stop and run the `bootstrap` skill first.** Report: "State files are empty. Running bootstrap to onboard this project."
39
40
  If `docs/project-brief.md` alone is empty → Warn the user but proceed (the plan will lack direction guard).
40
41
 
42
+ ### Step 0.5: Load Agent Memory
43
+
44
+ Read `docs/agent-memory/planner.md` for past learnings:
45
+ - Estimation accuracy from previous sprints (did Wave estimates match reality?)
46
+ - Architecture patterns that worked or failed in this project
47
+ - Repeated planning mistakes to avoid
48
+
49
+ Apply these insights when creating the implementation plan. If the memory file is empty or contains only placeholders, skip this step.
50
+
51
+ > **Team Mode**: In Team mode, agent memory is personal (`.harness/agent-memory/`). Each developer accumulates their own planning insights.
52
+
41
53
  ### For New Feature
42
54
 
43
55
  1. Read `docs/project-brief.md` to understand project vision, goals, **non-goals**, and **Decision Log**
@@ -122,3 +134,19 @@ If `docs/project-brief.md` alone is empty → Warn the user but proceed (the pla
122
134
  - All plans must include test tasks (no code without tests)
123
135
  - If a feature affects 5+ modules, flag as High Risk
124
136
  - If the plan exceeds one Sprint's worth of work, suggest splitting into sub-features
137
+
138
+ <!-- TEAM_MODE_START -->
139
+ ## Team Mode: Planning
140
+
141
+ ### Pre-Pull
142
+ Before reading or updating shared state files, run `git pull origin main`.
143
+
144
+ ### Owner-Aware Planning
145
+ - When assigning tasks, check docs/dependency-map.md Owner column to identify module ownership
146
+ - For features that cross module boundaries, identify all affected Owners and flag coordination needs
147
+ - Set Owner on new rows you create in docs/features.md and docs/dependency-map.md
148
+
149
+ ### Agent Memory
150
+ - Your personal docs/agent-memory/planner.md contains your individual estimation accuracy
151
+ - Team velocity estimates should be coordinated through sprint planning meetings, not derived from personal metrics alone
152
+ <!-- TEAM_MODE_END -->
@@ -13,9 +13,12 @@ Finds issues and auto-fixes where safe, escalates where not.
13
13
 
14
14
  ## Referenced Files
15
15
 
16
+ - docs/project-brief.md — Project vision, goals, non-goals, and Decision Log
17
+ - docs/features.md — Feature registry (for Step 6 Feature Registry Check)
16
18
  - docs/failure-patterns.md — Project failure patterns
17
19
  - docs/project-state.md — Current Story scope
18
20
  - docs/dependency-map.md — Module dependency graph
21
+ - docs/agent-memory/reviewer.md — Past review patterns and frequently missed items
19
22
 
20
23
  ## Procedure
21
24
 
@@ -27,6 +30,15 @@ Before reviewing, verify that required state files exist and are not empty:
27
30
 
28
31
  If state files are empty/placeholder-only → Warn: "State files are not filled. Review will proceed but scope check and failure pattern cross-check will be limited. Consider running `bootstrap` skill."
29
32
 
33
+ ### Step 0.5: Load Agent Memory
34
+
35
+ Read `docs/agent-memory/reviewer.md` for past learnings:
36
+ - Frequently missed review items in this project
37
+ - Common code patterns that caused issues
38
+ - Review statistics (pass rate, common failure categories)
39
+
40
+ Pay extra attention to items flagged in past reviews. If the memory file is empty or contains only placeholders, skip this step.
41
+
30
42
  ### Input
31
43
 
32
44
  Changed file list (user-provided or from `git diff --name-only`)
@@ -138,3 +150,26 @@ Report using: **DONE** | **DONE_WITH_CONCERNS** | **BLOCKED** | **NEEDS_CONTEXT*
138
150
  - Do not refactor beyond the review scope
139
151
  - Auto-apply security fixes but always record them in output
140
152
  - Escalate with NEEDS_CONTEXT after 3 uncertain judgments
153
+
154
+ ## STATE-AUDIT Handoff
155
+
156
+ When Step 8 (State File Audit) produces `[STATE-AUDIT]` flags:
157
+ 1. List all flagged items in the review output
158
+ 2. The `learn` skill (run at session end) will verify and resolve these flags
159
+ 3. If a flag is critical (missing module in dependency-map, unregistered feature), recommend fixing immediately rather than deferring to learn
160
+
161
+ <!-- TEAM_MODE_START -->
162
+ ## Team Mode: Review
163
+
164
+ ### Pre-Pull
165
+ Before running review, run `git pull origin main` to get the latest shared state files.
166
+
167
+ ### Owner-Scoped Audit
168
+ - **Step 6 (Feature Registry)**: only check that YOUR new features are registered — do not modify other developers' rows
169
+ - **Step 7 (Dependency Map)**: only check that YOUR new modules are registered — do not modify other developers' rows
170
+ - **Step 8 (State File Audit)**: verify that personal state files (docs/project-state.md, docs/failure-patterns.md, docs/agent-memory/) are updated; for shared files, only audit your own Owner rows
171
+
172
+ ### Cross-Owner Changes
173
+ - If your changes affect modules owned by other developers (check docs/dependency-map.md Owner), flag these as "⚠️ Cross-Owner Impact" in the review output
174
+ - Recommend getting the affected Owner's review before merging
175
+ <!-- TEAM_MODE_END -->
@@ -5,10 +5,21 @@
5
5
  Manage Sprint/Story state, guide development sequence, and prevent scope drift.
6
6
  Keeps the LLM focused on the current work item.
7
7
 
8
+ ## Referenced Skills
9
+
10
+ - bootstrap — Recommended when state files are empty
11
+ - learn — Recommended at session end or when all stories are done
12
+ - pivot — Recommended when direction change is detected
13
+ - investigate — Recommended when bug is blocking progress
14
+
8
15
  ## Referenced Files
9
16
 
10
17
  - docs/project-state.md — Current state (this is the core file)
18
+ - docs/project-brief.md — Project vision and goals (for direction checks)
19
+ - docs/features.md — Feature registry (for progress overview)
20
+ - docs/dependency-map.md — Module graph (for scope validation)
11
21
  - docs/failure-patterns.md — Recurring failure tracking
22
+ - docs/agent-memory/sprint-manager.md — Past velocity and scope drift data
12
23
 
13
24
  ## Procedure
14
25
 
@@ -18,7 +29,18 @@ Before handling any request, verify `docs/project-state.md` has content:
18
29
  - Quick Summary must not be all TODO placeholders
19
30
  - Story Status table must have at least one row
20
31
 
21
- If `docs/project-state.md` is empty/placeholder-only → **Recommend running `bootstrap` skill first.** Report: docs/project-state.md is empty. Run bootstrap to initialize project state before tracking sprints."
32
+ If `docs/project-state.md` is empty/placeholder-only → **Recommend running `bootstrap` skill first.** Report: "docs/project-state.md is empty. Run bootstrap to initialize project state before tracking sprints."
33
+
34
+ ### Step 0.5: Load Agent Memory
35
+
36
+ Read `docs/agent-memory/sprint-manager.md` for past learnings:
37
+ - Team velocity data (stories per sprint)
38
+ - Scope drift history (how often did scope expand?)
39
+ - Story sizing accuracy (were estimates correct?)
40
+
41
+ Use these insights when recommending story order and estimating sprint capacity. If the memory file is empty or contains only placeholders, skip this step.
42
+
43
+ > **Team Mode**: In Team mode, agent memory is personal (`.harness/agent-memory/`). Each developer tracks their own velocity and scope drift patterns.
22
44
 
23
45
  ### Input
24
46
 
@@ -63,8 +85,10 @@ After every status check, recommend the next action based on current context:
63
85
  **Request: "new story" / "next task"**
64
86
  1. Find next `todo` Story in docs/project-state.md
65
87
  2. Change its status to `in-progress`
66
- 3. Specify Story scope (related files/directories)
67
- 4. Alert relevant docs/failure-patterns.md items
88
+ 3. Read `docs/dependency-map.md` to identify modules involved in this Story
89
+ 4. Specify Story scope (related files/directories from dependency-map)
90
+ 5. Alert relevant docs/failure-patterns.md items
91
+ 6. Recommend relevant skill: "Consider running `planner` if this story needs detailed breakdown"
68
92
 
69
93
  **Request: "new sprint"**
70
94
  1. Check all Stories in current Sprint
@@ -108,3 +132,24 @@ STATUS: DONE
108
132
  - Do not modify code directly — manage state only
109
133
  - Only write to docs/project-state.md; read-only for all other files
110
134
  - Always confirm with user before modifying scope boundaries
135
+
136
+ ## Related Failure Patterns
137
+
138
+ - FP-003: Scope drift → Scope Check handler detects out-of-scope modifications and warns the user before proceeding
139
+
140
+ <!-- TEAM_MODE_START -->
141
+ ## Team Mode: Sprint Management
142
+
143
+ ### Personal vs Shared State
144
+ - Your sprint progress is tracked in personal docs/project-state.md
145
+ - Shared docs/features.md and docs/dependency-map.md reflect the entire team's work
146
+ - When reporting status, read BOTH personal and shared state for a complete picture
147
+
148
+ ### Scope Check with Ownership
149
+ - When checking scope, also verify the module's Owner in docs/dependency-map.md
150
+ - If work is being done on a module owned by another developer, flag it as a potential scope drift AND an ownership concern
151
+
152
+ ### Next Step Recommendation
153
+ - Consider other developers' active stories when recommending next steps
154
+ - If a dependency on another developer's work is detected, recommend coordination before proceeding
155
+ <!-- TEAM_MODE_END -->
@@ -9,6 +9,8 @@ Read `docs/project-state.md` first. If all state files are empty, run `bootstrap
9
9
 
10
10
  ## Workflow
11
11
 
12
+ - First time / empty state → run `bootstrap`
13
+ - Session start → run `sprint-manager` to check status
12
14
  - New feature → run `planner` before coding
13
15
  - Before commit → run `reviewer`
14
16
  - Bug or issue → run `investigate`
@@ -163,3 +163,27 @@ When starting a NEW session (not during bootstrap), read these files in order:
163
163
  | Leave rules file TODOs unfilled | Phase 3.5 fills ALL TODO sections — no manual editing needed |
164
164
  | Use TypeScript globs for non-TS projects | Detect language in Phase 1 and set correct globs |
165
165
  | Only fill state files, skip rules | Bootstrap fills BOTH — state files AND rules files |
166
+
167
+ <!-- TEAM_MODE_START -->
168
+ ## Team Mode: Onboarding
169
+
170
+ When running bootstrap in Team mode:
171
+
172
+ ### New Project (first developer)
173
+ 1. Run `k-harness init --team` to create shared + personal state files
174
+ 2. Fill all state files via normal bootstrap procedure
175
+ 3. Commit shared files (docs/) to git
176
+ 4. Push to remote — teammates will clone this
177
+
178
+ ### Joining Developer (existing project)
179
+ 1. Clone the repository (shared docs/ already exist)
180
+ 2. Run `k-harness init --team` — only personal files (.harness/) are created; shared files are skipped
181
+ 3. **DO NOT re-run bootstrap interviews** — shared state is already filled by the first developer
182
+ 4. Review docs/project-brief.md to understand project goals
183
+ 5. Create your personal .harness/project-state.md with your current Story assignment
184
+
185
+ ### Rules
186
+ - **Never overwrite shared files** when joining an existing project
187
+ - Set your Owner name in docs/features.md and docs/dependency-map.md rows you create
188
+ - Personal state (.harness/) is yours alone — no coordination needed
189
+ <!-- TEAM_MODE_END -->
@@ -5,6 +5,10 @@
5
5
  Decompose a feature into implementation tasks ordered by dependency.
6
6
  Ensures bottom-up implementation: foundations first, then layers that depend on them.
7
7
 
8
+ ## Invoked By
9
+
10
+ - **planner** agent — Step 8: Create ordered task list for new features
11
+
8
12
  ## When to Apply
9
13
 
10
14
  - Starting a new feature or Story
@@ -15,24 +19,26 @@ Ensures bottom-up implementation: foundations first, then layers that depend on
15
19
  ## Procedure
16
20
 
17
21
  1. **Describe the feature** in one sentence
18
- 2. **Read docs/dependency-map.md** to understand current module relationships
19
- 3. **Identify affected modules**: List every module that needs changes
20
- 4. **Classify changes per module**:
22
+ 2. **Read docs/project-brief.md** verify the feature aligns with Goals and does not violate Non-Goals. 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)
23
+ 3. **Read docs/dependency-map.md** to understand current module relationships
24
+ 4. **Identify affected modules**: List every module that needs changes
25
+ 5. **Classify changes per module**:
21
26
  - NEW_MODULE: Entirely new module to create
22
27
  - INTERFACE_CHANGE: Existing module's public interface changes
23
28
  - INTERNAL_CHANGE: Only internal implementation changes
24
29
  - TEST_ONLY: Only test updates needed
25
- 5. **Build dependency order**:
30
+ 6. **Build dependency order**:
26
31
  - Draw a mini dependency graph for just the affected modules
27
32
  - Sort topologically: modules with no dependencies come first
28
33
  - Group into implementation waves (parallel-safe batches)
29
- 6. **Create task sequence**: Convert waves into numbered tasks
30
- 7. **Annotate each task** with:
34
+ 7. **Create task sequence**: Convert waves into numbered tasks
35
+ 8. **Annotate each task** with:
31
36
  - Module name
32
- - Change type (from step 4)
37
+ - Change type (from step 5)
33
38
  - Files to create/modify
34
39
  - Tests to write
35
40
  - Dependency (which prior task must finish first)
41
+ - ⚠️ Relevant failure patterns (check docs/failure-patterns.md)
36
42
 
37
43
  ## Output Format
38
44
 
@@ -87,3 +93,26 @@ After completing the breakdown, update these files in the same session:
87
93
  | Skip dependency-map registration | Register immediately when creating module |
88
94
  | Tests "later" | Tests in the same task |
89
95
  | Produce breakdown but skip state file updates | State file updates are part of the breakdown, not a separate step |
96
+
97
+ ## Related Failure Patterns
98
+
99
+ - FP-001: Interface changed, mock not updated → When creating tasks that modify interfaces, include "Update mock" as an explicit sub-task
100
+ - FP-002: Type confusion → When annotating tasks, specify expected types for new interfaces
101
+ - FP-003: Scope drift → If the breakdown exceeds the current Story scope, stop and report
102
+
103
+ <!-- TEAM_MODE_START -->
104
+ ## Team Mode: Feature Breakdown
105
+
106
+ ### Pre-Pull
107
+ Before updating shared state files, run `git pull origin main` to get the latest docs/features.md and docs/dependency-map.md.
108
+
109
+ ### Owner Assignment
110
+ - When adding new rows to docs/features.md, set the Owner column to your name
111
+ - When adding new modules to docs/dependency-map.md, set the Owner column to your name
112
+ - Do NOT modify rows owned by other developers — if there is a dependency, note it in your task description instead
113
+
114
+ ### Cross-Developer Dependencies
115
+ If your feature depends on a module owned by another developer:
116
+ 1. Note the dependency in the task description (e.g., "Depends on [module] owned by [dev]")
117
+ 2. Coordinate with the module owner before implementation
118
+ <!-- TEAM_MODE_END -->
@@ -5,6 +5,11 @@
5
5
  Before modifying any module, trace all affected modules to prevent cascade failures.
6
6
  The most common cause of regressions in growing projects is changing one module without updating its dependents.
7
7
 
8
+ ## Invoked By
9
+
10
+ - **planner** agent — Step 9: for each existing module being modified
11
+ - **reviewer** agent — Step 7: when interface changes affect 2+ dependent modules
12
+
8
13
  ## When to Apply
9
14
 
10
15
  - Adding, removing, or changing a module's public interface
@@ -16,21 +21,25 @@ The most common cause of regressions in growing projects is changing one module
16
21
 
17
22
  1. **Identify the target module**: Which module are you about to change?
18
23
  2. **Read docs/dependency-map.md**: Find the target module's row
19
- 3. **List dependents**: Read the "Depended By" column these are the blast radius
20
- 4. **Check interface impact**: Does your change affect the module's public interface?
24
+ 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.
25
+ 4. **List dependents**: Read the "Depended By" column — these are the blast radius
26
+ 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.
27
+ 6. **Check interface impact**: Does your change affect the module's public interface?
21
28
  - If NO (internal-only change) → proceed, but still run dependent tests
22
- - If YES → continue to step 5
23
- 5. **Trace each dependent**:
29
+ - If YES → continue to step 7
30
+ 7. **Trace each dependent**:
24
31
  - List files in each dependent module that import from the target
25
32
  - Identify which functions/types they use
26
33
  - Determine if the interface change breaks them
27
- 6. **Plan updates**: Create a task list of all files that need modification
28
- 7. **Verify scope**: Confirm all files are within the current Story scope docs/project-state.md)
34
+ 8. **Plan updates**: Create a task list of all files that need modification
35
+ 9. **Verify scope**: Confirm all files are within the current Story scope (docs/project-state.md)
29
36
 
30
37
  ## Checklist
31
38
 
32
39
  - [ ] Target module identified in docs/dependency-map.md
40
+ - [ ] docs/failure-patterns.md checked for active patterns
33
41
  - [ ] All dependent modules listed
42
+ - [ ] Affected features identified from docs/features.md
34
43
  - [ ] Interface vs internal change classified
35
44
  - [ ] Files importing from target module enumerated
36
45
  - [ ] Mock/test updates planned for each dependent (FP-001)
@@ -62,9 +71,23 @@ Plan: 4 files to update, all within S3-2 scope
62
71
  After completing the analysis, update these files:
63
72
 
64
73
  - [ ] **docs/dependency-map.md**: Update the Interface Change Log table with: Date, Module, Change description, Affected Modules, Status. **This is mandatory for ALL interface changes** — do not skip even if the change seems minor.
74
+ - [ ] **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.
65
75
  - [ ] **docs/project-state.md**: If scope exceeds current Story, add a note to Recent Changes.
66
76
 
67
77
  ## Related Failure Patterns
68
78
 
69
- - FP-001: Interface changed, mock not updated → Checklist item 5
70
- - FP-002: Type confusion across modules → Step 5 verification
79
+ - FP-001: Interface changed, mock not updated → Checklist item 7 (mock/test updates planned)
80
+ - FP-002: Type confusion across modules → Step 7 (trace each dependent, verify types)
81
+
82
+ <!-- TEAM_MODE_START -->
83
+ ## Team Mode: Impact Analysis
84
+
85
+ ### Owner-Aware Blast Radius
86
+ - When listing affected modules from docs/dependency-map.md, check the Owner column
87
+ - If a dependent module is owned by another developer, the blast radius extends to their scope
88
+ - Flag cross-owner impacts: "⚠️ Module [X] owned by [dev] will be affected"
89
+
90
+ ### Notification
91
+ - For interface changes affecting modules owned by other developers, **list them explicitly** in the analysis output
92
+ - Recommend notifying affected module owners before proceeding with changes
93
+ <!-- TEAM_MODE_END -->
@@ -26,8 +26,10 @@ Debug bugs systematically. Prevent "symptom patching" — fixing without underst
26
26
  ### Phase 2: Scope Lock
27
27
 
28
28
  1. Identify the module/directory containing the root cause
29
- 2. Exclude files outside that scope from modification
30
- 3. Check docs/failure-patterns.md for matching patterns
29
+ 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.
30
+ 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, **warn the user** before proceeding (Iron Law #3: Scope Compliance).
31
+ 4. Exclude files outside that scope from modification
32
+ 5. Check docs/failure-patterns.md for matching patterns
31
33
 
32
34
  ### Phase 3: Hypothesis + Fix
33
35
 
@@ -45,6 +47,8 @@ Debug bugs systematically. Prevent "symptom patching" — fixing without underst
45
47
 
46
48
  - [ ] Root cause hypothesis is stated explicitly
47
49
  - [ ] Did NOT skip Phase 1 (evidence collection) and jump straight to fixing
50
+ - [ ] docs/dependency-map.md consulted for blast radius understanding
51
+ - [ ] Fix scope verified against current Story in docs/project-state.md
48
52
  - [ ] Fix scope is limited to the problem's scope
49
53
  - [ ] All related tests pass after the fix
50
54
  - [ ] Regression test is added
@@ -82,5 +86,19 @@ After the fix is verified (Phase 4):
82
86
 
83
87
  ## Related Failure Patterns
84
88
 
85
- - FP-002: Type confusion → Phase 1 requires verifying actual types
86
89
  - FP-001: Mock not updated → Phase 4 requires checking mock sync
90
+ - FP-002: Type confusion → Phase 1 requires verifying actual types
91
+ - FP-003: Scope drift → Phase 2 Scope Lock must verify fix is within current Story scope
92
+
93
+ <!-- TEAM_MODE_START -->
94
+ ## Team Mode: Investigation
95
+
96
+ ### Owner Awareness
97
+ - In Phase 2 (Scope Lock), check docs/dependency-map.md Owner column for the affected module
98
+ - If the root cause module is owned by another developer, **notify them** before applying a fix
99
+ - If the bug is in a shared module (no single Owner), document the fix in your PR description so the team can review
100
+
101
+ ### Personal State
102
+ - Record new failure patterns in your personal .harness/failure-patterns.md
103
+ - If the pattern affects the whole team, promote it (see learn skill Team Mode section)
104
+ <!-- TEAM_MODE_END -->
@@ -60,6 +60,22 @@ For each issue/error that occurred in this session:
60
60
  2. If existing features were modified → update Key Files and Test Files columns
61
61
  3. If features were completed → update Status to `✅ done`
62
62
 
63
+ ### Step 4.5: Verify docs/dependency-map.md (mandatory)
64
+
65
+ 1. Check if any new modules were created in this session (scan `git diff --stat` for new directories)
66
+ 2. Check if any module interfaces changed
67
+ 3. For each finding:
68
+ - New module without dependency-map entry → **add it now**
69
+ - Interface change without Interface Change Log entry → **add it now**
70
+ 4. Cross-reference `docs/features.md` Key Files against `docs/dependency-map.md` modules — flag orphaned modules
71
+
72
+ ### Step 4.6: Resolve STATE-AUDIT Flags (if applicable)
73
+
74
+ If the `reviewer` agent was run in this session and produced `[STATE-AUDIT]` flags:
75
+ 1. Review each flagged item
76
+ 2. Apply the recommended state file update
77
+ 3. If the flag was already resolved during the session, skip it
78
+
63
79
  ### Step 5: Update Agent Memory (if applicable)
64
80
 
65
81
  If an agent (reviewer, planner, sprint-manager) was used in this session, update its memory file in `docs/agent-memory/`:
@@ -88,9 +104,10 @@ Present a summary of all updates made.
88
104
  - [FP-NNN] (new/updated): [description]
89
105
 
90
106
  ### State Files Updated:
91
- - [x]docs/project-state.md — Quick Summary refreshed
92
- - [x]docs/failure-patterns.md — [N] patterns added/updated
93
- - [x]docs/features.md — [N] features updated (if applicable)
107
+ - [x] docs/project-state.md — Quick Summary refreshed
108
+ - [x] docs/failure-patterns.md — [N] patterns added/updated
109
+ - [x] docs/features.md — [N] features updated (if applicable)
110
+ - [x] docs/dependency-map.md — [N] modules verified/added (if applicable)
94
111
  - [x] docs/agent-memory/{name}.md — [N] agents updated (if applicable)
95
112
 
96
113
  ### Next Session Should:
@@ -127,3 +144,21 @@ STATUS: DONE
127
144
  | Write vague descriptions ("something broke") | Be specific: file name, error message, root cause |
128
145
  | Skip this skill because "nothing went wrong" | Still update Quick Summary and Story Status |
129
146
  | Update docs/failure-patterns.md but not docs/project-state.md | Always update both — they serve different purposes |
147
+
148
+ <!-- TEAM_MODE_START -->
149
+ ## Team Mode: Session Wrap-up
150
+
151
+ ### Pre-Pull (mandatory before any shared file edit)
152
+ 1. Run `git pull origin main` before updating docs/features.md or docs/dependency-map.md
153
+ 2. If merge conflicts occur, resolve them BEFORE proceeding
154
+
155
+ ### Owner-Scoped Updates
156
+ - **docs/features.md**: only update rows where Owner = you
157
+ - **docs/dependency-map.md**: only update rows where Owner = you; if adding a new module, append at the bottom
158
+ - **Personal files** (.harness/project-state.md, .harness/failure-patterns.md, .harness/agent-memory/): update freely — no coordination needed
159
+
160
+ ### Failure Pattern Promotion
161
+ If a personal failure pattern (FP-NNN in .harness/failure-patterns.md) is likely to affect other developers:
162
+ 1. Discuss with the team (Slack, PR comment, etc.)
163
+ 2. If agreed, add it to a shared location (team wiki, PR description) so others can add it to their personal .harness/failure-patterns.md
164
+ <!-- TEAM_MODE_END -->
@@ -113,3 +113,22 @@ If `.harness/` directory exists (Team mode is active):
113
113
  3. Team lead runs pivot on main
114
114
  4. All developers pull main to get updated shared state files
115
115
  5. Each developer's `.harness/` personal state is unaffected (update manually if needed)
116
+
117
+ <!-- TEAM_MODE_START -->
118
+ ## Team Mode: Pivot Lock
119
+
120
+ ### Who Can Run Pivot
121
+ - **Only the team lead** runs pivot, and **only on the main branch**
122
+ - If you are not the team lead, propose the direction change to the team lead instead of running pivot yourself
123
+
124
+ ### Branch Check
125
+ Before running pivot, verify:
126
+ 1. You are on the `main` branch: `git branch --show-current` must return `main`
127
+ 2. Your working tree is clean: `git status` must show no uncommitted changes
128
+ 3. You have pulled the latest: `git pull origin main`
129
+
130
+ ### After Pivot
131
+ 1. Commit and push the updated shared files
132
+ 2. Notify all team members to run `git pull origin main`
133
+ 3. Each developer's personal .harness/ files are NOT auto-updated — developers should review the pivot changes and manually update their personal state if needed
134
+ <!-- TEAM_MODE_END -->
@@ -5,6 +5,10 @@
5
5
  Inspect for security risks before committing code.
6
6
  Prevents credential leaks and accidental commits of sensitive files. (FP-004)
7
7
 
8
+ ## Invoked By
9
+
10
+ - **reviewer** agent — Step 4: Security risk inspection
11
+
8
12
  ## When to Apply
9
13
 
10
14
  - Before running `git add` or committing
@@ -15,13 +19,15 @@ Prevents credential leaks and accidental commits of sensitive files. (FP-004)
15
19
  ## Procedure
16
20
 
17
21
  1. **Check staging area**: Run `git diff --cached --name-only` to list files staged for commit
18
- 2. **Scan for forbidden files**: Check if .env, credentials, *.pem, *.key files are staged
19
- 3. **Scan for hardcoded secrets**: Search staged files for passwords, API keys, tokens
20
- 4. **Verify .gitignore**: Ensure new environment files are covered by .gitignore
21
- 5. **Check for temp files**: Verify tmp_*, debug_*, coverage_* files are not staged
22
+ 2. **Read docs/failure-patterns.md**: Check FP-004 status. If frequency > 0, apply extra scrutiny to all staged files and verify .gitignore coverage is comprehensive.
23
+ 3. **Scan for forbidden files**: Check if .env, credentials, *.pem, *.key files are staged
24
+ 4. **Scan for hardcoded secrets**: Search staged files for passwords, API keys, tokens
25
+ 5. **Verify .gitignore**: Ensure new environment files are covered by .gitignore
26
+ 6. **Check for temp files**: Verify tmp_*, debug_*, coverage_* files are not staged
22
27
 
23
28
  ## Checklist
24
29
 
30
+ - [ ] docs/failure-patterns.md reviewed for FP-004 history
25
31
  - [ ] (FP-004) No .env, credentials, *.key files in staging area
26
32
  - [ ] (FP-004) No hardcoded passwords, API keys, or tokens in code
27
33
  - [ ] Sensitive file patterns are registered in .gitignore
@@ -49,7 +55,16 @@ const dbPassword = "super_secret_123";
49
55
  After completing the security check:
50
56
 
51
57
  - [ ] **docs/failure-patterns.md**: If a security issue was found (credentials staged, hardcoded secret), add a new FP-NNN entry or increment FP-004 Frequency.
58
+ - [ ] **docs/project-state.md**: If a security issue was found, add to Recent Changes: "⚠️ Security: [description of issue found/fixed]". This ensures the next session's Quick Summary includes the security context.
52
59
 
53
60
  ## Related Failure Patterns
54
61
 
55
- - FP-004: Dangerous file committed → Checklist items 1, 4
62
+ - FP-004: Dangerous file committed → Checklist items 2, 5 (no forbidden files, no temp files)
63
+
64
+ <!-- TEAM_MODE_START -->
65
+ ## Team Mode: Security
66
+
67
+ - Personal state files (.harness/) are gitignored — they cannot leak via git
68
+ - When committing shared config files (docs/), verify no team credentials or shared secrets are included
69
+ - If a security issue is found in a shared module, notify the module Owner before fixing
70
+ <!-- TEAM_MODE_END -->
@@ -5,6 +5,10 @@
5
5
  Ensure test mocks stay synchronized when repository/service interfaces change.
6
6
  Prevents the most common LLM coding failure: updating an interface but forgetting to update corresponding mocks. (FP-001)
7
7
 
8
+ ## Invoked By
9
+
10
+ - **reviewer** agent — Step 3: Mock synchronization verification
11
+
8
12
  ## When to Apply
9
13
 
10
14
  - Adding, removing, or modifying methods on a repository/service interface
@@ -13,16 +17,18 @@ Prevents the most common LLM coding failure: updating an interface but forgettin
13
17
 
14
18
  ## Procedure
15
19
 
16
- 1. **Identify changed interfaces**: Find modified files in your interface directory
17
- 2. **Map to mock files**: Locate the corresponding mock file for each changed interface
18
- 3. **Sync methods**: Verify every interface method exists in the mock
19
- 4. **Verify return types**: Confirm mock return values match the interface return types
20
- 5. **Check consumers**: Verify use case tests configure the mock correctly for new methods
20
+ 1. **Read docs/failure-patterns.md**: Check FP-001 status. If frequency > 0, this project has a history of mock sync failures — apply extra scrutiny to every interface change.
21
+ 2. **Identify changed interfaces**: Find modified files in your interface directory
22
+ 3. **Map to mock files**: Locate the corresponding mock file for each changed interface
23
+ 4. **Sync methods**: Verify every interface method exists in the mock
24
+ 5. **Verify return types**: Confirm mock return values match the interface return types (FP-002: watch for type confusion)
25
+ 6. **Check consumers**: Verify use case tests configure the mock correctly for new methods
21
26
 
22
27
  ## Checklist
23
28
 
29
+ - [ ] docs/failure-patterns.md reviewed for FP-001 history
24
30
  - [ ] (FP-001) Every changed interface method is reflected in its mock
25
- - [ ] Mock return types match interface signatures
31
+ - [ ] (FP-002) Mock return types match interface signatures (no type confusion)
26
32
  - [ ] New methods have default mock return values set
27
33
  - [ ] Use case tests correctly use the new mock methods
28
34
  - [ ] Existing tests still pass
@@ -47,6 +53,7 @@ After synchronizing mocks:
47
53
 
48
54
  - [ ] **docs/failure-patterns.md**: If mock sync was missed and caused a test failure, increment FP-001 Frequency.
49
55
  - [ ] **docs/dependency-map.md**: If the interface change altered module relationships, update the relevant row.
56
+ - [ ] **docs/project-state.md**: If mock sync issues were found and fixed, add to Recent Changes: "🔧 Test: [interface] mock synchronized". This ensures the next session is aware of the fix.
50
57
 
51
58
  ## Testing Rules (enforced during this skill)
52
59
 
@@ -59,4 +66,12 @@ After synchronizing mocks:
59
66
 
60
67
  ## Related Failure Patterns
61
68
 
62
- - FP-001: Interface changed, mock not updated → Checklist item 1
69
+ - FP-001: Interface changed, mock not updated → Checklist item 2
70
+ - FP-002: Type confusion → Step 5 return type verification
71
+
72
+ <!-- TEAM_MODE_START -->
73
+ ## Team Mode: Test Integrity
74
+
75
+ - If the interface you changed is owned by another developer (check docs/dependency-map.md Owner), notify them about the mock update requirement
76
+ - When updating shared test fixtures or mocks, run `git pull` first to avoid overwriting teammates' changes
77
+ <!-- TEAM_MODE_END -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "k-harness",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "LLM Development Harness — IDE-agnostic rules, skills, and agents that prevent common AI coding failures",
5
5
  "keywords": [
6
6
  "llm",
package/src/init.js CHANGED
@@ -75,19 +75,31 @@ This project uses Team mode. State files are split into shared and personal.
75
75
  - **Personal** (.harness/, gitignored): project-state.md, failure-patterns.md, agent-memory/
76
76
 
77
77
  ### Rules
78
- 1. Shared files: only modify your own rows (check Owner column)
79
- 2. Other developers' Owner rows are READ ONLY
80
- 3. New rows go at the bottom of the table
81
- 4. The \`pivot\` skill must be run on the main branch by the team lead only
78
+ 1. **Pre-Pull**: before modifying any shared file (docs/), run \`git pull\` to get latest changes
79
+ 2. **Owner Column**: shared files use Owner columns only modify your own rows
80
+ 3. **Read-Only**: other developers' Owner rows are READ ONLY
81
+ 4. **Append-Only**: new rows go at the bottom of the table
82
+ 5. **Pivot Lock**: the \`pivot\` skill must be run on the main branch by the team lead only
83
+ 6. **FP Promotion**: if a personal failure pattern (FP-NNN) affects the team, promote it to a shared doc or team channel
82
84
  `;
83
85
 
84
86
  function resolveContent(content, mode) {
85
- if (mode !== 'team') return content;
87
+ if (mode !== 'team') {
88
+ // Solo mode: strip Team-only blocks entirely
89
+ return content.replace(/<!-- TEAM_MODE_START -->[\s\S]*?<!-- TEAM_MODE_END -->\n?/g, '');
90
+ }
86
91
  let result = content
87
92
  .replaceAll('docs/project-state.md', '.harness/project-state.md')
88
93
  .replaceAll('docs/failure-patterns.md', '.harness/failure-patterns.md')
89
94
  .replaceAll('docs/agent-memory/', '.harness/agent-memory/');
90
95
 
96
+ // Remove markers, keep Team content
97
+ result = result
98
+ .replaceAll('<!-- TEAM_MODE_START -->\n', '')
99
+ .replaceAll('<!-- TEAM_MODE_START -->', '')
100
+ .replaceAll('<!-- TEAM_MODE_END -->\n', '')
101
+ .replaceAll('<!-- TEAM_MODE_END -->', '');
102
+
91
103
  // Append Team Mode section to core-rules (detected by the heading)
92
104
  if (result.includes('## State Files') && result.includes('## Session Start')) {
93
105
  result += TEAM_MODE_SECTION;