k-harness 0.4.0 → 0.5.0

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/README.md CHANGED
@@ -21,6 +21,12 @@ npx k-harness init
21
21
 
22
22
  Select your IDE when prompted. Files are installed into the current directory.
23
23
 
24
+ After installation, ask your LLM to run the `bootstrap` skill:
25
+
26
+ > "Run bootstrap to onboard this project."
27
+
28
+ This scans your codebase and fills all 5 state files automatically.
29
+
24
30
  ### Non-interactive
25
31
 
26
32
  ```bash
@@ -87,10 +93,7 @@ All IDEs also get `project-state.md`, `project-brief.md`, `features.md`, `failur
87
93
  ## How It Works
88
94
 
89
95
  ### 1. Bootstrap (once)
90
- ```bash
91
- npx k-harness init --ide vscode
92
- ```
93
- Then ask your LLM to run the `bootstrap` skill — it scans your codebase and fills all 5 state files automatically.
96
+ After `k-harness init`, run the `bootstrap` skill. It scans your codebase, interviews you about goals/non-goals, and fills all 5 state files automatically. **This is the most important step** — without it, Direction Guard and other skills have no context.
94
97
 
95
98
  ### 2. Direction Guard (every request)
96
99
  Before ANY coding task, the LLM reads `project-brief.md` and checks:
@@ -113,14 +116,9 @@ When goals, technology, or scope changes, run the `pivot` skill:
113
116
  - Records the decision with reasoning in Decision Log
114
117
  - Prevents silent inconsistencies across files
115
118
 
116
- ## Design Principles
119
+ ## Documentation
117
120
 
118
- 1. **Direction First** Every request checked against project goals before code is written
119
- 2. **State Injection** — Project state injected at every session start
120
- 3. **Rigid Workflow** — Hard "do/don't" rules; soft suggestions get ignored by LLMs
121
- 4. **Enforced Updates** — Reviewer audits that state files were actually updated, not just instructed
122
- 5. **Failure-Driven Rules** — Rules derived only from actual project failures
123
- 6. **Context Minimization** — ≤3 files per task, zero dependencies, one `npm install`
121
+ See [docs/reference.md](docs/reference.md) for detailed descriptions of every skill, agent, rule, and state file.
124
122
 
125
123
  ## Why Not BMAD or gstack?
126
124
 
@@ -135,8 +133,6 @@ When goals, technology, or scope changes, run the `pivot` skill:
135
133
  | State file audit | ❌ | ❌ | ✅ (reviewer Step 8) |
136
134
  | Context per task | 4-6 files | 1 file | 2-3 files |
137
135
 
138
- See [docs/analysis/comparison.md](docs/analysis/comparison.md) for the full analysis.
139
-
140
136
  ## License
141
137
 
142
138
  MIT
