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,244 @@
1
+ ---
2
+ command: np:note
3
+ description: Capture a free-form note to markdown. Defaults to project scope (.nubos-pilot/notes/YYYY-MM-DD-<slug>.md, committed). Use --global for sensitive/cross-project notes (~/.nubos-pilot/notes/YYYY-MM-DD-<slug>.md, NOT committed). No agent spawn, no STATE mutation.
4
+ ---
5
+
6
+ # np:note
7
+
8
+ Implements UTIL-05b. Zero-friction idea capture that writes the note
9
+ text verbatim to a timestamped markdown file.
10
+ Unlike `/np:add-todo`, `/np:note` does NOT touch STATE.md and has no
11
+ pending-todo semantics — it is the fastest-possible surface for
12
+ "capture now, triage later".
13
+
14
+ This workflow ships with a project-default + global-fallback scope
15
+ model. Project scope (`.nubos-pilot/notes/YYYY-MM-DD-<slug>.md`,
16
+ committed per ADR-0004) is the happy path. The `--global` flag routes
17
+ to `~/.nubos-pilot/notes/` and intentionally does **not** commit —
18
+ global notes live outside any repository (Pitfall 10: the global
19
+ branch bypasses `lib/core.cjs.findProjectRoot` entirely so the tool
20
+ works from any cwd, including directories that have no project at
21
+ all).
22
+
23
+ This is a pure-CRUD workflow — no agent spawn, no resolve-model, no
24
+ metrics record. The `workflow-missing-metrics` lint in
25
+ `bin/check-workflows.cjs` only fires on `Task(` / `Spawn agent=` sites,
26
+ so CRUD-only workflows are exempt (Pitfall 9 resolution from
27
+ Plan 10-05). Interactive prompts route through
28
+ `node np-tools.cjs askuser --json` per INST-03.
29
+
30
+ ## Initialize
31
+
32
+ ```bash
33
+ SCOPE="project"
34
+ TEXT_ARGS=()
35
+ for arg in "$@"; do
36
+ case "$arg" in
37
+ --global) SCOPE="global" ;;
38
+ *) TEXT_ARGS+=("$arg") ;;
39
+ esac
40
+ done
41
+ TEXT="${TEXT_ARGS[*]}"
42
+ if [[ -z "$TEXT" ]]; then
43
+ echo "Usage: /np:note [--global] <text>" >&2
44
+ exit 2
45
+ fi
46
+ ```
47
+
48
+ The `--global` flag is stripped from anywhere in `$@` (beginning,
49
+ middle, or end of the argv list) before the remaining args are joined
50
+ into `$TEXT`. Empty text after stripping is an error — there is no
51
+ `list` or `promote` subcommand here (deferred to a future
52
+ capture-management plan).
53
+
54
+ ## Compute Paths
55
+
56
+ Scope branching is explicit (T-10-05-02 mitigation + Pitfall 10
57
+ guidance). The project branch walks the `lib/core.cjs.projectStateDir`
58
+ resolver which asserts the cwd is inside a project. The global branch
59
+ sidesteps that resolver and hardcodes `HOME + /.nubos-pilot/notes`.
60
+
61
+ ```bash
62
+ if [[ "$SCOPE" == "global" ]]; then
63
+ NOTES_DIR="$HOME/.nubos-pilot/notes"
64
+ else
65
+ NOTES_DIR=$(node -e "console.log(require('./lib/core.cjs').projectStateDir(process.cwd()) + '/notes')")
66
+ fi
67
+ mkdir -p "$NOTES_DIR"
68
+ DATE=$(date +%Y-%m-%d)
69
+ TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
70
+ SLUG=$(node np-tools.cjs generate-slug "$TEXT" --raw)
71
+ if [[ -z "$SLUG" ]]; then
72
+ echo "Error: note text produced no slug-safe characters." >&2
73
+ exit 1
74
+ fi
75
+ NOTE_PATH="${NOTES_DIR}/${DATE}-${SLUG}.md"
76
+ ```
77
+
78
+ Slug generation is delegated to `node np-tools.cjs generate-slug`
79
+ (which wraps `lib/phase.cjs.phaseSlug`) — the same filename-safety
80
+ rails used by every capture workflow (T-10-05-01 & T-10-05-02
81
+ mitigation; only `[a-z0-9-]` enter the filename).
82
+
83
+ ## Duplicate Check
84
+
85
+ Same `date + slug` collisions are resolved via `askuser` Pattern S-3.
86
+ The fourth option, "append-timestamp", adds the current `HHMM` to the
87
+ filename so rapid-fire notes on the same topic each get their own
88
+ file.
89
+
90
+ ```bash
91
+ if [[ -f "$NOTE_PATH" ]]; then
92
+ CHOICE=$(node np-tools.cjs askuser --json '{
93
+ "type": "select",
94
+ "header": "Duplicate note",
95
+ "question": "A note already exists at '"${NOTE_PATH}"'. What would you like to do?",
96
+ "options": [
97
+ {"label": "Re-run — overwrite existing note", "description": "Replaces the body with the new text."},
98
+ {"label": "View — display existing note and exit", "description": "No changes."},
99
+ {"label": "Skip — keep existing and exit", "description": "Leaves the file untouched."},
100
+ {"label": "Append-timestamp — add HHMM suffix", "description": "Writes a new file with a time-suffixed name."}
101
+ ]
102
+ }')
103
+ case "$CHOICE" in
104
+ "View"*) cat "$NOTE_PATH"; exit 0 ;;
105
+ "Skip"*) exit 0 ;;
106
+ "Append-timestamp"*)
107
+ HHMM=$(date +%H%M)
108
+ NOTE_PATH="${NOTES_DIR}/${DATE}-${SLUG}-${HHMM}.md"
109
+ ;;
110
+ esac
111
+ fi
112
+ ```
113
+
114
+ ## Write Note File
115
+
116
+ Use the `Write` tool to create `$NOTE_PATH` with the following
117
+ frontmatter + body. The first 100 characters of `$TEXT` flow into a
118
+ short `text:` field for quick scanning; the full verbatim text lives
119
+ in the body so notes containing `:` characters or multi-line content
120
+ cannot break the YAML frontmatter (T-10-05-03 defence-in-depth
121
+ variant — the full text is never interpolated into frontmatter).
122
+
123
+ ```markdown
124
+ ---
125
+ text: <first line of TEXT, truncated to 100 chars>
126
+ created: <TIMESTAMP>
127
+ scope: project | global
128
+ promoted: false
129
+ ---
130
+
131
+ <TEXT>
132
+ ```
133
+
134
+ The note text is captured verbatim — typos, emoji, capitalisation are
135
+ all preserved. The `promoted` flag starts as `false`; a future
136
+ capture-management workflow will flip it when a note is promoted to a
137
+ todo.
138
+
139
+ ## Commit (project scope only)
140
+
141
+ Project-scope notes commit to git per ADR-0004 so the capture shows
142
+ up in the repo history. Global-scope notes do **not** commit — they
143
+ live under `$HOME/.nubos-pilot/notes/` which is outside any repo, and
144
+ committing would require running `git` against an unknown repo (or
145
+ none). The scope-branching commit step is the single-source-of-truth
146
+ for that distinction.
147
+
148
+ ```bash
149
+ if [[ "$SCOPE" == "project" ]]; then
150
+ node np-tools.cjs commit "docs(10): add note — ${SLUG}" --files "$NOTE_PATH"
151
+ else
152
+ echo "Global note written to $NOTE_PATH (not committed — lives outside any project)." >&2
153
+ fi
154
+ ```
155
+
156
+ ## Report
157
+
158
+ ```
159
+ Note saved ($SCOPE): $NOTE_PATH
160
+
161
+ Text: $TEXT
162
+ Created: $TIMESTAMP
163
+ Scope: $SCOPE
164
+ ```
165
+
166
+ ## Scope Guardrail
167
+
168
+ <scope_guardrail>
169
+ **Do:**
170
+ - Use `--global` for sensitive data that must not enter git history
171
+ (API keys, personal context, cross-project thoughts). Project scope
172
+ writes are committed; treat them as public.
173
+ - Let `lib/core.cjs.projectStateDir` throw on a non-project cwd for
174
+ project scope — the error message is clearer than a silent write
175
+ to a resolved-to-unexpected-root.
176
+ - For global scope, bypass `lib/core.cjs.findProjectRoot` completely
177
+ (Pitfall 10) so the workflow works from any cwd, including non-repo
178
+ directories.
179
+ - Derive the slug via `node np-tools.cjs generate-slug` so only
180
+ `[a-z0-9-]` enter the filename.
181
+ - Route the project-scope commit through `node np-tools.cjs commit`
182
+ for `lib/git.cjs.assertCommittablePaths()` validation.
183
+
184
+ **Don't:**
185
+ - Commit global-scope notes. They live outside any repo; committing
186
+ them from this workflow would write into whatever git repo happens
187
+ to contain the current cwd.
188
+ - Put the full note text in the frontmatter `text:` field —
189
+ multi-line content or `:` characters would break YAML parsing
190
+ (T-10-05-03 defence-in-depth).
191
+ - Invoke host-specific prompt tools directly (the BARE_ASKUSER lint
192
+ in `bin/check-workflows.cjs` blocks them) — always route through
193
+ `node np-tools.cjs askuser --json '…'`.
194
+ - Mutate STATE.md. Notes are lighter-weight than todos; there is no
195
+ pending-note counter. If you need STATE semantics, use
196
+ `/np:add-todo` instead.
197
+ - Add a `metrics record` block. There is no Task/Spawn site here;
198
+ Pitfall 9 / `workflow-missing-metrics` is exempt.
199
+ </scope_guardrail>
200
+
201
+ ## Output
202
+
203
+ - `.nubos-pilot/notes/YYYY-MM-DD-<slug>.md` (project scope) OR
204
+ `~/.nubos-pilot/notes/YYYY-MM-DD-<slug>.md` (global scope) — note
205
+ file with `text / created / scope / promoted:false` frontmatter and
206
+ the verbatim capture as body text.
207
+ - Project scope only: one atomic git commit
208
+ `docs(10): add note — <slug>` containing the new note file.
209
+ - Global scope: no commit. The note lives outside the repo.
210
+
211
+ ## Success Criteria
212
+
213
+ - [ ] `--global` stripped from `$@` at any position.
214
+ - [ ] Scope defaults to `project`; `--global` switches to HOME-based
215
+ path (Pitfall 10 mitigation — bypasses findProjectRoot).
216
+ - [ ] Project-scope directory resolved via
217
+ `lib/core.cjs.projectStateDir`.
218
+ - [ ] Slug produced via `node np-tools.cjs generate-slug` (only
219
+ `[a-z0-9-]` enter filename).
220
+ - [ ] Duplicate collisions resolved via `askuser` Pattern S-3
221
+ (Re-run / View / Skip / Append-timestamp).
222
+ - [ ] Note text captured verbatim in body (never in frontmatter).
223
+ - [ ] Project-scope notes committed via `np-tools.cjs commit`;
224
+ global-scope notes not committed (stderr confirmation only).
225
+ - [ ] STATE.md is NOT touched by this workflow (notes have no
226
+ pending-counter semantics).
227
+ - [ ] Lint clean under `bin/check-workflows.cjs` — no BARE_ASKUSER
228
+ violations and no DIRECT_READ pattern matches for the project
229
+ state directory.
230
+
231
+ ## Related Workflows
232
+
233
+ - **`/np:add-todo <title>`** — pending todo capture with STATE.md
234
+ counter increment. Use when the idea is actionable.
235
+ - **`/np:add-backlog <title>`** — larger-scope capture for a full
236
+ backlog phase (`999.x`) entry in ROADMAP.md.
237
+
238
+ ## Design Notes
239
+
240
+ `list` and `promote` subcommands are out of scope (they belong to a
241
+ future capture-management workflow). Global notes live under
242
+ `~/.nubos-pilot/notes/` per D-14. Empty text after flags errors out
243
+ rather than falling through to a list dump — the explicit failure
244
+ mode is easier to debug than an accidental list surface.
@@ -0,0 +1,29 @@
1
+ ---
2
+ command: np:park
3
+ description: Mark a task as parked (lifecycle CRUD). Use when a task needs to be deferred without being marked skipped.
4
+ ---
5
+
6
+ # /np:park
7
+
8
+ <objective>
9
+ Flip the task's frontmatter `status` field to `parked`. Like `skipped`,
10
+ parked tasks are excluded from wave-selection — but the semantic intent
11
+ is "come back to this", so `/np:unpark` returns it to `pending` rather
12
+ than implying the task was permanently dropped.
13
+ </objective>
14
+
15
+ ## Execution
16
+
17
+ ```bash
18
+ TASK_ID="$1"
19
+ if [ -z "$TASK_ID" ]; then
20
+ echo "Usage: /np:park <task-id>" >&2
21
+ exit 1
22
+ fi
23
+ node np-tools.cjs park "$TASK_ID"
24
+ ```
25
+
26
+ ## Scope Guardrail
27
+
28
+ **Do:** flip task status to `parked` via `lib/tasks.setTaskStatus`.
29
+ **Don't:** revert commits; modify other frontmatter fields.
@@ -0,0 +1,34 @@
1
+ ---
2
+ command: np:pause-work
3
+ description: Stamp STATE.session.stopped_at and resume_file for explicit session handoff. No git stash (D-08 semantic).
4
+ ---
5
+
6
+ # /np:pause-work
7
+
8
+ <objective>
9
+ Record the session boundary in STATE.md so the next session (or a
10
+ different operator) can re-enter via `/np:resume-work`. The in-flight
11
+ checkpoint, if any, is untouched — it continues to capture the executor's
12
+ progress.
13
+ </objective>
14
+
15
+ ## Execution
16
+
17
+ ```bash
18
+ node np-tools.cjs init pause-work
19
+ ```
20
+
21
+ Output is a small JSON payload `{ ok, stopped_at, resume_file }`. The
22
+ workflow simply displays it.
23
+
24
+ ## Scope Guardrail
25
+
26
+ **Do:** stamp STATE.session; print the resume hint.
27
+ **Don't:** stash, discard, or modify the working tree; delete checkpoints
28
+ (resume-work needs them).
29
+
30
+ ## Output
31
+
32
+ - STATE.md updated with `session.stopped_at = <ISO>` and
33
+ `session.resume_file = .nubos-pilot/checkpoints/<task-id>.json` (or null
34
+ if no active task).
@@ -0,0 +1,233 @@
1
+ ---
2
+ command: np:plan-milestone-gaps
3
+ description: Create corrective phases for audit gaps without touching completed phases.
4
+ ---
5
+
6
+ # np:plan-milestone-gaps
7
+
8
+ Create corrective phases for gaps surfaced by phase VERIFICATION.md files or
9
+ an external audit markdown. New phases are appended to the current milestone
10
+ (or decimal-inserted after a chosen base phase) and their `depends_on` is
11
+ ALWAYS set to the *semantic* source phase — never the positional insertion
12
+ point. Completed phases are NEVER rewritten.
13
+
14
+ ## Philosophy
15
+
16
+ <philosophy>
17
+ Gaps are the gap between plan and reality. When a plan's VERIFICATION.md
18
+ flags unfinished checkboxes, explicit `## Gap:` sections, or `❌` / `FAIL`
19
+ markers, the correct response is NOT to edit the originating phase — that
20
+ phase shipped, its SUMMARY.md was written, its commit landed. Instead, we
21
+ ADD a corrective phase whose `depends_on` cites the source phase, leaving the
22
+ git history linear and the downstream roadmap unmutated.
23
+ </philosophy>
24
+
25
+ ## Scope Guardrail
26
+
27
+ <scope_guardrail>
28
+ This workflow ONLY touches `.nubos-pilot/roadmap.yaml` (via the lib's write
29
+ API) and `.nubos-pilot/ROADMAP.md` (regenerated atomically in the same lock).
30
+ It NEVER:
31
+
32
+ - rewrites completed phases' `depends_on` to route through the new phase
33
+ - deletes or renumbers existing phases
34
+ - reads files outside the project root (`parseAuditFile` rejects with
35
+ `gaps-invalid-audit-path`)
36
+ - writes outside `.nubos-pilot/` or the workflow's own logs
37
+
38
+ Any proposed deviation from these invariants MUST be raised with the user
39
+ before proceeding.
40
+ </scope_guardrail>
41
+
42
+ ## Downstream Awareness
43
+
44
+ <downstream_awareness>
45
+ A decimal-inserted phase (e.g. `7.1` after phase 7) is PHYSICALLY positioned
46
+ between 7 and 8 in the yaml, but the `depends_on` edges of phases 8+ are NOT
47
+ rewritten. This is load-bearing: other workflows (progress, next, the
48
+ executor's wave planner) treat the numeric edges in `depends_on` as the
49
+ authoritative dependency graph. If a user wants phase 8 to depend on `7.1`
50
+ they must edit phase 8's `depends_on` explicitly — this workflow will not do
51
+ it on their behalf, because doing so in bulk is how corrective phases
52
+ silently invalidate in-flight SUMMARY.md claims. See Phase 5 RESEARCH §
53
+ "Pitfall 5" for the full rationale.
54
+ </downstream_awareness>
55
+
56
+ ## Single-Call Init
57
+
58
+ All context is gathered in one call to `np-tools.cjs init
59
+ plan-milestone-gaps`. The subcommand scans every phase's VERIFICATION.md (or
60
+ parses `--from <audit.md>` when supplied), resolves the current milestone
61
+ from STATE.md, and returns a JSON payload consumable by the rest of this
62
+ workflow.
63
+
64
+ ```bash
65
+ INIT=$(node np-tools.cjs init plan-milestone-gaps "$@")
66
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
67
+ ```
68
+
69
+ The payload shape:
70
+
71
+ ```json
72
+ {
73
+ "_workflow": "plan-milestone-gaps",
74
+ "milestoneId": "v1.0",
75
+ "mode": "scan" | "from-file",
76
+ "gaps": [
77
+ {
78
+ "source_phase": 7,
79
+ "gap_type": "explicit" | "unchecked-box" | "fail-marker",
80
+ "description": "…",
81
+ "severity": "critical" | "major" | "minor"
82
+ }
83
+ ],
84
+ "insertAfter": null | <integer>,
85
+ "agent_skills": { "np-planner": <skills-payload | null> }
86
+ }
87
+ ```
88
+
89
+ Extract fields with standard shell JSON handling (e.g. `jq`). All further
90
+ logic in this workflow MUST key off `INIT` — do NOT re-read files directly.
91
+
92
+ ## Answer Validation
93
+
94
+ <answer_validation>
95
+ Before mutating the roadmap, confirm with the user:
96
+
97
+ 1. How many gaps were found and which phases they originated from.
98
+ 2. Whether to append new phases at the milestone tail (default) or to use a
99
+ decimal insert via `--insert-after N`.
100
+ 3. Whether to proceed when the gap set is empty (usually: exit).
101
+
102
+ All three confirmations use `np-tools.cjs askuser` (Pattern 2) — NEVER a
103
+ bare `AskUserQuestion` invocation. The executor hosts will route the JSON
104
+ question through whichever UI they support.
105
+ </answer_validation>
106
+
107
+ ### Empty-gap short circuit
108
+
109
+ ```bash
110
+ if [[ $(echo "$INIT" | jq '.gaps | length') -eq 0 ]]; then
111
+ node np-tools.cjs askuser --json '{
112
+ "type": "confirm",
113
+ "prompt": "No gaps found in VERIFICATION.md scan / audit. Exit without changes?",
114
+ "default": true
115
+ }'
116
+ exit 0
117
+ fi
118
+ ```
119
+
120
+ ### Scan-mode confirmation
121
+
122
+ ```bash
123
+ MODE=$(echo "$INIT" | jq -r '.mode')
124
+ if [[ "$MODE" == "scan" ]]; then
125
+ node np-tools.cjs askuser --json '{
126
+ "type": "select",
127
+ "prompt": "Gaps found via VERIFICATION.md scan. Choose how to apply them:",
128
+ "options": [
129
+ "Proceed — append new phases to milestone tail",
130
+ "Abort — I want to re-run with --insert-after N",
131
+ "Cancel"
132
+ ]
133
+ }'
134
+ fi
135
+ ```
136
+
137
+ ### From-file confirmation
138
+
139
+ ```bash
140
+ if [[ "$MODE" == "from-file" ]]; then
141
+ node np-tools.cjs askuser --json '{
142
+ "type": "confirm",
143
+ "prompt": "Audit file parsed. Proceed to create corrective phases?",
144
+ "default": true
145
+ }'
146
+ fi
147
+ ```
148
+
149
+ ## Apply Gap-to-Phase Conversion
150
+
151
+ All file writes are delegated to `lib/gaps.cjs#gapsToPhases`. This keeps the
152
+ workflow thin: no inline YAML mutation, no direct `atomicWriteFileSync` use,
153
+ no hand-rolled slug generation. The lib function already:
154
+
155
+ - groups gaps by `source_phase` (one new phase per unique source)
156
+ - sets `depends_on: [source_phase]` (SEMANTIC — not positional)
157
+ - calls `addPhase(milestoneId, …)` or `insertPhaseAfter(base, …)` based on
158
+ `insertAfter`
159
+ - wraps the mutation in `withFileLock` and regenerates ROADMAP.md atomically
160
+
161
+ ```bash
162
+ # Compose the apply payload and invoke the lib directly via node -e. Using
163
+ # node -e keeps this file hermetic (no spawn of a separate CLI verb for
164
+ # mutation) and delegates lock + render to lib/gaps.cjs.
165
+ node -e '
166
+ const gaps = JSON.parse(process.env.GAPS);
167
+ const insertAfter = process.env.INSERT_AFTER === "null" ? null : Number(process.env.INSERT_AFTER);
168
+ const { gapsToPhases } = require("./lib/gaps.cjs");
169
+ const created = gapsToPhases(gaps, { insertAfter });
170
+ process.stdout.write(JSON.stringify({ created }, null, 2));
171
+ ' \
172
+ GAPS="$(echo "$INIT" | jq -c '.gaps')" \
173
+ INSERT_AFTER="$(echo "$INIT" | jq -r '.insertAfter // "null"')"
174
+ ```
175
+
176
+ ## Commit the Roadmap Change
177
+
178
+ The roadmap mutation is already atomic. The workflow's final step is to
179
+ commit the updated `roadmap.yaml` + regenerated `ROADMAP.md` so the change
180
+ is preserved in git history — but ONLY when `.nubos-pilot/config.json`'s
181
+ `commit_docs` flag is `true` (default).
182
+
183
+ ```bash
184
+ COMMIT_DOCS=$(node -e 'try{
185
+ const c=require("./.nubos-pilot/config.json");
186
+ process.stdout.write(String(c.commit_docs !== false));
187
+ }catch(e){process.stdout.write("true");}')
188
+
189
+ if [[ "$COMMIT_DOCS" == "true" ]]; then
190
+ # Stage and commit via the git CLI (safe arg-array form; never string-concat
191
+ # the commit message through a shell). Empty diff is silently tolerated.
192
+ git add .nubos-pilot/roadmap.yaml .nubos-pilot/ROADMAP.md
193
+ if ! git diff --cached --quiet; then
194
+ # Choose the verb from mode: append vs insert.
195
+ VERB="append"
196
+ if [[ "$(echo "$INIT" | jq -r '.insertAfter')" != "null" ]]; then
197
+ VERB="insert"
198
+ fi
199
+ git commit --no-verify -m "docs(05-05): plan-milestone-gaps ${VERB} phase(s)"
200
+ fi
201
+ else
202
+ echo "commit_docs=false — skipping roadmap commit (roadmap.yaml/ROADMAP.md remain staged-dirty)" >&2
203
+ fi
204
+ ```
205
+
206
+ ## Naming Conventions (D-03)
207
+
208
+ Canonical tokens this workflow uses:
209
+
210
+ | Token | Value |
211
+ | ------------------------------------- | ------------------------------ |
212
+ | Tools-binary | `np-tools.cjs` |
213
+ | Slash-command | `/np:plan-milestone-gaps` |
214
+ | Roadmap file path | `.nubos-pilot/ROADMAP.md` |
215
+
216
+ Auto-advance state lives on `workflow.auto_advance` (boolean). Set
217
+ from `/np:autonomous`; cleared when the loop exits or the user aborts.
218
+
219
+ ## Exit Codes
220
+
221
+ - `0` — applied successfully, or user aborted with nothing to do.
222
+ - non-zero — unrecoverable error (invalid audit path, YAML parse failure,
223
+ duplicate slug on re-run). Error code + message are emitted on stderr in
224
+ JSON `{error: {code, message, details}}` form by `np-tools.cjs`.
225
+
226
+ ## See Also
227
+
228
+ - `lib/gaps.cjs` — scan, parse, group-to-phase logic (pure, unit-tested).
229
+ - `lib/roadmap.cjs` — write API (`addMilestone`, `addPhase`,
230
+ `insertPhaseAfter`).
231
+ - Phase 05 RESEARCH § "Pitfall 5" — why `depends_on` must be semantic.
232
+ - `/np:next` — dispatches to this workflow when the project state flags
233
+ uncovered gaps.