@lumenflow/cli 4.23.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/README.md +54 -52
  2. package/dist/agent-issues-query.js +10 -2
  3. package/dist/agent-issues-query.js.map +1 -1
  4. package/dist/agent-runtime-enrollment-events.js +44 -0
  5. package/dist/agent-runtime-enrollment-events.js.map +1 -0
  6. package/dist/agent-session-end.js +47 -0
  7. package/dist/agent-session-end.js.map +1 -1
  8. package/dist/agent-session-heartbeat.js +250 -0
  9. package/dist/agent-session-heartbeat.js.map +1 -0
  10. package/dist/agent-session.js +299 -5
  11. package/dist/agent-session.js.map +1 -1
  12. package/dist/capacity-snapshot-emitter.js +73 -0
  13. package/dist/capacity-snapshot-emitter.js.map +1 -0
  14. package/dist/claim-queue.js +276 -0
  15. package/dist/claim-queue.js.map +1 -0
  16. package/dist/config-set.js +22 -3
  17. package/dist/config-set.js.map +1 -1
  18. package/dist/control-plane-sidecar-runner.js +145 -0
  19. package/dist/control-plane-sidecar-runner.js.map +1 -0
  20. package/dist/delegation-list.js +160 -1
  21. package/dist/delegation-list.js.map +1 -1
  22. package/dist/delegation-role-resolver.js +69 -0
  23. package/dist/delegation-role-resolver.js.map +1 -0
  24. package/dist/docs-generate-pack-reference.js +500 -0
  25. package/dist/docs-generate-pack-reference.js.map +1 -0
  26. package/dist/docs-sync.js +116 -1
  27. package/dist/docs-sync.js.map +1 -1
  28. package/dist/file-edit.js +28 -8
  29. package/dist/file-edit.js.map +1 -1
  30. package/dist/file-write.js +29 -5
  31. package/dist/file-write.js.map +1 -1
  32. package/dist/gate-co-change.js +25 -7
  33. package/dist/gate-co-change.js.map +1 -1
  34. package/dist/gate-conditional.js +19 -7
  35. package/dist/gate-conditional.js.map +1 -1
  36. package/dist/gates-runners.js +42 -33
  37. package/dist/gates-runners.js.map +1 -1
  38. package/dist/gates-utils.js +34 -20
  39. package/dist/gates-utils.js.map +1 -1
  40. package/dist/gates.js +79 -7
  41. package/dist/gates.js.map +1 -1
  42. package/dist/hooks/config-resolver.js +10 -1
  43. package/dist/hooks/config-resolver.js.map +1 -1
  44. package/dist/init-package-config.js +1 -1
  45. package/dist/init-package-config.js.map +1 -1
  46. package/dist/init-scaffolding.js +5 -1
  47. package/dist/init-scaffolding.js.map +1 -1
  48. package/dist/init-templates.js +10 -0
  49. package/dist/init-templates.js.map +1 -1
  50. package/dist/init.js +1 -1
  51. package/dist/init.js.map +1 -1
  52. package/dist/initiative-create.js +17 -0
  53. package/dist/initiative-create.js.map +1 -1
  54. package/dist/initiative-remove-wu.js +17 -3
  55. package/dist/initiative-remove-wu.js.map +1 -1
  56. package/dist/kernel-event-sync/emitters.js +104 -0
  57. package/dist/kernel-event-sync/emitters.js.map +1 -0
  58. package/dist/kernel-event-sync/index.js +13 -0
  59. package/dist/kernel-event-sync/index.js.map +1 -0
  60. package/dist/kernel-event-sync/lifecycle-emitters.js +160 -0
  61. package/dist/kernel-event-sync/lifecycle-emitters.js.map +1 -0
  62. package/dist/kernel-event-sync/narrow-emissions.js +89 -0
  63. package/dist/kernel-event-sync/narrow-emissions.js.map +1 -0
  64. package/dist/kernel-event-sync/software-delivery-emitters.js +297 -0
  65. package/dist/kernel-event-sync/software-delivery-emitters.js.map +1 -0
  66. package/dist/lane-lock.js +14 -1
  67. package/dist/lane-lock.js.map +1 -1
  68. package/dist/lane-suggest.js +21 -0
  69. package/dist/lane-suggest.js.map +1 -1
  70. package/dist/lumenflow-upgrade.js +7 -5
  71. package/dist/lumenflow-upgrade.js.map +1 -1
  72. package/dist/mem-context.js +145 -0
  73. package/dist/mem-context.js.map +1 -1
  74. package/dist/mem-create.js +39 -6
  75. package/dist/mem-create.js.map +1 -1
  76. package/dist/mem-inbox.js +16 -0
  77. package/dist/mem-inbox.js.map +1 -1
  78. package/dist/mem-roster.js +95 -0
  79. package/dist/mem-roster.js.map +1 -0
  80. package/dist/mem-signal.js +97 -2
  81. package/dist/mem-signal.js.map +1 -1
  82. package/dist/metrics-cli.js +3 -2
  83. package/dist/metrics-cli.js.map +1 -1
  84. package/dist/metrics-snapshot.js +271 -13
  85. package/dist/metrics-snapshot.js.map +1 -1
  86. package/dist/orchestrate-init-status.js +117 -2
  87. package/dist/orchestrate-init-status.js.map +1 -1
  88. package/dist/orchestrate-initiative.js +83 -10
  89. package/dist/orchestrate-initiative.js.map +1 -1
  90. package/dist/orchestrate-monitor-quality.js +289 -0
  91. package/dist/orchestrate-monitor-quality.js.map +1 -0
  92. package/dist/orchestrate-monitor.js +85 -0
  93. package/dist/orchestrate-monitor.js.map +1 -1
  94. package/dist/pack-validate.js +127 -2
  95. package/dist/pack-validate.js.map +1 -1
  96. package/dist/plan-create.js +18 -0
  97. package/dist/plan-create.js.map +1 -1
  98. package/dist/plan-link.js +13 -0
  99. package/dist/plan-link.js.map +1 -1
  100. package/dist/plan-promote.js +14 -0
  101. package/dist/plan-promote.js.map +1 -1
  102. package/dist/pre-commit-check.js +4 -3
  103. package/dist/pre-commit-check.js.map +1 -1
  104. package/dist/public-manifest.js +17 -3
  105. package/dist/public-manifest.js.map +1 -1
  106. package/dist/release.js +10 -10
  107. package/dist/release.js.map +1 -1
  108. package/dist/session-cross-link.js +139 -0
  109. package/dist/session-cross-link.js.map +1 -0
  110. package/dist/sidecar-manager.js +208 -0
  111. package/dist/sidecar-manager.js.map +1 -0
  112. package/dist/state-path-resolvers.js +18 -0
  113. package/dist/state-path-resolvers.js.map +1 -1
  114. package/dist/stream-heartbeat.js +151 -0
  115. package/dist/stream-heartbeat.js.map +1 -0
  116. package/dist/sync-templates.js +56 -2
  117. package/dist/sync-templates.js.map +1 -1
  118. package/dist/wu-block.js +47 -5
  119. package/dist/wu-block.js.map +1 -1
  120. package/dist/wu-claim-branch.js +8 -4
  121. package/dist/wu-claim-branch.js.map +1 -1
  122. package/dist/wu-claim-state.js +5 -3
  123. package/dist/wu-claim-state.js.map +1 -1
  124. package/dist/wu-claim-worktree.js +5 -3
  125. package/dist/wu-claim-worktree.js.map +1 -1
  126. package/dist/wu-claim.js +261 -9
  127. package/dist/wu-claim.js.map +1 -1
  128. package/dist/wu-done-auto-cleanup.js +3 -2
  129. package/dist/wu-done-auto-cleanup.js.map +1 -1
  130. package/dist/wu-done-git-ops.js +12 -8
  131. package/dist/wu-done-git-ops.js.map +1 -1
  132. package/dist/wu-done-preflight.js +3 -3
  133. package/dist/wu-done-preflight.js.map +1 -1
  134. package/dist/wu-done.js +46 -10
  135. package/dist/wu-done.js.map +1 -1
  136. package/dist/wu-lifecycle-sync/gate-scope-resolver.js +16 -0
  137. package/dist/wu-lifecycle-sync/gate-scope-resolver.js.map +1 -0
  138. package/dist/wu-lifecycle-sync/kernel-event-sync-shim.js +10 -0
  139. package/dist/wu-lifecycle-sync/kernel-event-sync-shim.js.map +1 -0
  140. package/dist/wu-prep.js +363 -22
  141. package/dist/wu-prep.js.map +1 -1
  142. package/dist/wu-prune.js +68 -27
  143. package/dist/wu-prune.js.map +1 -1
  144. package/dist/wu-release.js +34 -3
  145. package/dist/wu-release.js.map +1 -1
  146. package/dist/wu-review.js +167 -0
  147. package/dist/wu-review.js.map +1 -0
  148. package/dist/wu-spawn-prompt-builders.js +296 -40
  149. package/dist/wu-spawn-prompt-builders.js.map +1 -1
  150. package/dist/wu-spawn-strategy-resolver.js +126 -14
  151. package/dist/wu-spawn-strategy-resolver.js.map +1 -1
  152. package/dist/wu-unblock.js +52 -22
  153. package/dist/wu-unblock.js.map +1 -1
  154. package/package.json +13 -8
  155. package/packs/agent-runtime/.turbo/turbo-build.log +1 -1
  156. package/packs/agent-runtime/.turbo/turbo-test.log +25 -0
  157. package/packs/agent-runtime/.turbo/turbo-typecheck.log +4 -0
  158. package/packs/agent-runtime/agent-heartbeat.ts +163 -0
  159. package/packs/agent-runtime/auto-session-integration.ts +874 -0
  160. package/packs/agent-runtime/delegation-registry-schema.ts +220 -0
  161. package/packs/agent-runtime/delegation-registry-store.ts +269 -0
  162. package/packs/agent-runtime/delegation-tree.ts +328 -0
  163. package/packs/agent-runtime/index.ts +9 -0
  164. package/packs/agent-runtime/manifest.ts +103 -19
  165. package/packs/agent-runtime/manifest.yaml +132 -0
  166. package/packs/agent-runtime/memory-coordination-contract.ts +86 -0
  167. package/packs/agent-runtime/memory.d.ts +19 -0
  168. package/packs/agent-runtime/orchestration.ts +238 -23
  169. package/packs/agent-runtime/package.json +11 -2
  170. package/packs/agent-runtime/remote-controls/index.ts +7 -0
  171. package/packs/agent-runtime/remote-controls/operations.ts +399 -0
  172. package/packs/agent-runtime/remote-controls/port.ts +48 -0
  173. package/packs/agent-runtime/remote-controls/state-store.ts +258 -0
  174. package/packs/agent-runtime/remote-controls/types.ts +105 -0
  175. package/packs/agent-runtime/session-schema.ts +423 -0
  176. package/packs/agent-runtime/tool-impl/index.ts +1 -0
  177. package/packs/agent-runtime/tool-impl/remote-controls.mock.ts +252 -0
  178. package/packs/agent-runtime/tool-impl/remote-controls.ts +273 -0
  179. package/packs/agent-runtime/tsconfig.json +1 -1
  180. package/packs/agent-runtime/turn-lifecycle-events.ts +501 -0
  181. package/packs/sidekick/.lumenflow/state/conductor/outbox/sidekick-events.jsonl +213 -0
  182. package/packs/sidekick/.turbo/turbo-build.log +1 -1
  183. package/packs/sidekick/.turbo/turbo-test.log +25 -0
  184. package/packs/sidekick/.turbo/turbo-typecheck.log +4 -0
  185. package/packs/sidekick/channel-ingress.ts +137 -0
  186. package/packs/sidekick/manifest.ts +74 -0
  187. package/packs/sidekick/manifest.yaml +88 -0
  188. package/packs/sidekick/package.json +3 -1
  189. package/packs/sidekick/sidekick-events.ts +517 -0
  190. package/packs/sidekick/src/adapters/cloud-queue.ts +101 -0
  191. package/packs/sidekick/src/adapters/control-plane-bridge.adapter.ts +378 -0
  192. package/packs/sidekick/src/adapters/filesystem-bridge.adapter.ts +224 -0
  193. package/packs/sidekick/src/domain/channel.types.ts +84 -0
  194. package/packs/sidekick/src/ports/channel-bridge.port.ts +75 -0
  195. package/packs/sidekick/src/routines/commit.ts +74 -0
  196. package/packs/sidekick/tool-impl/channel-tools.ts +47 -0
  197. package/packs/sidekick/tool-impl/memory-tools.ts +17 -0
  198. package/packs/sidekick/tool-impl/routine-commit.ts +102 -0
  199. package/packs/sidekick/tool-impl/routine-tools.ts +67 -7
  200. package/packs/sidekick/tool-impl/runtime-context.ts +4 -0
  201. package/packs/sidekick/tool-impl/storage.ts +3 -0
  202. package/packs/sidekick/tool-impl/system-tools.ts +7 -0
  203. package/packs/sidekick/tool-impl/task-tools.ts +46 -0
  204. package/packs/sidekick/tsconfig.json +1 -1
  205. package/packs/software-delivery/.turbo/turbo-build.log +1 -1
  206. package/packs/software-delivery/.turbo/turbo-test.log +63 -0
  207. package/packs/software-delivery/.turbo/turbo-typecheck.log +4 -0
  208. package/packs/software-delivery/manifest-schema.ts +30 -0
  209. package/packs/software-delivery/manifest.ts +99 -1
  210. package/packs/software-delivery/manifest.yaml +46 -0
  211. package/packs/software-delivery/package.json +88 -3
  212. package/packs/software-delivery/src/commands/index.ts +5 -0
  213. package/packs/software-delivery/src/config/delivery-review-contract.ts +20 -0
  214. package/packs/software-delivery/src/config/env-accessors.ts +19 -0
  215. package/packs/software-delivery/src/config/index.ts +8 -0
  216. package/packs/software-delivery/src/config/normalize-config-keys.ts +19 -0
  217. package/packs/software-delivery/src/config/schemas/lumenflow-config-schema-types.ts +436 -0
  218. package/packs/software-delivery/src/config/workspace-reader.ts +310 -0
  219. package/packs/software-delivery/src/constants/backlog-patterns.ts +31 -0
  220. package/packs/software-delivery/src/constants/client-ids.ts +19 -0
  221. package/packs/software-delivery/src/constants/config-contract.ts +7 -0
  222. package/packs/software-delivery/src/constants/docs-layout-presets.ts +50 -0
  223. package/packs/software-delivery/src/constants/duration-constants.ts +20 -0
  224. package/packs/software-delivery/src/constants/gate-constants.ts +32 -0
  225. package/packs/software-delivery/src/constants/index.ts +29 -0
  226. package/packs/software-delivery/src/constants/lock-constants.ts +35 -0
  227. package/packs/software-delivery/src/constants/object-guards.ts +12 -0
  228. package/packs/software-delivery/src/constants/section-headings.ts +107 -0
  229. package/packs/software-delivery/src/constants/wu-cli-constants.ts +485 -0
  230. package/packs/software-delivery/src/constants/wu-domain-constants.ts +466 -0
  231. package/packs/software-delivery/src/constants/wu-git-constants.ts +7 -0
  232. package/packs/software-delivery/src/constants/wu-id-format.ts +327 -0
  233. package/packs/software-delivery/src/constants/wu-paths-constants.ts +358 -0
  234. package/packs/software-delivery/src/constants/wu-statuses.ts +287 -0
  235. package/packs/software-delivery/src/constants/wu-type-helpers.ts +67 -0
  236. package/packs/software-delivery/src/constants/wu-ui-constants.ts +267 -0
  237. package/packs/software-delivery/src/constants/wu-validation-constants.ts +73 -0
  238. package/packs/software-delivery/src/domain/index.ts +5 -0
  239. package/packs/software-delivery/src/domain/orchestration.constants.ts +168 -0
  240. package/packs/software-delivery/src/domain/orchestration.schemas.ts +239 -0
  241. package/packs/software-delivery/src/domain/orchestration.types.ts +178 -0
  242. package/packs/software-delivery/src/methodology/incremental-test.ts +90 -0
  243. package/packs/software-delivery/src/methodology/index.ts +6 -0
  244. package/packs/software-delivery/src/methodology/manual-test-validator.ts +292 -0
  245. package/packs/software-delivery/src/policy/coverage-gate.ts +270 -0
  246. package/packs/software-delivery/src/policy/gates-agent-mode.ts +223 -0
  247. package/packs/software-delivery/src/policy/gates-config-internal.ts +121 -0
  248. package/packs/software-delivery/src/policy/gates-config.ts +293 -0
  249. package/packs/software-delivery/src/policy/gates-coverage.ts +247 -0
  250. package/packs/software-delivery/src/policy/gates-presets.ts +134 -0
  251. package/packs/software-delivery/src/policy/gates-schemas.ts +173 -0
  252. package/packs/software-delivery/src/policy/index.ts +22 -0
  253. package/packs/software-delivery/src/policy/package-manager-resolver.ts +319 -0
  254. package/packs/software-delivery/src/policy/resolve-policy.ts +518 -0
  255. package/packs/software-delivery/src/ports/config.ports.ts +90 -0
  256. package/packs/software-delivery/src/ports/dashboard-renderer.port.ts +125 -0
  257. package/packs/software-delivery/src/ports/index.ts +10 -0
  258. package/packs/software-delivery/src/ports/sync-validator.ports.ts +59 -0
  259. package/packs/software-delivery/src/ports/wu-helpers.ports.ts +168 -0
  260. package/packs/software-delivery/src/ports/wu-state.ports.ts +241 -0
  261. package/packs/software-delivery/src/primitives/index.ts +5 -0
  262. package/packs/software-delivery/src/runtime/index.ts +6 -0
  263. package/packs/software-delivery/src/runtime/work-classifier.ts +561 -0
  264. package/packs/software-delivery/src/sandbox/index.ts +10 -0
  265. package/packs/software-delivery/src/sandbox/sandbox-allowlist.ts +118 -0
  266. package/packs/software-delivery/src/sandbox/sandbox-backend-linux.ts +88 -0
  267. package/packs/software-delivery/src/sandbox/sandbox-backend-macos.ts +154 -0
  268. package/packs/software-delivery/src/sandbox/sandbox-backend-windows.ts +47 -0
  269. package/packs/software-delivery/src/sandbox/sandbox-profile.ts +153 -0
  270. package/packs/software-delivery/src/schemas/index.ts +5 -0
  271. package/packs/software-delivery/src/state/date-utils.ts +158 -0
  272. package/packs/software-delivery/src/state/index.ts +15 -0
  273. package/packs/software-delivery/src/state/state-machine.ts +119 -0
  274. package/packs/software-delivery/src/state/wu-doc-types.ts +51 -0
  275. package/packs/software-delivery/src/state/wu-paths.ts +381 -0
  276. package/packs/software-delivery/src/state/wu-schema.ts +1139 -0
  277. package/packs/software-delivery/src/state/wu-state-schema.ts +255 -0
  278. package/packs/software-delivery/src/state/wu-yaml.ts +338 -0
  279. package/packs/software-delivery/src/types.d.ts +16 -0
  280. package/packs/software-delivery/tool-impl/wu-lifecycle-tools.ts +18 -0
  281. package/packs/software-delivery/tsconfig.json +28 -2
  282. package/templates/core/AGENTS.md.template +76 -17
  283. package/templates/core/LUMENFLOW.md.template +265 -66
  284. package/templates/core/_frameworks/lumenflow/wu-sizing-guide.md.template +180 -116
  285. package/templates/core/ai/onboarding/agent-invocation-guide.md.template +26 -8
  286. package/templates/core/ai/onboarding/existing-project-bootstrap.md.template +171 -0
  287. package/templates/core/ai/onboarding/first-15-mins.md.template +3 -1
  288. package/templates/core/ai/onboarding/first-wu-mistakes.md.template +1 -1
  289. package/templates/core/ai/onboarding/initiative-orchestration.md.template +46 -30
  290. package/templates/core/ai/onboarding/quick-ref-commands.md.template +36 -33
  291. package/templates/core/ai/onboarding/release-process.md.template +8 -7
  292. package/templates/core/ai/onboarding/starting-prompt.md.template +2 -0
  293. package/templates/core/ai/onboarding/troubleshooting-wu-done.md.template +62 -0
  294. package/templates/vendors/claude/.claude/CLAUDE.md.template +29 -54
  295. package/templates/vendors/cursor/.cursor/rules/lumenflow.md.template +24 -52
  296. package/templates/vendors/windsurf/.windsurf/rules/lumenflow.md.template +24 -52
