@kodevibe/harness 0.9.6 → 0.11.1

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.
@@ -0,0 +1,161 @@
1
+ # Docs Bridge
2
+
3
+ ## Purpose
4
+
5
+ Connect project-local documentation to a wiki, knowledge base, or docs hub through a small, safe index in `docs/project-brief.md`.
6
+ This keeps the repository as the source of truth for project-internal docs while letting a central hub discover, summarize, and link them safely.
7
+
8
+ ## Invoked By
9
+
10
+ - **User** — "connect this project to my wiki", "문서를 위키처럼 정리해줘", "sync docs to Confluence", "Obsidian docs hub"
11
+ - **setup** — after state files are filled, when the user asked for documentation organization or a central docs hub
12
+ - **wrap-up** — when documentation changed and `docs/project-brief.md` already has a Project Docs Hub Index
13
+ - **state-check** — validates the index shape and local path coverage
14
+
15
+ ## When to Apply
16
+
17
+ - A project has several documentation surfaces: README, `docs/`, ADRs, runbooks, API specs, planning artifacts, generated reports
18
+ - The user wants a central wiki/docs hub to know which project docs exist without copying every document into the hub
19
+ - The user wants LLMs to manage internal docs, source cards, meeting notes, or project cards across sessions
20
+ - Before promoting a local document into an external wiki, Confluence space, Obsidian vault, or team knowledge base
21
+
22
+ ## Boundaries
23
+
24
+ - Preserve original documents unless the user explicitly asks to edit them.
25
+ - Do not copy entire READMEs, specs, transcripts, or external pages into the hub. Summarize and link.
26
+ - Treat the hub as a reference layer: path/URL, role, key constraints, status, and visibility are enough.
27
+ - Respect visibility. Private or confidential rows need explicit user confirmation before any external target is written.
28
+ - Do not commit company-private URLs or personal vault paths into OSS templates. Those belong in the user's local project state.
29
+ - Keep tracked index rows sanitized: use `local-only`, `pending`, or a logical hub alias/note title, not machine-specific absolute paths.
30
+ - Store local resolver details such as Obsidian vault paths, personal Wiki names, page IDs, or sync scripts only in ignored local files such as `.harness/docs-bridge.local.json`.
31
+ - Keep uncertain relationships as `proposed`, `needs verification`, or `review required`.
32
+
33
+ ## Procedure
34
+
35
+ ### Phase 1: Discover Documentation Surfaces
36
+
37
+ Read only enough to classify documents. Prefer headers, tables of contents, and first sections before reading full files.
38
+
39
+ Common candidates:
40
+ - Root docs: `README*`, `CHANGELOG*`, `CONTRIBUTING*`, `SECURITY*`, `LICENSE`
41
+ - Project docs: `docs/`, `adr/`, `architecture/`, `design/`, `runbooks/`, `playbooks/`, `operations/`
42
+ - API and contract docs: `openapi*`, `swagger*`, `schema*`, `proto/`, `graphql/`
43
+ - AI/planning docs: planning artifact directories, role-based analysis folders, meeting notes, research notes
44
+ - Existing state: `docs/project-brief.md`, `docs/features.md`, `docs/dependency-map.md`, `docs/project-state.md`
45
+
46
+ Skip generated dependency/build directories: `node_modules/`, `dist/`, `build/`, `.next/`, coverage output, binary archives.
47
+
48
+ ### Phase 2: Classify Each Candidate
49
+
50
+ Use this vocabulary in the index:
51
+
52
+ | Role | Meaning |
53
+ |------|---------|
54
+ | `source` | Original project documentation maintained in this repo |
55
+ | `planning-artifact` | PRD, design, architecture, ARB, roadmap, or external planning output |
56
+ | `decision-record` | ADR, Decision Log, meeting decision, or governance note |
57
+ | `reference` | External guide, source card, example, standard, or adoption candidate |
58
+ | `runbook` | Operational procedure, deployment guide, incident response, support playbook |
59
+ | `state` | kode:harness state file used by LLM agents |
60
+ | `generated` | Derived output that should not be treated as an original source |
61
+
62
+ ### Phase 3: Confirm The Docs Hub Contract
63
+
64
+ Ask at most three questions if the prompt does not already answer them:
65
+
66
+ 1. Hub target: logical hub alias/note title, wiki space/page label, repository path, `pending`, or `local-only`? Do not ask for or write absolute local vault paths into tracked state.
67
+ 2. Visibility boundary: `public`, `team`, `company-confidential`, `personal-private`, or `do-not-share`?
68
+ 3. Sync intent: summarize local docs into the hub, index hub references locally, or only maintain a bidirectional map?
69
+
70
+ If the user skips the hub target, create a local map only and set Hub Target to `local-only`. If the user provides a local filesystem path, write only a sanitized alias or `local-only` in the tracked index and put the concrete path in `.harness/docs-bridge.local.json`.
71
+
72
+ ### Phase 4: Update Project Docs Hub Index
73
+
74
+ Ensure `docs/project-brief.md` contains this section. Add it if missing:
75
+
76
+ ```markdown
77
+ ## Project Docs Hub Index
78
+
79
+ | Local Source | Role | Hub Target | Sync Direction | Visibility | Status | Last Reviewed |
80
+ |--------------|------|------------|----------------|------------|--------|---------------|
81
+ | README.md | source | local-only | local-source -> hub-summary | public | active | YYYY-MM-DD |
82
+ ```
83
+
84
+ Column rules:
85
+ - **Local Source**: exact repository path, or external URL only when no local file exists.
86
+ - **Role**: use the Phase 2 vocabulary.
87
+ - **Hub Target**: `local-only`, `pending`, a sanitized external page label/URL, an Obsidian note title, a Confluence page label, or a logical hub alias. Never store `/Users/...`, `~/...`, `file://...`, drive-letter paths, personal vault paths, or tokens in this tracked table.
88
+ - **Sync Direction**: one of `local-source -> hub-summary`, `hub-reference -> local-index`, `bidirectional-index-only`, `local-only`.
89
+ - **Visibility**: one of `public`, `team`, `company-confidential`, `personal-private`, `do-not-share`.
90
+ - **Status**: `active`, `proposed`, `stale`, or `archived`.
91
+ - **Last Reviewed**: ISO date, or `pending` for proposed rows.
92
+
93
+ ### Phase 5: Promote Safely (Optional)
94
+
95
+ Only when the user asks to update the hub:
96
+
97
+ 1. Create or update a short hub summary that links back to the Local Source.
98
+ 2. Preserve originals. If a local source needs improvement, ask before editing it.
99
+ 3. Record relationships with evidence, for example:
100
+ - `project -> documents -> Local Source`
101
+ - `Local Source -> summarized_by -> Hub Target`
102
+ - `reference -> supports -> project decision`
103
+ 4. Put uncertain claims under `needs verification` or `proposed relationship`.
104
+ 5. Never expose private/confidential rows into a less-restricted hub target without explicit user confirmation.
105
+ 6. For local-only hubs, use `.harness/docs-bridge.local.json` for machine-specific resolver details. Do not write those details into tracked state, README, or OSS templates.
106
+
107
+ ### Phase 6: Verify
108
+
109
+ 1. Run `state-check` after updating `docs/project-brief.md`.
110
+ 2. Confirm local paths in the index exist, unless the row is intentionally external.
111
+ 3. Report any private/confidential row that has an external Hub Target and ask for confirmation before hub writes.
112
+ 4. If documentation files changed, include the proof in the response: paths updated, index rows added/changed, and any hub target touched.
113
+
114
+ ## Output Format
115
+
116
+ ```markdown
117
+ ## Docs Bridge Result
118
+
119
+ ### Index Updates
120
+ - Added/updated rows: N
121
+ - Local-only rows: N
122
+ - External hub rows: N
123
+
124
+ ### Visibility Warnings
125
+ - [none] or [row requiring confirmation]
126
+
127
+ ### Verification
128
+ - state-check: PASS | WARN | FAIL
129
+ - Missing local paths: [none or list]
130
+
131
+ ---
132
+ 🧭 Next Step
133
+ → Goal: Keep project docs discoverable without rewriting originals
134
+ → Evidence: `state-check` plus changed index rows
135
+ → Next: `wrap-up` or [Hub update]
136
+ → Prompt: "문서 허브 인덱스를 기준으로 다음 문서를 요약/연결해줘"
137
+ → Why: The docs map is now explicit enough for future LLM sessions
138
+ → Pipeline: utility skill (docs bridge)
139
+ ---
140
+ ```
141
+
142
+ ## Rules
143
+
144
+ - Use repository-relative paths for Local Source.
145
+ - Prefer summaries and links over copied bodies.
146
+ - Do not modify raw/source docs during discovery.
147
+ - Do not invent hub targets. Use `local-only` or `pending` when unknown.
148
+ - Keep visibility explicit on every row.
149
+ - Keep personal/local Wiki resolver details in ignored `.harness/docs-bridge.local.*` files only.
150
+ - Do not write absolute local paths, personal vault names, private page IDs, tokens, or company-private URLs into tracked templates or public docs.
151
+
152
+ ## Anti-patterns
153
+
154
+ | Anti-pattern | Correct Approach |
155
+ |---|---|
156
+ | Copy every project doc into the central wiki | Index local sources and promote concise summaries only |
157
+ | Treat generated reports as authoritative source | Mark as `generated` and link to the original input when known |
158
+ | Publish private docs to a team/public hub silently | Stop and ask for explicit confirmation |
159
+ | Rewrite READMEs while building the index | Preserve originals; ask before editing source docs |
160
+ | Leave Hub Target blank | Use `local-only` or `pending` with a follow-up |
161
+ | Put `/Users/...`, `~/...`, `file://...`, or personal vault paths in `project-brief.md` | Store only a logical alias in the index and keep resolver details in `.harness/docs-bridge.local.json` |
@@ -114,7 +114,9 @@ After pivot completes, always append a 🧭 block:
114
114
  | Pivot Result | 🧭 Next Step |
