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,269 @@
1
+ ---
2
+ command: np:discuss-phase --assumptions
3
+ description: Codebase-first assumption surfacing; writes {padded}-ASSUMPTIONS.md (not CONTEXT.md).
4
+ ---
5
+
6
+ # np:discuss-phase --assumptions
7
+
8
+ > **Phase-5 scope note:** Assumptions analysis runs as inline orchestrator
9
+ > reasoning. A dedicated `assumptions-analyzer` subagent is deferred
10
+ > (tracked in `.planning/phases/05-planning-workflows-agents/05-CONTEXT.md`
11
+ > §deferred). A standalone `assumptions-analyzer` agent is intentionally
12
+ > out of scope in Phase 5 — the orchestrator LLM performs the analysis
13
+ > directly inside this workflow.
14
+
15
+ > **Artifact note:** This mode writes `{phase_dir}/{padded}-ASSUMPTIONS.md`,
16
+ > NOT `{padded}-CONTEXT.md`. It deliberately produces a separate artifact so
17
+ > running `--assumptions` never clobbers a CONTEXT.md written by the
18
+ > interactive adaptive mode. Downstream agents (researcher, planner) can
19
+ > read either file; the planner precedence rule is "CONTEXT.md wins if both
20
+ > exist".
21
+
22
+ ## Initialize
23
+
24
+ ```bash
25
+ INIT=$(node np-tools.cjs init discuss-phase "$PHASE" --assumptions)
26
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
27
+ ```
28
+
29
+ Parse JSON for: `phase_number`, `padded`, `phase_dir`, `phase_name`,
30
+ `phase_slug`, `has_context`, `goal`, `requirements`, `agent_skills`, `mode`
31
+ (expected `"assumptions"`).
32
+
33
+ ## Purpose
34
+
35
+ <purpose>
36
+ Extract implementation decisions that downstream agents need — using
37
+ codebase-first analysis and assumption surfacing instead of interview-style
38
+ questioning.
39
+
40
+ You are a thinking partner, not an interviewer. Analyze the codebase deeply,
41
+ surface what you believe based on evidence, and ask the user only to correct
42
+ what's wrong.
43
+ </purpose>
44
+
45
+ ## Downstream Awareness
46
+
47
+ <downstream_awareness>
48
+ **ASSUMPTIONS.md feeds into:**
49
+
50
+ 1. **researcher** — Reads ASSUMPTIONS.md to know WHAT to research.
51
+ 2. **planner** — Reads ASSUMPTIONS.md to know WHAT decisions are locked.
52
+
53
+ **Your job:** Capture decisions clearly enough that downstream agents can
54
+ act on them without asking the user again. Output shape is identical to
55
+ adaptive-mode CONTEXT.md — six sections (domain, decisions, canonical_refs,
56
+ code_context, specifics, deferred) — only the filename differs.
57
+ </downstream_awareness>
58
+
59
+ ## Philosophy
60
+
61
+ <philosophy>
62
+ **Assumptions mode philosophy:**
63
+
64
+ The user is a visionary, not a codebase archaeologist. They need enough
65
+ context to evaluate whether your assumptions match their intent — not to
66
+ answer questions you could figure out by reading the code.
67
+
68
+ - Read the codebase FIRST, form opinions SECOND, ask ONLY about what's
69
+ genuinely unclear
70
+ - Every assumption must cite evidence (file paths, patterns found)
71
+ - Every assumption must state consequences if wrong
72
+ - Minimize user interactions: ~2-4 corrections vs ~15-20 questions
73
+ </philosophy>
74
+
75
+ ## Scope Guardrail
76
+
77
+ <scope_guardrail>
78
+ **CRITICAL: No scope creep.**
79
+
80
+ The phase boundary comes from ROADMAP.md and is FIXED. Discussion clarifies
81
+ HOW to implement what's scoped, never WHETHER to add new capabilities.
82
+
83
+ When user suggests scope creep:
84
+ "[Feature X] would be a new capability — that's its own phase.
85
+ Want me to note it for the roadmap backlog? For now, let's focus on
86
+ [phase domain]."
87
+
88
+ Capture the idea in "Deferred Ideas". Don't lose it, don't act on it.
89
+ </scope_guardrail>
90
+
91
+ ## Answer Validation
92
+
93
+ <answer_validation>
94
+ **IMPORTANT: Answer validation** — After every interactive prompt, check if
95
+ the response is empty or whitespace-only. If so:
96
+ 1. Retry the question once with the same parameters
97
+ 2. If still empty, present the options as a plain-text numbered list
98
+
99
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):**
100
+ When text mode is active, do not use `np-tools.cjs askuser` at all. Present
101
+ every question as a plain-text numbered list and ask the user to type their
102
+ choice number.
103
+ </answer_validation>
104
+
105
+ ## Process
106
+
107
+ ### Step 1: Guard against existing ASSUMPTIONS.md
108
+
109
+ If an ASSUMPTIONS.md already exists at `{phase_dir}/{padded}-ASSUMPTIONS.md`,
110
+ ask the user explicitly:
111
+
112
+ ```bash
113
+ ASSUMPTIONS_PATH="$PHASE_DIR/$PADDED-ASSUMPTIONS.md"
114
+ if [[ -f "$ASSUMPTIONS_PATH" ]]; then
115
+ node np-tools.cjs askuser --json '{
116
+ "type": "select",
117
+ "prompt": "Phase '"$PHASE"' already has ASSUMPTIONS.md. What do you want to do?",
118
+ "options": [
119
+ "Overwrite existing ASSUMPTIONS.md",
120
+ "Abort"
121
+ ]
122
+ }'
123
+ fi
124
+ ```
125
+
126
+ **Overwrite:** preserve the prior file under
127
+ `{padded}-ASSUMPTIONS.archive.md` before writing.
128
+ **Abort:** exit the workflow.
129
+
130
+ Note: we do NOT gate on `has_context` — CONTEXT.md lives in its own slot and
131
+ is untouched by this workflow.
132
+
133
+ ### Step 2: Read the codebase and prior phases
134
+
135
+ Orchestrator responsibility (no bash wrapping needed — this is LLM work
136
+ driven by the standard Read/Glob/Grep tools):
137
+
138
+ 1. Read `.planning/PROJECT.md`, `.planning/REQUIREMENTS.md`,
139
+ `.planning/ROADMAP.md` for the current phase's boundary.
140
+ 2. Read every prior `*-CONTEXT.md` / `*-ASSUMPTIONS.md` file with phase
141
+ number < current. Capture locked decisions that constrain this phase.
142
+ 3. Glob + Grep the codebase for artifacts touching the phase's domain
143
+ (components, hooks, routes, API paths mentioned in the phase goal).
144
+ 4. Extract: reusable assets, established patterns, integration points,
145
+ existing tests that constrain refactors.
146
+
147
+ Accumulate findings internally; nothing is written yet.
148
+
149
+ ### Step 3: Surface assumptions with evidence
150
+
151
+ For each implementation decision you are about to assume, write an
152
+ evidence-backed assumption of the form:
153
+
154
+ ```
155
+ ### A-<n>: <decision>
156
+ - **Assumption:** <what you intend to do>
157
+ - **Evidence:** <file:line or pattern observed>
158
+ - **Consequence if wrong:** <what breaks / has to be redone>
159
+ ```
160
+
161
+ Produce 4–10 assumptions. Less than 4 means the codebase did not give you
162
+ enough signal — fall back to adaptive mode. More than 10 means you are
163
+ turning this into a questionnaire; consolidate.
164
+
165
+ ### Step 4: Present assumptions for correction
166
+
167
+ Show the user the full list of assumptions (the orchestrator renders them
168
+ as a readable markdown list), then ask which ones are wrong:
169
+
170
+ ```bash
171
+ node np-tools.cjs askuser --json '{
172
+ "type": "multiselect",
173
+ "prompt": "Which of these assumptions are wrong? (Select any that need correction; empty = all correct.)",
174
+ "options": [
175
+ "A-1: <short title>",
176
+ "A-2: <short title>",
177
+ "A-3: <short title>",
178
+ "A-4: <short title>"
179
+ ]
180
+ }'
181
+ ```
182
+
183
+ For each selected (wrong) assumption, capture the user's correction:
184
+
185
+ ```bash
186
+ node np-tools.cjs askuser --json '{
187
+ "type": "input",
188
+ "prompt": "A-<n> correction: what is the right decision, and why?"
189
+ }'
190
+ ```
191
+
192
+ If the user selected zero assumptions to correct, skip directly to Step 6.
193
+
194
+ ### Step 5: Confirm the corrected list
195
+
196
+ After applying corrections, show the user the revised assumption list and
197
+ confirm:
198
+
199
+ ```bash
200
+ node np-tools.cjs askuser --json '{
201
+ "type": "confirm",
202
+ "prompt": "Corrected assumptions look right? (No = loop back for more corrections.)",
203
+ "default": true
204
+ }'
205
+ ```
206
+
207
+ No → return to Step 4 with the revised list as the new input. Max 2 loops
208
+ then force-proceed to Step 6 to prevent infinite correction cycles.
209
+
210
+ ### Step 6: Render ASSUMPTIONS.md
211
+
212
+ Render the collected assumptions into the six-section CONTEXT.md-shaped
213
+ artifact. Use `lib/template.cjs render()` with the same
214
+ `templates/CONTEXT.md` template (section shapes are identical to adaptive
215
+ mode — only the output filename differs):
216
+
217
+ ```bash
218
+ mkdir -p "$PHASE_DIR"
219
+ node -e '
220
+ const { render } = require("./lib/template.cjs");
221
+ const fs = require("node:fs");
222
+ const tpl = fs.readFileSync("templates/CONTEXT.md", "utf-8");
223
+ const vars = JSON.parse(process.argv[1]);
224
+ process.stdout.write(render(tpl, vars));
225
+ ' "$VARS_JSON" > "$PHASE_DIR/$PADDED-ASSUMPTIONS.md"
226
+ ```
227
+
228
+ Variables mirror adaptive mode (phase_number, phase_name, goal, domain,
229
+ decisions, canonical_refs, code_context, specifics, deferred, date).
230
+ Decisions accumulator is populated from assumptions + user corrections.
231
+
232
+ `render()` is fail-loud on unknown placeholders — do not mask
233
+ `NubosPilotError('template-missing-key', …)` if it fires.
234
+
235
+ ### Step 7: Commit respecting config.commit_docs
236
+
237
+ ```bash
238
+ COMMIT_DOCS=$(node np-tools.cjs config-get workflow.commit_docs 2>/dev/null || echo "true")
239
+ if [[ "$COMMIT_DOCS" == "true" ]]; then
240
+ git add "$PHASE_DIR/$PADDED-ASSUMPTIONS.md"
241
+ git commit -m "docs($PADDED): capture phase assumptions"
242
+ fi
243
+ ```
244
+
245
+ If `workflow.commit_docs` is false, leave the file uncommitted.
246
+
247
+ ### Step 8: Confirm and next steps
248
+
249
+ ```bash
250
+ node np-tools.cjs askuser --json '{
251
+ "type": "confirm",
252
+ "prompt": "ASSUMPTIONS.md written at '"$PHASE_DIR"'/'"$PADDED"'-ASSUMPTIONS.md. Run np:plan-phase '"$PHASE"' now?",
253
+ "default": true
254
+ }'
255
+ ```
256
+
257
+ Yes → hand off to `np:plan-phase $PHASE`. No → print
258
+ `Next: /np:plan-phase $PHASE` and exit.
259
+
260
+ ## Success Criteria
261
+
262
+ - `{phase_dir}/{padded}-ASSUMPTIONS.md` exists with all six sections.
263
+ - No CONTEXT.md was touched by this workflow (distinct artifact).
264
+ - Every interactive prompt went through `np-tools.cjs askuser`; zero
265
+ bypasses of the Phase-3 SC-5 invariant.
266
+ - Assumptions carried evidence citations (file paths or pattern refs) at
267
+ the moment they were presented to the user.
268
+ - If ASSUMPTIONS.md existed before this run, user explicitly chose
269
+ overwrite or abort — no silent overwrite.
@@ -0,0 +1,139 @@
1
+ # np:discuss-phase --power
2
+
3
+ Power-user mode for phase discussion. Generates a bulk question set into a
4
+ plain JSON file; the user edits it in their favourite editor (VS Code, vim,
5
+ JetBrains, Zed, Emacs …) and then says `refresh` or `finalize`.
6
+
7
+ > **Single-source-of-truth:** `QUESTIONS.json` is authoritative for in-progress
8
+ > state. `CONTEXT.md` is DERIVED only on `finalize`. `refresh` does NOT touch
9
+ > `CONTEXT.md`.
10
+
11
+ <philosophy>
12
+ Power mode exists for phases with many gray areas where chat-round-trip answering
13
+ is too slow. Instead of a synchronous interview, Claude seeds a bulk question
14
+ set; the user answers asynchronously in their editor; Claude processes all
15
+ answers in a single pass on `finalize`. The UX trade-off is bulk-speed in
16
+ exchange for losing the adaptive follow-up that standard discuss-phase offers —
17
+ use power mode only when that trade-off is explicit.
18
+ </philosophy>
19
+
20
+ <scope_guardrail>
21
+ Power mode MUST NOT widen the phase. The seeded question set reflects the
22
+ existing phase boundary as captured in ROADMAP.md and REQUIREMENTS.md. If a
23
+ user answer introduces a new requirement, Claude flags it on finalize; it does
24
+ not silently absorb it into CONTEXT.md.
25
+ </scope_guardrail>
26
+
27
+ <downstream_awareness>
28
+ CONTEXT.md produced by this workflow is the same shape that `np:research-phase`
29
+ and `np:plan-phase` consume. The planner reads the `<decisions>` and
30
+ `<canonical_refs>` sections without knowing whether they came from adaptive or
31
+ power mode. Schema parity is therefore mandatory — never invent keys that only
32
+ power mode emits.
33
+ </downstream_awareness>
34
+
35
+ <answer_validation>
36
+ On `finalize`, the subcommand rejects the transition if ANY question's `answer`
37
+ field is still `null` or an empty string. Pending IDs are returned to the user
38
+ via `NubosPilotError('power-finalize-incomplete', { pending_ids })` so the
39
+ editor round-trip is resumed without data loss.
40
+ </answer_validation>
41
+
42
+ ## What This Workflow Does NOT Do
43
+
44
+ - **No HTML file generation.** A self-contained HTML companion is
45
+ deliberately out of scope per CONTEXT D-05..D-08.
46
+ - **No browser File System Access API.** FSA is Chromium-only and useless in
47
+ Codex / Gemini / OpenCode terminal runtimes.
48
+ - **No embedded CSS or JS bundle.** Zero frontend code in this phase.
49
+ - **No server, no port, no background process.** Pure file-on-disk state.
50
+ - **No auto-open.** JSON is edited in the user's preferred editor —
51
+ nubos-pilot never launches a UI.
52
+
53
+ ## Flow
54
+
55
+ ### 1. Bootstrap
56
+
57
+ Single init call:
58
+
59
+ ```bash
60
+ PHASE="$1" # phase number passed by /np:discuss-phase --power N
61
+ INIT=$(node np-tools.cjs init discuss-phase-power init "$PHASE")
62
+ ```
63
+
64
+ The subcommand writes `{phase_dir}/{padded}-QUESTIONS.json` with a seeded
65
+ question catalogue spanning the six CONTEXT areas (domain, decisions,
66
+ canonical_refs, code_context, specifics, deferred).
67
+
68
+ ### 2. Instruct the user
69
+
70
+ Echo this prompt verbatim (D-06):
71
+
72
+ > Öffne `{padded}-QUESTIONS.json` in deinem Editor, setze `answer` pro Frage,
73
+ > speichere. Sag mir dann `refresh` oder `finalize`.
74
+
75
+ ### 3. Command loop
76
+
77
+ Drive all prompts through `np-tools.cjs askuser --json` (no bare runtime
78
+ prompt calls anywhere in this workflow — SC-5):
79
+
80
+ ```bash
81
+ while true; do
82
+ CMD=$(node np-tools.cjs askuser --json '{"type":"select","question":"Command?","options":[{"label":"refresh"},{"label":"finalize"},{"label":"explain"},{"label":"exit"}]}')
83
+ case "$CMD" in
84
+ refresh)
85
+ node np-tools.cjs init discuss-phase-power refresh "$PHASE"
86
+ ;;
87
+ finalize)
88
+ node np-tools.cjs init discuss-phase-power finalize "$PHASE" && break
89
+ ;;
90
+ explain)
91
+ QID=$(node np-tools.cjs askuser --json '{"type":"input","question":"Question ID? (e.g. Q-03)"}')
92
+ node np-tools.cjs init discuss-phase-power explain "$PHASE" "$QID"
93
+ ;;
94
+ exit)
95
+ node np-tools.cjs init discuss-phase-power exit "$PHASE" && break
96
+ ;;
97
+ esac
98
+ done
99
+ ```
100
+
101
+ ### 4. Verb semantics
102
+
103
+ | Verb | Effect | Touches CONTEXT.md? |
104
+ | ---------- | ------------------------------------------------------------------------ | ------------------- |
105
+ | `init` | Writes `{padded}-QUESTIONS.json` with seeded questions. | No |
106
+ | `refresh` | Re-reads JSON; emits stats JSON (totals per area). | **No** (Pitfall 1) |
107
+ | `finalize` | Validates all answers; renders CONTEXT.md; marks `answers_status='finalized'`. | Yes |
108
+ | `explain` | Returns a single question object with its `explain` body. | No |
109
+ | `exit` | Emits status JSON; leaves QUESTIONS.json on disk. | No |
110
+
111
+ ### 5. Post-finalize
112
+
113
+ On success Claude reports:
114
+
115
+ ```
116
+ CONTEXT.md written: {phase_dir}/{padded}-CONTEXT.md
117
+ Next step: /np:plan-phase {N}
118
+ ```
119
+
120
+ ## Error surface
121
+
122
+ | Error code | When | Recovery |
123
+ | ------------------------------- | ---------------------------------------------------- | ----------------------------------------------- |
124
+ | `power-questions-exist` | `init` run twice without editing. | Edit JSON or delete it to re-seed. |
125
+ | `power-finalize-incomplete` | `finalize` called with null / empty answers. | Inspect `pending_ids`, fill them, retry. |
126
+ | `power-question-not-found` | `explain Q-XX` with unknown id. | Use `refresh` to list question ids. |
127
+ | `power-explain-missing-id` | `explain` invoked without a question id. | Supply an id via askuser input. |
128
+ | `template-not-found` | CONTEXT.md template missing from `.nubos-pilot/templates/`. | Ensure Phase 5 templates are installed. |
129
+ | `template-unresolved-var` | User answer references an unknown placeholder. | Check CONTEXT.md template; do not widen schema. |
130
+
131
+ ## Success criteria
132
+
133
+ - JSON is the only state file produced by this workflow.
134
+ - `refresh` never writes CONTEXT.md.
135
+ - `finalize` writes CONTEXT.md atomically via `lib/template.cjs loadTemplate`.
136
+ - Zero bare runtime-prompt calls; every prompt routes through
137
+ `np-tools.cjs askuser`.
138
+ - Verb set refresh / finalize / explain / exit covers the full power-mode
139
+ lifecycle (D-07).