@@ -14,7 +14,7 @@ Before claiming a WU, estimate its "weight" using these heuristics.
14
14
 
15
15
  | Complexity | Files | Tool Calls | Context Budget | Strategy |
16
16
  | :------------ | :---- | :--------- | :------------- | :---------------------------------------------------------------------------------------------------------- |
17
- | **Simple** | <20 | <50 | <30% | **Single Session** (Tier 2 Context) |
17
+ | **Simple** | <20 | <50 | <30% | **Single Session** |
18
18
  | **Medium** | 20-50 | 50-100 | 30-50% | **Checkpoint-Resume** (Standard Handoff) |
19
19
  | **Complex** | 50+ | 100+ | >50% | **Orchestrator-Worker** or **Checkpoint-Resume**; split only if non-atomic |
20
20
  | **Oversized** | 100+ | 200+ | — | **Re-check cohesion**; split only when the work cannot land as one coherent outcome or no exception applies |
@@ -75,6 +75,33 @@ Agents consistently under-apply the cohesion rule, defaulting to micro-splitting
75
75
 
76
76
  **Apply this checklist iteratively.** After your first pass at splitting, re-run the checklist. If any merges are possible, merge and re-run again. Stop only when no further merges pass the checklist. Real-world experience shows the first pass typically over-splits by 2-3x.