115
115
  |---|---|
116
116
  | All state files updated | `pm` — "변경된 방향에 맞춰 재계획해줘" |
117
+ <!-- CREW_MODE_START -->
117
118
  | Crew artifacts exist for new direction | `setup` (🟣) — "crew 산출물을 기반으로 state를 다시 세팅해줘" |
119
+ <!-- CREW_MODE_END -->
118
120
  | User cancelled | 🏁 No action — "기존 방향을 유지합니다" |
119
121
 
120
122
  Example 🧭 block:
@@ -13,6 +13,12 @@ One command does everything — no manual editing required.
13
13
  - When state files are outdated and need a refresh
14
14
  - When any agent reports "state files are empty"
15
15
 
16
+ ## Re-running on an existing install (Upgrade flow)
17
+
18
+ On existing installs, default `init` preserves state (`project-state`, `features`, `dependency-map`, `failure-patterns`, `project-brief`, `agent-memory`) and refreshes IDE config (`.github/`, `.claude/`, `.cursor/`, `.codex/`, `.windsurf/`, `.agents/`, `CLAUDE.md`, `AGENTS.md`). Overwritten IDE files are backed up to `.harness/init-backups/<ISO-timestamp>/...`.
19
+
20
+ Use `--overwrite` only to reset corrupted state after backup; then rerun setup to repopulate files.
21
+
16
22
  ## Procedure
