k-harness 0.3.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 +66 -37
- package/harness/agent-memory/planner.md +25 -0
- package/harness/agent-memory/reviewer.md +24 -0
- package/harness/agent-memory/sprint-manager.md +26 -0
- package/harness/agents/planner.md +32 -18
- package/harness/agents/reviewer.md +29 -10
- package/harness/agents/sprint-manager.md +41 -9
- package/harness/backend-rules.md +10 -8
- package/harness/core-rules.md +65 -15
- package/harness/dependency-map.md +1 -1
- package/harness/failure-patterns.md +1 -1
- package/harness/project-brief.md +39 -19
- package/harness/project-state.md +7 -7
- package/harness/skills/bootstrap.md +119 -0
- package/harness/skills/feature-breakdown.md +19 -10
- package/harness/skills/impact-analysis.md +10 -3
- package/harness/skills/investigate.md +9 -2
- package/harness/skills/learn.md +113 -0
- package/harness/skills/pivot.md +102 -0
- package/harness/skills/security-checklist.md +6 -0
- package/harness/skills/test-integrity.md +7 -0
- package/harness/testing-rules.md +3 -3
- package/package.json +4 -1
- package/src/init.js +107 -151
package/harness/project-brief.md
CHANGED
|
@@ -1,49 +1,69 @@
|
|
|
1
1
|
# Project Brief
|
|
2
2
|
|
|
3
|
+
> **Fill this out immediately after running `k-harness init`.** The Planner agent uses this file for Direction Guard — without it, scope drift cannot be prevented.
|
|
4
|
+
|
|
3
5
|
## Vision
|
|
4
6
|
|
|
5
|
-
<!-- What is this project and why does it exist?
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
<!-- What is this project and why does it exist? Keep it to 1-2 sentences.
|
|
8
|
+
This is the north star for all decisions.
|
|
9
|
+
Examples:
|
|
10
|
+
- "An open-source MCP hub that connects AI tools to enterprise services."
|
|
11
|
+
- "A CLI tool that generates IDE-specific instruction files for LLM agents."
|
|
12
|
+
- "An e-commerce platform focused on local artisan products."
|
|
13
|
+
-->
|
|
8
14
|
|
|
9
15
|
## Goals
|
|
10
16
|
|
|
11
|
-
<!-- What must this project achieve? List 3-5 concrete goals.
|
|
12
|
-
|
|
17
|
+
<!-- What must this project achieve? List 3-5 concrete, measurable goals.
|
|
18
|
+
Examples:
|
|
13
19
|
- Support 50+ MCP servers with auto-discovery
|
|
14
20
|
- Sub-100ms routing latency
|
|
15
21
|
- Zero-config developer experience
|
|
22
|
+
- API coverage for all CRUD operations by v1.0
|
|
16
23
|
-->
|
|
17
24
|
|
|
18
25
|
## Non-Goals
|
|
19
26
|
|
|
20
27
|
<!-- What is explicitly OUT OF SCOPE? This is equally important as Goals.
|
|
21
|
-
|
|
28
|
+
The Planner agent will WARN you when a requested feature falls here.
|
|
29
|
+
Examples:
|
|
22
30
|
- Not a hosting platform — users deploy their own
|
|
23
31
|
- Not supporting legacy REST APIs — MCP only
|
|
24
32
|
- Not building a UI dashboard in v1
|
|
33
|
+
- No mobile app — web only
|
|
25
34
|
-->
|
|
26
35
|
|
|
27
36
|
## Target Users
|
|
28
37
|
|
|
29
|
-
<!-- Who is this for?
|
|
30
|
-
|
|
38
|
+
<!-- Who is this for? Be specific.
|
|
39
|
+
Examples:
|
|
40
|
+
- "Solo developers and small teams (1-3) using AI coding assistants."
|
|
41
|
+
- "Enterprise teams migrating from monolith to microservices."
|
|
42
|
+
- "Data scientists who need reproducible ML pipelines."
|
|
31
43
|
-->
|
|
32
44
|
|
|
33
45
|
## Key Technical Decisions
|
|
34
46
|
|
|
35
|
-
<!-- Record
|
|
36
|
-
|
|
37
|
-
- TypeScript
|
|
38
|
-
-
|
|
39
|
-
-
|
|
47
|
+
<!-- Record foundational technology choices. Helps LLMs generate correct code.
|
|
48
|
+
Examples:
|
|
49
|
+
- Language: TypeScript 5.x (strict mode)
|
|
50
|
+
- Framework: Express + Prisma ORM
|
|
51
|
+
- Test runner: Vitest (not Jest)
|
|
52
|
+
- Database: PostgreSQL 16
|
|
53
|
+
- Architecture: Hexagonal (Port + Adapter)
|
|
54
|
+
- Language: Python 3.12, Framework: FastAPI, Tests: pytest
|
|
55
|
+
- Language: Go 1.22, no framework, Tests: go test
|
|
40
56
|
-->
|
|
41
57
|
|
|
42
|
-
##
|
|
58
|
+
## Decision Log
|
|
59
|
+
|
|
60
|
+
<!-- Record WHY key decisions were made. The Planner uses this to avoid re-debating settled decisions.
|
|
61
|
+
Use the `pivot` skill to add entries here when direction changes.
|
|
62
|
+
Format:
|
|
43
63
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
64
|
+
### [YYYY-MM-DD] [Decision Title]
|
|
65
|
+
- **Change**: What changed
|
|
66
|
+
- **Reason**: Why this decision was made
|
|
67
|
+
- **Impact**: What was affected
|
|
68
|
+
- **Alternatives Considered**: What else was considered and rejected
|
|
49
69
|
-->
|
package/harness/project-state.md
CHANGED
|
@@ -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
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Bootstrap
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Onboard a new or existing project into K-Harness by filling state files automatically.
|
|
6
|
+
Solves the cold-start problem: users don't know which `.md` files to fill or how.
|
|
7
|
+
|
|
8
|
+
## When to Apply
|
|
9
|
+
|
|
10
|
+
- Right after running `k-harness init` on a new project
|
|
11
|
+
- When joining an existing project that has empty state files
|
|
12
|
+
- When state files are outdated and need a refresh
|
|
13
|
+
- When any agent reports "state files are empty"
|
|
14
|
+
|
|
15
|
+
## Procedure
|
|
16
|
+
|
|
17
|
+
### Phase 1: Project Discovery (read-only)
|
|
18
|
+
|
|
19
|
+
1. **Scan project root** for configuration files:
|
|
20
|
+
- `package.json`, `tsconfig.json` → Node.js/TypeScript
|
|
21
|
+
- `go.mod`, `go.sum` → Go
|
|
22
|
+
- `requirements.txt`, `pyproject.toml`, `setup.py` → Python
|
|
23
|
+
- `pom.xml`, `build.gradle` → Java
|
|
24
|
+
- `Cargo.toml` → Rust
|
|
25
|
+
- `Gemfile` → Ruby
|
|
26
|
+
2. **Scan directory structure**: List top-level directories and identify patterns
|
|
27
|
+
- `src/`, `lib/`, `app/` → source code
|
|
28
|
+
- `tests/`, `test/`, `__tests__/`, `spec/` → test directories
|
|
29
|
+
- `docs/` → documentation
|
|
30
|
+
3. **Scan for existing tests**: Find test files and map them to source modules
|
|
31
|
+
4. **Scan imports/dependencies**: Trace module relationships from import statements
|
|
32
|
+
|
|
33
|
+
**Do NOT modify any code files in this phase.**
|
|
34
|
+
|
|
35
|
+
### Phase 2: User Interview (interactive)
|
|
36
|
+
|
|
37
|
+
Ask the user these questions (skip any already answered by Phase 1):
|
|
38
|
+
|
|
39
|
+
1. "What does this project do? (one sentence)"
|
|
40
|
+
2. "What are the top 3 goals of this project?"
|
|
41
|
+
3. "What is explicitly OUT of scope? (non-goals)"
|
|
42
|
+
4. "What architecture pattern are you using?" (show detected pattern if found)
|
|
43
|
+
5. "Are there any type decisions or conventions the AI should know about?"
|
|
44
|
+
|
|
45
|
+
### Phase 3: Fill State Files
|
|
46
|
+
|
|
47
|
+
Using data from Phase 1 + Phase 2, fill the following files:
|
|
48
|
+
|
|
49
|
+
**docs/project-brief.md**:
|
|
50
|
+
- Project Name → from package.json name, go.mod module, or user input
|
|
51
|
+
- Vision → from user answer #1
|
|
52
|
+
- Goals → from user answer #2
|
|
53
|
+
- Non-Goals → from user answer #3
|
|
54
|
+
- Key Technical Decisions → from Phase 1 scan + user answer #4, #5
|
|
55
|
+
|
|
56
|
+
**docs/features.md**:
|
|
57
|
+
- Add one row per detected module/feature area
|
|
58
|
+
- Status: `✅ done` for modules with passing tests, `🔧 active` for modules without tests
|
|
59
|
+
- Key Files: actual file paths from scan
|
|
60
|
+
- Test Files: actual test file paths from scan
|
|
61
|
+
|
|
62
|
+
**docs/dependency-map.md**:
|
|
63
|
+
- Add one row per module
|
|
64
|
+
- Layer: inferred from directory structure (domain/application/infrastructure/presentation)
|
|
65
|
+
- Depends On / Depended By: inferred from import scan
|
|
66
|
+
|
|
67
|
+
**docs/project-state.md**:
|
|
68
|
+
- Quick Summary: filled with current project state
|
|
69
|
+
- Sprint 1 stories: based on what bootstrap discovered
|
|
70
|
+
- Module Registry: summary from docs/dependency-map.md
|
|
71
|
+
|
|
72
|
+
**docs/failure-patterns.md**:
|
|
73
|
+
- Keep FP-001 through FP-004 as templates (Frequency: 0)
|
|
74
|
+
- No changes unless user reports known issues
|
|
75
|
+
|
|
76
|
+
### Phase 4: Verify
|
|
77
|
+
|
|
78
|
+
1. Present a summary of all filled state files to the user
|
|
79
|
+
2. Ask "Does this look correct? What should I change?"
|
|
80
|
+
3. Apply corrections if any
|
|
81
|
+
4. Report completion
|
|
82
|
+
|
|
83
|
+
## Output Format
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
## Bootstrap Complete
|
|
87
|
+
|
|
88
|
+
### Project: [name]
|
|
89
|
+
### Tech Stack: [detected stack]
|
|
90
|
+
### Modules Found: [count]
|
|
91
|
+
### Features Mapped: [count]
|
|
92
|
+
### Dependency Links: [count]
|
|
93
|
+
|
|
94
|
+
### State Files Updated:
|
|
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
|
+
|
|
101
|
+
STATUS: DONE
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Rules
|
|
105
|
+
|
|
106
|
+
- Never modify source code — this skill only writes to state files
|
|
107
|
+
- Always show the user what was discovered BEFORE writing files
|
|
108
|
+
- If the project has 0 source files, skip Phase 1 scan and go straight to Phase 2
|
|
109
|
+
- If a state file already has content, ask before overwriting
|
|
110
|
+
- Run this skill only once per project (or when explicitly requested for refresh)
|
|
111
|
+
|
|
112
|
+
## Anti-patterns
|
|
113
|
+
|
|
114
|
+
| Anti-pattern | Correct Approach |
|
|
115
|
+
|---|---|
|
|
116
|
+
| Guess module boundaries | Scan actual directory structure and imports |
|
|
117
|
+
| Skip user interview | Phase 1 scan alone is insufficient — always confirm with user |
|
|
118
|
+
| Overwrite existing state files silently | Ask before overwriting non-empty files |
|
|
119
|
+
| Create perfect dependency map on first try | Start with what's detectable, refine over time |
|
|
@@ -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
|
|
@@ -41,24 +41,24 @@ Ensures bottom-up implementation: foundations first, then layers that depend on
|
|
|
41
41
|
|
|
42
42
|
### Wave 1 (no dependencies)
|
|
43
43
|
- [ ] Task 1: [Module A] — Create entity + repository interface
|
|
44
|
-
- Files:
|
|
45
|
-
- Tests:
|
|
44
|
+
- Files: <!-- list files to create/modify -->
|
|
45
|
+
- Tests: <!-- list test files -->
|
|
46
46
|
- Depends on: none
|
|
47
47
|
|
|
48
48
|
### Wave 2 (depends on Wave 1)
|
|
49
49
|
- [ ] Task 2: [Module B] — Implement use case
|
|
50
|
-
- Files:
|
|
51
|
-
- Tests:
|
|
50
|
+
- Files: <!-- list files to create/modify -->
|
|
51
|
+
- Tests: <!-- list test files -->
|
|
52
52
|
- Depends on: Task 1
|
|
53
53
|
|
|
54
54
|
### Wave 3 (depends on Wave 2)
|
|
55
|
-
- [ ] Task 3: [Module C] — Add API endpoint
|
|
56
|
-
- Files:
|
|
57
|
-
- Tests:
|
|
55
|
+
- [ ] Task 3: [Module C] — Add API endpoint / UI integration
|
|
56
|
+
- Files: <!-- list files to create/modify -->
|
|
57
|
+
- Tests: <!-- list test files -->
|
|
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,9 +67,17 @@ 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
|
+
## State File Updates (mandatory)
|
|
74
|
+
|
|
75
|
+
After completing the breakdown, update these files in the same session:
|
|
76
|
+
|
|
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
|
+
|
|
73
81
|
## Anti-patterns
|
|
74
82
|
|
|
75
83
|
| Anti-pattern | Correct Approach |
|
|
@@ -78,3 +86,4 @@ Ensures bottom-up implementation: foundations first, then layers that depend on
|
|
|
78
86
|
| One giant task for the whole feature | Break into single-module tasks |
|
|
79
87
|
| Skip dependency-map registration | Register immediately when creating module |
|
|
80
88
|
| Tests "later" | Tests in the same task |
|
|
89
|
+
| Produce breakdown but skip state file updates | State file updates are part of the breakdown, not a separate step |
|
|
@@ -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
|
|
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
|
|
@@ -57,6 +57,13 @@ Plan: 4 files to update, all within S3-2 scope
|
|
|
57
57
|
→ Tests fail in 3 modules, mock out of sync, 2 hours wasted
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
## State File Updates (mandatory)
|
|
61
|
+
|
|
62
|
+
After completing the analysis, update these files:
|
|
63
|
+
|
|
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
|
+
|
|
60
67
|
## Related Failure Patterns
|
|
61
68
|
|
|
62
69
|
- FP-001: Interface changed, mock not updated → Checklist item 5
|
|
@@ -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
|
|
|
@@ -67,6 +67,13 @@ Phase 4: Tests pass, null case test added
|
|
|
67
67
|
→ Root cause unknown, no reproduction conditions recorded, same error possible elsewhere
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
## State File Updates (mandatory)
|
|
71
|
+
|
|
72
|
+
After the fix is verified (Phase 4):
|
|
73
|
+
|
|
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
|
+
|
|
70
77
|
## Related Failure Patterns
|
|
71
78
|
|
|
72
79
|
- FP-002: Type confusion → Phase 1 requires verifying actual types
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Learn
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Capture lessons from the current session before ending.
|
|
6
|
+
Updates docs/failure-patterns.md with new patterns and refreshes docs/project-state.md Quick Summary.
|
|
7
|
+
This is K-Harness's memory mechanism — without it, the same mistakes repeat across sessions.
|
|
8
|
+
|
|
9
|
+
## When to Apply
|
|
10
|
+
|
|
11
|
+
- Before ending a chat session (recommended as the LAST skill invoked)
|
|
12
|
+
- After a debugging session where a non-obvious fix was found
|
|
13
|
+
- After a review revealed a repeated mistake
|
|
14
|
+
- When the user explicitly asks to record a lesson
|
|
15
|
+
|
|
16
|
+
## Procedure
|
|
17
|
+
|
|
18
|
+
### Step 1: Review Session Activity
|
|
19
|
+
|
|
20
|
+
1. Scan recent git changes: `git log --oneline -10` and `git diff --stat HEAD~3`
|
|
21
|
+
2. Identify what was accomplished in this session
|
|
22
|
+
3. Identify any errors, failures, or unexpected issues that occurred
|
|
23
|
+
|
|
24
|
+
### Step 2: Failure Pattern Detection
|
|
25
|
+
|
|
26
|
+
For each issue/error that occurred in this session:
|
|
27
|
+
|
|
28
|
+
1. Read `docs/failure-patterns.md`
|
|
29
|
+
2. Check if this matches an existing pattern (FP-NNN):
|
|
30
|
+
- **If match found**: Increment the Frequency counter, add the Sprint/Story to "Occurred"
|
|
31
|
+
- **If new pattern**: Assign next FP-NNN number, create a new entry using this format:
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
## FP-NNN: [Short description]
|
|
35
|
+
|
|
36
|
+
- **Occurred**: S[sprint]-[story]
|
|
37
|
+
- **Frequency**: 1
|
|
38
|
+
- **Cause**: [What went wrong and why]
|
|
39
|
+
- **Prevention**: [Specific check to prevent recurrence]
|
|
40
|
+
- **Applied in**: [Which skills/agents/rules should enforce this]
|
|
41
|
+
- **Status**: Active
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
3. If the failure relates to a specific skill or agent, note it for that skill's checklist
|
|
45
|
+
|
|
46
|
+
### Step 3: Update docs/project-state.md
|
|
47
|
+
|
|
48
|
+
1. Update **Quick Summary** (3 lines):
|
|
49
|
+
- Line 1: What was accomplished in this session
|
|
50
|
+
- Line 2: What is currently in progress
|
|
51
|
+
- Line 3: What should be done next
|
|
52
|
+
2. Update **Story Status** table if any stories changed
|
|
53
|
+
3. Add to **Recent Changes** section with date and summary
|
|
54
|
+
|
|
55
|
+
### Step 4: Update docs/features.md (if applicable)
|
|
56
|
+
|
|
57
|
+
1. If new features were added → add row to Feature List
|
|
58
|
+
2. If existing features were modified → update Key Files and Test Files columns
|
|
59
|
+
3. If features were completed → update Status to `✅ done`
|
|
60
|
+
|
|
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
|
|
74
|
+
|
|
75
|
+
Present a summary of all updates made.
|
|
76
|
+
|
|
77
|
+
## Output Format
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
## Session Learn Complete
|
|
81
|
+
|
|
82
|
+
### Lessons Captured:
|
|
83
|
+
- [FP-NNN] (new/updated): [description]
|
|
84
|
+
|
|
85
|
+
### State Files Updated:
|
|
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)
|
|
90
|
+
|
|
91
|
+
### Next Session Should:
|
|
92
|
+
1. [recommended first action]
|
|
93
|
+
2. [next priority]
|
|
94
|
+
|
|
95
|
+
STATUS: DONE
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Rules
|
|
99
|
+
|
|
100
|
+
- Never invent patterns that didn't actually occur — record only real failures
|
|
101
|
+
- Keep failure pattern descriptions concise (1-2 sentences for Cause and Prevention)
|
|
102
|
+
- If no failures occurred, skip Step 2 and just update state files
|
|
103
|
+
- Do not modify source code — this skill only updates state files
|
|
104
|
+
- Quick Summary must be exactly 3 lines — concise enough for the next session to scan instantly
|
|
105
|
+
|
|
106
|
+
## Anti-patterns
|
|
107
|
+
|
|
108
|
+
| Anti-pattern | Correct Approach |
|
|
109
|
+
|---|---|
|
|
110
|
+
| Record theoretical risks as failure patterns | Only record failures that actually happened |
|
|
111
|
+
| Write vague descriptions ("something broke") | Be specific: file name, error message, root cause |
|
|
112
|
+
| Skip this skill because "nothing went wrong" | Still update Quick Summary and Story Status |
|
|
113
|
+
| Update docs/failure-patterns.md but not docs/project-state.md | Always update both — they serve different purposes |
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Pivot
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
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:docs/project-brief.md says "GraphQL" but docs/dependency-map.md still references REST modules.
|
|
7
|
+
|
|
8
|
+
## When to Apply
|
|
9
|
+
|
|
10
|
+
- Technology change: "Switch from REST to GraphQL", "Replace PostgreSQL with MongoDB"
|
|
11
|
+
- Scope change: "Add real-time features", "Remove mobile support", "Downscope to MVP"
|
|
12
|
+
- Architecture shift: "Move from monolith to microservices", "Switch from SSR to SPA"
|
|
13
|
+
- Goal change: "Pivot from B2C to B2B", "Change target users"
|
|
14
|
+
- Any time the user says "let's change direction", "pivot", "switch to", "drop [feature area]"
|
|
15
|
+
|
|
16
|
+
## Procedure
|
|
17
|
+
|
|
18
|
+
### Step 1: Capture the Change
|
|
19
|
+
|
|
20
|
+
1. Ask the user to describe the change in one sentence
|
|
21
|
+
2. Classify the change type:
|
|
22
|
+
- **Tech Swap**: Replacing one technology with another
|
|
23
|
+
- **Scope Change**: Adding or removing feature areas
|
|
24
|
+
- **Architecture Shift**: Changing system structure
|
|
25
|
+
- **Goal Pivot**: Changing project purpose or target
|
|
26
|
+
|
|
27
|
+
### Step 2: Impact Scan
|
|
28
|
+
|
|
29
|
+
Read ALL state files and identify what needs updating:
|
|
30
|
+
|
|
31
|
+
1. **docs/project-brief.md**:
|
|
32
|
+
- Does Vision need rewording?
|
|
33
|
+
- Do Goals need updating?
|
|
34
|
+
- Do Non-Goals need updating?
|
|
35
|
+
- Do Key Technical Decisions need changing?
|
|
36
|
+
- Record the decision with reasoning in the Decision Log section
|
|
37
|
+
|
|
38
|
+
2. **docs/features.md**:
|
|
39
|
+
- Which existing features are affected?
|
|
40
|
+
- Which features should be marked `⛔ dropped`?
|
|
41
|
+
- Are new features needed?
|
|
42
|
+
|
|
43
|
+
3. **docs/dependency-map.md**:
|
|
44
|
+
- Which modules are obsoleted by this change?
|
|
45
|
+
- Which new modules are needed?
|
|
46
|
+
- Which dependency relationships change?
|
|
47
|
+
|
|
48
|
+
4. **docs/project-state.md**:
|
|
49
|
+
- Which in-progress stories are affected?
|
|
50
|
+
- Does the current sprint goal change?
|
|
51
|
+
- Update Quick Summary to reflect the pivot
|
|
52
|
+
|
|
53
|
+
5. **docs/failure-patterns.md**:
|
|
54
|
+
- Are any existing patterns invalidated by this change?
|
|
55
|
+
- Mark invalidated patterns as `Status: Obsolete (pivot: [reason])`
|
|
56
|
+
|
|
57
|
+
### Step 3: Present Change Plan
|
|
58
|
+
|
|
59
|
+
Before writing anything, present a summary to the user:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
## Pivot: [one-sentence description]
|
|
63
|
+
Type: [Tech Swap | Scope Change | Architecture Shift | Goal Pivot]
|
|
64
|
+
|
|
65
|
+
### State File Changes:
|
|
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
|
+
|
|
72
|
+
### Confirm? (yes/no)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Step 4: Execute Updates
|
|
76
|
+
|
|
77
|
+
After user confirms, update ALL state files in order:
|
|
78
|
+
|
|
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
|
+
|
|
85
|
+
### Step 5: Decision Log Entry
|
|
86
|
+
|
|
87
|
+
Add an entry to the Decision Log section in docs/project-brief.md:
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
### [YYYY-MM-DD] [Decision Title]
|
|
91
|
+
- **Change**: [What changed]
|
|
92
|
+
- **Reason**: [Why this decision was made]
|
|
93
|
+
- **Impact**: [What was affected]
|
|
94
|
+
- **Alternatives Considered**: [What else was considered and rejected]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Rules
|
|
98
|
+
|
|
99
|
+
- **Never skip the confirmation step** — the user must approve before any state file is written
|
|
100
|
+
- **Never update partially** — if you update docs/project-brief.md, you MUST check and update all other state files too
|
|
101
|
+
- **Preserve history** — mark dropped features as `⛔ dropped`, don't delete rows
|
|
102
|
+
- **Record the why** — every pivot must have a Decision Log entry with reasoning
|
|
@@ -44,6 +44,12 @@ git add .
|
|
|
44
44
|
const dbPassword = "super_secret_123";
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
## State File Updates (mandatory)
|
|
48
|
+
|
|
49
|
+
After completing the security check:
|
|
50
|
+
|
|
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
|
+
|
|
47
53
|
## Related Failure Patterns
|
|
48
54
|
|
|
49
55
|
- FP-004: Dangerous file committed → Checklist items 1, 4
|
|
@@ -41,6 +41,13 @@ Interface adds findByFilters() → Mock unchanged
|
|
|
41
41
|
→ Runtime error: method not found on mock object
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
## State File Updates (mandatory)
|
|
45
|
+
|
|
46
|
+
After synchronizing mocks:
|
|
47
|
+
|
|
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
|
+
|
|
44
51
|
## Related Failure Patterns
|
|
45
52
|
|
|
46
53
|
- FP-001: Interface changed, mock not updated → Checklist item 1
|
package/harness/testing-rules.md
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
## Forbidden
|
|
12
12
|
|
|
13
13
|
- Casting mocks with `any` type. Create mocks using the actual interface type.
|
|
14
|
-
- Creating mocks with
|
|
14
|
+
- Creating mocks with no default return values. Always set sensible defaults (e.g. `mockResolvedValue`, stub returns).
|
|
15
15
|
- Committing with `skip` or `only` left in test files.
|
|
16
|
-
- Committing with `console.log`
|
|
16
|
+
- Committing with debugging statements (e.g. `console.log`, `print`, `println`).
|
|
17
17
|
|
|
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.
|
|
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",
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=18.0.0"
|
|
37
37
|
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"test": "node --test tests/*.test.js"
|
|
40
|
+
},
|
|
38
41
|
"publishConfig": {
|
|
39
42
|
"access": "public"
|
|
40
43
|
}
|