77
77
 
78
+ ### 1.0.2 How to Estimate
79
+
80
+ The matrix in §1 demands `estimated_files` and `estimated_tool_calls` numbers, but agents (and humans) consistently under-estimate scope. WU-1215 declared 708 LOC and shipped against 768 LOC + 100 control-flow statements — an 8% file-size miss that compounded into a 5x tool-call miss. Use the heuristics below before you commit to a sizing strategy.
81
+
82
+ **Pre-claim heuristics (run these in order):**
83
+
84
+ 1. **Read the entry point.** Open the file you'll modify first and skim it end-to-end. If it's >500 lines or contains >50 control-flow branches, treat the WU as Medium minimum even if file count looks Simple.
85
+ 2. **Grep call sites for any symbol you'll rename or change.** `rg -l '<symbol>'` gives you a hard floor on file count. If grep returns >20 hits, you are at least Medium — stop estimating from intuition.
86
+ 3. **Count test files that touch the area.** `rg -l '<symbol>' --type ts -g '*.test.*'`. Each test file is at minimum 1 read + 1 edit + 1 verify = 3 tool calls.
87
+ 4. **Multiply by 3 for unfamiliar code, 1.5 for familiar code.** Rough rule: if you have not touched this module in the last 30 days, your first instinct is wrong by ~3x. Bias upward.
88
+ 5. **Add a 30% buffer for gates and handoff.** Format, lint, typecheck, test runs, `wu:prep`, `wu:done`, and any rebase/conflict resolution typically consume 15-20 tool calls before you ship — bake them into the estimate.
89
+
90
+ **Sanity-check thresholds:**
91
+
92
+ - If your estimate sits at exactly the boundary (e.g., 19 files, 49 tool calls), round up a tier. Boundary estimates almost always tip over once execution starts.
93
+ - If you find yourself justifying why a Complex estimate "should really be Medium," you are wrong. Honour the larger estimate and pick the matching strategy.
94
+ - If estimation itself takes >10 tool calls, the WU is probably oversized — re-check cohesion (§1.0) and consider whether a §1.5 Pre-Phase Audit would scope it better.
95
+
96
+ **When to skip estimation:**
97
+
98
+ - Trivial bug fixes where you have already opened the file and identified the change (1-2 tool calls). Mark `single-session` and move on.
99
+ - Documentation WUs touching one file (this WU, for example).
100
+
101
+ For everything else, the 5 minutes of grep + skim spent estimating saves the cost of a mid-WU spawn-fresh recovery.
102
+
103
+ ---
104
+
78
105
  ### 1.1 Documentation-Only Exception
