@pieerry/harness-kit 3.1.2 → 3.3.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.
- package/.claude/.hk-version +1 -0
- package/.claude/agents/product-manager.md +2 -2
- package/.claude/agents/staff-software-engineer.md +2 -2
- package/.claude/commands/pipeline/continue.md +8 -8
- package/.claude/commands/pipeline/reset.md +4 -4
- package/.claude/commands/product-manager/prd.md +4 -4
- package/.claude/commands/product-manager/prp.md +7 -7
- package/.claude/commands/product-manager/run.md +9 -5
- package/.claude/commands/sse/dev.md +18 -13
- package/.claude/commands/sse/plan.md +8 -8
- package/.claude/commands/sse/pr-monitor.md +56 -0
- package/.claude/commands/sse/pr.md +22 -12
- package/.claude/commands/sse/run.md +15 -8
- package/.claude/commands/sse/test.md +16 -10
- package/.claude/conventions/README.md +12 -0
- package/.claude/hooks/activity-pre-read.sh +18 -0
- package/.claude/hooks/pipeline-session-start.sh +26 -2
- package/.claude/hooks/status-line.sh +17 -1
- package/.claude/plugins/product-manager/evals/prd-quality.md +3 -3
- package/.claude/plugins/product-manager/evals/prd-readiness.md +1 -1
- package/.claude/plugins/product-manager/evals/prp-context-readiness.md +5 -5
- package/.claude/plugins/product-manager/evals/prp-quality.md +1 -1
- package/.claude/plugins/product-manager/guides/pipeline.md +14 -14
- package/.claude/plugins/product-manager/guides/prd-guidelines.md +4 -4
- package/.claude/plugins/product-manager/guides/product-guidelines.md +16 -16
- package/.claude/plugins/product-manager/guides/prp-guidelines.md +16 -16
- package/.claude/plugins/product-manager/guides/writing-style.md +9 -9
- package/.claude/plugins/product-manager/sensors/prd-acceptance-criteria.md +6 -6
- package/.claude/plugins/product-manager/sensors/prd-structure.md +2 -2
- package/.claude/plugins/product-manager/sensors/prp-context-quality.md +6 -6
- package/.claude/plugins/product-manager/sensors/prp-links.md +2 -2
- package/.claude/plugins/product-manager/sensors/prp-structure.md +1 -1
- package/.claude/plugins/staff-software-engineer/evals/dev-quality.md +48 -0
- package/.claude/plugins/staff-software-engineer/evals/plan-quality.md +6 -6
- package/.claude/plugins/staff-software-engineer/evals/pr-quality.md +48 -0
- package/.claude/plugins/staff-software-engineer/evals/test-quality.md +48 -0
- package/.claude/plugins/staff-software-engineer/guides/coding-style.md +7 -7
- package/.claude/plugins/staff-software-engineer/guides/commit-style.md +3 -3
- package/.claude/plugins/staff-software-engineer/guides/conventions-override.md +13 -13
- package/.claude/plugins/staff-software-engineer/guides/pipeline.md +19 -15
- package/.claude/plugins/staff-software-engineer/hooks/post-eval-sse.sh +65 -0
- package/.claude/plugins/staff-software-engineer/hooks/post-write-sse.sh +60 -0
- package/.claude/plugins/staff-software-engineer/sensors/code-conventions.md +4 -4
- package/.claude/plugins/staff-software-engineer/sensors/dev-structure.md +46 -0
- package/.claude/plugins/staff-software-engineer/sensors/pr-structure.md +49 -0
- package/.claude/plugins/staff-software-engineer/sensors/test-coverage.md +6 -6
- package/.claude/plugins/staff-software-engineer/sensors/test-structure.md +46 -0
- package/.claude/plugins/staff-software-engineer/skills/backend/SKILL.md +8 -8
- package/.claude/plugins/staff-software-engineer/skills/devops/SKILL.md +3 -3
- package/.claude/plugins/staff-software-engineer/skills/mobile/SKILL.md +3 -3
- package/.claude/plugins/staff-software-engineer/skills/web/SKILL.md +2 -2
- package/.claude/scripts/activity.py +68 -0
- package/.claude/scripts/pr-monitor.py +113 -0
- package/.claude/scripts/stage-card.md +37 -34
- package/.claude/settings.json +74 -0
- package/.claude/settings.local.json +13 -1
- package/CLAUDE.md +6 -0
- package/README.md +161 -61
- package/VERSION +1 -1
- package/bin/hk.js +6 -1
- package/package.json +1 -1
- package/setup/install.sh +16 -8
- package/.claude/plugins/staff-software-engineer/hooks/post-eval-plan.sh +0 -43
- package/.claude/plugins/staff-software-engineer/hooks/post-write-plan.sh +0 -49
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Claude Code harness for product + engineering delivery.
|
|
6
6
|
From idea to merged PR, one pipeline.
|
|
7
7
|
|
|
8
|
-
[](VERSION)
|
|
9
9
|
[](https://claude.ai/code)
|
|
10
10
|
[](#layout)
|
|
11
11
|
[](#usage)
|
|
@@ -15,12 +15,26 @@ From idea to merged PR, one pipeline.
|
|
|
15
15
|
|
|
16
16
|

|
|
17
17
|
|
|
18
|
-
<sub>110s walkthrough · install → 6 commands →
|
|
18
|
+
<sub>110s walkthrough · install → 6 commands → auto-watch PR until merged. Each command scene names its **guide · ref · sensor · eval**; final summary shows token spend per phase.</sub>
|
|
19
19
|
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
24
|
+
## What this is
|
|
25
|
+
|
|
26
|
+
harness-kit turns a target repo into a Claude Code workspace where **product and engineering share one pipeline**. You go from a problem statement to a merged PR through six gated stages — `prd → prp → plan → dev → test → pr` — each producing a markdown artifact, each gated by deterministic sensors and an LLM-judged eval, each accounting for its own token spend.
|
|
27
|
+
|
|
28
|
+
The pipeline is two Claude Code plugins (`product-manager`, `staff-software-engineer`) wired together by a small shell+python harness that tracks state, runs gates, and renders a live status bar. After a PR opens, an in-session monitor polls GitHub on backoff until the PR merges, then auto-clears state so the next feature starts clean.
|
|
29
|
+
|
|
30
|
+
**Who it's for:** PMs and engineers who want their `/`-commands to (1) produce real artifacts with named gates, (2) survive session restarts via persisted state, (3) record per-phase token spend so usage is auditable.
|
|
31
|
+
|
|
32
|
+
**What it's not:** a code generator, a CI replacement, or an opinionated agent framework. It's a thin harness that defers all model work to Claude Code and all VCS work to `git`/`gh`.
|
|
33
|
+
|
|
34
|
+
**Internal docs use caveman-full style** (drop articles + filler, fragments OK) to save input tokens — see [CLAUDE.md](CLAUDE.md). Generated artifacts (PRDs, PRPs, plans, dev/test/pr reports) stay natural English for external stakeholders. Reference templates and good-example artifacts are deliberately left in natural prose so produced docs inherit the right pattern.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
24
38
|
## Table of Contents
|
|
25
39
|
|
|
26
40
|
- [Getting Started](#getting-started)
|
|
@@ -29,10 +43,16 @@ From idea to merged PR, one pipeline.
|
|
|
29
43
|
- [Usage](#usage)
|
|
30
44
|
- [Workflow](#workflow)
|
|
31
45
|
- [Samples](#samples)
|
|
46
|
+
- [How it works](#how-it-works)
|
|
47
|
+
- [Anatomy of a stage](#anatomy-of-a-stage)
|
|
48
|
+
- [Sensors + evals matrix](#sensors--evals-matrix)
|
|
49
|
+
- [Status bar](#status-bar)
|
|
50
|
+
- [Live activity indicator](#live-activity-indicator)
|
|
51
|
+
- [PR monitor](#pr-monitor)
|
|
52
|
+
- [Token accounting](#token-accounting)
|
|
53
|
+
- [Session-start auto-clear](#session-start-auto-clear)
|
|
32
54
|
- [Layout](#layout)
|
|
33
55
|
- [Project conventions](#project-conventions)
|
|
34
|
-
- [Anatomy of a stage](#anatomy-of-a-stage)
|
|
35
|
-
- [Status bar](#status-bar)
|
|
36
56
|
- [Tooling](#tooling)
|
|
37
57
|
|
|
38
58
|
---
|
|
@@ -46,7 +66,7 @@ npm i -g @pieerry/harness-kit
|
|
|
46
66
|
hk install
|
|
47
67
|
```
|
|
48
68
|
|
|
49
|
-
`hk install` writes plugins into `.claude/plugins/`, drops
|
|
69
|
+
`hk install` writes plugins into `.claude/plugins/`, drops hooks in `.claude/hooks/` (status-line, pipeline tracking, activity tracker), copies state managers to `.claude/scripts/` (`pipeline.py`, `activity.py`, `pr-monitor.py`), registers slash commands under `.claude/commands/`, generates `.claude/settings.json`, and scaffolds `.claude/conventions/` for your project overrides. Run from the target repo or pass `[target]`. Restart Claude Code after.
|
|
50
70
|
|
|
51
71
|
Reinstalling on top of an existing setup backs up the previous `settings.json` to `.claude/settings.json.bak.{timestamp}` before overwriting, so manual customizations are recoverable.
|
|
52
72
|
|
|
@@ -60,7 +80,7 @@ CLI subcommands:
|
|
|
60
80
|
| `hk status [target]` | installed version + active pipeline stage |
|
|
61
81
|
| `hk version` | source version |
|
|
62
82
|
|
|
63
|
-
No-npm path
|
|
83
|
+
No-npm path:
|
|
64
84
|
|
|
65
85
|
```bash
|
|
66
86
|
git clone https://github.com/Pierry/harness-kit ~/.harness-kit
|
|
@@ -92,16 +112,17 @@ hk update
|
|
|
92
112
|
| `/product-manager:prp` | Draft a PRP (needs an approved PRD) |
|
|
93
113
|
| `/product-manager:run` | Full PM pipeline (PRD then PRP) |
|
|
94
114
|
| `/sse:plan` | Generate plan from an approved PRP |
|
|
95
|
-
| `/sse:dev` | Implement the plan, run convention gates |
|
|
96
|
-
| `/sse:test` | Run the project test suite |
|
|
97
|
-
| `/sse:pr` | Open the draft PR |
|
|
115
|
+
| `/sse:dev` | Implement the plan, run convention + structure + quality gates |
|
|
116
|
+
| `/sse:test` | Run the project test suite + write a structured test report |
|
|
117
|
+
| `/sse:pr` | Open the draft PR, then auto-arm `pr-monitor` |
|
|
118
|
+
| `/sse:pr-monitor` | Watch the active PR for merge with backoff polling (auto-invoked by `/sse:pr`) |
|
|
98
119
|
| `/sse:run` | Full SSE pipeline (plan, dev, test, pr) |
|
|
99
120
|
| `/pipeline:continue` | Resume the active pipeline at its next pending stage |
|
|
100
121
|
| `/pipeline:reset` | Abandon the active pipeline run (clears state, keeps artifacts) |
|
|
101
122
|
|
|
102
|
-
Pipeline order: `prd → prp → plan → dev → test → pr`. Each stage gets an approval marker.
|
|
123
|
+
Pipeline order: `prd → prp → plan → dev → test → pr`. Each stage gets an approval marker. Approval requires both the sensor gate (pass) and the eval gate (score ≥ 8.0).
|
|
103
124
|
|
|
104
|
-
You can enter the pipeline at any stage
|
|
125
|
+
You can enter the pipeline at any stage:
|
|
105
126
|
|
|
106
127
|
- `prd → prp → plan → dev → test → pr` (full PM + SSE)
|
|
107
128
|
- `prd → prp` (PM only, hand off to a separate engineering process)
|
|
@@ -143,13 +164,14 @@ Plan saved at outputs/plan/2026-05-12-billing-multi-currency.md.
|
|
|
143
164
|
sensors: plan-structure ok (problem, files, gates, scope)
|
|
144
165
|
eval: plan-quality 8.3/10
|
|
145
166
|
guides: pipeline.md, coding-style.md, skills/backend/SKILL.md
|
|
146
|
-
refs: prp
|
|
167
|
+
refs: prp/..., conventions/backend.md
|
|
147
168
|
next: /sse:dev
|
|
148
169
|
|
|
149
170
|
Dev complete. branch feat/PROJ-123-multi-currency.
|
|
150
171
|
files changed: 5
|
|
151
172
|
commits: 3 (a1b2c3d, d4e5f6g, h7i8j9k)
|
|
152
|
-
sensors: code-conventions ok, test-coverage ok
|
|
173
|
+
sensors: code-conventions ok, test-coverage ok, dev-structure ok
|
|
174
|
+
eval: dev-quality 8.4/10
|
|
153
175
|
guides: coding-style.md, commit-style.md, skills/backend/SKILL.md
|
|
154
176
|
next: /sse:test
|
|
155
177
|
|
|
@@ -157,17 +179,20 @@ Tests passed.
|
|
|
157
179
|
command: ./mvnw test
|
|
158
180
|
passed: 24, failed: 0
|
|
159
181
|
duration: 12.4s
|
|
182
|
+
sensors: test-structure ok
|
|
183
|
+
eval: test-quality 8.7/10
|
|
160
184
|
next: /sse:pr
|
|
161
185
|
|
|
162
186
|
PR opened: https://github.com/your-org/billing-service/pull/567
|
|
163
|
-
title:
|
|
164
|
-
draft:
|
|
165
|
-
|
|
166
|
-
|
|
187
|
+
title: feat(PROJ-123): timezone-aware deadline check
|
|
188
|
+
draft: yes
|
|
189
|
+
sensors: pr-structure ok
|
|
190
|
+
eval: pr-quality 8.9/10
|
|
167
191
|
|
|
168
|
-
|
|
192
|
+
PR monitor armed for #567. First check in 3min, escalates to 30min cap.
|
|
193
|
+
```
|
|
169
194
|
|
|
170
|
-
|
|
195
|
+
Every reply names the actual sensors that ran, evals with scores, and guides loaded — no generic "ok" lines. The `/sse:run` and `/product-manager:run` summaries aggregate the same shape across phases, plus per-phase token totals from `outputs/tokens/{feature_id}.json`.
|
|
171
196
|
|
|
172
197
|
### Samples
|
|
173
198
|
|
|
@@ -178,6 +203,111 @@ Reference artifacts ship inside the plugins:
|
|
|
178
203
|
|
|
179
204
|
---
|
|
180
205
|
|
|
206
|
+
## How it works
|
|
207
|
+
|
|
208
|
+
### Anatomy of a stage
|
|
209
|
+
|
|
210
|
+
Every stage in the pipeline runs the same loop. Same four ingredients, every time:
|
|
211
|
+
|
|
212
|
+
| Ingredient | What it is | Example |
|
|
213
|
+
|-----------|------------|---------|
|
|
214
|
+
| **guide** | How to write the artifact. Style + structure rules the LLM follows. | `prd-guidelines.md`, `coding-style.md` |
|
|
215
|
+
| **ref** | Context pulled in before drafting. Org/squad data + prior artifacts. | `business-info.md`, `outputs/prp/...md`, `.claude/conventions/backend.md` |
|
|
216
|
+
| **sensor** | Must-pass structural check. Deterministic, fast. Blocks approval. | `prd-structure`, `prp-links`, `dev-structure`, `test-structure`, `pr-structure`, `code-conventions`, `test-coverage` |
|
|
217
|
+
| **eval** | Scored quality rubric. LLM-judge, threshold 8.0, retried until pass or max attempts. | `prd-quality`, `prp-context-readiness`, `plan-quality`, `dev-quality`, `test-quality`, `pr-quality` |
|
|
218
|
+
|
|
219
|
+
Sensors are pass/fail. Evals are scored. Approval markers (`<!-- approved: -->`) gate the next stage. Token totals get appended as an inline `<!-- tokens: ... -->` reference after publish.
|
|
220
|
+
|
|
221
|
+
### Sensors + evals matrix
|
|
222
|
+
|
|
223
|
+
| Stage | Sensors (deterministic) | Eval (LLM-judge, ≥ 8.0) |
|
|
224
|
+
|-------|-------------------------|--------------------------|
|
|
225
|
+
| `prd` | `prd-structure`, `prd-acceptance-criteria` | `prd-quality`, `prd-readiness` |
|
|
226
|
+
| `prp` | `prp-structure`, `prp-context-quality`, `prp-links` | `prp-quality`, `prp-context-readiness` |
|
|
227
|
+
| `plan` | `plan-structure` | `plan-quality` |
|
|
228
|
+
| `dev` | `code-conventions`, `test-coverage`, `dev-structure` | `dev-quality` |
|
|
229
|
+
| `test` | `test-structure` | `test-quality` |
|
|
230
|
+
| `pr` | `pr-structure` | `pr-quality` |
|
|
231
|
+
|
|
232
|
+
Document sensors (`*-structure`) are auto-run by the post-write hook when the artifact lands on disk. Code sensors (`code-conventions`, `test-coverage`) are invoked by `/sse:dev` after each commit. Evals are scored by Claude inside the slash command. Convention: sensor files live at `plugins/{plugin}/sensors/{phase}-*.md`; evals at `plugins/{plugin}/evals/{phase}-quality.md`.
|
|
233
|
+
|
|
234
|
+
### Status bar
|
|
235
|
+
|
|
236
|
+
The status line follows the active feature through whatever pipeline shape you started. It is dynamic: a `UserPromptSubmit` hook records intent the moment you type a slash command, and `PostToolUse` hooks update state as artifact files land on disk.
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
idle · /product-manager:run · /sse:run · /pipeline:continue
|
|
240
|
+
starting sse-run [plan+dev+test+pr] · plan pending · next /sse:plan
|
|
241
|
+
multi-currency [plan+dev+test+pr] · plan drafting · next /sse:plan · sensor: plan-structure
|
|
242
|
+
multi-currency [plan+dev+test+pr] · plan approved · dev pending · next /sse:dev
|
|
243
|
+
multi-currency [prd+prp+plan+dev+test+pr] · prp approved · plan drafting · next /sse:plan
|
|
244
|
+
multi-currency · complete (prd+prp+plan+dev+test+pr)
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
The bracketed list is the pipeline shape — the stages this run will execute. The shape is inferred from the slash command you invoked and extended when you chain commands (e.g. running `/sse:run` after `/product-manager:run` appends `plan+dev+test+pr` to the existing `prd+prp`).
|
|
248
|
+
|
|
249
|
+
State lives at `.claude/.pipeline-state.json`. Close the session and reopen — the `SessionStart` hook prints a one-line resume hint, and `/pipeline:continue` invokes the next pending stage. `/pipeline:reset` clears the file. Output artifacts under `.claude/plugins/*/outputs/` are never deleted by reset.
|
|
250
|
+
|
|
251
|
+
### Live activity indicator
|
|
252
|
+
|
|
253
|
+
While Claude is reading a sensor, eval, or guide, the status bar appends a cyan tag with the file being touched:
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
multi-currency [plan+dev+test+pr] · plan drafting · next /sse:plan · sensor: plan-structure
|
|
257
|
+
multi-currency [plan+dev+test+pr] · dev drafting · next /sse:dev · guide: coding-style
|
|
258
|
+
multi-currency [plan+dev+test+pr] · plan drafting · next /sse:plan · eval: plan-quality
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Mechanism: a `PreToolUse` Read hook (`activity-pre-read.sh`) detects when Claude reads a file under `plugins/*/sensors/`, `plugins/*/evals/`, or `plugins/*/guides/` and writes the activity to `.claude/.activity` with a 60s TTL. The status-line reads it on each render and clears stale entries. The Claude Code top-of-screen "thinking…" indicator is rendered by the CLI itself and cannot be augmented; the bottom status bar is the available channel.
|
|
262
|
+
|
|
263
|
+
### PR monitor
|
|
264
|
+
|
|
265
|
+
After `/sse:pr` opens a PR, it auto-invokes `/sse:pr-monitor`, which polls `gh pr view --json state` on backoff and stays in the session until the PR transitions out of `OPEN`.
|
|
266
|
+
|
|
267
|
+
| Rung | Interval | Attempts | Cumulative |
|
|
268
|
+
|------|----------|----------|------------|
|
|
269
|
+
| 1 | 3 min | 5 | 15 min |
|
|
270
|
+
| 2 | 6 min | 5 | 45 min |
|
|
271
|
+
| 3 | 12 min | 5 | 1h 45m |
|
|
272
|
+
| 4 | 24 min | 5 | 3h 45m |
|
|
273
|
+
| 5 (cap) | 30 min | ∞ | until merged/closed |
|
|
274
|
+
|
|
275
|
+
On `MERGED`: notifies and clears both `.pipeline-state.json` and `.pr-monitor-state.json`. On `CLOSED` without merge: stops cleanly. Mechanism: `ScheduleWakeup` in the active session — closing the session ends the monitor.
|
|
276
|
+
|
|
277
|
+
State: `.claude/.pr-monitor-state.json` records PR number, URL, branch, current interval, and attempt counts.
|
|
278
|
+
|
|
279
|
+
### Token accounting
|
|
280
|
+
|
|
281
|
+
Every phase has its own start/end marker written to `outputs/.markers/{feature_id}.{phase}-{generate|validate}.{start|end}`. When the artifact is approved, the post-eval hook runs `scripts/token-phase.py` for both phases — it reads the Claude session transcript JSONL, sums input/output/cache-read/cache-creation tokens within each window, and appends an entry to `outputs/tokens/{feature_id}.json`.
|
|
282
|
+
|
|
283
|
+
Schema:
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"feature_id": "2026-05-12-billing-multi-currency",
|
|
288
|
+
"files": { "prd": "outputs/prd/...md", "prp": "outputs/prp/...md" },
|
|
289
|
+
"phases": [
|
|
290
|
+
{ "phase": "prd-generate", "started_at": "...", "ended_at": "...", "tokens": { "input": 1234, "output": 567, "cache_read": 8910, "cache_creation": 234 }, "attempts": 1 }
|
|
291
|
+
],
|
|
292
|
+
"totals": { "input": 0, "output": 0, "cache_read": 0, "cache_creation": 0 }
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Each plugin keeps its own `outputs/tokens/{feature_id}.json`. The artifact gets an inline `<!-- tokens: outputs/tokens/{feature_id}.json in=N out=N cache_r=N -->` reference appended after approval so the totals are visible from the artifact itself. Query examples in the [product-manager README](.claude/plugins/product-manager/README.md#token-accounting).
|
|
297
|
+
|
|
298
|
+
### Session-start auto-clear
|
|
299
|
+
|
|
300
|
+
When you reopen a session on a branch whose PR is `MERGED` or `CLOSED` and the pipeline state still has `feature_id: null` (i.e. the run was never linked to a feature), the `SessionStart` hook auto-clears `.pipeline-state.json` and prints:
|
|
301
|
+
|
|
302
|
+
```
|
|
303
|
+
previous feature shipped (PR #271 MERGED). pipeline state cleared.
|
|
304
|
+
start next with /product-manager:run or /sse:run
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
This avoids the stale `next /sse:plan` nag after work has already shipped.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
181
311
|
## Layout
|
|
182
312
|
|
|
183
313
|
```
|
|
@@ -189,14 +319,20 @@ Reference artifacts ship inside the plugins:
|
|
|
189
319
|
│ ├── commands/ slash commands per plugin namespace
|
|
190
320
|
│ ├── agents/ Task-tool-invokable orchestrators
|
|
191
321
|
│ ├── hooks/
|
|
192
|
-
│ │ ├── status-line.sh pipeline status indicator
|
|
322
|
+
│ │ ├── status-line.sh pipeline status indicator (with cyan activity)
|
|
193
323
|
│ │ ├── pipeline-prompt.sh slash-command intent tracking
|
|
194
324
|
│ │ ├── pipeline-postwrite.sh stage-state from artifact writes
|
|
195
325
|
│ │ ├── pipeline-postedit.sh stage-state from approval marker
|
|
196
|
-
│ │
|
|
326
|
+
│ │ ├── pipeline-session-start.sh resume hint + PR-merged auto-clear
|
|
327
|
+
│ │ └── activity-pre-read.sh surfaces current sensor/eval/guide
|
|
197
328
|
│ ├── scripts/
|
|
198
|
-
│ │
|
|
329
|
+
│ │ ├── pipeline.py pipeline state CRUD
|
|
330
|
+
│ │ ├── activity.py live activity CRUD (60s TTL)
|
|
331
|
+
│ │ ├── pr-monitor.py PR-watch state + backoff schedule
|
|
332
|
+
│ │ └── stage-card.md header/footer card convention
|
|
199
333
|
│ ├── .pipeline-state.json active feature + per-stage state
|
|
334
|
+
│ ├── .pr-monitor-state.json PR being watched
|
|
335
|
+
│ ├── .activity current sensor/eval/guide being touched
|
|
200
336
|
│ └── settings.json hooks wiring + permissions
|
|
201
337
|
├── context-library/ reusable org/squad context
|
|
202
338
|
├── setup/
|
|
@@ -208,7 +344,7 @@ Reference artifacts ship inside the plugins:
|
|
|
208
344
|
Plugin documentation:
|
|
209
345
|
|
|
210
346
|
- [product-manager](.claude/plugins/product-manager/README.md): PRD and PRP generation, sensor and eval gates, retry loop, token accounting, optional Confluence publish.
|
|
211
|
-
- [staff-software-engineer](.claude/plugins/staff-software-engineer/README.md): plan, dev, test, pr stages with per-project conventions override.
|
|
347
|
+
- [staff-software-engineer](.claude/plugins/staff-software-engineer/README.md): plan, dev, test, pr stages with per-project conventions override, document + code sensors, quality evals, PR monitor.
|
|
212
348
|
|
|
213
349
|
---
|
|
214
350
|
|
|
@@ -228,50 +364,14 @@ The installer scaffolds `.claude/conventions/README.md` to remind you of the con
|
|
|
228
364
|
|
|
229
365
|
---
|
|
230
366
|
|
|
231
|
-
## Anatomy of a stage
|
|
232
|
-
|
|
233
|
-
Every stage in the pipeline runs the same loop. Same four ingredients, every time:
|
|
234
|
-
|
|
235
|
-
| Ingredient | What it is | Example |
|
|
236
|
-
|-----------|------------|---------|
|
|
237
|
-
| **guide** | How to write the artifact. Style + structure rules the LLM follows. | `prd-guidelines.md`, `coding-style.md` |
|
|
238
|
-
| **ref** | Context pulled in before drafting. Org/squad data + prior artifacts. | `business-info.md`, `outputs/prp/...md`, `.claude/conventions/backend.md` |
|
|
239
|
-
| **sensor** | Must-pass structural check. Blocks the stage from being approved. | `prd-structure`, `prp-links`, `code-conventions`, `test-coverage` |
|
|
240
|
-
| **eval** | Scored quality rubric. Returns a 0–10 score with diff suggestions. | `prd-quality`, `prp-context-readiness`, `plan-quality` |
|
|
241
|
-
|
|
242
|
-
Sensors are pass/fail (deterministic, fast). Evals are scored (LLM-judged, retried until ≥ threshold or max attempts). Approval markers (`<!-- approved: -->`) gate the next stage.
|
|
243
|
-
|
|
244
|
-
The 110s demo above shows every command running with these artifacts loading live on the right panel — plus the final summary scene that names every sensor, eval, and guide per phase.
|
|
245
|
-
|
|
246
|
-
---
|
|
247
|
-
|
|
248
|
-
## Status bar
|
|
249
|
-
|
|
250
|
-
The status line follows the active feature through whatever pipeline shape you started. It is dynamic: a `UserPromptSubmit` hook records intent the moment you type a slash command, and `PostToolUse` hooks update state as artifact files land on disk.
|
|
251
|
-
|
|
252
|
-
```
|
|
253
|
-
idle · /product-manager:run · /sse:run · /pipeline:continue
|
|
254
|
-
starting sse-run [plan+dev+test+pr] · plan pending · next /sse:plan
|
|
255
|
-
multi-currency [plan+dev+test+pr] · plan drafting · next /sse:plan
|
|
256
|
-
multi-currency [plan+dev+test+pr] · plan approved · dev pending · next /sse:dev
|
|
257
|
-
multi-currency [prd+prp+plan+dev+test+pr] · prp approved · plan drafting · next /sse:plan
|
|
258
|
-
multi-currency · complete (prd+prp+plan+dev+test+pr)
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
The bracketed list is the pipeline shape — the stages this run will execute. The shape is inferred from the slash command you invoked and extended when you chain commands (e.g. running `/sse:run` after `/product-manager:run` appends `plan+dev+test+pr` to the existing `prd+prp`).
|
|
262
|
-
|
|
263
|
-
State lives at `.claude/.pipeline-state.json`. Close the session and reopen — the SessionStart hook prints a one-line resume hint, and `/pipeline:continue` invokes the next pending stage. `/pipeline:reset` clears the file. Output artifacts under `.claude/plugins/*/outputs/` are never deleted by reset.
|
|
264
|
-
|
|
265
|
-
---
|
|
266
|
-
|
|
267
367
|
## Tooling
|
|
268
368
|
|
|
269
369
|
| Tool | Why |
|
|
270
370
|
|------|-----|
|
|
271
371
|
| [Claude Code](https://claude.ai/code) | the agent runtime |
|
|
272
372
|
| [git](https://git-scm.com/) | version control + status bar branch detection |
|
|
273
|
-
| [python3](https://www.python.org/) | sensor runner, token accounting,
|
|
274
|
-
| [gh CLI](https://cli.github.com/) | install, update, opening PRs via `/sse:pr` |
|
|
373
|
+
| [python3](https://www.python.org/) | sensor runner, token accounting, pipeline state, activity tracker, PR monitor |
|
|
374
|
+
| [gh CLI](https://cli.github.com/) | install, update, opening PRs via `/sse:pr`, polling merge via `/sse:pr-monitor` |
|
|
275
375
|
|
|
276
376
|
Optional:
|
|
277
377
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.1
|
|
1
|
+
3.3.1
|
package/bin/hk.js
CHANGED
|
@@ -70,9 +70,14 @@ function cmdUninstall(target) {
|
|
|
70
70
|
'.claude/hooks/pipeline-postwrite.sh',
|
|
71
71
|
'.claude/hooks/pipeline-postedit.sh',
|
|
72
72
|
'.claude/hooks/pipeline-session-start.sh',
|
|
73
|
+
'.claude/hooks/activity-pre-read.sh',
|
|
73
74
|
'.claude/scripts/pipeline.py',
|
|
75
|
+
'.claude/scripts/activity.py',
|
|
76
|
+
'.claude/scripts/pr-monitor.py',
|
|
74
77
|
'.claude/scripts/stage-card.md',
|
|
75
78
|
'.claude/.pipeline-state.json',
|
|
79
|
+
'.claude/.pr-monitor-state.json',
|
|
80
|
+
'.claude/.activity',
|
|
76
81
|
'.claude/settings.json',
|
|
77
82
|
'.claude/.hk-version',
|
|
78
83
|
];
|
|
@@ -121,7 +126,7 @@ usage:
|
|
|
121
126
|
|
|
122
127
|
after install, restart Claude Code and use:
|
|
123
128
|
/product-manager:prd | :prp | :run
|
|
124
|
-
/sse:plan | :dev | :test | :pr | :run
|
|
129
|
+
/sse:plan | :dev | :test | :pr | :pr-monitor | :run
|
|
125
130
|
/pipeline:continue | :reset`);
|
|
126
131
|
}
|
|
127
132
|
|
package/package.json
CHANGED
package/setup/install.sh
CHANGED
|
@@ -66,18 +66,20 @@ for plugin in product-manager staff-software-engineer; do
|
|
|
66
66
|
"$TARGET/.claude/plugins/$plugin/.claude-plugin"
|
|
67
67
|
done
|
|
68
68
|
|
|
69
|
-
# Copy harness-kit hooks (status-line + pipeline tracking)
|
|
69
|
+
# Copy harness-kit hooks (status-line + pipeline tracking + live activity)
|
|
70
70
|
mkdir -p "$TARGET/.claude/hooks"
|
|
71
|
-
for h in status-line.sh pipeline-prompt.sh pipeline-postwrite.sh pipeline-postedit.sh pipeline-session-start.sh; do
|
|
71
|
+
for h in status-line.sh pipeline-prompt.sh pipeline-postwrite.sh pipeline-postedit.sh pipeline-session-start.sh activity-pre-read.sh; do
|
|
72
72
|
cp "$SOURCE_ROOT/.claude/hooks/$h" "$TARGET/.claude/hooks/$h"
|
|
73
73
|
chmod +x "$TARGET/.claude/hooks/$h"
|
|
74
74
|
done
|
|
75
75
|
|
|
76
|
-
# Copy harness-kit scripts (pipeline state
|
|
76
|
+
# Copy harness-kit scripts (pipeline state, activity tracker, PR monitor, stage-card)
|
|
77
77
|
mkdir -p "$TARGET/.claude/scripts"
|
|
78
|
-
|
|
78
|
+
for s in pipeline.py activity.py pr-monitor.py; do
|
|
79
|
+
cp "$SOURCE_ROOT/.claude/scripts/$s" "$TARGET/.claude/scripts/$s"
|
|
80
|
+
chmod +x "$TARGET/.claude/scripts/$s"
|
|
81
|
+
done
|
|
79
82
|
cp "$SOURCE_ROOT/.claude/scripts/stage-card.md" "$TARGET/.claude/scripts/stage-card.md"
|
|
80
|
-
chmod +x "$TARGET/.claude/scripts/pipeline.py"
|
|
81
83
|
|
|
82
84
|
# Settings.json (back up existing if content differs)
|
|
83
85
|
if [ -f "$TARGET/.claude/settings.json" ]; then
|
|
@@ -128,6 +130,12 @@ cat > "$TARGET/.claude/settings.json" <<'EOF'
|
|
|
128
130
|
"hooks": [
|
|
129
131
|
{ "type": "command", "command": "[ -x .claude/plugins/product-manager/hooks/pre-prp-check.sh ] && bash .claude/plugins/product-manager/hooks/pre-prp-check.sh; exit 0" }
|
|
130
132
|
]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"matcher": "Read",
|
|
136
|
+
"hooks": [
|
|
137
|
+
{ "type": "command", "command": "[ -x .claude/hooks/activity-pre-read.sh ] && bash .claude/hooks/activity-pre-read.sh; exit 0" }
|
|
138
|
+
]
|
|
131
139
|
}
|
|
132
140
|
],
|
|
133
141
|
"PostToolUse": [
|
|
@@ -136,7 +144,7 @@ cat > "$TARGET/.claude/settings.json" <<'EOF'
|
|
|
136
144
|
"hooks": [
|
|
137
145
|
{ "type": "command", "command": "[ -x .claude/plugins/product-manager/hooks/post-write-prd.sh ] && bash .claude/plugins/product-manager/hooks/post-write-prd.sh; exit 0" },
|
|
138
146
|
{ "type": "command", "command": "[ -x .claude/plugins/product-manager/hooks/post-write-prp.sh ] && bash .claude/plugins/product-manager/hooks/post-write-prp.sh; exit 0" },
|
|
139
|
-
{ "type": "command", "command": "[ -x .claude/plugins/staff-software-engineer/hooks/post-write-
|
|
147
|
+
{ "type": "command", "command": "[ -x .claude/plugins/staff-software-engineer/hooks/post-write-sse.sh ] && bash .claude/plugins/staff-software-engineer/hooks/post-write-sse.sh; exit 0" },
|
|
140
148
|
{ "type": "command", "command": "[ -x .claude/hooks/pipeline-postwrite.sh ] && bash .claude/hooks/pipeline-postwrite.sh; exit 0" }
|
|
141
149
|
]
|
|
142
150
|
},
|
|
@@ -145,7 +153,7 @@ cat > "$TARGET/.claude/settings.json" <<'EOF'
|
|
|
145
153
|
"hooks": [
|
|
146
154
|
{ "type": "command", "command": "[ -x .claude/plugins/product-manager/hooks/post-eval-prd.sh ] && bash .claude/plugins/product-manager/hooks/post-eval-prd.sh; exit 0" },
|
|
147
155
|
{ "type": "command", "command": "[ -x .claude/plugins/product-manager/hooks/post-eval-prp.sh ] && bash .claude/plugins/product-manager/hooks/post-eval-prp.sh; exit 0" },
|
|
148
|
-
{ "type": "command", "command": "[ -x .claude/plugins/staff-software-engineer/hooks/post-eval-
|
|
156
|
+
{ "type": "command", "command": "[ -x .claude/plugins/staff-software-engineer/hooks/post-eval-sse.sh ] && bash .claude/plugins/staff-software-engineer/hooks/post-eval-sse.sh; exit 0" },
|
|
149
157
|
{ "type": "command", "command": "[ -x .claude/hooks/pipeline-postedit.sh ] && bash .claude/hooks/pipeline-postedit.sh; exit 0" }
|
|
150
158
|
]
|
|
151
159
|
}
|
|
@@ -182,5 +190,5 @@ echo "$VERSION" > "$TARGET/.claude/.hk-version"
|
|
|
182
190
|
|
|
183
191
|
echo "done. restart Claude Code to load."
|
|
184
192
|
echo " /product-manager:prd | :prp | :run"
|
|
185
|
-
echo " /sse:plan | :dev | :test | :pr | :run"
|
|
193
|
+
echo " /sse:plan | :dev | :test | :pr | :pr-monitor | :run"
|
|
186
194
|
echo " /pipeline:continue | :reset"
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# After Edit appends approval marker to plan, close phases, run token accounting.
|
|
3
|
-
|
|
4
|
-
set -euo pipefail
|
|
5
|
-
|
|
6
|
-
FILE_PATH="${CLAUDE_TOOL_FILE_PATH:-}"
|
|
7
|
-
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
8
|
-
|
|
9
|
-
case "$FILE_PATH" in
|
|
10
|
-
*.claude/plugins/staff-software-engineer/outputs/plan/*.md) ;;
|
|
11
|
-
*) exit 0 ;;
|
|
12
|
-
esac
|
|
13
|
-
|
|
14
|
-
if ! grep -q "<!-- approved:" "$FILE_PATH"; then
|
|
15
|
-
exit 0
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
if grep -q "<!-- published:" "$FILE_PATH"; then
|
|
19
|
-
exit 0
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
FEATURE_ID="$(basename "$FILE_PATH" .md)"
|
|
23
|
-
MARKERS_DIR="$PLUGIN_DIR/outputs/.markers"
|
|
24
|
-
mkdir -p "$MARKERS_DIR"
|
|
25
|
-
NOW="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
26
|
-
|
|
27
|
-
if [ -f "$MARKERS_DIR/${FEATURE_ID}.plan-validate.start" ]; then
|
|
28
|
-
printf '{"timestamp":"%s"}\n' "$NOW" > "$MARKERS_DIR/${FEATURE_ID}.plan-validate.end"
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
python3 "$PLUGIN_DIR/scripts/token-phase.py" \
|
|
32
|
-
--feature-id "$FEATURE_ID" \
|
|
33
|
-
--phase "plan-generate" \
|
|
34
|
-
--plugin-dir "$PLUGIN_DIR" >&2 || true
|
|
35
|
-
|
|
36
|
-
python3 "$PLUGIN_DIR/scripts/token-phase.py" \
|
|
37
|
-
--feature-id "$FEATURE_ID" \
|
|
38
|
-
--phase "plan-validate" \
|
|
39
|
-
--plugin-dir "$PLUGIN_DIR" >&2 || true
|
|
40
|
-
|
|
41
|
-
printf '\n<!-- published: %s -->\n' "$NOW" >> "$FILE_PATH"
|
|
42
|
-
echo "[hook] Plan approved + token accounting done" >&2
|
|
43
|
-
exit 0
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# After Write to outputs/plan/, run sensors and write phase markers.
|
|
3
|
-
|
|
4
|
-
set -euo pipefail
|
|
5
|
-
|
|
6
|
-
FILE_PATH="${CLAUDE_TOOL_FILE_PATH:-}"
|
|
7
|
-
PLUGIN_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
8
|
-
|
|
9
|
-
case "$FILE_PATH" in
|
|
10
|
-
*.claude/plugins/staff-software-engineer/outputs/plan/*.md) ;;
|
|
11
|
-
*) exit 0 ;;
|
|
12
|
-
esac
|
|
13
|
-
|
|
14
|
-
if grep -q "<!-- approved:" "$FILE_PATH" 2>/dev/null; then
|
|
15
|
-
exit 0
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
echo "[hook] Running plan sensors on $(basename "$FILE_PATH")" >&2
|
|
19
|
-
|
|
20
|
-
FAILURES=()
|
|
21
|
-
for sensor in "$PLUGIN_DIR"/sensors/plan-*.md; do
|
|
22
|
-
[ -f "$sensor" ] || continue
|
|
23
|
-
if ! python3 "$PLUGIN_DIR/scripts/sensor-runner.py" \
|
|
24
|
-
--sensor "$sensor" \
|
|
25
|
-
--artifact "$FILE_PATH" >&2; then
|
|
26
|
-
FAILURES+=("$(basename "$sensor")")
|
|
27
|
-
fi
|
|
28
|
-
done
|
|
29
|
-
|
|
30
|
-
if [ ${#FAILURES[@]} -gt 0 ]; then
|
|
31
|
-
echo "[hook] Plan sensor failures: ${FAILURES[*]}" >&2
|
|
32
|
-
exit 2
|
|
33
|
-
fi
|
|
34
|
-
|
|
35
|
-
echo "[hook] Plan sensors passed" >&2
|
|
36
|
-
|
|
37
|
-
FEATURE_ID="$(basename "$FILE_PATH" .md)"
|
|
38
|
-
MARKERS_DIR="$PLUGIN_DIR/outputs/.markers"
|
|
39
|
-
mkdir -p "$MARKERS_DIR"
|
|
40
|
-
NOW="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
41
|
-
|
|
42
|
-
if [ ! -f "$MARKERS_DIR/${FEATURE_ID}.plan-validate.start" ]; then
|
|
43
|
-
if [ -f "$MARKERS_DIR/${FEATURE_ID}.plan-generate.start" ]; then
|
|
44
|
-
printf '{"timestamp":"%s"}\n' "$NOW" > "$MARKERS_DIR/${FEATURE_ID}.plan-generate.end"
|
|
45
|
-
printf '{"timestamp":"%s","session_id":"%s"}\n' "$NOW" "${CLAUDE_SESSION_ID:-}" > "$MARKERS_DIR/${FEATURE_ID}.plan-validate.start"
|
|
46
|
-
fi
|
|
47
|
-
fi
|
|
48
|
-
|
|
49
|
-
exit 0
|