17
23
 
18
24
  ### Phase 1: Project Discovery (read-only)
@@ -62,6 +68,10 @@ One command does everything — no manual editing required.
62
68
 
63
69
  **Do NOT modify any code files in this phase.**
64
70
 
71
+ ### Phase 1.4: Project Docs Hub Detection (optional)
72
+
73
+ If user asked for wiki/docs-hub work, record candidate paths from Phase 1 without reading or rewriting full docs. After Phase 3, invoke `docs-bridge` to fill `## Project Docs Hub Index`. Otherwise skip.
74
+
65
75
  <!-- CREW_MODE_START -->
66
76
  ### Phase 1.5: Crew Artifact Detection + Indexing
67
77
 
@@ -135,6 +145,17 @@ Ask the user these questions (skip any already answered by Phase 1):
135
145
  5. "Are there any type decisions or conventions the AI should know about?"
136
146
  6. "What is your test command?" (show detected command if found, e.g., `npm test`, `pytest`, `go test ./...`)
137
147
 
148
+ ### Phase 2.1: Common Mode Confidence Loop
149
+
150
+ Before filling state files, collapse the answers into a **Goal Card** and **Proof Profile**:
151
+ - Goal: one sentence from Vision + top goal
152
+ - First usable result: smallest working outcome the user can inspect
153
+ - Non-goal boundary: what will not be built now
154
+ - Required proof: test command, smoke proof, or manual checklist
155
+ - Open question: at most one unresolved ambiguity
156
+
157
+ If the user's answers are vague, ask at most one follow-up question. If still unclear, record the assumption instead of looping.
158
+
138
159
  ### Phase 3: Fill State Files