79
106
 
80
107
  Documentation WUs (`type: documentation`) have relaxed file count thresholds because:
@@ -140,14 +167,16 @@ A WU touching 30 files where each requires unique logic changes, test updates, o
140
167
 
141
168
  ### 1.3 Examples Summary
142
169
 
143
- | WU Type | Files | Eligible for Override? | Reasoning |
144
- | :-------------------------- | :---- | :--------------------- | :--------------------------------------------- |
145
- | Docs: update 25 markdown | 25 | Yes (docs exception) | <40 files, docs-only, low complexity |
146
- | Docs: reorg 60 doc files | 60 | Yes (docs exception) | <80 files = Medium, checkpoint-resume strategy |
147
- | Code: rename import in 45 | 45 | Yes (shallow override) | Uniform 1-line changes, no structural edits |
148
- | Code: refactor 30 files | 30 | No | Each file has unique logic changes |
149
- | Code: add feature across 25 | 25 | No | Exceeds 20-file threshold, structural changes |
150
- | Docs + Code: mixed 15 files | 15 | No | Not docs-only, standard code thresholds apply |
170
+ | WU Type | Files | Eligible for Override? | Reasoning |
171
+ | :--------------------------- | :---- | :----------------------- | :------------------------------------------------------------------ |
172
+ | Docs: update 25 markdown | 25 | Yes (docs exception) | <40 files, docs-only, low complexity |
173
+ | Docs: reorg 60 doc files | 60 | Yes (docs exception) | <80 files = Medium, checkpoint-resume strategy |
174
+ | Code: rename import in 45 | 45 | Yes (shallow override) | Uniform 1-line changes, no structural edits |
175
+ | Code: refactor 30 files | 30 | No | Each file has unique logic changes |
176
+ | Code: add feature across 25 | 25 | No | Exceeds 20-file threshold, structural changes |
177
+ | Docs + Code: mixed 15 files | 15 | No | Not docs-only, standard code thresholds apply |
178
+ | Review: audit 80 components | 80 | Yes (review-audit, §1.4) | Read-only; spawn 4-6 parallel sub-agents with non-overlapping scope |
179
+ | Review: security audit, auth | 30 | Yes (review-audit, §1.4) | Read-only; spawn 3-4 agents (RLS, middleware, secrets, API surface) |
151
180
 
