nubos-pilot 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.
Files changed (273) hide show
  1. package/agents/np-ai-researcher.md +140 -0
  2. package/agents/np-code-fixer.md +363 -0
  3. package/agents/np-code-reviewer.md +351 -0
  4. package/agents/np-domain-researcher.md +136 -0
  5. package/agents/np-eval-auditor.md +167 -0
  6. package/agents/np-eval-planner.md +153 -0
  7. package/agents/np-executor.md +72 -0
  8. package/agents/np-framework-selector.md +171 -0
  9. package/agents/np-nyquist-auditor.md +185 -0
  10. package/agents/np-plan-checker.md +165 -0
  11. package/agents/np-planner.md +199 -0
  12. package/agents/np-researcher.md +150 -0
  13. package/agents/np-security-auditor.md +206 -0
  14. package/agents/np-ui-auditor.md +369 -0
  15. package/agents/np-ui-checker.md +192 -0
  16. package/agents/np-ui-researcher.md +324 -0
  17. package/agents/np-verifier.md +79 -0
  18. package/bin/check-coverage.cjs +40 -0
  19. package/bin/check-workflows.cjs +171 -0
  20. package/bin/check-workflows.test.cjs +208 -0
  21. package/bin/install.js +500 -0
  22. package/bin/np-tools/_commands.cjs +70 -0
  23. package/bin/np-tools/add-tests.cjs +171 -0
  24. package/bin/np-tools/add-tests.test.cjs +122 -0
  25. package/bin/np-tools/add-todo.cjs +108 -0
  26. package/bin/np-tools/add-todo.test.cjs +112 -0
  27. package/bin/np-tools/agent-skills.cjs +14 -0
  28. package/bin/np-tools/agent-skills.test.cjs +42 -0
  29. package/bin/np-tools/ai-integration-phase.cjs +109 -0
  30. package/bin/np-tools/ai-integration-phase.test.cjs +123 -0
  31. package/bin/np-tools/askuser.cjs +53 -0
  32. package/bin/np-tools/askuser.test.cjs +49 -0
  33. package/bin/np-tools/autonomous.cjs +69 -0
  34. package/bin/np-tools/autonomous.test.cjs +74 -0
  35. package/bin/np-tools/checkpoint.cjs +101 -0
  36. package/bin/np-tools/checkpoint.test.cjs +119 -0
  37. package/bin/np-tools/code-review.cjs +133 -0
  38. package/bin/np-tools/code-review.test.cjs +96 -0
  39. package/bin/np-tools/commit-task.cjs +120 -0
  40. package/bin/np-tools/commit-task.test.cjs +160 -0
  41. package/bin/np-tools/commit.cjs +103 -0
  42. package/bin/np-tools/commit.test.cjs +93 -0
  43. package/bin/np-tools/config.cjs +101 -0
  44. package/bin/np-tools/config.test.cjs +71 -0
  45. package/bin/np-tools/discuss-phase-power.cjs +265 -0
  46. package/bin/np-tools/discuss-phase-power.test.cjs +242 -0
  47. package/bin/np-tools/discuss-phase.cjs +132 -0
  48. package/bin/np-tools/discuss-phase.test.cjs +148 -0
  49. package/bin/np-tools/dispatch.cjs +116 -0
  50. package/bin/np-tools/doctor.cjs +242 -0
  51. package/bin/np-tools/eval-review.cjs +116 -0
  52. package/bin/np-tools/eval-review.test.cjs +123 -0
  53. package/bin/np-tools/execute-phase.cjs +182 -0
  54. package/bin/np-tools/execute-phase.test.cjs +116 -0
  55. package/bin/np-tools/execute-plan.cjs +124 -0
  56. package/bin/np-tools/execute-plan.test.cjs +82 -0
  57. package/bin/np-tools/help.cjs +28 -0
  58. package/bin/np-tools/help.test.cjs +29 -0
  59. package/bin/np-tools/init-dispatch.test.cjs +91 -0
  60. package/bin/np-tools/metrics.cjs +97 -0
  61. package/bin/np-tools/metrics.test.cjs +188 -0
  62. package/bin/np-tools/new-milestone.cjs +288 -0
  63. package/bin/np-tools/new-milestone.test.cjs +166 -0
  64. package/bin/np-tools/new-project.cjs +284 -0
  65. package/bin/np-tools/new-project.test.cjs +165 -0
  66. package/bin/np-tools/next.cjs +7 -0
  67. package/bin/np-tools/next.test.cjs +30 -0
  68. package/bin/np-tools/park.cjs +48 -0
  69. package/bin/np-tools/park.test.cjs +50 -0
  70. package/bin/np-tools/pause-work.cjs +24 -0
  71. package/bin/np-tools/pause-work.test.cjs +74 -0
  72. package/bin/np-tools/phase.cjs +71 -0
  73. package/bin/np-tools/phase.test.cjs +81 -0
  74. package/bin/np-tools/plan-diff.cjs +57 -0
  75. package/bin/np-tools/plan-diff.test.cjs +134 -0
  76. package/bin/np-tools/plan-milestone-gaps.cjs +115 -0
  77. package/bin/np-tools/plan-milestone-gaps.test.cjs +122 -0
  78. package/bin/np-tools/plan-phase.cjs +350 -0
  79. package/bin/np-tools/plan-phase.test.cjs +263 -0
  80. package/bin/np-tools/progress.cjs +7 -0
  81. package/bin/np-tools/progress.test.cjs +44 -0
  82. package/bin/np-tools/queue.cjs +213 -0
  83. package/bin/np-tools/research-phase.cjs +144 -0
  84. package/bin/np-tools/research-phase.test.cjs +154 -0
  85. package/bin/np-tools/reset-slice.cjs +17 -0
  86. package/bin/np-tools/reset-slice.test.cjs +96 -0
  87. package/bin/np-tools/resolve-model.cjs +110 -0
  88. package/bin/np-tools/resolve-model.test.cjs +200 -0
  89. package/bin/np-tools/resume-work.cjs +76 -0
  90. package/bin/np-tools/resume-work.test.cjs +91 -0
  91. package/bin/np-tools/skip.cjs +48 -0
  92. package/bin/np-tools/skip.test.cjs +66 -0
  93. package/bin/np-tools/slug.cjs +34 -0
  94. package/bin/np-tools/slug.test.cjs +46 -0
  95. package/bin/np-tools/state.cjs +16 -0
  96. package/bin/np-tools/state.test.cjs +40 -0
  97. package/bin/np-tools/stats.cjs +151 -0
  98. package/bin/np-tools/stats.test.cjs +118 -0
  99. package/bin/np-tools/triage.cjs +128 -0
  100. package/bin/np-tools/ui-phase.cjs +108 -0
  101. package/bin/np-tools/ui-phase.test.cjs +121 -0
  102. package/bin/np-tools/ui-review.cjs +108 -0
  103. package/bin/np-tools/ui-review.test.cjs +120 -0
  104. package/bin/np-tools/undo-task.cjs +31 -0
  105. package/bin/np-tools/undo-task.test.cjs +117 -0
  106. package/bin/np-tools/undo.cjs +43 -0
  107. package/bin/np-tools/undo.test.cjs +120 -0
  108. package/bin/np-tools/unpark.cjs +48 -0
  109. package/bin/np-tools/unpark.test.cjs +50 -0
  110. package/bin/np-tools/verify-work.cjs +186 -0
  111. package/bin/np-tools/verify-work.test.cjs +97 -0
  112. package/docs/adr/0001-no-daemon-invariant.md +82 -0
  113. package/docs/adr/0002-zero-runtime-dependencies.md +90 -0
  114. package/docs/adr/0003-max-six-unit-types.md +85 -0
  115. package/docs/adr/0004-atomic-commit-per-unit.md +102 -0
  116. package/docs/adr/0005-three-orthogonal-file-trees.md +98 -0
  117. package/docs/adr/0006-yaml-dependency-amendment.md +60 -0
  118. package/docs/adr/README.md +27 -0
  119. package/docs/agent-frontmatter-schema.md +84 -0
  120. package/docs/phase-artifact-schemas.md +292 -0
  121. package/docs/phase-directory-layout.md +82 -0
  122. package/lib/__tests__/README.md +1 -0
  123. package/lib/agents.cjs +98 -0
  124. package/lib/agents.test.cjs +286 -0
  125. package/lib/askuser.cjs +36 -0
  126. package/lib/askuser.test.cjs +310 -0
  127. package/lib/checkpoint.cjs +135 -0
  128. package/lib/checkpoint.test.cjs +184 -0
  129. package/lib/core.cjs +165 -0
  130. package/lib/core.test.cjs +405 -0
  131. package/lib/fixtures/README.md +1 -0
  132. package/lib/fixtures/phase-tree/README.md +1 -0
  133. package/lib/fixtures/plans/cycle/PLAN.md +16 -0
  134. package/lib/fixtures/plans/cycle/tasks/T-01.md +20 -0
  135. package/lib/fixtures/plans/cycle/tasks/T-02.md +20 -0
  136. package/lib/fixtures/plans/cycle/tasks/T-03.md +20 -0
  137. package/lib/fixtures/plans/linear/PLAN.md +16 -0
  138. package/lib/fixtures/plans/linear/tasks/T-01.md +20 -0
  139. package/lib/fixtures/plans/linear/tasks/T-02.md +20 -0
  140. package/lib/fixtures/plans/linear/tasks/T-03.md +20 -0
  141. package/lib/fixtures/plans/parallel/PLAN.md +16 -0
  142. package/lib/fixtures/plans/parallel/tasks/T-01.md +20 -0
  143. package/lib/fixtures/plans/parallel/tasks/T-02.md +20 -0
  144. package/lib/fixtures/plans/parallel/tasks/T-03.md +20 -0
  145. package/lib/fixtures/plans/wave-conflict/PLAN.md +16 -0
  146. package/lib/fixtures/plans/wave-conflict/tasks/T-01.md +20 -0
  147. package/lib/fixtures/plans/wave-conflict/tasks/T-02.md +20 -0
  148. package/lib/fixtures/roadmap/ROADMAP-malformed.md +3 -0
  149. package/lib/fixtures/roadmap/ROADMAP-minimal.md +51 -0
  150. package/lib/fixtures/roadmap/roadmap-malformed.yaml +7 -0
  151. package/lib/fixtures/roadmap/roadmap-minimal.yaml +40 -0
  152. package/lib/fixtures/roadmap/roadmap-ten-phases.yaml +101 -0
  153. package/lib/fixtures/templates/phase-context.md +6 -0
  154. package/lib/fixtures/templates/plan-skeleton.md +6 -0
  155. package/lib/frontmatter.cjs +251 -0
  156. package/lib/frontmatter.test.cjs +177 -0
  157. package/lib/gaps.cjs +197 -0
  158. package/lib/gaps.test.cjs +200 -0
  159. package/lib/git.cjs +207 -0
  160. package/lib/git.test.cjs +305 -0
  161. package/lib/install/agents-md.cjs +77 -0
  162. package/lib/install/backup.cjs +70 -0
  163. package/lib/install/codex-toml.cjs +440 -0
  164. package/lib/install/managed-block.cjs +30 -0
  165. package/lib/install/manifest.cjs +148 -0
  166. package/lib/install/mcp-writer.cjs +127 -0
  167. package/lib/install/runtime-detect.cjs +44 -0
  168. package/lib/install/staging.cjs +149 -0
  169. package/lib/metrics-aggregate.cjs +229 -0
  170. package/lib/metrics-aggregate.test.cjs +192 -0
  171. package/lib/metrics.cjs +120 -0
  172. package/lib/metrics.test.cjs +182 -0
  173. package/lib/model-aliases.regression.test.cjs +16 -0
  174. package/lib/model-profiles.cjs +42 -0
  175. package/lib/model-profiles.test.cjs +61 -0
  176. package/lib/next.cjs +236 -0
  177. package/lib/next.test.cjs +194 -0
  178. package/lib/phase.cjs +95 -0
  179. package/lib/phase.test.cjs +189 -0
  180. package/lib/plan-checker-contract.test.cjs +72 -0
  181. package/lib/plan-diff.cjs +173 -0
  182. package/lib/plan-diff.test.cjs +217 -0
  183. package/lib/plan.cjs +85 -0
  184. package/lib/plan.test.cjs +263 -0
  185. package/lib/progress.cjs +95 -0
  186. package/lib/progress.test.cjs +116 -0
  187. package/lib/researcher-contract.test.cjs +61 -0
  188. package/lib/roadmap-render.cjs +206 -0
  189. package/lib/roadmap-render.test.cjs +121 -0
  190. package/lib/roadmap.cjs +416 -0
  191. package/lib/roadmap.test.cjs +371 -0
  192. package/lib/runtime/_contract.test.cjs +61 -0
  193. package/lib/runtime/_readline.cjs +119 -0
  194. package/lib/runtime/_readline.test.cjs +126 -0
  195. package/lib/runtime/claude.cjs +48 -0
  196. package/lib/runtime/claude.test.cjs +101 -0
  197. package/lib/runtime/codex.cjs +35 -0
  198. package/lib/runtime/codex.test.cjs +114 -0
  199. package/lib/runtime/gemini.cjs +35 -0
  200. package/lib/runtime/gemini.test.cjs +109 -0
  201. package/lib/runtime/index.cjs +49 -0
  202. package/lib/runtime/index.test.cjs +181 -0
  203. package/lib/runtime/opencode.cjs +35 -0
  204. package/lib/runtime/opencode.test.cjs +124 -0
  205. package/lib/state.cjs +205 -0
  206. package/lib/state.test.cjs +264 -0
  207. package/lib/surface-audit.test.cjs +46 -0
  208. package/lib/tasks.cjs +327 -0
  209. package/lib/tasks.test.cjs +389 -0
  210. package/lib/template.cjs +66 -0
  211. package/lib/template.test.cjs +159 -0
  212. package/lib/undo.cjs +179 -0
  213. package/lib/undo.test.cjs +261 -0
  214. package/lib/verify.cjs +116 -0
  215. package/lib/verify.test.cjs +187 -0
  216. package/np-tools.cjs +303 -0
  217. package/package.json +39 -0
  218. package/templates/AI-SPEC.md +90 -0
  219. package/templates/CONTEXT.md +32 -0
  220. package/templates/PLAN.md +69 -0
  221. package/templates/PROJECT.md +60 -0
  222. package/templates/REQUIREMENTS.md +38 -0
  223. package/templates/SECURITY.md +61 -0
  224. package/templates/UI-SPEC.md +64 -0
  225. package/templates/VALIDATION.md +76 -0
  226. package/templates/claude/payload/README.md +11 -0
  227. package/templates/opencode/opencode.json +6 -0
  228. package/templates/opencode/payload/AGENTS.md +9 -0
  229. package/workflows/add-backlog.md +212 -0
  230. package/workflows/add-tests.md +69 -0
  231. package/workflows/add-todo.md +222 -0
  232. package/workflows/ai-integration-phase.md +230 -0
  233. package/workflows/autonomous.md +94 -0
  234. package/workflows/cleanup.md +325 -0
  235. package/workflows/code-review-fix.md +435 -0
  236. package/workflows/code-review.md +447 -0
  237. package/workflows/discuss-phase-assumptions.md +269 -0
  238. package/workflows/discuss-phase-power.md +139 -0
  239. package/workflows/discuss-phase.md +386 -0
  240. package/workflows/dispatch.md +9 -0
  241. package/workflows/doctor.md +10 -0
  242. package/workflows/eval-review.md +243 -0
  243. package/workflows/execute-phase.md +142 -0
  244. package/workflows/execute-plan.md +82 -0
  245. package/workflows/help.md +8 -0
  246. package/workflows/new-milestone.md +166 -0
  247. package/workflows/new-project.md +213 -0
  248. package/workflows/next.md +8 -0
  249. package/workflows/note.md +244 -0
  250. package/workflows/park.md +29 -0
  251. package/workflows/pause-work.md +34 -0
  252. package/workflows/plan-milestone-gaps.md +233 -0
  253. package/workflows/plan-phase.md +351 -0
  254. package/workflows/progress.md +8 -0
  255. package/workflows/queue.md +9 -0
  256. package/workflows/research-phase.md +327 -0
  257. package/workflows/reset-slice.md +39 -0
  258. package/workflows/resume-work.md +79 -0
  259. package/workflows/review.md +489 -0
  260. package/workflows/secure-phase.md +209 -0
  261. package/workflows/session-report.md +243 -0
  262. package/workflows/skip.md +29 -0
  263. package/workflows/state.md +7 -0
  264. package/workflows/stats.md +170 -0
  265. package/workflows/thread.md +214 -0
  266. package/workflows/triage.md +9 -0
  267. package/workflows/ui-phase.md +246 -0
  268. package/workflows/ui-review.md +222 -0
  269. package/workflows/undo-task.md +42 -0
  270. package/workflows/undo.md +55 -0
  271. package/workflows/unpark.md +29 -0
  272. package/workflows/validate-phase.md +231 -0
  273. package/workflows/verify-work.md +83 -0