139
160
 
140
161
  Using data from Phase 1 + Phase 2, fill the following files:
@@ -144,6 +165,8 @@ Using data from Phase 1 + Phase 2, fill the following files:
144
165
  - Vision → from user answer #1
145
166
  - Goals → from user answer #2
146
167
  - Non-Goals → from user answer #3
168
+ - Done Definition → from Goal Card / first usable result
169
+ - Success Proof → from Proof Profile (test command, smoke proof, or manual checklist)
147
170
  <!-- CREW_MODE_START -->
148
171
  - Crew Artifact Index → from Phase 1.5 (🟣 pipeline only — leave as template comment for 🟢 pipeline)
149
172
  - Validation Tracker → from Phase 1.5 (🟣 pipeline only — leave as template comment for 🟢 pipeline)
@@ -231,6 +254,11 @@ After setup completes, remind the user that shared files require `git pull` befo
231
254
  - [x]docs/project-state.md — Sprint 1 initialized
232
255
  - [ ]docs/failure-patterns.md — templates only (no changes)
233
256
 
257
+ ### Goal Card
258
+ - Goal: [one sentence]
259
+ - First usable result: [observable outcome]
260
+ - Required proof: [test/smoke/manual]
261
+
234
262
  STATUS: DONE
235
263
  ```
236
264
 
@@ -238,7 +266,7 @@ STATUS: DONE
238
266
 
239
267
  Bootstrap always leads to `pm`. Append this block after STATUS: DONE:
240
268
 
241
- **If NO crew artifacts** (🟢 pipeline):
269
+ **Default common pipeline**:
242
270
  ```
243
271
  ---
244
272
  🧭 Next Step
@@ -46,7 +46,7 @@ For each file:
46
46
  1. Read all `✅ done` Stories from `docs/project-state.md` (or `.harness/project-state.md` in Team mode) Story Status table
47
47
  2. Read `docs/features.md` Feature Registry
48
48
  3. For each `✅ done` Story:
49
- - If Story has `[FR-NNN]` prefix → must map to a feature row with that FR reference
49
+ - If Story has an external reference prefix → must map to a feature row with the same reference
50
50
  - Otherwise → must map to at least one feature row whose Key Files overlap with the Story's Scope
51
51
  4. Outcomes:
52
52
  - Story ✅ done but no matching feature row → FAIL: `[FAIL] Story {S-N-M} done but no feature registered`
@@ -105,6 +105,32 @@ If `docs/project-brief.md` contains a `## Validation Tracker` section:
105
105
  If no Validation Tracker → skip.