152
181
  ---
153
182
 
@@ -236,7 +265,51 @@ sizing_estimate:
236
265
 
237
266
  ---
238
267
 
239
- ### 1.5 Sizing Contract (Tooling-Backed Enforcement) (WU-2141)
268
+ ### 1.5 Pre-Phase Audit (No WU)
269
+
270
+ Sometimes the orchestrator needs to investigate _before_ it can scope the next phase of work correctly. This is **not** a review WU — the output is the scope of the follow-up WU(s), not a standalone report. It is also not an exception clause for an over-sized single WU (sections 1.1/1.2) — it is a scoping activity the orchestrator performs inline, with no WU YAML at all.
271
+
272
+ #### When to use
273
+
274
+ - An earlier phase surfaced an architectural unknown (cycle, dep, interface shape) that blocks clean scoping of the next WU
275
+ - The investigation is read-only, narrow, and bounded
276
+ - The output is used immediately by the orchestrator to write the next WU spec
277
+
278
+ #### Criteria (ALL must be true)
279
+
280
+ - **Read-only**: no code changes, no YAML edits, no commits
281
+ - **Narrow scope**: typically one dep-graph question, one file interaction, or one schema shape
282
+ - **Bounded budget**: tool-call count fits in a single orchestrator turn (typically <25 tool calls)
283
+ - **Output = next WU scope**: findings inform WU creation immediately; they are not promoted to a standalone document
284
+
285
+ #### Not to use
286
+
287
+ - If the investigation spans multiple files or concerns → use section 1.4 (Review, Audit, Exploration WU) instead, and spawn parallel sub-agents with a report as the output
288
+ - If the output would become a design document or ADR → create a documentation WU for it
289
+ - If any findings require code changes → those belong in their own WU, not inline
290
+
291
+ #### How this differs from neighbouring sections
292
+
293
+ - **vs §1.4 (Review/Audit/Exploration WU)** — §1.4 WUs produce a report as their output and typically spawn parallel sub-agents. Pre-phase audits produce no report; their only artifact is the next WU's scope, captured in the follow-up WU YAML.
294
+ - **vs §1.1 / §1.2 (Docs-only / Shallow multi-file exceptions)** — those sections relax sizing thresholds for a _single WU that is being executed_. Pre-phase audits happen _before_ a WU is scoped; there is no WU to apply an exception to.
295
+
296
+ #### Example
297
+
298
+ During INIT-058 Wave 2, WU-2672 failed with a turbo cyclic dependency error. Before scoping follow-up work, the orchestrator ran an inline audit in ~5 tool calls:
299
+
300
+ 1. Grep `packages/@lumenflow/packs/software-delivery` for `@lumenflow/core` imports
301
+ 2. Inspect `packages/@lumenflow/packs/software-delivery/package.json` dependencies
302
+ 3. Check the two files that imported `CoverageMode`
303
+
304
+ Finding: the pack's `package.json` declared only `@lumenflow/kernel` as a LumenFlow dep, and the pack had zero static imports of `@lumenflow/core` (one lazy dynamic import in one file). The cycle was self-inflicted by the previous sub-agent adding `@lumenflow/core` to the pack's deps. That audit took minutes, bypassed the need for a dedicated audit WU, and unblocked scoping of WU-2674 (a correct cohesion-closed bundle strategy) without a dead WU-2672-style shim attempt. Without this pattern, future orchestrators would default to §1.4 (overkill for a read-only 5-call check) or dispatch blind (re-introducing the same failure mode).
305
+
306
+ #### Contract
307
+
308
+ This pattern is informal — no `sizing_estimate` metadata, no WU YAML. The orchestrator's conversation log is the audit trail; significant findings should be captured via `pnpm mem:create --type discovery` so downstream agents can see them. If the investigation starts expanding beyond the bounded budget, stop and create a §1.4 Review WU instead.
309
+
310
+ ---
311
+
312
+ ### 1.6 Sizing Contract (Tooling-Backed Enforcement) (WU-2141)
240
313
 
241
314
  The sizing thresholds in sections 1.0-1.2 are now enforced by CLI tooling. The `sizing_estimate` metadata contract lets agents declare their sizing intent at WU creation time, and the tooling validates compliance.
242
315
 
@@ -363,52 +436,75 @@ Strict mode is intended for teams that want to enforce sizing discipline before
363
436
 
364
437
  ## 2. Strategy Decision Tree
365
438
 
366
- Use this logic to select your approach. If `git status` ever shows >20 modified files, STOP and re-evaluate cohesion and strategy. Do not auto-split on file count alone. First check the cohesion rule, the required ship/review/rollback question, and the documented exceptions.
439
+ Cohesion comes first. Sizing is a strategy question, not a splitting question. Use this tree to pick an execution strategy **after** the cohesion rule (§1.0) and consolidation checklist (§1.0.1) have confirmed you have one coherent outcome. If `git status` ever shows >20 modified files mid-WU, STOP and re-evaluate cohesion before continuing.
367
440
 
