k-harness 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 K-Harness Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # K-Harness
2
+
3
+ LLM Development Harness — IDE-agnostic rules, skills, and agents that prevent common AI coding failures.
4
+
5
+ ## What It Does
6
+
7
+ K-Harness installs structured instruction files into your project that guide LLM coding agents (Copilot, Claude, Cursor, Codex, Windsurf) to avoid common mistakes:
8
+
9
+ - **Iron Laws** — Hard rules the LLM must follow every session (mock sync, type checking, security)
10
+ - **Skills** — Step-by-step procedures for specific tasks (debugging, code review, security checks)
11
+ - **Agents** — Role-based personas (reviewer, sprint manager)
12
+ - **Failure Patterns** — Project-specific failure log that prevents repeat mistakes
13
+ - **State Tracking** — Sprint/Story state so the LLM knows what to work on
14
+
15
+ ## Quick Start
16
+
17
+ ```bash
18
+ npx k-harness init
19
+ ```
20
+
21
+ Select your IDE when prompted. Files are installed into the current directory.
22
+
23
+ ### Non-interactive
24
+
25
+ ```bash
26
+ npx k-harness init --ide vscode
27
+ npx k-harness init --ide claude
28
+ npx k-harness init --ide cursor
29
+ npx k-harness init --ide codex
30
+ npx k-harness init --ide windsurf
31
+ ```
32
+
33
+ ### Options
34
+
35
+ | Flag | Description |
36
+ |------|-------------|
37
+ | `--ide <name>` | Target IDE: `vscode`, `claude`, `cursor`, `codex`, `windsurf` |
38
+ | `--dir <path>` | Target directory (default: current directory) |
39
+ | `--overwrite` | Overwrite existing files |
40
+
41
+ ## Supported IDEs
42
+
43
+ | IDE | Global Rules | File-Scoped Rules | Skills | Agents |
44
+ |-----|-------------|-------------------|--------|--------|
45
+ | **VS Code Copilot** | `.github/copilot-instructions.md` | `.vscode/instructions/*.instructions.md` | `.github/skills/*/SKILL.md` | `.github/agents/*.agent.md` |
46
+ | **Claude Code** | `CLAUDE.md` | (merged into CLAUDE.md) | `.claude/skills/*/SKILL.md` | (merged into CLAUDE.md) |
47
+ | **Cursor** | `.cursor/rules/core.mdc` | `.cursor/rules/*.mdc` | `.cursor/rules/*.mdc` | `.cursor/rules/*.mdc` |
48
+ | **Codex** | `AGENTS.md` | (merged into AGENTS.md) | `.agents/skills/*/SKILL.md` | (merged into AGENTS.md) |
49
+ | **Windsurf** | `.windsurfrules` | (merged) | (merged) | (merged) |
50
+
51
+ All IDEs also get `project-state.md`, `failure-patterns.md`, `features.md`, and `project-brief.md` at the project root.
52
+
53
+ ## What Gets Installed
54
+
55
+ ### Rules (always active)
56
+ - **Core Rules** — Architecture enforcement, Iron Laws, completion protocol, concreteness rules
57
+ - **Testing Rules** — Mock synchronization, forbidden patterns (applied to test files)
58
+ - **Backend Rules** — Dependency inversion, type safety, explicit staging (applied to source files)
59
+
60
+ ### Skills (on-demand procedures)
61
+ - **test-integrity** — Verify mock/interface synchronization before committing
62
+ - **security-checklist** — Pre-commit security risk scan
63
+ - **investigate** — 4-phase systematic debugging (evidence → scope → fix → verify)
64
+
65
+ ### Agents (role-based personas)
66
+ - **reviewer** — Code review: architecture, tests, security, failure pattern cross-check
67
+ - **sprint-manager** — Sprint/Story state management, scope drift prevention
68
+
69
+ ### State Files
70
+ - **project-state.md** — Current sprint, stories, and progress tracking
71
+ - **failure-patterns.md** — Template for logging project-specific failure patterns
72
+
73
+ ## After Installation
74
+
75
+ 1. **Edit `project-state.md`** — Set up your first sprint and stories
76
+ 2. **Customize global rules** — Add your architecture, type rules, and directory structure
77
+ 3. **Log failures** — When an LLM makes a repeated mistake, record it in `failure-patterns.md`
78
+
79
+ ## Design Principles
80
+
81
+ 1. **State Injection** — Project state injected at every session start
82
+ 2. **Rigid Workflow** — Hard "do/don't" rules; soft suggestions get ignored by LLMs
83
+ 3. **Failure-Driven Rules** — Rules derived only from actual project failures
84
+ 4. **Completion Status Protocol** — DONE / BLOCKED / NEEDS_CONTEXT reporting
85
+ 5. **Scope Lock** — Escalate before modifying files outside current story scope
86
+
87
+ ## Research & Analysis
88
+
89
+ ```
90
+ docs/
91
+ ├── analysis/ # Framework comparisons
92
+ │ ├── comparison.md # BMAD vs gstack
93
+ │ ├── bmad-deep-dive.md
94
+ │ └── gstack-deep-dive.md
95
+ ├── architecture/ # K-Harness design
96
+ │ ├── design-principles.md
97
+ │ ├── file-structure.md
98
+ │ └── skill-spec.md
99
+ └── case-study/
100
+ └── mcphub-lessons.md
101
+ ```
102
+
103
+ ## License
104
+
105
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { run } = require('../src/init');
4
+ run(process.argv.slice(2));
@@ -0,0 +1,100 @@
1
+ # Planner
2
+
3
+ ## Role
4
+
5
+ Feature planning and dependency management.
6
+ Combines PM (what to build), Analytics (what exists), and Architecture (how it connects) into one workflow.
7
+ The Planner is the entry point for new features — use it BEFORE writing code.
8
+
9
+ ## Referenced Skills
10
+
11
+ - feature-breakdown
12
+ - impact-analysis
13
+
14
+ ## Referenced Files
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
21
+
22
+ ## Input
23
+
24
+ One of:
25
+ - **New Feature**: "I want to add [feature description]"
26
+ - **Architecture Query**: "What depends on [module]?" / "Show me the current module map"
27
+ - **Refactor Plan**: "I need to refactor [module/area]"
28
+
29
+ ## Procedure
30
+
31
+ ### For New Feature
32
+
33
+ 1. Read `project-brief.md` to understand project vision, goals, and **non-goals**
34
+ 2. **Direction Guard**: Verify the requested feature aligns with the project goals and does NOT fall into non-goals. If it conflicts, warn the user before proceeding.
35
+ 3. Read `features.md` to understand what already exists
36
+ 4. Read `dependency-map.md` to understand current architecture
37
+ 5. Read `project-state.md` for current Sprint context
38
+ 6. Identify which existing modules are affected
39
+ 7. Identify new modules that need to be created
40
+ 8. Run **feature-breakdown** skill to create ordered task list
41
+ 9. Run **impact-analysis** skill for each existing module being modified
42
+ 10. Check `failure-patterns.md` for relevant past mistakes
43
+ 11. Produce implementation plan (see Output Format)
44
+ 12. Update `project-state.md` with the new Story
45
+ 13. Update `features.md` with the new feature entry
46
+
47
+ ### For Architecture Query
48
+
49
+ 1. Read `dependency-map.md`
50
+ 2. Answer the query with specific module names, dependencies, and layer info
51
+ 3. If the query reveals missing entries in the map, flag them
52
+
53
+ ### For Refactor Plan
54
+
55
+ 1. Read `dependency-map.md` to map the blast radius
56
+ 2. Run **impact-analysis** skill on each module being refactored
57
+ 3. Identify safe refactoring order (leaf modules first, core modules last)
58
+ 4. Produce refactoring plan with rollback checkpoints
59
+
60
+ ## Output Format
61
+
62
+ ### New Feature Plan
63
+ ```markdown
64
+ ## Feature: [name]
65
+ **Story**: S[sprint]-[number]
66
+ **Scope**: [modules affected]
67
+ **Risk**: Low | Medium | High
68
+
69
+ ### Architecture Impact
70
+ - New modules: [list]
71
+ - Modified modules: [list]
72
+ - Unchanged dependents that need testing: [list]
73
+
74
+ ### Implementation Plan
75
+ [Output from feature-breakdown skill]
76
+
77
+ ### Risk Notes
78
+ - [Any failure patterns that apply]
79
+ - [Any high-coupling areas to watch]
80
+
81
+ ### Dependency Map Changes
82
+ [Additions/modifications to dependency-map.md]
83
+ ```
84
+
85
+ ### Architecture Query Response
86
+ ```markdown
87
+ ## Module: [name]
88
+ - Layer: [domain | application | infrastructure | presentation]
89
+ - Depends on: [list with reasons]
90
+ - Depended by: [list with reasons]
91
+ - Last changed: [Sprint/Story reference]
92
+ ```
93
+
94
+ ## Constraints
95
+
96
+ - Never skip reading dependency-map.md — the plan is only as good as the map
97
+ - If dependency-map.md is empty or outdated, report this FIRST
98
+ - All plans must include test tasks (no code without tests)
99
+ - If a feature affects 5+ modules, flag as High Risk
100
+ - If the plan exceeds one Sprint's worth of work, suggest splitting into sub-features
@@ -0,0 +1,86 @@
1
+ # Reviewer
2
+
3
+ ## Role
4
+
5
+ Review code changes before commit or PR for quality, security, and test integrity.
6
+ Finds issues and auto-fixes where safe, escalates where not.
7
+
8
+ ## Referenced Skills
9
+
10
+ - test-integrity — Mock synchronization verification
11
+ - security-checklist — Security risk inspection
12
+ - impact-analysis — Change blast radius assessment
13
+
14
+ ## Referenced Files
15
+
16
+ - failure-patterns.md — Project failure patterns
17
+ - project-state.md — Current Story scope
18
+ - dependency-map.md — Module dependency graph
19
+
20
+ ## Procedure
21
+
22
+ ### Input
23
+
24
+ Changed file list (user-provided or from `git diff --name-only`)
25
+
26
+ ### Steps
27
+
28
+ **Step 1: Identify Change Scope**
29
+ - Run `git diff --cached --stat` or `git diff --stat` to see changed files
30
+ - Compare against current Story scope in project-state.md
31
+
32
+ **Step 2: Architecture Rule Check**
33
+ - [ ] No imports from infrastructure in domain layer
34
+ - [ ] No business logic in presentation layer
35
+ - [ ] Constructor parameters match actual source (FP-002)
36
+
37
+ **Step 3: Test Integrity (test-integrity skill)**
38
+ - [ ] Interface changes have synchronized mocks (FP-001)
39
+ - [ ] New features have tests
40
+ - [ ] Existing tests pass
41
+
42
+ **Step 4: Security Check (security-checklist skill)**
43
+ - [ ] No credentials, .env, or temp files in staging (FP-004)
44
+ - [ ] No hardcoded API keys or passwords
45
+ - [ ] No injection vulnerabilities (SQL, XSS)
46
+
47
+ **Step 5: Failure Pattern Cross-Check**
48
+ - Compare current changes against all FP-NNN items in failure-patterns.md
49
+ - Warn if any pattern applies
50
+
51
+ **Step 6: Feature Registry Check**
52
+ - [ ] If a new feature was added, verify it is registered in features.md (Iron Law #7)
53
+ - [ ] If feature files changed, verify features.md key files are up to date
54
+ - [ ] If tests were added/removed, verify features.md test files column is accurate
55
+
56
+ **Step 7: Dependency Map Check**
57
+ - [ ] If new modules were added, verify they are registered in dependency-map.md (Iron Law #6)
58
+ - [ ] If module interfaces changed, verify "Depends On" / "Depended By" columns are updated
59
+ - [ ] If module was deleted/renamed, verify dependency-map.md is cleaned up
60
+ - [ ] Run impact-analysis skill if interface changes affect 2+ dependent modules
61
+
62
+ ### Output Format
63
+
64
+ ```
65
+ ## Review Result
66
+
67
+ ### Auto-Fixed (AUTO-FIXED)
68
+ - [file:line] description
69
+
70
+ ### Needs User Confirmation (ASK)
71
+ - [file:line] issue → recommended fix
72
+
73
+ ### Passed Items
74
+ - Architecture rules: ✅
75
+ - Test integrity: ✅ / ⚠️ (detail)
76
+ - Security check: ✅ / ❌ (detail)
77
+ - Failure pattern check: ✅ / ⚠️ (FP-NNN)
78
+
79
+ STATUS: DONE / DONE_WITH_CONCERNS / BLOCKED
80
+ ```
81
+
82
+ ## Constraints
83
+
84
+ - Do not refactor beyond the review scope
85
+ - Auto-apply security fixes but always record them in output
86
+ - Escalate with NEEDS_CONTEXT after 3 uncertain judgments
@@ -0,0 +1,73 @@
1
+ # Sprint Manager
2
+
3
+ ## Role
4
+
5
+ Manage Sprint/Story state, guide development sequence, and prevent scope drift.
6
+ Keeps the LLM focused on the current work item.
7
+
8
+ ## Referenced Files
9
+
10
+ - project-state.md — Current state (this is the core file)
11
+ - failure-patterns.md — Recurring failure tracking
12
+
13
+ ## Procedure
14
+
15
+ ### Input
16
+
17
+ User request: "next task", "current status", "story done", "new sprint", "scope check"
18
+
19
+ ### Handlers
20
+
21
+ **Request: "current status" / "where are we"**
22
+ 1. Read project-state.md
23
+ 2. Summarize: current Sprint, in-progress Story, completed Stories
24
+ 3. Recommend next action
25
+
26
+ **Request: "story done" / "S{N}-{M} done"**
27
+ 1. Update the Story status to `done` in project-state.md
28
+ 2. Add completion record to "Recent Changes" section
29
+ 3. Guide to next Story if available
30
+
31
+ **Request: "new story" / "next task"**
32
+ 1. Find next `todo` Story in project-state.md
33
+ 2. Change its status to `in-progress`
34
+ 3. Specify Story scope (related files/directories)
35
+ 4. Alert relevant failure-patterns.md items
36
+
37
+ **Request: "new sprint"**
38
+ 1. Check all Stories in current Sprint
39
+ 2. Warn if incomplete Stories exist
40
+ 3. Confirm new Sprint number and theme (user input)
41
+ 4. Update project-state.md
42
+
43
+ **Scope Check (automatic)**
44
+ - If user requests a file modification outside current Story scope:
45
+ - "This file is outside the current Story (S{N}-{M}) scope. Proceed?"
46
+ - Modify only after user approval
47
+
48
+ ### Output Format
49
+
50
+ ```
51
+ ## Sprint Status
52
+
53
+ Sprint: {N} — {theme}
54
+ Progress: {done}/{total} Stories
55
+
56
+ | ID | Title | Status | Notes |
57
+ |----|-------|--------|-------|
58
+ | S{N}-1 | ... | ✅ done | |
59
+ | S{N}-2 | ... | 🔄 in-progress | ← current |
60
+ | S{N}-3 | ... | ⬜ todo | |
61
+
62
+ **Next**: S{N}-2 — {description}
63
+ **Scope**: {file/directory list}
64
+ **Watch**: FP-{NNN} applies (description)
65
+
66
+ STATUS: DONE
67
+ ```
68
+
69
+ ## Constraints
70
+
71
+ - Do not modify code directly — manage state only
72
+ - Only write to project-state.md; read-only for all other files
73
+ - Always confirm with user before modifying scope boundaries
@@ -0,0 +1,22 @@
1
+ # Backend Code Rules
2
+
3
+ ## Required
4
+
5
+ - Follow the project's architecture patterns strictly:
6
+ - Domain layer must not import from infrastructure.
7
+ - Application layer accesses data only through domain interfaces.
8
+ - Infrastructure implements domain interfaces.
9
+ - Presentation handles routing and DTO conversion only. No business logic.
10
+ - Before calling any constructor, read the actual source file to verify parameters. Do not trust memory. (FP-002)
11
+
12
+ ## Forbidden
13
+
14
+ - Importing infrastructure from domain (dependency inversion violation).
15
+ - `any` type usage — when unavoidable, add `// eslint-disable-next-line` with reason comment.
16
+ - Hardcoding environment variables in code. Use `process.env` with centralized config.
17
+ - `git add .` or `git add -A` — use explicit per-file staging.
18
+
19
+ ## References
20
+
21
+ - failure-patterns.md FP-002: Type confusion
22
+ - failure-patterns.md FP-004: Unnecessary files committed
@@ -0,0 +1,76 @@
1
+ # Project Instructions
2
+
3
+ ## Architecture
4
+
5
+ <!-- TODO: Describe your project's architecture here.
6
+ Example:
7
+ TypeScript / Express / PostgreSQL
8
+ Hexagonal Architecture (Port + Adapter)
9
+ -->
10
+
11
+ ## Directory Structure
12
+
13
+ <!-- TODO: Map your directory structure.
14
+ Example:
15
+ src/
16
+ ├── domain/ # Entities, Repository interfaces
17
+ ├── application/ # Use Cases
18
+ ├── infrastructure/ # DB, HTTP adapters
19
+ ├── presentation/ # Controllers, DTOs
20
+ └── shared/ # Utils, types, errors
21
+ -->
22
+
23
+ ## Core Type Rules
24
+
25
+ <!-- TODO: Document type decisions that LLMs frequently get wrong.
26
+ Example:
27
+ - `ServerType` is a union type ("stdio" | "sse"), NOT an enum.
28
+ - `UserRole` is a union type ("admin" | "user"), NOT an enum.
29
+ -->
30
+
31
+ ## Iron Laws
32
+
33
+ 1. **Mock Sync**: When you modify a repository/service interface, update corresponding mocks in the same commit.
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.
36
+ 4. **Security**: Never include credentials, passwords, or API keys in code or commits.
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.
41
+
42
+ ## Test Rules
43
+
44
+ - New feature = New test. Do not commit feature code without tests.
45
+ - Test command: `npm test` <!-- TODO: customize -->
46
+ - Mock location: `tests/__mocks__/` <!-- TODO: customize -->
47
+
48
+ ## Completion Status Protocol
49
+
50
+ Report completion using one of:
51
+ - **DONE**: All steps completed. Present evidence (test results, file list, etc).
52
+ - **DONE_WITH_CONCERNS**: Completed but with concerns. List each concern.
53
+ - **BLOCKED**: Cannot proceed. Describe the cause and what was tried.
54
+ - **NEEDS_CONTEXT**: Need more information. Describe exactly what is needed.
55
+
56
+ ## Concreteness Rules
57
+
58
+ - When modifying files, specify exact paths and line numbers.
59
+ - When tests fail, quote the test name and error message.
60
+ - When type errors occur, specify expected type and actual type.
61
+
62
+ ## New Session Bootstrap
63
+
64
+ When starting a NEW chat session, read these files in order before doing any work:
65
+ 1. `project-state.md` — Quick Summary tells you where we left off
66
+ 2. `features.md` — What features exist in this project
67
+ 3. `failure-patterns.md` — What mistakes to avoid
68
+ 4. `project-brief.md` — Project vision, goals, and non-goals
69
+
70
+ ## References
71
+
72
+ - project-brief.md — Project vision, goals, non-goals (the "why")
73
+ - features.md — Feature registry (the "what")
74
+ - project-state.md — Sprint/Story tracking, module registry (the "where")
75
+ - dependency-map.md — Module dependency graph (the "how")
76
+ - failure-patterns.md — Log of known failure patterns (the "watch out")
@@ -0,0 +1,44 @@
1
+ # Dependency Map
2
+
3
+ A living document of module relationships. Update whenever modules are added or modified.
4
+
5
+ ## Module Registry
6
+
7
+ | Module | Layer | Purpose | Depends On | Depended By |
8
+ |--------|-------|---------|------------|-------------|
9
+ <!-- Example:
10
+ | auth | domain | User authentication | - | api, admin |
11
+ | api | presentation | REST endpoints | auth, services | frontend |
12
+ | services | application | Business logic | auth, database | api |
13
+ | database | infrastructure| Data persistence | - | services |
14
+ -->
15
+
16
+ ## Dependency Rules
17
+
18
+ - **No circular dependencies**: If A depends on B, B must not depend on A.
19
+ - **Layer direction**: domain → application → infrastructure/presentation (never reverse).
20
+ - **Interface boundaries**: Modules communicate through interfaces, not concrete implementations.
21
+ - **New module = new row**: Every new module must be registered here before implementation.
22
+
23
+ ## Change Impact Quick Reference
24
+
25
+ When modifying a module:
26
+
27
+ 1. Find the module row above
28
+ 2. Check the **Depended By** column — these modules may break
29
+ 3. For each dependent module:
30
+ - Check if the change affects the public interface
31
+ - Update tests and mocks for all affected dependents
32
+ 4. Record the change in project-state.md
33
+
34
+ ## Interface Change Log
35
+
36
+ <!-- Record interface changes as they happen.
37
+ Format:
38
+ | Date | Module | Change | Affected Modules | Status |
39
+ |------|--------|--------|------------------|--------|
40
+ | 2026-04-01 | auth | Added `resetPassword()` | api, admin | Updated |
41
+ -->
42
+
43
+ | Date | Module | Change | Affected Modules | Status |
44
+ |------|--------|--------|------------------|--------|
@@ -0,0 +1,48 @@
1
+ # Failure Patterns
2
+
3
+ Record only actual failures from this project. No theories or assumptions.
4
+ Keep resolved patterns for regression prevention.
5
+
6
+ ---
7
+
8
+ ## FP-001: Mock not updated when interface changed
9
+
10
+ - **Occurred**: <!-- Sprint/Story where this happened -->
11
+ - **Frequency**: 0
12
+ - **Cause**: LLM treated interface change and mock update as separate tasks. Added method to interface but forgot to update the mock, causing test failures.
13
+ - **Prevention**: Update mock in the same commit as the interface change.
14
+ - **Applied in**: testing rules, test-integrity skill, reviewer agent
15
+ - **Status**: Template — activate when first occurrence is logged
16
+
17
+ ---
18
+
19
+ ## FP-002: Type confusion (enum vs union, wrong parameter count)
20
+
21
+ - **Occurred**: <!-- Sprint/Story where this happened -->
22
+ - **Frequency**: 0
23
+ - **Cause**: LLM does not retain type information across sessions. Used enum syntax for union types or called constructors with wrong parameter count.
24
+ - **Prevention**: Document core types in global instructions. Read source file before calling constructors.
25
+ - **Applied in**: global instructions, backend rules
26
+ - **Status**: Template — activate when first occurrence is logged
27
+
28
+ ---
29
+
30
+ ## FP-003: Scope drift / ignoring instructions
31
+
32
+ - **Occurred**: <!-- Sprint/Story where this happened -->
33
+ - **Frequency**: 0
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.
36
+ - **Applied in**: sprint-manager agent, global instructions
37
+ - **Status**: Template — activate when first occurrence is logged
38
+
39
+ ---
40
+
41
+ ## FP-004: Dangerous file committed
42
+
43
+ - **Occurred**: <!-- Sprint/Story where this happened -->
44
+ - **Frequency**: 0
45
+ - **Cause**: LLM created temp files during work, then ran `git add .` which staged credentials or debug artifacts.
46
+ - **Prevention**: Ban `git add .`. Run security-checklist skill before commits. Reviewer agent inspects staging area.
47
+ - **Applied in**: security-checklist skill, reviewer agent, backend rules
48
+ - **Status**: Template — activate when first occurrence is logged
@@ -0,0 +1,38 @@
1
+ # Feature Registry
2
+
3
+ A living document of all features in this project. Update whenever features are added, modified, or deprecated.
4
+ This is LLM's map to understand "what exists" — without this, features get forgotten as the project grows.
5
+
6
+ ## Feature List
7
+
8
+ | Feature | Status | Key Files | Test Files | Owner |
9
+ |---------|--------|-----------|------------|-------|
10
+ <!-- Example:
11
+ | User Auth | ✅ done | src/auth/login.ts, src/auth/jwt.ts | tests/auth/login.test.ts | - |
12
+ | MCP Routing | 🔧 active | src/router/index.ts, src/router/mcp.ts | tests/router/mcp.test.ts | - |
13
+ | Admin Dashboard | ⬜ planned | - | - | - |
14
+ | Legacy REST API | ❌ dropped | - | - | - |
15
+ -->
16
+
17
+ ## Status Legend
18
+
19
+ - ✅ **done** — Feature complete with tests passing
20
+ - 🔧 **active** — Currently being developed
21
+ - ⬜ **planned** — In backlog, not started
22
+ - ⚠️ **broken** — Tests failing or known issues
23
+ - ❌ **dropped** — Removed or abandoned (keep for history)
24
+
25
+ ## Update Protocol
26
+
27
+ When you add or modify a feature:
28
+ 1. Add/update the row in the Feature List table above
29
+ 2. List the key source files and test files
30
+ 3. Update the Status column
31
+
32
+ **Iron Law #7**: When adding a new feature, register it here in the same commit.
33
+
34
+ ## Test Coverage Quick Check
35
+
36
+ To verify all features are tested, scan this table for any row where:
37
+ - Status is ✅ or 🔧 but Test Files is empty → **missing tests**
38
+ - Status is ✅ but test files reference modules that no longer exist → **stale tests**
@@ -0,0 +1,49 @@
1
+ # Project Brief
2
+
3
+ ## Vision
4
+
5
+ <!-- What is this project and why does it exist?
6
+ Example: "An open-source MCP hub that connects AI tools to enterprise services."
7
+ Keep it to 1-2 sentences. This is the north star for all decisions. -->
8
+
9
+ ## Goals
10
+
11
+ <!-- What must this project achieve? List 3-5 concrete goals.
12
+ Example:
13
+ - Support 50+ MCP servers with auto-discovery
14
+ - Sub-100ms routing latency
15
+ - Zero-config developer experience
16
+ -->
17
+
18
+ ## Non-Goals
19
+
20
+ <!-- What is explicitly OUT OF SCOPE? This is equally important as Goals.
21
+ Example:
22
+ - Not a hosting platform — users deploy their own
23
+ - Not supporting legacy REST APIs — MCP only
24
+ - Not building a UI dashboard in v1
25
+ -->
26
+
27
+ ## Target Users
28
+
29
+ <!-- Who is this for?
30
+ Example: "Solo developers and small teams (1-3) using AI coding assistants."
31
+ -->
32
+
33
+ ## Key Technical Decisions
34
+
35
+ <!-- Record major architecture choices that should NOT be reversed without discussion.
36
+ Example:
37
+ - TypeScript + Node.js (not Go, not Python)
38
+ - SQLite for local storage (not PostgreSQL)
39
+ - Monorepo with npm workspaces
40
+ -->
41
+
42
+ ## Success Criteria
43
+
44
+ <!-- How do we know this project is working?
45
+ Example:
46
+ - Users can install and run in under 5 minutes
47
+ - All MCP tools discoverable without manual configuration
48
+ - 90%+ test coverage on core modules
49
+ -->