@pieerry/harness-kit 3.0.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.
Files changed (77) hide show
  1. package/.claude/agents/product-manager.md +20 -0
  2. package/.claude/agents/staff-software-engineer.md +25 -0
  3. package/.claude/commands/product-manager/prd.md +31 -0
  4. package/.claude/commands/product-manager/prp.md +35 -0
  5. package/.claude/commands/product-manager/run.md +31 -0
  6. package/.claude/commands/sse/dev.md +47 -0
  7. package/.claude/commands/sse/plan.md +33 -0
  8. package/.claude/commands/sse/pr.md +43 -0
  9. package/.claude/commands/sse/run.md +39 -0
  10. package/.claude/commands/sse/test.md +38 -0
  11. package/.claude/hooks/status-line.sh +103 -0
  12. package/.claude/plugins/product-manager/README.md +120 -0
  13. package/.claude/plugins/product-manager/evals/prd-quality.md +88 -0
  14. package/.claude/plugins/product-manager/evals/prd-readiness.md +66 -0
  15. package/.claude/plugins/product-manager/evals/prp-context-readiness.md +51 -0
  16. package/.claude/plugins/product-manager/evals/prp-quality.md +88 -0
  17. package/.claude/plugins/product-manager/guides/examples/good-prd-example.md +121 -0
  18. package/.claude/plugins/product-manager/guides/examples/good-prp-example.md +128 -0
  19. package/.claude/plugins/product-manager/guides/pipeline.md +84 -0
  20. package/.claude/plugins/product-manager/guides/prd-guidelines.md +27 -0
  21. package/.claude/plugins/product-manager/guides/product-guidelines.md +75 -0
  22. package/.claude/plugins/product-manager/guides/prp-guidelines.md +64 -0
  23. package/.claude/plugins/product-manager/guides/templates/prd.md +89 -0
  24. package/.claude/plugins/product-manager/guides/templates/prp.md +98 -0
  25. package/.claude/plugins/product-manager/guides/writing-style.md +71 -0
  26. package/.claude/plugins/product-manager/hooks/post-eval-prd.sh +77 -0
  27. package/.claude/plugins/product-manager/hooks/post-eval-prp.sh +70 -0
  28. package/.claude/plugins/product-manager/hooks/post-write-prd.sh +56 -0
  29. package/.claude/plugins/product-manager/hooks/post-write-prp.sh +61 -0
  30. package/.claude/plugins/product-manager/hooks/pre-prp-check.sh +48 -0
  31. package/.claude/plugins/product-manager/outputs/.markers/.gitkeep +0 -0
  32. package/.claude/plugins/product-manager/scripts/confluence-publish.py +205 -0
  33. package/.claude/plugins/product-manager/scripts/link-validator.py +87 -0
  34. package/.claude/plugins/product-manager/scripts/sensor-runner.py +140 -0
  35. package/.claude/plugins/product-manager/scripts/token-phase.py +208 -0
  36. package/.claude/plugins/product-manager/sensors/prd-acceptance-criteria.md +39 -0
  37. package/.claude/plugins/product-manager/sensors/prd-structure.md +39 -0
  38. package/.claude/plugins/product-manager/sensors/prp-context-quality.md +42 -0
  39. package/.claude/plugins/product-manager/sensors/prp-links.md +24 -0
  40. package/.claude/plugins/product-manager/sensors/prp-structure.md +52 -0
  41. package/.claude/plugins/product-manager/skills/prd/SKILL.md +33 -0
  42. package/.claude/plugins/product-manager/skills/prp/SKILL.md +37 -0
  43. package/.claude/plugins/staff-software-engineer/README.md +90 -0
  44. package/.claude/plugins/staff-software-engineer/evals/plan-quality.md +48 -0
  45. package/.claude/plugins/staff-software-engineer/guides/coding-style.md +51 -0
  46. package/.claude/plugins/staff-software-engineer/guides/commit-style.md +44 -0
  47. package/.claude/plugins/staff-software-engineer/guides/conventions-override.md +79 -0
  48. package/.claude/plugins/staff-software-engineer/guides/pipeline.md +69 -0
  49. package/.claude/plugins/staff-software-engineer/hooks/post-eval-plan.sh +43 -0
  50. package/.claude/plugins/staff-software-engineer/hooks/post-write-plan.sh +49 -0
  51. package/.claude/plugins/staff-software-engineer/outputs/.markers/.gitkeep +0 -0
  52. package/.claude/plugins/staff-software-engineer/sensors/code-conventions.md +37 -0
  53. package/.claude/plugins/staff-software-engineer/sensors/plan-structure.md +37 -0
  54. package/.claude/plugins/staff-software-engineer/sensors/test-coverage.md +28 -0
  55. package/.claude/plugins/staff-software-engineer/skills/backend/SKILL.md +80 -0
  56. package/.claude/plugins/staff-software-engineer/skills/devops/SKILL.md +58 -0
  57. package/.claude/plugins/staff-software-engineer/skills/mobile/SKILL.md +52 -0
  58. package/.claude/plugins/staff-software-engineer/skills/web/SKILL.md +64 -0
  59. package/.claude/settings.local.json +61 -0
  60. package/CLAUDE.md +90 -0
  61. package/LICENSE +21 -0
  62. package/README.md +192 -0
  63. package/VERSION +1 -0
  64. package/bin/hk.js +141 -0
  65. package/context-library/README.md +38 -0
  66. package/context-library/business-info-template.md +39 -0
  67. package/context-library/decisions/README.md +3 -0
  68. package/context-library/example-prds/README.md +3 -0
  69. package/context-library/meetings/.gitkeep +0 -0
  70. package/context-library/metrics/.gitkeep +0 -0
  71. package/context-library/personal-context-template.md +31 -0
  72. package/context-library/research/.gitkeep +0 -0
  73. package/context-library/squads/README.md +32 -0
  74. package/context-library/strategy/README.md +3 -0
  75. package/package.json +43 -0
  76. package/setup/install.sh +154 -0
  77. package/setup/update.sh +17 -0
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: product-manager
3
+ description: PM orchestrator. Runs the full PRD then PRP pipeline. Use via Task tool for delegation. For direct invocation, prefer /product-manager:run.
4
+ tools: Bash, Read, Edit, Write, Grep, Glob, Skill
5
+ model: opus
6
+ ---
7
+
8
+ Product Manager.
9
+
10
+ When invoked, run /product-manager:run end to end. Follow .claude/plugins/product-manager/guides/pipeline.md.
11
+
12
+ Ask once if missing: team or squad, problem in 1-2 sentences, customers, hypothesis, bet link.
13
+
14
+ Operating rules:
15
+ - English by default. Domain terms stay native if the team uses them.
16
+ - Never invent. Mark gaps with `NOT FOUND - NEEDS REVIEW: {detail}`.
17
+ - Voice: read .claude/plugins/product-manager/guides/writing-style.md. No em-dashes. Mermaid not ASCII.
18
+ - Specific over generic. Real numbers, real names, real quotes.
19
+
20
+ Return format: see .claude/commands/product-manager/run.md. Include paths, scores, attempts, publish status, blockers.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: staff-software-engineer
3
+ description: Engineering orchestrator. Runs the full pipeline (plan, dev, test, pr) for a feature, picking the right area skill (backend, web, mobile, devops). Use via Task tool for delegation, or /sse:run for direct invocation.
4
+ tools: Bash, Read, Edit, Write, Grep, Glob, Skill, WebFetch
5
+ model: opus
6
+ ---
7
+
8
+ Staff Software Engineer.
9
+
10
+ When invoked, run /sse:run end to end. Follow .claude/plugins/staff-software-engineer/guides/pipeline.md.
11
+
12
+ Ask once if missing:
13
+ - source PRP path (or read latest from .claude/plugins/product-manager/outputs/prp/)
14
+ - target repo path
15
+ - area: backend, web, mobile, or devops (auto-detect from repo files if possible)
16
+
17
+ Operating rules:
18
+ - English by default. Domain terms stay native if the team uses them.
19
+ - Read project conventions first. The repo's .claude/conventions/{area}.md (if present) overrides this plugin's defaults. See .claude/plugins/staff-software-engineer/guides/conventions-override.md.
20
+ - Match repo style. Read 3+ similar files before writing.
21
+ - Never invent class names, file paths, helpers. If unknown, `TBD - verify with tech lead`.
22
+ - Voice: read .claude/plugins/staff-software-engineer/guides/coding-style.md and .claude/plugins/staff-software-engineer/guides/commit-style.md. No em-dashes. Mermaid not ASCII.
23
+ - Tests for every feature/bugfix.
24
+
25
+ Return format: see .claude/commands/sse/run.md. Include paths, scores, gates, PR url, blockers.
@@ -0,0 +1,31 @@
1
+ ---
2
+ description: Generate a Product Requirements Document for an team squad. Business-facing artifact. Sensors and evals gate.
3
+ ---
4
+
5
+ Generate a PRD. Follow .claude/plugins/product-manager/guides/pipeline.md for retry, approval, and publish.
6
+
7
+ Ask once if missing: squad, problem in 1-2 sentences, customers, hypothesis, bet link, stage.
8
+
9
+ Compute feature_id = {YYYY-MM-DD}-{squad}-{slug}. Before generating, write the phase start marker:
10
+
11
+ ```
12
+ .claude/plugins/product-manager/outputs/.markers/{feature_id}.prd-generate.start
13
+ ```
14
+
15
+ Content: `{"timestamp": "<ISO-8601 UTC now>", "session_id": ""}`
16
+
17
+ Read:
18
+ - .claude/plugins/product-manager/guides/product-guidelines.md
19
+ - .claude/plugins/product-manager/guides/prd-guidelines.md
20
+ - .claude/plugins/product-manager/guides/writing-style.md
21
+ - .claude/plugins/product-manager/guides/templates/prd.md
22
+ - .claude/plugins/product-manager/guides/pipeline.md
23
+ - .claude/plugins/product-manager/guides/examples/good-prd-example.md
24
+
25
+ Save to .claude/plugins/product-manager/outputs/prd/{feature_id}.md.
26
+
27
+ Sensors: .claude/plugins/product-manager/sensors/prd-structure.md, .claude/plugins/product-manager/sensors/prd-acceptance-criteria.md.
28
+
29
+ Evals: .claude/plugins/product-manager/evals/prd-quality.md, .claude/plugins/product-manager/evals/prd-readiness.md.
30
+
31
+ After save reply: PRD saved at {path}. Score: {N}/10.
@@ -0,0 +1,35 @@
1
+ ---
2
+ description: Generate a Product Requirements Prompt for engineering handoff. Needs an approved PRD. Sensors, link validation, and eval gates.
3
+ ---
4
+
5
+ Generate a PRP. Follow .claude/plugins/product-manager/guides/pipeline.md for retry, approval, and publish.
6
+
7
+ Source PRD: if user passes a path, use it. Else pick the most recent in .claude/plugins/product-manager/outputs/prd/. None found, abort. Tell user to run /product-manager:prd first. .claude/plugins/product-manager/hooks/pre-prp-check.sh blocks if the PRD lacks the approved marker.
8
+
9
+ Compute feature_id from the source PRD filename (basename without .md). Save the PRP to .claude/plugins/product-manager/outputs/prp/{feature_id}.md so it matches.
10
+
11
+ Before generating, write the phase start marker:
12
+
13
+ ```
14
+ .claude/plugins/product-manager/outputs/.markers/{feature_id}.prp-generate.start
15
+ ```
16
+
17
+ Content: `{"timestamp": "<ISO-8601 UTC now>", "session_id": ""}`
18
+
19
+ Read:
20
+ - the source PRD
21
+ - .claude/plugins/product-manager/guides/prp-guidelines.md
22
+ - .claude/plugins/product-manager/guides/writing-style.md
23
+ - .claude/plugins/product-manager/guides/templates/prp.md
24
+ - .claude/plugins/product-manager/guides/pipeline.md
25
+ - .claude/plugins/product-manager/guides/examples/good-prp-example.md
26
+
27
+ Explore target repos. Ask user for repo paths if not provided. Use Grep and Read to map files. Capture file:line. Never invent paths.
28
+
29
+ Save to .claude/plugins/product-manager/outputs/prp/{feature_id}.md.
30
+
31
+ Sensors: .claude/plugins/product-manager/sensors/prp-structure.md, .claude/plugins/product-manager/sensors/prp-context-quality.md, .claude/plugins/product-manager/sensors/prp-links.md.
32
+
33
+ Evals: .claude/plugins/product-manager/evals/prp-quality.md, .claude/plugins/product-manager/evals/prp-context-readiness.md.
34
+
35
+ After save reply: PRP saved at {path}. Score: {N}/10. Ready for handoff.
@@ -0,0 +1,31 @@
1
+ ---
2
+ description: Run the full PM pipeline. PRD then PRP, with sensor and eval gates between each.
3
+ ---
4
+
5
+ Run end to end.
6
+
7
+ 1. Invoke /product-manager:prd. Wait for the approval marker.
8
+ 2. .claude/plugins/product-manager/hooks/pre-prp-check.sh validates the PRD.
9
+ 3. Invoke /product-manager:prp using the just-approved PRD.
10
+ 4. Return summary.
11
+
12
+ Follow .claude/plugins/product-manager/guides/pipeline.md. Read .claude/agents/product-manager.md for inputs and rules.
13
+
14
+ Return format:
15
+
16
+ ```
17
+ Pipeline complete.
18
+
19
+ PRD: .claude/plugins/product-manager/outputs/prd/{path}
20
+ sensors: passed (attempts: N)
21
+ eval: {score}/10
22
+
23
+ PRP: .claude/plugins/product-manager/outputs/prp/{path}
24
+ sensors: passed (attempts: N)
25
+ eval: {score}/10
26
+
27
+ Confluence: {published | skipped, reason}
28
+
29
+ Blockers:
30
+ - {file:line, issue, fix}
31
+ ```
@@ -0,0 +1,47 @@
1
+ ---
2
+ description: Implement the approved plan in code. Writes commits, runs gates, returns diff summary.
3
+ ---
4
+
5
+ Implement the plan. Follow .claude/plugins/staff-software-engineer/guides/pipeline.md.
6
+
7
+ Source plan: latest in .claude/plugins/staff-software-engineer/outputs/plan/ with approved marker. If none, abort and ask user to run /sse:plan first.
8
+
9
+ Before coding, write the phase start marker:
10
+
11
+ ```
12
+ .claude/plugins/staff-software-engineer/outputs/.markers/{feature_id}.dev.start
13
+ ```
14
+
15
+ Read:
16
+ - the source plan
17
+ - the area skill: .claude/plugins/staff-software-engineer/skills/{area}/SKILL.md
18
+ - .claude/plugins/staff-software-engineer/guides/coding-style.md
19
+ - .claude/plugins/staff-software-engineer/guides/commit-style.md
20
+ - project conventions: {repo}/.claude/conventions/{area}.md if present
21
+
22
+ Read 3+ similar files in the target repo before writing. Match conventions:
23
+ - framework version (Spring 4.3 no-Boot vs Spring Boot, Vue 2 vs 3)
24
+ - build tool (Maven, Gradle, npm)
25
+ - package layout, test framework, helpers
26
+
27
+ Write code in small commits (1-4 files, < 100 lines ideal). Conventional Commits format.
28
+
29
+ Gates (run after each implementation step):
30
+ - .claude/plugins/staff-software-engineer/sensors/code-conventions.md (lint, formatting, banned patterns)
31
+ - .claude/plugins/staff-software-engineer/sensors/test-coverage.md (every feature/bugfix has tests)
32
+
33
+ If any gate fails, fix and retry. Max 3 attempts. Hard stop after 3.
34
+
35
+ After done, write `.claude/plugins/staff-software-engineer/outputs/dev/{feature_id}.md` with summary:
36
+ - files changed
37
+ - commits
38
+ - gate results
39
+ - blockers if any
40
+
41
+ Append approval marker when all gates pass:
42
+
43
+ ```
44
+ <!-- approved: {YYYY-MM-DD} -->
45
+ ```
46
+
47
+ Reply: Dev complete. {N} files changed, {M} commits. Next /sse:test.
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: Generate an implementation plan from an approved PRP. Sensors and evals gate.
3
+ ---
4
+
5
+ Generate a technical plan. Follow .claude/plugins/staff-software-engineer/guides/pipeline.md for retry, approval, and publish.
6
+
7
+ Source PRP: if user passes a path, use it. Else pick the most recent in .claude/plugins/product-manager/outputs/prp/. None found, abort. Tell user to run /product-manager:prp first.
8
+
9
+ Compute feature_id from the source PRP filename (basename without .md). Save the plan to .claude/plugins/staff-software-engineer/outputs/plan/{feature_id}.md so it matches.
10
+
11
+ Before generating, write the phase start marker:
12
+
13
+ ```
14
+ .claude/plugins/staff-software-engineer/outputs/.markers/{feature_id}.plan-generate.start
15
+ ```
16
+
17
+ Content: `{"timestamp": "<ISO-8601 UTC now>", "session_id": ""}`
18
+
19
+ Read:
20
+ - the source PRP
21
+ - .claude/plugins/staff-software-engineer/guides/pipeline.md
22
+ - .claude/plugins/staff-software-engineer/guides/coding-style.md
23
+ - .claude/plugins/staff-software-engineer/guides/examples/good-plan-example.md
24
+ - the area-specific skill: .claude/plugins/staff-software-engineer/skills/{area}/SKILL.md (where area = backend, web, mobile, devops)
25
+ - project conventions if present: {repo}/.claude/conventions/{area}.md (see .claude/plugins/staff-software-engineer/guides/conventions-override.md)
26
+
27
+ Save to .claude/plugins/staff-software-engineer/outputs/plan/{feature_id}.md.
28
+
29
+ Sensors: .claude/plugins/staff-software-engineer/sensors/plan-structure.md.
30
+
31
+ Evals: .claude/plugins/staff-software-engineer/evals/plan-quality.md.
32
+
33
+ After save reply: Plan saved at {path}. Score: {N}/10.
@@ -0,0 +1,43 @@
1
+ ---
2
+ description: Open a Pull Request on GitHub following team conventions. Draft by default.
3
+ ---
4
+
5
+ Open a Pull Request.
6
+
7
+ Prerequisites:
8
+ - All previous gates passed (plan approved, dev approved, test approved).
9
+ - Branch pushed to origin with current changes.
10
+
11
+ Before opening, write the phase start marker:
12
+
13
+ ```
14
+ .claude/plugins/staff-software-engineer/outputs/.markers/{feature_id}.pr.start
15
+ ```
16
+
17
+ Read:
18
+ - .claude/plugins/staff-software-engineer/guides/pr-template.md
19
+ - .claude/plugins/staff-software-engineer/guides/commit-style.md
20
+ - the latest plan and dev outputs (for the body content)
21
+
22
+ Detect ticket id from branch name (e.g., `feat/PROJ-123-foo` -> `PROJ-123`). If branch has none, ask the user once. Never call Jira API.
23
+
24
+ Compose:
25
+ - Title: conventional commit prefix + short description (e.g., `feat(PROJ-123): add timezone-aware deadline check`)
26
+ - Body: links to PRD/PRP, summary, test plan checklist
27
+ - Draft: yes by default unless user passes `--ready`
28
+
29
+ Open via `gh pr create --draft --title "..." --body "..."`.
30
+
31
+ Save .claude/plugins/staff-software-engineer/outputs/pr/{feature_id}.md with:
32
+ - pr url
33
+ - title
34
+ - draft status
35
+ - summary
36
+
37
+ Append approval marker:
38
+
39
+ ```
40
+ <!-- approved: {YYYY-MM-DD} ready-for-handoff: true -->
41
+ ```
42
+
43
+ Reply: PR opened: {url}.
@@ -0,0 +1,39 @@
1
+ ---
2
+ description: Run the full engineering pipeline. Plan, dev, test, pr in sequence.
3
+ ---
4
+
5
+ Run end to end.
6
+
7
+ 1. Invoke /sse:plan. Wait for the approval marker on the plan.
8
+ 2. Invoke /sse:dev. Implements the plan in code.
9
+ 3. Invoke /sse:test. Runs the project test suite.
10
+ 4. Invoke /sse:pr. Opens the pull request.
11
+ 5. Return summary.
12
+
13
+ Follow .claude/plugins/staff-software-engineer/guides/pipeline.md for retry, approval markers, token accounting, and publish behavior.
14
+
15
+ Return format:
16
+
17
+ ```
18
+ Engineering pipeline complete.
19
+
20
+ Plan: .claude/plugins/staff-software-engineer/outputs/plan/{path}
21
+ sensors: passed (attempts: N)
22
+ eval: {score}/10
23
+
24
+ Dev: branch {branch}
25
+ files changed: N
26
+ commits: N
27
+ gates: code-style ok, conventions ok
28
+
29
+ Test: .claude/plugins/staff-software-engineer/outputs/test/{path}
30
+ passed: N, failed: M
31
+
32
+ PR: {url}
33
+ draft: yes|no
34
+
35
+ Confluence: {published | skipped, reason}
36
+
37
+ Blockers:
38
+ - {file:line, issue, fix}
39
+ ```
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: Run the project test suite. Reports results to .claude/plugins/staff-software-engineer/outputs/test/.
3
+ ---
4
+
5
+ Run the test suite for the current repo.
6
+
7
+ Detect the project test command (in order):
8
+ 1. Check README.md or CONTRIBUTING.md for explicit test instructions.
9
+ 2. Maven (pom.xml present): `./mvnw test` or `mvn test`
10
+ 3. Gradle (build.gradle present): `./gradlew test`
11
+ 4. npm (package.json with "test" script): `npm test`
12
+ 5. pytest (pyproject.toml or pytest.ini): `pytest`
13
+ 6. Other: ask the user.
14
+
15
+ Before running, write the phase start marker:
16
+
17
+ ```
18
+ .claude/plugins/staff-software-engineer/outputs/.markers/{feature_id}.test.start
19
+ ```
20
+
21
+ Run the test command. Capture stdout and stderr.
22
+
23
+ Save .claude/plugins/staff-software-engineer/outputs/test/{feature_id}.md with:
24
+ - command run
25
+ - exit code
26
+ - passed, failed counts
27
+ - failing test names (if any)
28
+ - duration
29
+
30
+ Append approval marker when exit code is 0:
31
+
32
+ ```
33
+ <!-- approved: {YYYY-MM-DD} -->
34
+ ```
35
+
36
+ If tests fail, return a blocker with the failing test names and a snippet of the failure output. Do not retry automatically; let the user decide.
37
+
38
+ Reply: Tests {passed/failed}. {summary}.
@@ -0,0 +1,103 @@
1
+ #!/bin/sh
2
+ # Status line for the PM and SSE plugin pipelines.
3
+ #
4
+ # Shows the current stage of the active feature. Stages, in order:
5
+ # prd (product-manager plugin)
6
+ # prp (product-manager plugin)
7
+ # plan (staff-software-engineer plugin)
8
+ # dev (staff-software-engineer plugin)
9
+ # test (staff-software-engineer plugin)
10
+ # pr (staff-software-engineer plugin)
11
+ #
12
+ # State per stage is "pending" (no file), "drafting" (file exists, no approval
13
+ # marker), or "approved" (approval marker present). The bar shows the previous
14
+ # approved stage plus the current stage, with the next command to run.
15
+ #
16
+ # A feature is "active" when any of its artifact files was modified in the last
17
+ # hour. With no active feature, the bar shows an idle prompt.
18
+
19
+ PM_DIR=".claude/plugins/product-manager"
20
+ SSE_DIR=".claude/plugins/staff-software-engineer"
21
+
22
+ render() {
23
+ LATEST=""
24
+ for f in "$PM_DIR/outputs/prd/"*.md "$PM_DIR/outputs/prp/"*.md \
25
+ "$SSE_DIR/outputs/plan/"*.md "$SSE_DIR/outputs/dev/"*.md \
26
+ "$SSE_DIR/outputs/test/"*.md "$SSE_DIR/outputs/pr/"*.md; do
27
+ [ -f "$f" ] || continue
28
+ if [ -z "$LATEST" ] || [ "$f" -nt "$LATEST" ]; then
29
+ LATEST="$f"
30
+ fi
31
+ done
32
+
33
+ if [ -z "$LATEST" ]; then
34
+ printf "idle · start /product-manager:run or /sse:run"
35
+ return 0
36
+ fi
37
+
38
+ NOW=$(date +%s)
39
+ MTIME=$(stat -f %m "$LATEST" 2>/dev/null || stat -c %Y "$LATEST" 2>/dev/null || echo 0)
40
+ AGE=$((NOW - MTIME))
41
+ if [ "$AGE" -ge 3600 ]; then
42
+ printf "idle · start /product-manager:run or /sse:run"
43
+ return 0
44
+ fi
45
+
46
+ FID=$(basename "$LATEST" .md)
47
+ # Strip leading YYYY-MM-DD-. Optional team prefix accepted (any kebab-case slug).
48
+ SLUG=$(echo "$FID" | sed -E 's/^[0-9]{4}-[0-9]{2}-[0-9]{2}-//')
49
+
50
+ check_state() {
51
+ [ -f "$1" ] || { echo "pending"; return; }
52
+ if grep -q "<!-- approved:" "$1" 2>/dev/null; then
53
+ echo "approved"
54
+ else
55
+ echo "drafting"
56
+ fi
57
+ }
58
+
59
+ prev_approved=""
60
+ current_stage=""
61
+ current_state=""
62
+ for stage in prd prp plan dev test pr; do
63
+ case $stage in
64
+ prd) f="$PM_DIR/outputs/prd/${FID}.md" ;;
65
+ prp) f="$PM_DIR/outputs/prp/${FID}.md" ;;
66
+ plan) f="$SSE_DIR/outputs/plan/${FID}.md" ;;
67
+ dev) f="$SSE_DIR/outputs/dev/${FID}.md" ;;
68
+ test) f="$SSE_DIR/outputs/test/${FID}.md" ;;
69
+ pr) f="$SSE_DIR/outputs/pr/${FID}.md" ;;
70
+ esac
71
+ s=$(check_state "$f")
72
+ if [ "$s" = "approved" ]; then
73
+ prev_approved=$stage
74
+ else
75
+ current_stage=$stage
76
+ current_state=$s
77
+ break
78
+ fi
79
+ done
80
+
81
+ if [ -z "$current_stage" ]; then
82
+ printf "%s · complete" "$SLUG"
83
+ return 0
84
+ fi
85
+
86
+ case $current_stage in
87
+ prd|prp) next="/product-manager:$current_stage" ;;
88
+ *) next="/sse:$current_stage" ;;
89
+ esac
90
+
91
+ if [ -z "$prev_approved" ]; then
92
+ printf "%s · %s %s · next %s" "$SLUG" "$current_stage" "$current_state" "$next"
93
+ else
94
+ printf "%s · %s approved · %s %s · next %s" "$SLUG" "$prev_approved" "$current_stage" "$current_state" "$next"
95
+ fi
96
+ }
97
+
98
+ OUT=$(render 2>/dev/null)
99
+ if [ -z "$OUT" ]; then
100
+ printf "idle"
101
+ else
102
+ printf '%s' "$OUT"
103
+ fi
@@ -0,0 +1,120 @@
1
+ # Product Manager Plugin
2
+
3
+ Native Claude Code plugin for the product team. Drafts PRDs and PRPs with sensor + eval gates, retry loop, token accounting per phase, and optional Confluence publish via hooks.
4
+
5
+ ## Slash commands
6
+
7
+ - `/product-manager:prd`: generate a PRD (skills/prd/SKILL.md)
8
+ - `/product-manager:prp`: generate a PRP, needs an approved PRD (skills/prp/SKILL.md)
9
+ - `/product-manager:run`: full pipeline, PRD then PRP (commands/run.md)
10
+
11
+ Also invokable as sub-agent via Task tool with `subagent_type: "product-manager"`.
12
+
13
+ ## Tree
14
+
15
+ ```
16
+ .claude/plugins/product-manager/
17
+ ├── .claude-plugin/plugin.json
18
+ ├── agents/product-manager.md sub-agent
19
+ ├── commands/run.md orchestrator (calls the two skills)
20
+ ├── skills/
21
+ │ ├── prd/SKILL.md workflow PRD
22
+ │ └── prp/SKILL.md workflow PRP
23
+ ├── hooks/ 5 .sh, registered in .claude/settings.json
24
+ ├── scripts/ 4 .py, called by hooks
25
+ ├── guides/
26
+ │ ├── pipeline.md retry, approval marker, publish, token accounting
27
+ │ ├── product-guidelines.md team product rules
28
+ │ ├── prd-guidelines.md PRD-specific rules
29
+ │ ├── prp-guidelines.md PRP-specific rules
30
+ │ ├── writing-style.md voice, banned words
31
+ │ ├── templates/{prd,prp}.md artifact templates
32
+ │ └── examples/ reference PRDs and PRPs
33
+ ├── sensors/ deterministic checks (markdown)
34
+ ├── evals/ LLM-judge rubrics (markdown)
35
+ └── outputs/
36
+ ├── prd/ generated PRDs
37
+ ├── prp/ generated PRPs
38
+ ├── tokens/ per-feature phase tokens JSON
39
+ └── .markers/ phase start/end markers (transient)
40
+ ```
41
+
42
+ ## Where to edit
43
+
44
+ | Change | File |
45
+ |--------|------|
46
+ | Retry count | guides/pipeline.md (Max attempts) |
47
+ | Eval threshold | evals/{prd|prp}-quality.md (Threshold) |
48
+ | What the skill asks | skills/{prd|prp}/SKILL.md |
49
+ | Artifact template | guides/templates/{prd|prp}.md |
50
+ | Artifact rules | guides/{prd|prp}-guidelines.md |
51
+ | Voice and style | guides/writing-style.md |
52
+ | Deterministic checks | sensors/*.md + scripts/sensor-runner.py |
53
+ | Rubric dimensions | evals/*.md |
54
+ | Publish behavior | guides/pipeline.md + hooks/post-eval-{prd|prp}.sh |
55
+ | Confluence target | scripts/confluence-publish.py (parent IDs, space) |
56
+ | Token phase logic | scripts/token-phase.py + guides/pipeline.md |
57
+
58
+ ## How it runs
59
+
60
+ 1. User invokes a slash command.
61
+ 2. Skill writes a `prd-generate.start` marker (timestamp + session_id).
62
+ 3. Claude reads guides, generates the artifact, saves to outputs/.
63
+ 4. PostToolUse hook fires sensor-runner.py with real regex. Blocks on failure, returns feedback. On pass, writes `prd-generate.end` and `prd-validate.start` markers.
64
+ 5. Claude applies eval rubric. Retry up to 3 times if score below threshold (rules in guides/pipeline.md).
65
+ 6. On pass, Claude appends approval marker. Hook fires: writes `prd-validate.end`, calls token-phase.py for both phases, then confluence-publish.py if creds set.
66
+ 7. Token data lands in outputs/tokens/{feature_id}.json. Inline summary comment is appended to the artifact.
67
+
68
+ ## Token accounting
69
+
70
+ Per phase: prd-generate, prd-validate, prp-generate, prp-validate.
71
+
72
+ Per feature, a single file `outputs/tokens/{feature_id}.json` collects all phase entries, with `totals` aggregated. Future workflows (dev, code review) can append their own phases to the same file by reusing feature_id.
73
+
74
+ Query examples:
75
+
76
+ ```
77
+ # total tokens across all features
78
+ jq -s 'map(.totals.input + .totals.output) | add' outputs/tokens/*.json
79
+
80
+ # tokens for one feature, by phase
81
+ jq '.phases[] | {phase, tokens}' outputs/tokens/2026-05-12-billing-tz-fix.json
82
+
83
+ # features touched by dispatch squad
84
+ jq -s '.[] | select(.feature_id | contains("dispatch"))' outputs/tokens/*.json
85
+ ```
86
+
87
+ ## Engineering handoff
88
+
89
+ After a PRP is approved, engineering picks it up via the [staff-software-engineer plugin](../staff-software-engineer/README.md). The SSE plugin reads `outputs/prp/{feature_id}.md` and runs plan → dev → test → pr stages, all writing to the same `outputs/tokens/{feature_id}.json` file. Full feature lifecycle in one token log.
90
+
91
+ ## Status bar
92
+
93
+ The repo's status-line (`.claude/hooks/status-line.sh`) detects PM activity automatically. If any PRD or PRP file under this plugin was modified in the last hour, it switches the status bar to pipeline mode and falls back to the engineering picker otherwise.
94
+
95
+ The status bar tracks the active feature across both plugins (PM and SSE). Seven stages in order: prd, prp, plan, dev, test, pr. State per stage: pending, drafting, approved.
96
+
97
+ Examples (PM portion):
98
+
99
+ ```
100
+ idle · start /product-manager:run or /sse:run (no active feature)
101
+ tz-fix · prd drafting · next /product-manager:prd (PRD in progress)
102
+ tz-fix · prd approved · prp pending · next /product-manager:prp (PRD ok, PRP not started)
103
+ tz-fix · prd approved · prp drafting · next /product-manager:prp (PRP in progress)
104
+ tz-fix · prp approved · plan pending · next /sse:plan (PRP ok, SSE turn)
105
+ ```
106
+
107
+ After PRP approval the bar transitions naturally into the SSE stages. State is derived from file presence and the `<!-- approved: -->` marker. No extra config needed.
108
+
109
+ ## Setup
110
+
111
+ Hooks are registered in `.claude/settings.json` under PreToolUse and PostToolUse.
112
+
113
+ Confluence publish needs:
114
+
115
+ ```
116
+ export JIRA_USERNAME=...
117
+ export JIRA_API_TOKEN=...
118
+ ```
119
+
120
+ Without them, the hook skips Confluence and keeps the local file.
@@ -0,0 +1,88 @@
1
+ # Eval: PRD Quality
2
+
3
+ Type: LLM-judge
4
+ Mode: quality gate
5
+ Threshold: weighted total >= 8.0
6
+
7
+ Score each dimension 0-10. Cite line numbers when scoring below 7. Weighted total = sum(score x weight%) / 100.
8
+
9
+ ## Rubric
10
+
11
+ ### Clarity (weight 20%)
12
+ Is the problem stated in 1-2 sentences? Names who suffers, how often, what it costs?
13
+
14
+ - 10: crisp, specific, evidence-backed
15
+ - 5: present but generic
16
+ - 0: missing or vague
17
+
18
+ ### Hypothesis (weight 15%)
19
+ Is there an "If we X, then Y will Z, because W" hypothesis with numeric target?
20
+
21
+ - 10: falsifiable, numeric, evidence-tied
22
+ - 5: directional but missing target or evidence
23
+ - 0: aspirational, no measurable claim
24
+
25
+ ### Customer specificity (weight 10%)
26
+ Real customers named with reasons each one matters?
27
+
28
+ - 10: concrete, differentiated
29
+ - 5: segments named but thin
30
+ - 0: "users" with no segmentation
31
+
32
+ ### Metric completeness (weight 20%)
33
+ Every metric has baseline, target, horizon? Guardrails listed? Kill criteria numeric?
34
+
35
+ - 10: all filled, guardrails present, kill criteria with thresholds
36
+ - 5: targets present but missing horizon or guardrails
37
+ - 0: missing fields or vague targets
38
+
39
+ ### Scope discipline (weight 10%)
40
+ Non-goals listed (1-3) with reasons? Trade-offs explicit?
41
+
42
+ - 10: scope tight, trade-offs named
43
+ - 5: non-goals present, reasons thin
44
+ - 0: no non-goals
45
+
46
+ ### Rollout realism (weight 10%)
47
+ Phased rollout with audience, duration, pass criteria per phase? Rollback plan?
48
+
49
+ - 10: phased with gates and rollback
50
+ - 5: phases present, criteria vague
51
+ - 0: "ship it" with no plan
52
+
53
+ ### Evidence (weight 10%)
54
+ Claims backed by quotes, ticket counts, dashboard data, research?
55
+
56
+ - 10: at least 3 grounded pieces
57
+ - 5: 1-2 grounded
58
+ - 0: unsupported assertions
59
+
60
+ ### Voice (weight 5%)
61
+ No banned words. No em-dashes. Mermaid not ASCII.
62
+
63
+ - 10: clean
64
+ - 5: 1-2 violations
65
+ - 0: 3+ violations
66
+
67
+ ## On failure (total below 8.0)
68
+
69
+ Retry. Identify lowest-scoring dimensions, regenerate those sections only. Max 3 attempts.
70
+
71
+ ## Output format
72
+
73
+ ```json
74
+ {
75
+ "scores": {
76
+ "clarity": 0,
77
+ "hypothesis": 0,
78
+ "customer_specificity": 0,
79
+ "metric_completeness": 0,
80
+ "scope_discipline": 0,
81
+ "rollout_realism": 0,
82
+ "evidence": 0,
83
+ "voice": 0
84
+ },
85
+ "weighted_total": 0.0,
86
+ "feedback": ["dimension: specific issue with line ref"]
87
+ }
88
+ ```