368
441
  ```
369
- ┌─────────────────────────┐
370
- Start WU Analysis
371
- └────────────┬────────────┘
372
-
373
-
374
- ┌──────────────┐
375
- Est. Tool
376
- Calls > 50?
377
- └──┬────────┬──┘
378
-
379
- No Yes
380
-
381
-
382
- ┌─────────┐ ┌────────────────┐
383
- Standard Complexity │
384
- Strategy Type?
385
- (Tier 2) │ └──┬──────────┬──┘
386
- └─────────┘
387
-
388
- Single Domain Multi-Domain
389
- Clear Phases High Coordination
390
-
391
-
392
- ┌──────────────┐ ┌────────────────┐
393
- Checkpoint- │ │ Must Land │
394
- Resume │ │ Atomically?
395
- │• Investigate └──┬──────────┬──┘
396
- │• Implement
397
- │• Mid-WU Yes No
398
- Handoff │ │ │
399
- └──────────────┘ ▼ ▼
400
- ┌──────────────┐ ┌──────────────┐
401
- Orchestrator- │Decomposition
402
- │Worker │ │• Split WUs
403
- │• Main Agent │• Feature │
404
- │ = Coord. │ │ Flags │
405
- │• Spawns: │ │• Dependencies│
406
- Tester, └──────────────┘
407
- Guardian,
408
- │ Coder │
409
- └──────────────┘
442
+ ┌─────────────────────────────────────────┐
443
+ Start WU Analysis
444
+ └────────────────────┬────────────────────┘
445
+
446
+
447
+ ┌───────────────────────┐
448
+ §1.0 Cohesion check:
449
+ one coherent outcome?
450
+ └──┬─────────────────┬──┘
451
+
452
+ Yes No
453
+
454
+
455
+ │ ┌───────────────────────┐
456
+ §1.0.1 Consolidation
457
+ checklist (iterate)
458
+ └──────────┬────────────┘
459
+
460
+ Still multiple
461
+ │ independent outcomes?
462
+ │ │
463
+ ┌──────┴──────┐
464
+ No Yes
465
+ │ │ │
466
+ ▼ ▼
467
+ (one WU) ┌──────────────┐
468
+ │ │ │Decomposition
469
+ (§3 patterns) │
470
+ │ └──────────────┘
471
+
472
+ ┌───────────────────┴──┐
473
+ §1.0.2 Estimate: │
474
+ files & tool calls
475
+ └──────────┬───────────┘
476
+
477
+
478
+ ┌───────────────┐
479
+ Estimated
480
+ tool calls?
481
+ └──┬──────┬──┬──┘
482
+ │ │ │
483
+ <50 50-100 >100
484
+ │ │ │
485
+ ▼ ▼ ▼
486
+ ┌─────────┐ ┌─────────────┐ ┌────────────────────┐
487
+ │ Single │ │ Checkpoint- │ │ Multi-domain or │
488
+ │ Session │ │ Resume │ │ atomic delivery? │
489
+ └─────────┘ └─────────────┘ └──┬──────────────┬──┘
490
+ │ │
491
+ Yes No
492
+ │ │
493
+ ▼ ▼
494
+ ┌──────────────────┐ ┌────────────┐
495
+ │ Orchestrator- │ │ Checkpoint-│
496
+ │ Worker (§3 │ │ Resume │
497
+ │ patterns; spawn │ └────────────┘
498
+ │ tester/guardian) │
499
+ └──────────────────┘
410
500
  ```
411
501
 
502
+ **Reading the tree:**
503
+
504
+ - The first branch is always cohesion. Decomposition (§3) is reachable only when the consolidation checklist confirms genuinely independent outcomes — never as a default response to a high tool-call estimate.
505
+ - Once cohesion is settled, the second branch picks an _execution_ strategy from the §1 matrix. A Complex WU stays one WU; it just needs Orchestrator-Worker or Checkpoint-Resume to ship.
506
+ - Exceptions (§1.1 docs-only, §1.2 shallow multi-file, §1.4 review/audit) bypass the sizing-tier branch — apply them at estimation time, not in the tree.
507
+
412
508
  ---
413
509
 
414
510
  ## 3. Splitting Patterns (Decomposition)
@@ -487,91 +583,57 @@ Only use these patterns after you have confirmed the work is no longer one coher
487
583
 
488
584
  ---
489
585
 
490
- ## 4. Context Safety Triggers
491
-
492
- **Heading:** Default Triggers (Deviations require written justification in WU notes)
493
-
494
- If you hit ANY of these triggers during a session, you MUST perform a Standard Session Handoff:
495
-
496
- - **Token Limit:** Context usage hits **50% (Warning)** or **80% (Critical)**.
497
- - **Tool Volume:** **50+ tool calls** in current session.
498
- - **File Volume:** **20+ files** modified in `git status`.
499
- - **Session Staleness:** Repeated redundant queries or forgotten context (performance degradation).
500
-
501
- **Why these triggers matter:** Ignoring them led to the WU-1215 failure. An agent consumed 40% of context (80k tokens) on analysis alone, violated worktree discipline using absolute paths, and failed to deliver implementation. Preserve your reasoning capability by clearing context before you crash.
502
-
503
- **Performance degradation symptoms:**
586
+ ## 4. Context Safety and Handoff
504
587
 
505
- - Redundant tool calls (re-fetching already retrieved information)
506
- - Lost worktree discipline (edits landing in main instead of worktree)
507
- - Forgotten decisions or contradicting earlier conclusions
508
- - Increased latency on similar operations
588
+ When a session approaches its limits, the correct response is to checkpoint and spawn a fresh agent — not to continue through compaction. Compaction summarises the conversation, which routinely loses worktree discipline, WU context, and constraint rules. Spawning fresh from a clean checkpoint is simpler and more reliable than any recovery mechanism. This is the policy that emerged from the WU-1215 failure (analysis consumed 40% of context, worktree discipline lost, zero implementation shipped).
509
589
 