106
106
  <!-- CREW_MODE_END -->
107
107
 
108
+ ### Check 7: Proof Ledger Coverage
109
+
110
+ 1. Read `docs/project-state.md` (or `.harness/project-state.md` in Team mode).
111
+ 2. For each Story marked `✅ done`, verify at least one Proof Ledger or Evidence Summary row exists with a passing result.
112
+ 3. Outcomes:
113
+ - Done Story with passing proof → PASS
114
+ - Done Story with no proof → FAIL: `[FAIL] Story {S-N-M} is done but has no passing Proof Ledger/Evidence Summary entry — revert to Proof Pending or run reviewer proof before DONE/commit guidance`
115
+ - Done Story with failing proof → FAIL: `[FAIL] Story {S-N-M} proof shows failure but status is done`
116
+ - In-progress Story without proof → PASS; proof pending is normal
117
+
118
+ ### Check 8: Project Docs Hub Index (optional)
119
+
120
+ If `docs/project-brief.md` contains `## Project Docs Hub Index` with non-comment table rows:
121
+
122
+ 1. For each row, verify `Local Source`, `Sync Direction`, `Visibility`, `Status`, and `Last Reviewed` are not blank or `TBD`.
123
+ 2. If `Local Source` is a repository path, verify the file or directory exists. Skip existence checks for URLs and explicitly external rows.
124
+ 3. Verify `Sync Direction` is one of: `local-source -> hub-summary`, `hub-reference -> local-index`, `bidirectional-index-only`, `local-only`.
125
+ 4. Verify `Visibility` is one of: `public`, `team`, `company-confidential`, `personal-private`, `do-not-share`.
126
+ 5. If `Hub Target` contains an absolute/local machine path (`/Users/`, `~/`, `file://`, drive-letter paths, or backslash user paths), WARN: `[WARN] docs hub row contains local machine path — move resolver details to .harness/docs-bridge.local.*`.
127
+ 6. If Visibility is `company-confidential`, `personal-private`, or `do-not-share` and Hub Target is not `local-only` or `pending`, WARN: `[WARN] restricted docs row has external Hub Target — confirm disclosure boundary before hub writes`.
128
+
129
+ Outcomes:
130
+ - Complete rows with existing local paths → PASS
131
+ - Missing local path, blank required column, invalid vocabulary, local machine path leakage, or restricted row with external target → WARN
132
+ - No `Project Docs Hub Index` section or no real rows → skip; this project may not use docs-bridge
133
+
108
134
  ## Output Format
109
135
 