@@ -0,0 +1,42 @@
1
+ ---
2
+ command: np:undo-task
3
+ description: Revert a single task commit via git revert (no history rewrite). Destructive — gated by askUser confirmation.
4
+ ---
5
+
6
+ # /np:undo-task
7
+
8
+ <objective>
9
+ Revert exactly one previously committed task. The original commit stays in
10
+ the log; a new `Revert "task(<id>): …"` commit is appended. Task status is
11
+ flipped back to `pending` so the executor can pick it up again on the next
12
+ wave-loop.
13
+ </objective>
14
+
15
+ ## Execution
16
+
17
+ ```bash
18
+ TASK_ID="$1"
19
+ if [ -z "$TASK_ID" ]; then
20
+ echo "Usage: /np:undo-task <task-id>" >&2
21
+ exit 1
22
+ fi
23
+
24
+ CHOICE=$(node np-tools.cjs askuser --json '{
25
+ "type": "select",
26
+ "header": "Undo Task bestätigen",
27
+ "question": "Der Task-Commit wird via git revert rückgängig gemacht (keine History-Rewrite). Fortfahren?",
28
+ "options": [
29
+ {"label": "Confirm", "description": "Revert ausführen — Task-Status wird auf pending zurückgesetzt."},
30
+ {"label": "Cancel", "description": "Nichts ändern."}
31
+ ]
32
+ }')
33
+ case "$CHOICE" in
34
+ Confirm*) node np-tools.cjs undo-task "$TASK_ID" ;;
35
+ *) echo "Aborted." ; exit 0 ;;
36
+ esac
37
+ ```
38
+
39
+ ## Scope Guardrail
40
+
41
+ **Do:** revert via `git revert` (forward-only); flip task status → pending.
42
+ **Don't:** rewrite history; force-push; touch other tasks.
@@ -0,0 +1,55 @@
1
+ ---
2
+ command: np:undo
3
+ description: Revert all task commits of a phase or plan via git revert (no history rewrite). Destructive — gated by askUser confirmation.
4
+ ---
5
+
6
+ # /np:undo
7
+
8
+ <objective>
9
+ Roll back every committed task of a phase (`/np:undo 6`) or plan
10
+ (`/np:undo 06-01`) by emitting one `git revert` commit per task in
11
+ reverse-chronological order. No history is rewritten — the original
12
+ commits stay in the log, each followed by an explicit `Revert "task(...)"`
13
+ commit. Per ADR-0004 every revert is itself an atomic commit.
14
+ </objective>
15
+
16
+ ## Execution
17
+
18
+ ```bash
19
+ PHASE_OR_PLAN="$1"
20
+ if [ -z "$PHASE_OR_PLAN" ]; then
21
+ echo "Usage: /np:undo <phase-number-or-plan-id>" >&2
22
+ exit 1
23
+ fi
24
+
25
+ # Discovery pass — list the commits that will be reverted so the user can
26
+ # evaluate the blast radius before confirming.
27
+ PREVIEW=$(node np-tools.cjs undo "$PHASE_OR_PLAN" 2>/dev/null || true)
28
+ COMMIT_COUNT=$(echo "$PREVIEW" | node -e "let d=''; process.stdin.on('data',c=>d+=c).on('end',()=>{ try{const j=JSON.parse(d); console.log(Array.isArray(j.reverted)?j.reverted.length:0);}catch{console.log(0);} })")
29
+ ```
30
+
31
+ If the discovery pass already produced revert commits (it does, because
32
+ `undo` is non-idempotent on first call), STOP HERE and report success — the
33
+ user invoked `/np:undo` knowing it is destructive. Otherwise continue with
34
+ the askUser gate below for the confirmation-then-execute pattern.
35
+
36
+ ```bash
37
+ CHOICE=$(node np-tools.cjs askuser --json '{
38
+ "type": "select",
39
+ "header": "Undo bestätigen",
40
+ "question": "Task-Commits werden via git revert rückgängig gemacht (keine History-Rewrite). Fortfahren?",
41
+ "options": [
42
+ {"label": "Confirm", "description": "Revert ausführen — Plan/Phase wird zurückgesetzt."},
43
+ {"label": "Cancel", "description": "Nichts ändern."}
44
+ ]
45
+ }')
46
+ case "$CHOICE" in
47
+ Confirm*) node np-tools.cjs undo "$PHASE_OR_PLAN" ;;
48
+ *) echo "Aborted." ; exit 0 ;;
49
+ esac
50
+ ```
51
+
52
+ ## Scope Guardrail
53
+
54
+ **Do:** revert via `git revert` (forward-only); flip task status → pending.
55
+ **Don't:** rewrite history; force-push; delete commits.
@@ -0,0 +1,29 @@
1
+ ---
2
+ command: np:unpark
3
+ description: Return a parked task to pending status (lifecycle CRUD). Counterpart to /np:park.
4
+ ---
5
+
6
+ # /np:unpark
7
+
8
+ <objective>
9
+ Flip the task's frontmatter `status` field from `parked` back to `pending`
10
+ so it re-enters wave-selection. Note that `setTaskStatus` does not enforce
11
+ the previous status — running `/np:unpark` on any task simply sets it to
12
+ `pending`.
13
+ </objective>
14
+
15
+ ## Execution
16
+
17
+ ```bash
18
+ TASK_ID="$1"
19
+ if [ -z "$TASK_ID" ]; then
20
+ echo "Usage: /np:unpark <task-id>" >&2
21
+ exit 1
22
+ fi
23
+ node np-tools.cjs unpark "$TASK_ID"
24
+ ```
25
+
26
+ ## Scope Guardrail
27
+
28
+ **Do:** flip task status to `pending` via `lib/tasks.setTaskStatus`.
29
+ **Don't:** revert commits; modify other frontmatter fields.
@@ -0,0 +1,231 @@
1
+ ---
2
+ command: np:validate-phase
3
+ description: Nyquist validation gap-fill on a completed phase. For each requirement in phase scope, verifies at least one test observes the implementation directly. Spawns np-nyquist-auditor (haiku) to score COVERED/UNDER_SAMPLED/UNCOVERED, writes VALIDATION.md sidecar from templates/VALIDATION.md skeleton. One atomic docs commit.
4
+ ---
5
+
6
+ # np:validate-phase
7
+
8
+ Produces `{phase_dir}/{padded}-VALIDATION.md` via a single `np-nyquist-auditor`
9
+ (haiku) spawn. Runs AFTER `/np:execute-phase` has landed code — the
10
+ audit needs SUMMARY.md, REQUIREMENTS.md, and the phase's declared
11
+ requirement IDs to score Nyquist coverage.
12
+
13
+ The workflow `cp`s `templates/VALIDATION.md` into the sidecar BEFORE
14
+ spawning the agent; the auditor substitutes placeholders (`{N}`,
15
+ `{phase-slug}`, `{date}`) and appends per-requirement scoring. The
16
+ Task spawn is wrapped in the Plan 09-05 metrics + resolve-model pattern
17
+ (D-06, D-01); `RUNTIME` is detected once and re-used by `metrics
18
+ record`. Prompts route through `np-tools.cjs askuser` (INST-03).
19
+
20
+ Nyquist metaphor: if a requirement's observable behavior is not
21
+ exercised by at least one direct assertion, the test suite under-samples
22
+ it — regressions in that requirement will pass silently. The auditor
23
+ scores COVERED / UNDER_SAMPLED / UNCOVERED per requirement ID and
24
+ records remediation guidance for the latter two states.
25
+
26
+ ## Initialize
27
+
28
+ ```bash
29
+ PHASE="$1"
30
+ if [[ -z "$PHASE" ]]; then
31
+ echo "Usage: /np:validate-phase <phase-number>" >&2
32
+ exit 2
33
+ fi
34
+
35
+ INIT=$(node np-tools.cjs init validate-phase "$PHASE")
36
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
37
+ RUNTIME=$(node -e "console.log(require('./lib/runtime/index.cjs').detect().runtime)")
38
+ ```
39
+
40
+ Parse JSON for: `padded_phase`, `phase_dir`, `phase_found`.
41
+
42
+ ```bash
43
+ PADDED=$(echo "$INIT" | jq -r '.padded_phase // .padded')
44
+ PHASE_DIR=$(echo "$INIT" | jq -r '.phase_dir')
45
+ PHASE_FOUND=$(echo "$INIT" | jq -r '.phase_found')
46
+ VALIDATION_PATH="${PHASE_DIR}/${PADDED}-VALIDATION.md"
47
+ SUMMARY_PATH="${PHASE_DIR}/${PADDED}-SUMMARY.md"
48
+ PLAN_PATH_GLOB="${PHASE_DIR}/${PADDED}-*-PLAN.md"
49
+ TEMPLATE_PATH="templates/VALIDATION.md"
50
+ REQS_PATH=".planning/REQUIREMENTS.md"
51
+ [ -f "$REQS_PATH" ] || REQS_PATH=".nubos-pilot/REQUIREMENTS.md"
52
+ PLAN_ID="${PADDED}-validate-phase"
53
+ TASK_ID="${PADDED}-validate-phase"
54
+ ```
55
+
56
+ ## Pre-Flight Gates
57
+
58
+ <pre_flight>
59
+
60
+ ### Gate 1 — Phase found + SUMMARY.md present
61
+
62
+ ```bash
63
+ if [[ "$PHASE_FOUND" != "true" ]]; then
64
+ echo "Error: Phase $PHASE not found in roadmap or on disk." >&2
65
+ exit 1
66
+ fi
67
+ if [[ ! -f "$SUMMARY_PATH" ]]; then
68
+ echo "Error: Phase $PHASE has no SUMMARY.md at $SUMMARY_PATH." >&2
69
+ echo "Run /np:execute-phase $PHASE before auditing." >&2
70
+ exit 1
71
+ fi
72
+ ```
73
+
74
+ ### Gate 2 — VALIDATION.md already exists
75
+
76
+ If a prior audit is present, let the user choose Re-run / View / Skip.
77
+ The `cp` step only runs in the Re-run branch — View or Skip never
78
+ overwrites a user-edited sidecar (T-10-04-01 mitigation).
79
+
80
+ ```bash
81
+ RERUN="false"
82
+ if [[ -f "$VALIDATION_PATH" ]]; then
83
+ CHOICE=$(node np-tools.cjs askuser --json '{
84
+ "type": "select",
85
+ "header": "Existing VALIDATION.md",
86
+ "question": "VALIDATION.md already exists for Phase '"$PHASE"'. What would you like to do?",
87
+ "options": [
88
+ {"label": "Re-run — replace the current audit", "description": "Re-runs np-nyquist-auditor and overwrites the existing file."},
89
+ {"label": "View — display current audit and exit", "description": "Reads the file and exits without changes."},
90
+ {"label": "Skip — keep current audit and exit", "description": "Leaves the file untouched."}
91
+ ]
92
+ }')
93
+ case "$CHOICE" in
94
+ "View"*) cat "$VALIDATION_PATH"; exit 0 ;;
95
+ "Skip"*) exit 0 ;;
96
+ "Re-run"*) RERUN="true" ;;
97
+ esac
98
+ fi
99
+ ```
100
+
101
+ ### Gate 3 — Template present
102
+
103
+ ```bash
104
+ if [[ ! -f "$TEMPLATE_PATH" ]]; then
105
+ echo "Error: $TEMPLATE_PATH missing; Plan 10-01-T03 should have ported it." >&2
106
+ echo "Re-run 'npx nubos-pilot install' or restore templates/VALIDATION.md from source." >&2
107
+ exit 1
108
+ fi
109
+ ```
110
+
111
+ </pre_flight>
112
+
113
+ ## Load Template
114
+
115
+ Copy `templates/VALIDATION.md` into the sidecar ONLY when absent OR user
116
+ chose Re-run. The agent substitutes `{N}` / `{phase-slug}` / `{date}`
117
+ at write time — the workflow never pre-substitutes.
118
+
119
+ ```bash
120
+ if [[ ! -f "$VALIDATION_PATH" || "$RERUN" == "true" ]]; then
121
+ cp "$TEMPLATE_PATH" "$VALIDATION_PATH"
122
+ fi
123
+ ```
124
+
125
+ ## Extract Requirement IDs
126
+
127
+ The `np-nyquist-auditor` agent reads REQUIREMENTS.md at `$REQS_PATH`
128
+ (`.planning/REQUIREMENTS.md` or `.nubos-pilot/REQUIREMENTS.md`), filters
129
+ to the phase's declared requirement IDs (from roadmap.yaml
130
+ `phases[].requirements`), and scans every
131
+ `${PHASE_DIR}/${PADDED}-*-PLAN.md` task frontmatter `requirements:`
132
+ field to cross-reference coverage. The agent then inspects test files
133
+ (`**/*.test.{cjs,js,ts}`, `*.spec.ts`, `test_*.py`, `*_test.go`) via
134
+ grep/Bash for each requirement ID (T-10-04-05 mitigation: REQUIREMENTS.md
135
+ path is canonical — no user input in the path; requirement IDs come
136
+ from roadmap.yaml via `lib/roadmap.cjs`, file-locked + validated).
137
+
138
+ ## Spawn np-nyquist-auditor (haiku)
139
+
140
+ ```bash
141
+ START=$(node np-tools.cjs metrics start-timestamp)
142
+ MODEL=$(node np-tools.cjs resolve-model np-nyquist-auditor --profile balanced)
143
+ # Spawn agent=np-nyquist-auditor model=$MODEL
144
+ # input: plan_path_glob=$PLAN_PATH_GLOB, summary_path=$SUMMARY_PATH,
145
+ # validation_path=$VALIDATION_PATH, template_path=$TEMPLATE_PATH,
146
+ # requirements_path=$REQS_PATH, phase_dir=$PHASE_DIR,
147
+ # phase=$PHASE, padded=$PADDED
148
+ # output: $VALIDATION_PATH with per-requirement Nyquist scoring
149
+ # (COVERED / UNDER_SAMPLED / UNCOVERED), using
150
+ # templates/VALIDATION.md as skeleton.
151
+ Task(
152
+ subagent_type="np-nyquist-auditor",
153
+ model="$MODEL",
154
+ prompt="<files_to_read>${PLAN_PATH_GLOB} ${SUMMARY_PATH} ${TEMPLATE_PATH} ${REQS_PATH} CLAUDE.md PROJECT.md</files_to_read><config>plan_path_glob=$PLAN_PATH_GLOB,summary_path=$SUMMARY_PATH,validation_path=$VALIDATION_PATH,template_path=$TEMPLATE_PATH,requirements_path=$REQS_PATH,phase_dir=$PHASE_DIR,phase=$PHASE,padded=$PADDED</config>"
155
+ )
156
+ END=$(node np-tools.cjs metrics end-timestamp)
157
+ node np-tools.cjs metrics record \
158
+ --agent np-nyquist-auditor --tier haiku --resolved-model "$MODEL" \
159
+ --phase "$PHASE" --plan "$PLAN_ID" --task "$TASK_ID" \
160
+ --started "$START" --ended "$END" \
161
+ --tokens-in "${TOKENS_IN:-0}" --tokens-out "${TOKENS_OUT:-0}" \
162
+ --retry-count 0 --status ok --runtime "$RUNTIME"
163
+ ```
164
+
165
+ ## Validation Gate
166
+
167
+ ```bash
168
+ if [[ ! -f "$VALIDATION_PATH" ]]; then
169
+ CHOICE=$(node np-tools.cjs askuser --json '{
170
+ "type": "select",
171
+ "header": "VALIDATION.md missing",
172
+ "question": "np-nyquist-auditor did not write VALIDATION.md. What would you like to do?",
173
+ "options": [
174
+ {"label": "Re-run np-nyquist-auditor", "description": "Spawn the auditor once more."},
175
+ {"label": "Abort", "description": "Exit without committing."}
176
+ ]
177
+ }')
178
+ case "$CHOICE" in "Abort") exit 1 ;; esac
179
+ fi
180
+ ```
181
+
182
+ ## Commit
183
+
184
+ ```bash
185
+ node np-tools.cjs commit "docs(${PADDED}): add validation audit report" --files "$VALIDATION_PATH"
186
+ ```
187
+
188
+ One atomic docs commit per ADR-0004. The commit helper routes through
189
+ `lib/git.cjs.assertCommittablePaths` (gitignore-guard) before staging.
190
+
191
+ ## Scope Guardrail
192
+
193
+ <scope_guardrail>
194
+ **Do:**
195
+ - Run `np-nyquist-auditor` exactly once per invocation (single-pass audit).
196
+ - Emit a metrics record AFTER the Task spawn (D-06).
197
+ - Resolve MODEL via `np-tools.cjs resolve-model np-nyquist-auditor --profile balanced` — no hardcoded IDs.
198
+ - Use `np-tools.cjs askuser` for every prompt (INST-03 invariant).
199
+ - `cp templates/VALIDATION.md` into the sidecar BEFORE spawning the agent.
200
+ - Only overwrite existing VALIDATION.md on Re-run choice (T-10-04-01).
201
+ - Abort early when phase_dir or SUMMARY.md is absent.
202
+ - Record metrics with `--tier haiku` (np-nyquist-auditor tier in D-01).
203
+ - Treat test files and implementation files as READ-ONLY — this
204
+ workflow is observation-only (D-20 SC-5). Remediation guidance goes
205
+ into VALIDATION.md's `## Remediation Guidance` section, never as
206
+ direct edits to test files.
207
+
208
+ **Don't:**
209
+ - Run this workflow on a phase without SUMMARY.md.
210
+ - Invoke host-specific prompt tools directly — route through `np-tools.cjs askuser`.
211
+ - Overwrite a user-edited VALIDATION.md without the Re-run gate (T-10-04-01).
212
+ - Construct phase paths from raw `$1` — consume `padded_phase` / `phase_dir`
213
+ from `np-tools.cjs init` (SAFE_PHASE_RE enforced upstream, T-10-04-03).
214
+ - Construct REQUIREMENTS.md path from user input — use the canonical
215
+ `.planning/REQUIREMENTS.md` or `.nubos-pilot/REQUIREMENTS.md` fallback
216
+ (T-10-04-05).
217
+ - Skip the metrics record block (D-06).
218
+ - Modify test files or implementation code — the auditor is read-only;
219
+ fixes belong to a follow-up planner pass.
220
+ - Spawn any additional agent beyond `np-nyquist-auditor`.
221
+ </scope_guardrail>
222
+
223
+ ## Output
224
+
225
+ - `{phase_dir}/{padded}-VALIDATION.md` — Nyquist scoring per
226
+ requirement (COVERED / UNDER_SAMPLED / UNCOVERED), Test Infrastructure
227
+ section, Per-Task Verification Map, Manual-Only list, Remediation
228
+ Guidance. Frontmatter carries `requirements_total`, `covered`,
229
+ `under_sampled`, `uncovered`, `nyquist_compliant` boolean.
230
+ - 1 metrics record in `.nubos-pilot/metrics/phase-${PHASE}.jsonl`.
231
+ - One atomic `docs(${PADDED}): add validation audit report` git commit.
@@ -0,0 +1,83 @@
1
+ ---
2
+ command: np:verify-work
3
+ description: Two-pass goal-backward verification after execution. Verifier agent classifies deterministic evidence; Pass-2 askUser loop resolves needs_user_confirm flags (D-21/D-22).
4
+ ---
5
+
6
+ # /np:verify-work
7
+
8
+ <objective>
9
+ Verify that a just-executed phase actually satisfies the ROADMAP
10
+ `success_criteria`. Pass 1 = verifier subagent emits Pass/Fail/Defer with
11
+ evidence; Pass 2 = workflow askUser resolves any `needs_user_confirm`
12
+ items. Final artifact: `<phase_dir>/<padded>-VERIFICATION.md` (D-24 schema).
13
+ </objective>
14
+
15
+ ## Initialize
16
+
17
+ ```bash
18
+ PHASE="$1"
19
+ INIT=$(node np-tools.cjs init verify-work "$PHASE")
20
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
21
+ AGENT_SKILLS_VERIFIER=$(node np-tools.cjs agent-skills verifier 2>/dev/null)
22
+ ```
23
+
24
+ Parse: `phase`, `padded`, `phase_dir`, `success_criteria`, `draft_results`,
25
+ `verification_path`, `verifier_tier`, `agent_skills`.
26
+
27
+ ## Pass 1 — verifier agent
28
+
29
+ Spawn `agents/np-verifier.md` (tier: sonnet, READ-ONLY tools) with:
30
+ - `<files_to_read>` = [ROADMAP.md, PLAN.md(s), all task commits via
31
+ `git log --grep='^task(<padded>-'`, each task's `files_modified`].
32
+ - `success_criteria` list from `$INIT`.
33
+
34
+ The agent emits a structured verdict per SC: Pass | Fail |
35
+ Needs-User-Confirm | Defer (never invents a SC, never edits source).
36
+
37
+ Persist the deterministic draft:
38
+
39
+ ```bash
40
+ node np-tools.cjs init verify-work emit-draft "$PHASE"
41
+ ```
42
+
43
+ ## Pass 2 — user-driven gate for needs_user_confirm
44
+
45
+ For each result flagged `needs_user_confirm` by Pass 1, ask the user:
46
+
47
+ ```bash
48
+ # Example — iterated by the workflow over each needs_user_confirm SC.
49
+ CHOICE=$(node np-tools.cjs askuser --json '{
50
+ "type": "select",
51
+ "header": "SC-3: UX feels responsive",
52
+ "question": "Ist dieses Kriterium erfüllt?",
53
+ "options": [
54
+ {"label": "Pass", "description": "Kriterium ist erfüllt."},
55
+ {"label": "Fail", "description": "Kriterium ist nicht erfüllt — Defekt."},
56
+ {"label": "Defer", "description": "Absichtlich zurückgestellt, später prüfen."},
57
+ {"label": "Re-investigate", "description": "Brauche mehr Evidence — spawn Verifier nochmal."}
58
+ ]
59
+ }')
60
+ node np-tools.cjs init verify-work record-sc "$PHASE" "SC-3" "$CHOICE"
61
+ ```
62
+
63
+ ## Hard-stop on Fail (D-23)
64
+
65
+ If any result ends with `status: Fail` after Pass 1 or Pass 2:
66
+
67
+ ```bash
68
+ echo "[np:verify-work] Phase $PHASE hat Fail-Ergebnisse — LOUD FAIL." >&2
69
+ exit 1
70
+ ```
71
+
72
+ ## Scope Guardrail
73
+
74
+ **Do:** spawn `agents/np-verifier.md` with read-only tools; persist SC
75
+ updates via `record-sc`; exit non-zero on any Fail.
76
+ **Don't:** let the verifier edit source files; self-classify subjective
77
+ criteria (Pitfall 5); mask a Fail as Defer.
78
+
79
+ ## Output
80
+
81
+ - `<phase_dir>/<padded>-VERIFICATION.md` written (D-24 schema).
82
+ - Phase status recorded as `verified | failed | deferred`.
83
+ - Ready for `/np:add-tests $PHASE` to persist Pass-SCs as UAT.