510
- **When triggers fire:**
511
-
512
- 1. Update WU YAML `notes` field with progress, decisions, and next steps
513
- 2. Run `pnpm mem:checkpoint --wu WU-XXX`
514
- 3. Commit work to the lane branch (in the worktree)
515
- 4. Push the lane branch to origin
516
- 5. Generate a fresh handoff with `pnpm wu:brief --id WU-XXX --client <client>`
517
- 6. Resume fresh from the documented checkpoint
518
-
519
- **Deviation protocol:** If a trigger fires but you believe an exception applies, check section 1.1 (Documentation-Only Exception) or section 1.2 (Shallow Multi-File Exception). If your WU qualifies:
520
-
521
- 1. Document the justification in WU notes (required)
522
- 2. Specify which exception applies and why
523
- 3. Monitor for performance degradation symptoms listed above
524
- 4. If symptoms appear, checkpoint and spawn fresh regardless of file count
525
-
526
- ---
527
-
528
- ## 5. Spawn Fresh, Don't Continue (Mandatory Policy)
529
-
530
- **When approaching context limits, spawn a fresh agent instead of continuing after compaction.**
531
-
532
- Context compaction (summarization) causes agents to lose critical rules. The recommended approach from [Anthropic's engineering guidance](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) is:
590
+ This aligns with [Anthropic's engineering guidance for long-running harnesses](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents):
533
591
 
534
592
  > "An initializer agent that sets up the environment, and a coding agent tasked with **making incremental progress in every session**, while leaving clear artifacts for the next session."
535
593
 
536
- ### When to Spawn Fresh
594
+ ### Triggers (Mandatory Handoff)
537
595
 
538
- Spawn a fresh agent when ANY of these apply:
596
+ Perform a handoff if **any** of these fire:
539
597
 
540
- - Context usage exceeds 80%
541
- - Tool calls exceed 50 in current session
542
- - You notice performance degradation (redundant queries, forgotten context)
543
- - You're about to run `/compact` or `/clear`
598
+ - **Context budget:** usage reaches **50% (Warning)** or **80% (Critical)**.
599
+ - **Tool volume:** **50+ tool calls** in the current session.
600
+ - **File volume:** **20+ files** modified in `git status` (re-evaluate cohesion first — see §1.0).
601
+ - **Performance degradation:** redundant tool calls, edits landing in main instead of the worktree, forgotten or contradicted earlier decisions, increasing latency on similar operations.
602
+ - **About to run `/compact` or `/clear`:** spawn fresh instead.
544
603
 
545
- ### Spawn Fresh Protocol
604
+ ### Handoff Protocol
546
605
 
547
606
  ```bash
548
- # 1. Checkpoint your progress
607
+ # 1. Checkpoint your progress (memory layer)
549
608
  pnpm mem:checkpoint "Progress: completed X, next: Y" --wu WU-XXX
550
609
 
551
- # 2. Commit and push work
610
+ # 2. Update WU YAML notes via wu:edit (decisions, next steps)
611
+ pnpm wu:edit --id WU-XXX --notes "<progress + next steps>"
612
+
613
+ # 3. Commit and push the lane branch (from the worktree)
552
614
  git add -A && git commit -m "checkpoint: progress on X"
553
615
  git push origin lane/<lane>/wu-xxx
554
616
 
555
- # 3. Generate fresh agent prompt
617
+ # 4. Generate the fresh-agent prompt
556
618
  pnpm wu:brief --id WU-XXX --client <client>
557
619
 
558
- # 4. EXIT current session (do NOT continue after compaction)
620
+ # 5. EXIT this session do NOT continue after compaction.
559
621
 
560
- # 5. Start fresh agent with the generated prompt
622
+ # 6. Start a fresh agent with the generated prompt.
561
623
  ```
562
624
 
563
- ### Why Not Continue After Compaction?
625
+ ### Deviation Protocol (Exceptions)
564
626
 
565
- - Compaction summarizes conversation rules get lost in summary
566
- - Agent forgets worktree discipline, WU context, constraints
567
- - Recovery mechanisms are complex and vendor-specific
568
- - Prevention (fresh agent) is simpler and more reliable than recovery
627
+ If a trigger fires but you believe an exception applies, check §1.1 (docs-only), §1.2 (shallow multi-file), or §1.4 (review/audit). If your WU qualifies:
569
628
 
570
- **This is not failure—it's disciplined execution.** Each agent session makes bounded progress and leaves clear artifacts for the next session.
629
+ 1. Document the justification in WU notes (required, not optional).
630
+ 2. Name the exception and explain why it applies.
631
+ 3. Watch for the degradation symptoms above.
632
+ 4. If symptoms appear, checkpoint and spawn fresh regardless of the exception — exceptions cover sizing thresholds, not cognitive ones.
571
633
 
572
634
  ---
573
635
 
574
- ## 6. Quick Reference
636
+ ## 5. Quick Reference
575
637
 
576
638
  | Scenario | Strategy | Action |
577
639
  | :----------------------------------------------- | :------------------ | :------------------------------------------------------------ |
@@ -587,7 +649,7 @@ pnpm wu:brief --id WU-XXX --client <client>
587
649
 
588
650
  ---
589
651
 
590
- ## 7. Case Study: WU-1215 (Learning from Failure)
652
+ ## 6. Case Study: WU-1215 (Learning from Failure)
591
653
 
592
654
  **WU:** Refactor wu-done.mjs 768-line `main()` function
593
655
 
@@ -617,7 +679,7 @@ This is a case study in genuinely non-atomic work. Do not generalize it into "mu
617
679
 
618
680
  ---
619
681
 
620
- ## 8. Related Documentation
682
+ ## 7. Related Documentation
621
683
 
622
684
  - [agent-safety-card.md](./agent/onboarding/agent-safety-card.md) — Quick reference safety thresholds
623
685
  - [agent-invocation-guide.md](./agent/onboarding/agent-invocation-guide.md) — Orchestrator-worker patterns
@@ -627,16 +689,18 @@ This is a case study in genuinely non-atomic work. Do not generalize it into "mu
627
689
 
628
690
  ---
629
691
 
630
- **Version:** 1.6 ({{DATE}})
692
+ **Version:** 1.8 ({{DATE}})
631
693
  **Last Updated:** {{DATE}}
632
694
  **Contributors:** Claude (research), Codex (pragmatic framing), Gemini (trigger enforcement)
633
695
 
634
696
  **Changelog:**
635
697
 
698
+ - v1.8 ({{DATE}}): Re-rooted §2 decision tree at the cohesion check (so it now matches the prose in §1.0/§1.0.1 instead of starting at the tool-call branch). Merged former §4 (Context Safety Triggers) and §5 (Spawn Fresh) into a single §4 "Context Safety and Handoff" — duplicated trigger lists and handoff protocols collapsed. Added §1.0.2 "How to Estimate" with concrete pre-claim heuristics (read entry point, grep call sites, count test files, multiplier rule, gates buffer). Added review-WU rows to §1.3 examples summary. Removed the undefined "Tier 2 Context" parenthetical from the §1 matrix. Renumbered §6 Quick Reference → §5, §7 Case Study → §6, §8 Related Documentation → §7. Sorted this changelog reverse-chronological. (WU-2676)
699
+ - v1.7 ({{DATE}}): Added section 1.5 (Pre-Phase Audit / No WU) — orchestrator inline investigation pattern distinct from §1.4 Review WUs. Renumbered Sizing Contract to §1.6. Emerged from INIT-058 Wave 2 orchestration (WU-2675).
636
700
  - v1.6 ({{DATE}}): Added section 1.4 (Review, Audit, and Exploration WUs) addressing multi-agent parallelism for read-heavy WUs. Fixes the "multiple passes" problem where agents under-scope review WUs. Deleted stale CLI docs shadow copy missed by WU-2398. Fixed broken relative links. Renumbered sizing contract to section 1.5.
637
701
  - v1.5 ({{DATE}}): Consolidated from two files into single canonical doc. Added consolidation checklist (1.0.1) to counter systematic agent over-splitting. Strengthened anti-patterns with additional examples.
638
- - v1.3 ({{DATE}}): Added sizing contract section (1.4) documenting tooling-backed enforcement via `sizing_estimate` metadata, advisory warnings in `wu:create`, and `--strict-sizing` mode in `wu:brief` (WU-2141, WU-2143).
639
702
  - v1.4 ({{DATE}}): Tightened anti-fragmentation guidance. Complex and oversized heuristics now force a cohesion re-check before decomposition, added explicit anti-patterns for backend/tests/docs micro-splitting, and replaced `/clear`-centric recovery advice with checkpoint + `wu:brief` handoff guidance.
703
+ - v1.3 ({{DATE}}): Added sizing contract section (1.4) documenting tooling-backed enforcement via `sizing_estimate` metadata, advisory warnings in `wu:create`, and `--strict-sizing` mode in `wu:brief` (WU-2141, WU-2143).
640
704
  - v1.2 ({{DATE}}): Added documentation-only exception (section 1.1), shallow multi-file exception with single-session override criteria (section 1.2), and examples summary table (section 1.3). Updated deviation protocol to reference exceptions.
641
705
  - v1.1 ({{DATE}}): Removed time-based estimates (hours); replaced with tool-call and context-budget heuristics. Agents operate in context windows, not clock time.
642
706
  - v1.0 ({{DATE}}): Initial version based on WU-1215 post-mortem.
@@ -8,7 +8,7 @@ Use this document when:
8
8
 
9
9
  - Generating delegation briefs for sub-agents or parallel WUs
10
10
  - Recording `wu:brief` evidence when implementing a WU in the current session
11
- - Writing orchestrator prompts
11
+ - Reviewing orchestration handoff artifacts
12
12
  - Starting a new session after `/clear`
13
13
  - Coordinating multi-wave initiatives
14
14
 
@@ -23,7 +23,7 @@ Load context in this order to reduce "lost in the middle" failures:
23
23
  3. `lumenflow-agent-capsule.md` — constraints + governance
24
24
  4. WU YAML — current task spec
25
25
  5. Task instructions — what to do
26
- 6. **Critical Constraints block** — append at the end (see below)
26
+ 6. **Critical Constraints block** — use only for non-canonical prompts (see below)
27
27
 
28
28
  **Tier guidance:**
29
29
 
@@ -110,7 +110,7 @@ It also stores **brief attestation metadata** (SHA-256 prompt hash, client, time
110
110
 
111
111
  It does **not** by itself prove pickup or execution. Pickup/execution confirmation comes from lifecycle evidence (claim/completion events, checkpoints, signals, and final `wu:done`).
112
112
 
113
- `wu:done` now enforces, for initiative-governed and explicitly delegated WUs:
113
+ For initiative-governed and explicitly delegated WUs, `wu:done` enforces:
114
114
 
115
115
  - Delegation lineage exists
116
116
  - Claim-time pickup evidence exists
@@ -133,9 +133,21 @@ pnpm wu:brief --id WU-XXX --client <client>
133
133
 
134
134
  ---
135
135
 
136
- ## 3) Spawn Prompt Structure (Recommended)
136
+ ## 3) Canonical Handoff Surfaces
137
137
 
138
- Use this structure for sub-agent prompts:
138
+ Use the canonical handoff output verbatim when you have it:
139
+
140
+ - `pnpm wu:brief --id WU-XXX --client <client>` for self-implementation
141
+ - `pnpm wu:delegate --id WU-XXX --parent-wu <P> --client <client>` for auditable delegation
142
+ - `pnpm orchestrate:initiative ... --print-handoffs` when you need orchestration to replay stored
143
+ handoff artifacts inline for manual copy/paste
144
+
145
+ These surfaces already assemble the objective, scope, code paths, tests, recovery guidance,
146
+ constraints block, and evidence metadata. Do not prepend or append a second wrapper block around
147
+ them.
148
+
149
+ If you are building a fully custom or experimental prompt outside those canonical surfaces, use
150
+ this structure:
139
151
 
140
152
  1. **Objective** — clear, single outcome
141
153
  2. **Scope** — what is in/out of scope
@@ -143,7 +155,7 @@ Use this structure for sub-agent prompts:
143
155
  4. **Tests/Gates** — required checks
144
156
  5. **Progress Artifacts** — checkpoints, commits, signals
145
157
  6. **Recovery** — what to do if blocked
146
- 7. **Critical Constraints** — append at the end
158
+ 7. **Critical Constraints** — include only if the canonical renderer is not in use
147
159
 
148
160
  ---
149
161
 
@@ -174,9 +186,13 @@ This ensures documentation WUs do not receive TDD directives, and methodology-sp
174
186
 
175
187
  ---
176
188
 
177
- ## 4) Append These Constraints at the End (Mandatory)
189
+ ## 4) Manual Fallback Constraints (Non-Canonical Prompts Only)
190
+
191
+ Use this block only when you are assembling a prompt outside `wu:brief`, `wu:delegate`, or the
192
+ stored orchestration handoff artifacts. If you are using one of those canonical surfaces, do not
193
+ append this block again.
178
194
 
179
- Paste this block at the end of every multi-agent prompt:
195
+ When needed, paste this block at the end of the custom prompt:
180
196
 
181
197
  ```
182
198
  CRITICAL CONSTRAINTS (append at end, do not omit):
@@ -206,6 +222,8 @@ After spawning:
206
222
 
207
223
  - Monitor with `pnpm mem:inbox --since 30m`
208
224
  - Use `pnpm mem:ready --wu WU-XXX` for handoff status
225
+ - Use the stored orchestration handoff artifact path or `--print-handoffs` if a human needs the
226
+ inline payload; do not rebuild the handoff text locally
209
227
 
210
228
  ---
211
229