@@ -0,0 +1,25 @@
1
+ # Planner Memory
2
+
3
+ > 이 파일은 planner 에이전트가 세션 간 학습 내용을 유지하기 위해 자동 업데이트합니다.
4
+ > learn 스킬이 세션 종료 시 갱신합니다. 직접 편집하지 마세요.
5
+
6
+ ## 추정 정확도
7
+
8
+ <!-- 예시:
9
+ - Wave 1 추정: 정확 (실제 소요시간과 일치)
10
+ - Wave 3+ 추정: 낙관적 경향 — 실제로 2배 소요
11
+ -->
12
+
13
+ ## 프로젝트 아키텍처 인사이트
14
+
15
+ <!-- 예시:
16
+ - 이 프로젝트는 domain → application → infrastructure 순으로 의존
17
+ - shared/ 폴더 변경 시 전체 리빌드 필요
18
+ -->
19
+
20
+ ## 반복 패턴
21
+
22
+ <!-- 예시:
23
+ - 새 기능 추가 시 항상 middleware + route + controller + service 4파일 세트
24
+ - DB 마이그레이션 파일 생성을 빠뜨리는 경향
25
+ -->
@@ -0,0 +1,24 @@
1
+ # Reviewer Memory
2
+
3
+ > 이 파일은 reviewer 에이전트가 세션 간 학습 내용을 유지하기 위해 자동 업데이트합니다.
4
+ > learn 스킬이 세션 종료 시 갱신합니다. 직접 편집하지 마세요.
5
+
6
+ ## 프로젝트별 리뷰 패턴
7
+
8
+ <!-- 예시:
9
+ - SQL injection 패턴이 빈번 — req.params를 직접 쿼리에 넣는 코드가 반복됨
10
+ - mock sync 누락률 높음 — interface 변경 시 50%가 mock 미동기화
11
+ -->
12
+
13
+ ## 자주 놓치는 항목
14
+
15
+ <!-- 예시:
16
+ - docs/features.md 업데이트 누락 (Iron Law #7)
17
+ - 테스트 파일에 실제 DB 연결하는 코드
18
+ -->
19
+
20
+ ## 리뷰 통계
21
+
22
+ - 총 리뷰 횟수: 0
23
+ - 자동 수정 건수: 0
24
+ - 에스컬레이션 건수: 0
@@ -0,0 +1,26 @@
1
+ # Sprint Manager Memory
2
+
3
+ > 이 파일은 sprint-manager 에이전트가 세션 간 학습 내용을 유지하기 위해 자동 업데이트합니다.
4
+ > learn 스킬이 세션 종료 시 갱신합니다. 직접 편집하지 마세요.
5
+
6
+ ## Velocity 추적
7
+
8
+ <!-- 예시:
9
+ - Sprint 1: 3 stories 완료 / 5 stories 계획 (60%)
10
+ - Sprint 2: 4 stories 완료 / 4 stories 계획 (100%)
11
+ - 평균 velocity: 스프린트당 3.5 stories
12
+ -->
13
+
14
+ ## 스코프 드리프트 이력
15
+
16
+ <!-- 예시:
17
+ - S1-003에서 스코프 밖 파일 3개 수정 발생 — 사전 경고 부족
18
+ - S2-001에서 방향 전환 요청 → pivot 스킬로 전환
19
+ -->
20
+
21
+ ## 추천 패턴
22
+
23
+ <!-- 예시:
24
+ - 이 프로젝트는 스프린트당 4 stories가 적절
25
+ - Story 크기가 5파일 이상이면 분할 권장
26
+ -->
@@ -13,11 +13,11 @@ The Planner is the entry point for new features — use it BEFORE writing code.
13
13
 
14
14
  ## Referenced Files
15
15
 
16
- - project-brief.md — Project vision, goals, and non-goals
17
- - features.md — Feature registry
18
- - dependency-map.md
19
- - project-state.md
20
- - failure-patterns.md
16
+ - docs/project-brief.md — Project vision, goals, and non-goals
17
+ - docs/features.md — Feature registry
18
+ - docs/dependency-map.md
19
+ - docs/project-state.md
20
+ - docs/failure-patterns.md
21
21
 
22
22
  ## Input
23
23
 
@@ -31,42 +31,42 @@ One of:
31
31
  ### Step 0: State File Readiness
32
32
 
33
33
  Before proceeding, verify that required state files have content (not just TODO placeholders):
34
- - `project-brief.md` — Must have Vision and Goals filled
35
- - `features.md` — Must have at least one feature row
36
- - `dependency-map.md` — Must have at least one module row (for existing projects)
34
+ - `docs/project-brief.md` — Must have Vision and Goals filled
35
+ - `docs/features.md` — Must have at least one feature row
36
+ - `docs/dependency-map.md` — Must have at least one module row (for existing projects)
37
37
 
38
38
  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
- If `project-brief.md` alone is empty → Warn the user but proceed (the plan will lack direction guard).
39
+ If `docs/project-brief.md` alone is empty → Warn the user but proceed (the plan will lack direction guard).
40
40
 
41
41
  ### For New Feature
42
42
 
43
- 1. Read `project-brief.md` to understand project vision, goals, **non-goals**, and **Decision Log**
43
+ 1. Read `docs/project-brief.md` to understand project vision, goals, **non-goals**, and **Decision Log**
44
44
  2. **Direction Alignment**: Verify the requested feature against three checkpoints:
45
45
  - **Goal Alignment**: Does it serve a listed Goal? If no clear link, warn the user.
46
46
  - **Non-Goal Violation**: Does it fall into Non-Goals? If yes, **stop and ask** — this may be a pivot.
47
47
  - **Decision Consistency**: Does it contradict any Decision Log entry? If yes, warn that a previous decision conflicts — recommend running the `pivot` skill before proceeding.
48
48
  If the request represents a clear direction change → recommend running the `pivot` skill instead of proceeding with planning.
49
- 3. Read `features.md` to understand what already exists
50
- 4. Read `dependency-map.md` to understand current architecture
51
- 5. Read `project-state.md` for current Sprint context
49
+ 3. Read `docs/features.md` to understand what already exists
50
+ 4. Read `docs/dependency-map.md` to understand current architecture
51
+ 5. Read `docs/project-state.md` for current Sprint context
52
52
  6. Identify which existing modules are affected
53
53
  7. Identify new modules that need to be created
54
54
  8. Run **feature-breakdown** skill to create ordered task list
55
55
  9. Run **impact-analysis** skill for each existing module being modified
56
- 10. Check `failure-patterns.md` for relevant past mistakes
56
+ 10. Check `docs/failure-patterns.md` for relevant past mistakes
57
57
  11. Produce implementation plan (see Output Format)
58
- 12. Update `project-state.md` with the new Story
59
- 13. Update `features.md` with the new feature entry
58
+ 12. Update `docs/project-state.md` with the new Story
59
+ 13. Update `docs/features.md` with the new feature entry
60
60
 
61
61
  ### For Architecture Query
62
62
 
63
- 1. Read `dependency-map.md`
63
+ 1. Read `docs/dependency-map.md`
64
64
  2. Answer the query with specific module names, dependencies, and layer info
65
65
  3. If the query reveals missing entries in the map, flag them
66
66
 
67
67
  ### For Refactor Plan
68
68
 
69
- 1. Read `dependency-map.md` to map the blast radius
69
+ 1. Read `docs/dependency-map.md` to map the blast radius
70
70
  2. Run **impact-analysis** skill on each module being refactored
71
71
  3. Identify safe refactoring order (leaf modules first, core modules last)
72
72
  4. Produce refactoring plan with rollback checkpoints
@@ -93,7 +93,7 @@ If `project-brief.md` alone is empty → Warn the user but proceed (the plan wil
93
93
  - [Any high-coupling areas to watch]
94
94
 
95
95
  ### Dependency Map Changes
96
- [Additions/modifications to dependency-map.md]
96
+ [Additions/modifications to docs/dependency-map.md]
97
97
  ```
98
98
 
99
99
  ### Architecture Query Response
@@ -107,8 +107,8 @@ If `project-brief.md` alone is empty → Warn the user but proceed (the plan wil
107
107
 
108
108
  ## Constraints
109
109
 
110
- - Never skip reading dependency-map.md — the plan is only as good as the map
111
- - If dependency-map.md is empty or outdated, report this FIRST
110
+ - Never skip reading docs/dependency-map.md — the plan is only as good as the map
111
+ - If docs/dependency-map.md is empty or outdated, report this FIRST
112
112
  - All plans must include test tasks (no code without tests)
113
113
  - If a feature affects 5+ modules, flag as High Risk
114
114
  - If the plan exceeds one Sprint's worth of work, suggest splitting into sub-features
@@ -13,17 +13,17 @@ Finds issues and auto-fixes where safe, escalates where not.
13
13
 
14
14
  ## Referenced Files
15
15
 
16
- - failure-patterns.md — Project failure patterns
17
- - project-state.md — Current Story scope
18
- - dependency-map.md — Module dependency graph
16
+ - docs/failure-patterns.md — Project failure patterns
17
+ - docs/project-state.md — Current Story scope
18
+ - docs/dependency-map.md — Module dependency graph
19
19
 
20
20
  ## Procedure
21
21
 
22
22
  ### Step 0: State File Readiness
23
23
 
24
24
  Before reviewing, verify that required state files exist and are not empty:
25
- - `failure-patterns.md` — Must exist (needed for Step 5 cross-check)
26
- - `project-state.md` — Must have current Sprint info (needed for scope check)
25
+ - `docs/failure-patterns.md` — Must exist (needed for Step 5 cross-check)
26
+ - `docs/project-state.md` — Must have current Sprint info (needed for scope check)
27
27
 
28
28
  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
29
 
@@ -35,7 +35,7 @@ Changed file list (user-provided or from `git diff --name-only`)
35
35
 
36
36
  **Step 1: Identify Change Scope**
37
37
  - Run `git diff --cached --stat` or `git diff --stat` to see changed files
38
- - Compare against current Story scope in project-state.md
38
+ - Compare against current Story scope in docs/project-state.md
39
39
 
40
40
  **Step 2: Architecture Rule Check**
41
41
  - [ ] No imports from infrastructure in domain layer
@@ -53,28 +53,28 @@ Changed file list (user-provided or from `git diff --name-only`)
53
53
  - [ ] No injection vulnerabilities (SQL, XSS)
54
54
 
55
55
  **Step 5: Failure Pattern Cross-Check**
56
- - Compare current changes against all FP-NNN items in failure-patterns.md
56
+ - Compare current changes against all FP-NNN items in docs/failure-patterns.md
57
57
  - Warn if any pattern applies
58
58
 
59
59
  **Step 6: Feature Registry Check**
60
- - [ ] If a new feature was added, verify it is registered in features.md (Iron Law #7)
61
- - [ ] If feature files changed, verify features.md key files are up to date
62
- - [ ] If tests were added/removed, verify features.md test files column is accurate
60
+ - [ ] If a new feature was added, verify it is registered in docs/features.md (Iron Law #7)
61
+ - [ ] If feature files changed, verify docs/features.md key files are up to date
62
+ - [ ] If tests were added/removed, verify docs/features.md test files column is accurate
63
63
 
64
64
  **Step 7: Dependency Map Check**
65
- - [ ] If new modules were added, verify they are registered in dependency-map.md (Iron Law #6)
65
+ - [ ] If new modules were added, verify they are registered in docs/dependency-map.md (Iron Law #6)
66
66
  - [ ] If module interfaces changed, verify "Depends On" / "Depended By" columns are updated
67
- - [ ] If module was deleted/renamed, verify dependency-map.md is cleaned up
67
+ - [ ] If module was deleted/renamed, verify docs/dependency-map.md is cleaned up
68
68
  - [ ] Run impact-analysis skill if interface changes affect 2+ dependent modules
69
69
 
70
70
  **Step 8: State File Audit**
71
71
 
72
72
  Verify that state file updates actually happened. Check each:
73
- - [ ] **project-state.md**: If stories were worked on, is Quick Summary current? Are story statuses updated?
74
- - [ ] **features.md**: If new features were added, are they registered? If features were completed, is status updated?
75
- - [ ] **dependency-map.md**: If new modules were created, are they registered? If dependencies changed, are relationships updated?
76
- - [ ] **failure-patterns.md**: If a bug was fixed that matched a pattern, was frequency incremented?
77
- - [ ] **project-brief.md**: If a technology or architectural decision was made, is it in Decision Log?
73
+ - [ ] **docs/project-state.md**: If stories were worked on, is Quick Summary current? Are story statuses updated?
74
+ - [ ] **docs/features.md**: If new features were added, are they registered? If features were completed, is status updated?
75
+ - [ ] **docs/dependency-map.md**: If new modules were created, are they registered? If dependencies changed, are relationships updated?
76
+ - [ ] **docs/failure-patterns.md**: If a bug was fixed that matched a pattern, was frequency incremented?
77
+ - [ ] **docs/project-brief.md**: If a technology or architectural decision was made, is it in Decision Log?
78
78
 
79
79
  For each missing update: flag as `[STATE-AUDIT]` in the output and provide the exact update that should be made.
80
80
 
@@ -7,18 +7,18 @@ Keeps the LLM focused on the current work item.
7
7
 
8
8
  ## Referenced Files
9
9
 
10
- - project-state.md — Current state (this is the core file)
11
- - failure-patterns.md — Recurring failure tracking
10
+ - docs/project-state.md — Current state (this is the core file)
11
+ - docs/failure-patterns.md — Recurring failure tracking
12
12
 
13
13
  ## Procedure
14
14
 
15
15
  ### Step 0: State File Readiness
16
16
 
17
- Before handling any request, verify `project-state.md` has content:
17
+ Before handling any request, verify `docs/project-state.md` has content:
18
18
  - Quick Summary must not be all TODO placeholders
19
19
  - Story Status table must have at least one row
20
20
 
21
- If `project-state.md` is empty/placeholder-only → **Recommend running `bootstrap` skill first.** Report: "project-state.md is empty. Run bootstrap to initialize project state before tracking sprints."
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."
22
22
 
23
23
  ### Input
24
24
 
@@ -27,7 +27,7 @@ User request: "next task", "current status", "story done", "new sprint", "scope
27
27
  ### Handlers
28
28
 
29
29
  **Request: "current status" / "where are we"**
30
- 1. Read project-state.md
30
+ 1. Read docs/project-state.md
31
31
  2. Summarize: current Sprint, in-progress Story, completed Stories
32
32
  3. Run **Next Step Recommendation** (see below)
33
33
 
@@ -35,13 +35,13 @@ User request: "next task", "current status", "story done", "new sprint", "scope
35
35
 
36
36
  After every status check, recommend the next action based on current context:
37
37
 
38
- 1. Read `project-state.md`, `features.md`, `project-brief.md`, `failure-patterns.md`
38
+ 1. Read `docs/project-state.md`, `docs/features.md`, `docs/project-brief.md`, `docs/failure-patterns.md`
39
39
  2. Determine the project phase and recommend accordingly:
40
40
 
41
41
  | Situation | Recommendation |
42
42
  |-----------|---------------|
43
43
  | State files are empty | → "Run `bootstrap` to onboard this project" |
44
- | project-brief.md has no Vision/Goals | → "Fill out project-brief.md — this is critical for direction" |
44
+ |docs/project-brief.md has no Vision/Goals | → "Fill out docs/project-brief.md — this is critical for direction" |
45
45
  | No stories exist | → "Run `planner` to break down your first feature" |
46
46
  | A story is in-progress | → "Continue S{N}-{M}: [title]. Scope: [files]" |
47
47
  | All stories in sprint are done | → "Run `learn` to capture session lessons, then start a new sprint" |
@@ -56,21 +56,21 @@ After every status check, recommend the next action based on current context:
56
56
  ```
57
57
 
58
58
  **Request: "story done" / "S{N}-{M} done"**
59
- 1. Update the Story status to `done` in project-state.md
59
+ 1. Update the Story status to `done` in docs/project-state.md
60
60
  2. Add completion record to "Recent Changes" section
61
61
  3. Guide to next Story if available
62
62
 
63
63
  **Request: "new story" / "next task"**
64
- 1. Find next `todo` Story in project-state.md
64
+ 1. Find next `todo` Story in docs/project-state.md
65
65
  2. Change its status to `in-progress`
66
66
  3. Specify Story scope (related files/directories)
67
- 4. Alert relevant failure-patterns.md items
67
+ 4. Alert relevant docs/failure-patterns.md items
68
68
 
69
69
  **Request: "new sprint"**
70
70
  1. Check all Stories in current Sprint
71
71
  2. Warn if incomplete Stories exist
72
72
  3. Confirm new Sprint number and theme (user input)
73
- 4. Update project-state.md
73
+ 4. Update docs/project-state.md
74
74
 
75
75
  **Scope Check (automatic)**
76
76
  - If user requests a file modification outside current Story scope:
@@ -101,5 +101,5 @@ STATUS: DONE
101
101
  ## Constraints
102
102
 
103
103
  - Do not modify code directly — manage state only
104
- - Only write to project-state.md; read-only for all other files
104
+ - Only write to docs/project-state.md; read-only for all other files
105
105
  - Always confirm with user before modifying scope boundaries
@@ -20,5 +20,5 @@
20
20
 
21
21
  ## References
22
22
 
23
- - failure-patterns.md FP-002: Type confusion
24
- - failure-patterns.md FP-004: Unnecessary files committed
23
+ - docs/failure-patterns.md FP-002: Type confusion
24
+ - docs/failure-patterns.md FP-004: Unnecessary files committed
@@ -32,12 +32,12 @@
32
32
 
33
33
  1. **Mock Sync**: When you modify a repository/service interface, update corresponding mocks in the same commit.
34
34
  2. **Type Check**: Before calling a constructor or factory, read the actual source file to verify parameters. Do not rely on memory.
35
- 3. **Scope Compliance**: Do not modify files outside the current Story scope (see project-state.md) without reporting first.
35
+ 3. **Scope Compliance**: Do not modify files outside the current Story scope (see docs/project-state.md) without reporting first.
36
36
  4. **Security**: Never include credentials, passwords, or API keys in code or commits.
37
37
  5. **3-Failure Stop**: If the same approach fails 3 times, stop and report to the user.
38
- 6. **Dependency Map**: When adding or modifying a module, update dependency-map.md in the same commit. Register new modules, update relationship columns.
39
- 7. **Feature Registry**: When adding a new feature, register it in features.md in the same commit. Include key files and test files.
40
- 8. **Session Handoff**: Before ending a chat session, update project-state.md Quick Summary. Never leave the project in an undocumented state.
38
+ 6. **Dependency Map**: When adding or modifying a module, update docs/dependency-map.md in the same commit. Register new modules, update relationship columns.
39
+ 7. **Feature Registry**: When adding a new feature, register it in docs/features.md in the same commit. Include key files and test files.
40
+ 8. **Session Handoff**: Before ending a chat session, update docs/project-state.md Quick Summary. Never leave the project in an undocumented state.
41
41
 
42
42
  ## Test Rules
43
43
 
@@ -63,8 +63,8 @@ Report completion using one of:
63
63
 
64
64
  Before starting ANY coding task, do this:
65
65
 
66
- 1. Read `project-brief.md` — check Vision, Goals, Non-Goals, and Decision Log
67
- 2. If `project-brief.md` is empty → run the `bootstrap` skill first, then return to the request
66
+ 1. Read `docs/project-brief.md` — check Vision, Goals, Non-Goals, and Decision Log
67
+ 2. If `docs/project-brief.md` is empty → run the `bootstrap` skill first, then return to the request
68
68
  3. If the request conflicts with **Non-Goals** → stop and warn: "This falls under Non-Goals. Do you want to proceed? If yes, run `pivot` skill first."
69
69
  4. If the request contradicts a **Decision Log** entry → warn: "This conflicts with a previous decision: [entry]. Run `pivot` skill to update direction."
70
70
  5. If aligned → proceed
@@ -74,10 +74,10 @@ This applies to EVERY request, not just new sessions. Skip only for trivial ques
74
74
  ## New Session Bootstrap
75
75
 
76
76
  When starting a NEW chat session, read these files in order before doing any work:
77
- 1. `project-state.md` — Quick Summary tells you where we left off
78
- 2. `features.md` — What features exist in this project
79
- 3. `failure-patterns.md` — What mistakes to avoid
80
- 4. `project-brief.md` — Project vision, goals, and non-goals
77
+ 1. `docs/project-state.md` — Quick Summary tells you where we left off
78
+ 2. `docs/features.md` — What features exist in this project
79
+ 3. `docs/failure-patterns.md` — What mistakes to avoid
80
+ 4. `docs/project-brief.md` — Project vision, goals, and non-goals
81
81
 
82
82
  If ALL state files are empty (only TODOs/placeholders), run the `bootstrap` skill before doing anything else.
83
83
 
@@ -108,8 +108,19 @@ investigate → [fix] → test-integrity → reviewer → learn
108
108
 
109
109
  ## References
110
110
 
111
- - project-brief.md — Project vision, goals, non-goals (the "why")
112
- - features.md — Feature registry (the "what")
113
- - project-state.md — Sprint/Story tracking, module registry (the "where")
114
- - dependency-map.md — Module dependency graph (the "how")
115
- - failure-patterns.md — Log of known failure patterns (the "watch out")
111
+ - docs/project-brief.md — Project vision, goals, non-goals (the "why")
112
+ - docs/features.md — Feature registry (the "what")
113
+ - docs/project-state.md — Sprint/Story tracking, module registry (the "where")
114
+ - docs/dependency-map.md — Module dependency graph (the "how")
115
+ - docs/failure-patterns.md — Log of known failure patterns (the "watch out")
116
+ - docs/agent-memory/ — Per-agent persistent memory (the "learned")
117
+
118
+ ## State File Size Limits
119
+
120
+ State files must stay compact to fit in LLM context windows. Enforce these limits:
121
+ - **docs/project-brief.md**: Max 200 lines. Keep Vision/Goals/Non-Goals concise.
122
+ - **docs/project-state.md**: Max 300 lines. Archive completed sprints when exceeding limit.
123
+ - **docs/failure-patterns.md**: Max 50 patterns. Periodically remove `Status: Resolved` entries.
124
+ - **docs/dependency-map.md**: Max 100 modules. Merge trivial internal modules.
125
+ - **docs/features.md**: Max 50 features. Archive shipped features when exceeding limit.
126
+ - **docs/agent-memory/*.md**: Max 100 lines each. Keep only actionable learnings.
@@ -29,7 +29,7 @@ When modifying a module:
29
29
  3. For each dependent module:
30
30
  - Check if the change affects the public interface
31
31
  - Update tests and mocks for all affected dependents
32
- 4. Record the change in project-state.md
32
+ 4. Record the change in docs/project-state.md
33
33
 
34
34
  ## Interface Change Log
35
35
 
@@ -32,7 +32,7 @@ Keep resolved patterns for regression prevention.
32
32
  - **Occurred**: <!-- Sprint/Story where this happened -->
33
33
  - **Frequency**: 0
34
34
  - **Cause**: LLM lost track of current scope in large workflows. Skipped "report and wait for approval" steps.
35
- - **Prevention**: Track current Story in project-state.md. Sprint manager agent detects scope violations.
35
+ - **Prevention**: Track current Story in docs/project-state.md. Sprint manager agent detects scope violations.
36
36
  - **Applied in**: sprint-manager agent, global instructions
37
37
  - **Status**: Template — activate when first occurrence is logged
38
38
 
@@ -25,7 +25,7 @@
25
25
 
26
26
  ## Module Registry
27
27
 
28
- <!-- Summary of current modules. Full details in dependency-map.md -->
28
+ <!-- Summary of current modules. Full details in docs/dependency-map.md -->
29
29
  | Module | Layer | Status |
30
30
  |--------|-------|--------|
31
31
  <!-- Fill as modules are created -->
@@ -45,11 +45,11 @@
45
45
  Before ending a chat session, you MUST:
46
46
  1. Update the **Quick Summary** section above (3 lines)
47
47
  2. Update **Story Status** table with current progress
48
- 3. Add any new failure patterns to `failure-patterns.md`
49
- 4. Update `features.md` if any features were added/changed
48
+ 3. Add any new failure patterns to `docs/failure-patterns.md`
49
+ 4. Update `docs/features.md` if any features were added/changed
50
50
 
51
51
  When starting a new chat session, read these files first:
52
- 1. `project-state.md` (this file) — where we are
53
- 2. `features.md` — what exists
54
- 3. `failure-patterns.md` — what to watch out for
55
- 4. `project-brief.md` — why we're building this
52
+ 1. `docs/project-state.md` (this file) — where we are
53
+ 2. `docs/features.md` — what exists
54
+ 3. `docs/failure-patterns.md` — what to watch out for
55
+ 4. `docs/project-brief.md` — why we're building this
@@ -46,30 +46,30 @@ Ask the user these questions (skip any already answered by Phase 1):
46
46
 
47
47
  Using data from Phase 1 + Phase 2, fill the following files:
48
48
 
49
- **project-brief.md**:
49
+ **docs/project-brief.md**:
50
50
  - Project Name → from package.json name, go.mod module, or user input
51
51
  - Vision → from user answer #1
52
52
  - Goals → from user answer #2
53
53
  - Non-Goals → from user answer #3
54
54
  - Key Technical Decisions → from Phase 1 scan + user answer #4, #5
55
55
 
56
- **features.md**:
56
+ **docs/features.md**:
57
57
  - Add one row per detected module/feature area
58
58
  - Status: `✅ done` for modules with passing tests, `🔧 active` for modules without tests
59
59
  - Key Files: actual file paths from scan
60
60
  - Test Files: actual test file paths from scan
61
61
 
62
- **dependency-map.md**:
62
+ **docs/dependency-map.md**:
63
63
  - Add one row per module
64
64
  - Layer: inferred from directory structure (domain/application/infrastructure/presentation)
65
65
  - Depends On / Depended By: inferred from import scan
66
66
 
67
- **project-state.md**:
67
+ **docs/project-state.md**:
68
68
  - Quick Summary: filled with current project state
69
69
  - Sprint 1 stories: based on what bootstrap discovered
70
- - Module Registry: summary from dependency-map.md
70
+ - Module Registry: summary from docs/dependency-map.md
71
71
 
72
- **failure-patterns.md**:
72
+ **docs/failure-patterns.md**:
73
73
  - Keep FP-001 through FP-004 as templates (Frequency: 0)
74
74
  - No changes unless user reports known issues
75
75
 
@@ -92,11 +92,11 @@ Using data from Phase 1 + Phase 2, fill the following files:
92
92
  ### Dependency Links: [count]
93
93
 
94
94
  ### State Files Updated:
95
- - [x] project-brief.md — [summary]
96
- - [x] features.md — [N] features registered
97
- - [x] dependency-map.md — [N] modules, [N] dependencies
98
- - [x] project-state.md — Sprint 1 initialized
99
- - [ ] failure-patterns.md — templates only (no changes)
95
+ - [x]docs/project-brief.md — [summary]
96
+ - [x]docs/features.md — [N] features registered
97
+ - [x]docs/dependency-map.md — [N] modules, [N] dependencies
98
+ - [x]docs/project-state.md — Sprint 1 initialized
99
+ - [ ]docs/failure-patterns.md — templates only (no changes)
100
100
 
101
101
  STATUS: DONE
102
102
  ```
@@ -15,7 +15,7 @@ Ensures bottom-up implementation: foundations first, then layers that depend on
15
15
  ## Procedure
16
16
 
17
17
  1. **Describe the feature** in one sentence
18
- 2. **Read dependency-map.md** to understand current module relationships
18
+ 2. **Read docs/dependency-map.md** to understand current module relationships
19
19
  3. **Identify affected modules**: List every module that needs changes
20
20
  4. **Classify changes per module**:
21
21
  - NEW_MODULE: Entirely new module to create
@@ -58,7 +58,7 @@ Ensures bottom-up implementation: foundations first, then layers that depend on
58
58
  - Depends on: Task 2
59
59
 
60
60
  ### Dependency Map Updates
61
- - [ ] Register Module A in dependency-map.md
61
+ - [ ] Register Module A in docs/dependency-map.md
62
62
  - [ ] Update Module B's "Depends On" column
63
63
  ```
64
64
 
@@ -67,16 +67,16 @@ Ensures bottom-up implementation: foundations first, then layers that depend on
67
67
  - Never implement a module before its dependencies exist
68
68
  - Each task should be completable in one session
69
69
  - Every task must include its test files
70
- - New modules MUST be registered in dependency-map.md (Iron Law #6)
70
+ - New modules MUST be registered in docs/dependency-map.md (Iron Law #6)
71
71
  - If a task exceeds Story scope, stop and report to user
72
72
 
73
73
  ## State File Updates (mandatory)
74
74
 
75
75
  After completing the breakdown, update these files in the same session:
76
76
 
77
- - [ ] **dependency-map.md**: Register all NEW_MODULE entries. Update "Depends On" / "Depended By" for INTERFACE_CHANGE entries.
78
- - [ ] **features.md**: Add a new row for the feature with Status `🔧 active`, Key Files from Wave tasks, and Test Files.
79
- - [ ] **project-state.md**: Add Stories to the Story Status table for each Wave.
77
+ - [ ] **docs/dependency-map.md**: Register all NEW_MODULE entries. Update "Depends On" / "Depended By" for INTERFACE_CHANGE entries.
78
+ - [ ] **docs/features.md**: Add a new row for the feature with Status `🔧 active`, Key Files from Wave tasks, and Test Files.
79
+ - [ ] **docs/project-state.md**: Add Stories to the Story Status table for each Wave.
80
80
 
81
81
  ## Anti-patterns
82
82
 
@@ -15,7 +15,7 @@ The most common cause of regressions in growing projects is changing one module
15
15
  ## Procedure
16
16
 
17
17
  1. **Identify the target module**: Which module are you about to change?
18
- 2. **Read dependency-map.md**: Find the target module's row
18
+ 2. **Read docs/dependency-map.md**: Find the target module's row
19
19
  3. **List dependents**: Read the "Depended By" column — these are the blast radius
20
20
  4. **Check interface impact**: Does your change affect the module's public interface?
21
21
  - If NO (internal-only change) → proceed, but still run dependent tests
@@ -25,11 +25,11 @@ The most common cause of regressions in growing projects is changing one module
25
25
  - Identify which functions/types they use
26
26
  - Determine if the interface change breaks them
27
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 (project-state.md)
28
+ 7. **Verify scope**: Confirm all files are within the current Story scope docs/project-state.md)
29
29
 
30
30
  ## Checklist
31
31
 
32
- - [ ] Target module identified in dependency-map.md
32
+ - [ ] Target module identified in docs/dependency-map.md
33
33
  - [ ] All dependent modules listed
34
34
  - [ ] Interface vs internal change classified
35
35
  - [ ] Files importing from target module enumerated
@@ -61,8 +61,8 @@ Plan: 4 files to update, all within S3-2 scope
61
61
 
62
62
  After completing the analysis, update these files:
63
63
 
64
- - [ ] **dependency-map.md**: Update the Interface Change Log table with: Date, Module, Change description, Affected Modules, Status.
65
- - [ ] **project-state.md**: If scope exceeds current Story, add a note to Recent Changes.
64
+ - [ ] **docs/dependency-map.md**: Update the Interface Change Log table with: Date, Module, Change description, Affected Modules, Status.
65
+ - [ ] **docs/project-state.md**: If scope exceeds current Story, add a note to Recent Changes.
66
66
 
67
67
  ## Related Failure Patterns
68
68
 
@@ -27,7 +27,7 @@ Debug bugs systematically. Prevent "symptom patching" — fixing without underst
27
27
 
28
28
  1. Identify the module/directory containing the root cause
29
29
  2. Exclude files outside that scope from modification
30
- 3. Check failure-patterns.md for matching patterns
30
+ 3. Check docs/failure-patterns.md for matching patterns
31
31
 
32
32
  ### Phase 3: Hypothesis + Fix
33
33
 
@@ -39,7 +39,7 @@ Debug bugs systematically. Prevent "symptom patching" — fixing without underst
39
39
 
40
40
  1. Run all related tests after the fix
41
41
  2. Add a regression test (prevent the same bug from recurring)
42
- 3. Decide if the pattern should be recorded in failure-patterns.md
42
+ 3. Decide if the pattern should be recorded in docs/failure-patterns.md
43
43
 
44
44
  ## Checklist
45
45
 
@@ -71,8 +71,8 @@ Phase 4: Tests pass, null case test added
71
71
 
72
72
  After the fix is verified (Phase 4):
73
73
 
74
- - [ ] **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. This is NOT optional.
75
- - [ ] **project-state.md**: Add the fix to Recent Changes with the root cause hypothesis.
74
+ - [ ] **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. This is NOT optional.
75
+ - [ ] **docs/project-state.md**: Add the fix to Recent Changes with the root cause hypothesis.
76
76
 
77
77
  ## Related Failure Patterns
78
78
 
@@ -3,7 +3,7 @@
3
3
  ## Purpose
4
4
 
5
5
  Capture lessons from the current session before ending.
6
- Updates failure-patterns.md with new patterns and refreshes project-state.md Quick Summary.
6
+ Updates docs/failure-patterns.md with new patterns and refreshes docs/project-state.md Quick Summary.
7
7
  This is K-Harness's memory mechanism — without it, the same mistakes repeat across sessions.
8
8
 
9
9
  ## When to Apply
@@ -25,7 +25,7 @@ This is K-Harness's memory mechanism — without it, the same mistakes repeat ac
25
25
 
26
26
  For each issue/error that occurred in this session:
27
27
 
28
- 1. Read `failure-patterns.md`
28
+ 1. Read `docs/failure-patterns.md`
29
29
  2. Check if this matches an existing pattern (FP-NNN):
30
30
  - **If match found**: Increment the Frequency counter, add the Sprint/Story to "Occurred"
31
31
  - **If new pattern**: Assign next FP-NNN number, create a new entry using this format:
@@ -43,7 +43,7 @@ For each issue/error that occurred in this session:
43
43
 
44
44
  3. If the failure relates to a specific skill or agent, note it for that skill's checklist
45
45
 
46
- ### Step 3: Update project-state.md
46
+ ### Step 3: Update docs/project-state.md
47
47
 
48
48
  1. Update **Quick Summary** (3 lines):
49
49
  - Line 1: What was accomplished in this session
@@ -52,13 +52,25 @@ For each issue/error that occurred in this session:
52
52
  2. Update **Story Status** table if any stories changed
53
53
  3. Add to **Recent Changes** section with date and summary
54
54
 
55
- ### Step 4: Update features.md (if applicable)
55
+ ### Step 4: Update docs/features.md (if applicable)
56
56
 
57
57
  1. If new features were added → add row to Feature List
58
58
  2. If existing features were modified → update Key Files and Test Files columns
59
59
  3. If features were completed → update Status to `✅ done`
60
60
 
61
- ### Step 5: Report
61
+ ### Step 5: Update Agent Memory (if applicable)
62
+
63
+ If an agent (reviewer, planner, sprint-manager) was used in this session, update its memory file in `docs/agent-memory/`:
64
+
65
+ 1. Read `docs/agent-memory/{agent-name}.md`
66
+ 2. Add session-specific learnings to the appropriate section:
67
+ - **reviewer.md**: Review patterns, frequently missed items, statistics
68
+ - **planner.md**: Estimation accuracy, architecture insights, repeated patterns
69
+ - **sprint-manager.md**: Velocity data, scope drift incidents, sizing recommendations
70
+ 3. Keep entries concise — one line per learning
71
+ 4. If no agent was used in this session, skip this step
72
+
73
+ ### Step 6: Report
62
74
 
63
75
  Present a summary of all updates made.
64
76
 
@@ -71,9 +83,10 @@ Present a summary of all updates made.
71
83
  - [FP-NNN] (new/updated): [description]
72
84
 
73
85
  ### State Files Updated:
74
- - [x] project-state.md — Quick Summary refreshed
75
- - [x] failure-patterns.md — [N] patterns added/updated
76
- - [x] features.md — [N] features updated (if applicable)
86
+ - [x]docs/project-state.md — Quick Summary refreshed
87
+ - [x]docs/failure-patterns.md — [N] patterns added/updated
88
+ - [x]docs/features.md — [N] features updated (if applicable)
89
+ - [x] docs/agent-memory/{name}.md — [N] agents updated (if applicable)
77
90
 
78
91
  ### Next Session Should:
79
92
  1. [recommended first action]
@@ -97,4 +110,4 @@ STATUS: DONE
97
110
  | Record theoretical risks as failure patterns | Only record failures that actually happened |
98
111
  | Write vague descriptions ("something broke") | Be specific: file name, error message, root cause |
99
112
  | Skip this skill because "nothing went wrong" | Still update Quick Summary and Story Status |
100
- | Update failure-patterns.md but not project-state.md | Always update both — they serve different purposes |
113
+ | Update docs/failure-patterns.md but not docs/project-state.md | Always update both — they serve different purposes |
@@ -3,7 +3,7 @@
3
3
  ## Purpose
4
4
 
5
5
  When a project direction changes — technology swap, scope expansion/reduction, architecture shift — this skill propagates the change across ALL state files consistently.
6
- Without this, direction changes create silent inconsistencies: project-brief.md says "GraphQL" but dependency-map.md still references REST modules.
6
+ Without this, direction changes create silent inconsistencies:docs/project-brief.md says "GraphQL" but docs/dependency-map.md still references REST modules.
7
7
 
8
8
  ## When to Apply
9
9
 
@@ -28,29 +28,29 @@ Without this, direction changes create silent inconsistencies: project-brief.md
28
28
 
29
29
  Read ALL state files and identify what needs updating:
30
30
 
31
- 1. **project-brief.md**:
31
+ 1. **docs/project-brief.md**:
32
32
  - Does Vision need rewording?
33
33
  - Do Goals need updating?
34
34
  - Do Non-Goals need updating?
35
35
  - Do Key Technical Decisions need changing?
36
36
  - Record the decision with reasoning in the Decision Log section
37
37
 
38
- 2. **features.md**:
38
+ 2. **docs/features.md**:
39
39
  - Which existing features are affected?
40
40
  - Which features should be marked `⛔ dropped`?
41
41
  - Are new features needed?
42
42
 
43
- 3. **dependency-map.md**:
43
+ 3. **docs/dependency-map.md**:
44
44
  - Which modules are obsoleted by this change?
45
45
  - Which new modules are needed?
46
46
  - Which dependency relationships change?
47
47
 
48
- 4. **project-state.md**:
48
+ 4. **docs/project-state.md**:
49
49
  - Which in-progress stories are affected?
50
50
  - Does the current sprint goal change?
51
51
  - Update Quick Summary to reflect the pivot
52
52
 
53
- 5. **failure-patterns.md**:
53
+ 5. **docs/failure-patterns.md**:
54
54
  - Are any existing patterns invalidated by this change?
55
55
  - Mark invalidated patterns as `Status: Obsolete (pivot: [reason])`
56
56
 
@@ -63,11 +63,11 @@ Before writing anything, present a summary to the user:
63
63
  Type: [Tech Swap | Scope Change | Architecture Shift | Goal Pivot]
64
64
 
65
65
  ### State File Changes:
66
- - project-brief.md: [what changes]
67
- - features.md: [N features affected, M dropped, K added]
68
- - dependency-map.md: [N modules obsoleted, M added, K relationships changed]
69
- - project-state.md: [N stories affected]
70
- - failure-patterns.md: [N patterns obsoleted]
66
+ - docs/project-brief.md: [what changes]
67
+ - docs/features.md: [N features affected, M dropped, K added]
68
+ - docs/dependency-map.md: [N modules obsoleted, M added, K relationships changed]
69
+ - docs/project-state.md: [N stories affected]
70
+ - docs/failure-patterns.md: [N patterns obsoleted]
71
71
 
72
72
  ### Confirm? (yes/no)
73
73
  ```
@@ -76,15 +76,15 @@ Type: [Tech Swap | Scope Change | Architecture Shift | Goal Pivot]
76
76
 
77
77
  After user confirms, update ALL state files in order:
78
78
 
79
- 1. **project-brief.md** first (source of truth for direction)
80
- 2. **features.md** second (what we're building)
81
- 3. **dependency-map.md** third (how it connects)
82
- 4. **project-state.md** fourth (current work status)
83
- 5. **failure-patterns.md** last (historical patterns)
79
+ 1. **docs/project-brief.md** first (source of truth for direction)
80
+ 2. **docs/features.md** second (what we're building)
81
+ 3. **docs/dependency-map.md** third (how it connects)
82
+ 4. **docs/project-state.md** fourth (current work status)
83
+ 5. **docs/failure-patterns.md** last (historical patterns)
84
84
 
85
85
  ### Step 5: Decision Log Entry
86
86
 
87
- Add an entry to the Decision Log section in project-brief.md:
87
+ Add an entry to the Decision Log section in docs/project-brief.md:
88
88
 
89
89
  ```markdown
90
90
  ### [YYYY-MM-DD] [Decision Title]
@@ -97,6 +97,6 @@ Add an entry to the Decision Log section in project-brief.md:
97
97
  ## Rules
98
98
 
99
99
  - **Never skip the confirmation step** — the user must approve before any state file is written
100
- - **Never update partially** — if you update project-brief.md, you MUST check and update all other state files too
100
+ - **Never update partially** — if you update docs/project-brief.md, you MUST check and update all other state files too
101
101
  - **Preserve history** — mark dropped features as `⛔ dropped`, don't delete rows
102
102
  - **Record the why** — every pivot must have a Decision Log entry with reasoning
@@ -48,7 +48,7 @@ const dbPassword = "super_secret_123";
48
48
 
49
49
  After completing the security check:
50
50
 
51
- - [ ] **failure-patterns.md**: If a security issue was found (credentials staged, hardcoded secret), add a new FP-NNN entry or increment FP-004 Frequency.
51
+ - [ ] **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.
52
52
 
53
53
  ## Related Failure Patterns
54
54
 
@@ -45,8 +45,8 @@ Interface adds findByFilters() → Mock unchanged
45
45
 
46
46
  After synchronizing mocks:
47
47
 
48
- - [ ] **failure-patterns.md**: If mock sync was missed and caused a test failure, increment FP-001 Frequency.
49
- - [ ] **dependency-map.md**: If the interface change altered module relationships, update the relevant row.
48
+ - [ ] **docs/failure-patterns.md**: If mock sync was missed and caused a test failure, increment FP-001 Frequency.
49
+ - [ ] **docs/dependency-map.md**: If the interface change altered module relationships, update the relevant row.
50
50
 
51
51
  ## Related Failure Patterns
52
52
 
@@ -18,4 +18,4 @@
18
18
  ## References
19
19
 
20
20
  - test-integrity skill
21
- - failure-patterns.md FP-001: Mock not updated
21
+ - docs/failure-patterns.md FP-001: Mock not updated
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "k-harness",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
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
@@ -51,11 +51,22 @@ const STATE_FILES = [
51
51
  'project-brief.md',
52
52
  ];
53
53
 
54
+ const AGENT_MEMORY_FILES = [
55
+ 'agent-memory/reviewer.md',
56
+ 'agent-memory/planner.md',
57
+ 'agent-memory/sprint-manager.md',
58
+ ];
59
+
60
+ const STATE_DEST_DIR = 'docs';
61
+
54
62
  // ─── Shared writers ──────────────────────────────────────────
55
63
 
56
64
  function writeStateFiles(targetDir, overwrite) {
57
65
  for (const file of STATE_FILES) {
58
- writeFile(targetDir, file, readTemplate(file), overwrite);
66
+ writeFile(targetDir, `${STATE_DEST_DIR}/${file}`, readTemplate(file), overwrite);
67
+ }
68
+ for (const file of AGENT_MEMORY_FILES) {
69
+ writeFile(targetDir, `${STATE_DEST_DIR}/${file}`, readTemplate(file), overwrite);
59
70
  }
60
71
  }
61
72
 
@@ -369,7 +380,7 @@ async function run(argv) {
369
380
  const gen = GENERATORS[ide];
370
381
  console.log(`\n Installing for ${gen.name}...\n`);
371
382
  gen.fn(args.dir, args.overwrite);
372
- console.log(`\n Done! Edit project-state.md to set up your first sprint.\n`);
383
+ console.log(`\n Done! Edit docs/project-state.md to set up your first sprint.\n`);
373
384
  }
374
385
  }
375
386