110
136
  ```
@@ -126,6 +152,12 @@ If no Validation Tracker → skip.
126
152
  ### Check 4: Agent Memory Legacy Names
127
153
  - No legacy names found (or list of legacy files to rename)
128
154
 
155
+ ### Check 7: Proof Ledger Coverage
156
+ - {N} done Stories checked / {M} missing proof / {K} failing proof
157
+
158
+ ### Check 8: Project Docs Hub Index
159
+ - {N} rows checked / {M} missing paths / {K} visibility warnings / skipped if unused
160
+
129
161
  <!-- CREW_MODE_START -->
130
162
  ### Check 6: Validation Tracker (🟣)
131
163
  - {N} FR references checked / {M} drifted
@@ -142,7 +174,7 @@ STATUS: PASS | WARN | FAIL
142
174
  ### Result Interpretation
143
175
 
144
176
  - **PASS** — all checks passed; calling agent may proceed with STATUS: DONE
145
- - **WARN** — non-blocking issues; calling agent should include warnings in its output but may proceed
177
+ - **WARN** — non-blocking issues; calling agent should include warnings in its output but may proceed. Exception: proof coverage gaps are FAIL.
146
178
  - **FAIL** — blocking; calling agent must NOT report STATUS: DONE until failures are resolved
147
179
 
148
180
  ### 🧭 Navigation — After State Check
@@ -138,6 +138,15 @@ For each issue/error that occurred in this session:
138
138
 
139
139
  > **Self-check**: `docs/dependency-map.md`에 이 세션에서 새로 추가한 모듈이 모두 등록되었는지 확인. 누락 시 즉시 추가. state-check가 PASS 또는 WARN을 반환해야 다음 단계로 진행합니다.
140
140
 
141
+ ### Step 5.55: Refresh Project Docs Hub Index (if applicable)
142
+
143
+ Run only if user used/requested `docs-bridge`, or Project Docs Hub Index has real rows.
144
+
145
+ 1. For changed docs (`README*`, `docs/`, ADR/design/runbook/API specs), refresh indexed review/status.
146
+ 2. For new docs, add `proposed` rows or recommend `docs-bridge`.
147
+ 3. Never write external hubs, invent targets, change visibility, or convert `local-only` / `pending` without explicit request.
148
+ 4. Keep filesystem paths, vault names, page IDs, and resolver details out of tracked state; use `.harness/docs-bridge.local.*`.
149
+
141
150
  ### Step 5.6: Resolve STATE-AUDIT Flags (if applicable)
142
151
 
143
152
  If the `reviewer` agent was run in this session and produced `[STATE-AUDIT]` flags:
@@ -145,6 +154,17 @@ If the `reviewer` agent was run in this session and produced `[STATE-AUDIT]` fla
145
154
  2. Apply the recommended state file update
146
155
  3. If the flag was already resolved during the session, skip it
147
156
 
157
+ ### Step 5.6a: Finalize Proof Ledger ⚠️ MANDATORY
158
+
159
+ Before session end, record the working proof that justified completion:
160
+ 1. Read reviewer output or recent terminal evidence for passing tests/smoke proof.
161
+ 2. Add one compact row to `docs/project-state.md` → `## Proof Ledger` for each completed Story.
162
+ 3. Cross-check completed Stories against `## Evidence Summary` / `## Proof Ledger`.
163
+ 4. If no proof exists, write `[PROOF-GAP] Proof missing` in the wrap-up report and recommend returning to `reviewer`; do not claim the Story is complete.
164
+ 5. If `[PROOF-GAP]` exists, STOP before Step 5.65. Do not auto-commit state files that mark a Story done/reviewed without passing proof. Revert the Story to Proof Pending or return to `reviewer`.
165
+
166
+ Proof rows must stay short: Date, Story, Evidence, Result, Command / Observation. Do not paste long logs.
167
+
148
168
  ### Step 5.65: Auto-Commit State Files ⚠️ MANDATORY
149
169
 
150
170
  State file 변경사항을 커밋합니다. Learn 실행 결과가 커밋되지 않으면 다음 세션에서 유실됩니다.
@@ -209,6 +229,7 @@ Present a summary of all updates made.
209
229
 
210
230
  ### State Files Updated:
211
231
  - [x] docs/project-state.md — Quick Summary refreshed
232
+ - [x] docs/project-state.md — Proof Ledger updated (if any Story completed)
212
233
  - [x] docs/failure-patterns.md — [N] patterns added/updated
213
234
  - [x] docs/features.md — [N] features updated (if applicable)
214
235
  - [x] docs/dependency-map.md — [N] modules verified/added (if applicable)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kodevibe/harness",
3
- "version": "0.9.6",
3
+ "version": "0.11.1",
4
4
  "description": "kode:harness — harness engineering for keeping every developer's AI aligned on one project direction.",
5
5
  "keywords": [
6
6
  "llm",
@@ -45,7 +45,9 @@
45
45
  "node": ">=18.0.0"
46
46
  },
47
47
  "scripts": {
48
- "test": "node --test tests/*.test.js"
48
+ "test": "node --test tests/*.test.js",
49
+ "harness:check-drift": "node scripts/check-harness-drift.js",
50
+ "harness:sync": "node bin/cli.js init --ide vscode --batch --dir . --overwrite"
49
51
  },
50
52
  "publishConfig": {
51
53
  "access": "public"