@lumenflow/cli 4.24.0 → 5.0.1

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 (287) 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-snapshot.js +3 -2
  83. package/dist/metrics-snapshot.js.map +1 -1
  84. package/dist/orchestrate-init-status.js +117 -2
  85. package/dist/orchestrate-init-status.js.map +1 -1
  86. package/dist/orchestrate-initiative.js +83 -10
  87. package/dist/orchestrate-initiative.js.map +1 -1
  88. package/dist/orchestrate-monitor-quality.js +289 -0
  89. package/dist/orchestrate-monitor-quality.js.map +1 -0
  90. package/dist/orchestrate-monitor.js +85 -0
  91. package/dist/orchestrate-monitor.js.map +1 -1
  92. package/dist/pack-validate.js +127 -2
  93. package/dist/pack-validate.js.map +1 -1
  94. package/dist/plan-create.js +18 -0
  95. package/dist/plan-create.js.map +1 -1
  96. package/dist/plan-link.js +13 -0
  97. package/dist/plan-link.js.map +1 -1
  98. package/dist/plan-promote.js +14 -0
  99. package/dist/plan-promote.js.map +1 -1
  100. package/dist/pre-commit-check.js +4 -3
  101. package/dist/pre-commit-check.js.map +1 -1
  102. package/dist/public-manifest.js +17 -3
  103. package/dist/public-manifest.js.map +1 -1
  104. package/dist/release.js +28 -10
  105. package/dist/release.js.map +1 -1
  106. package/dist/session-cross-link.js +139 -0
  107. package/dist/session-cross-link.js.map +1 -0
  108. package/dist/sidecar-manager.js +208 -0
  109. package/dist/sidecar-manager.js.map +1 -0
  110. package/dist/state-path-resolvers.js +18 -0
  111. package/dist/state-path-resolvers.js.map +1 -1
  112. package/dist/stream-heartbeat.js +151 -0
  113. package/dist/stream-heartbeat.js.map +1 -0
  114. package/dist/sync-templates.js +56 -2
  115. package/dist/sync-templates.js.map +1 -1
  116. package/dist/wu-block.js +47 -5
  117. package/dist/wu-block.js.map +1 -1
  118. package/dist/wu-claim-branch.js +8 -4
  119. package/dist/wu-claim-branch.js.map +1 -1
  120. package/dist/wu-claim-state.js +5 -3
  121. package/dist/wu-claim-state.js.map +1 -1
  122. package/dist/wu-claim-worktree.js +5 -3
  123. package/dist/wu-claim-worktree.js.map +1 -1
  124. package/dist/wu-claim.js +261 -9
  125. package/dist/wu-claim.js.map +1 -1
  126. package/dist/wu-done-auto-cleanup.js +3 -2
  127. package/dist/wu-done-auto-cleanup.js.map +1 -1
  128. package/dist/wu-done-git-ops.js +12 -8
  129. package/dist/wu-done-git-ops.js.map +1 -1
  130. package/dist/wu-done-preflight.js +3 -3
  131. package/dist/wu-done-preflight.js.map +1 -1
  132. package/dist/wu-done.js +46 -10
  133. package/dist/wu-done.js.map +1 -1
  134. package/dist/wu-lifecycle-sync/gate-scope-resolver.js +16 -0
  135. package/dist/wu-lifecycle-sync/gate-scope-resolver.js.map +1 -0
  136. package/dist/wu-lifecycle-sync/kernel-event-sync-shim.js +10 -0
  137. package/dist/wu-lifecycle-sync/kernel-event-sync-shim.js.map +1 -0
  138. package/dist/wu-prep.js +363 -22
  139. package/dist/wu-prep.js.map +1 -1
  140. package/dist/wu-prune.js +68 -27
  141. package/dist/wu-prune.js.map +1 -1
  142. package/dist/wu-release.js +34 -3
  143. package/dist/wu-release.js.map +1 -1
  144. package/dist/wu-review.js +167 -0
  145. package/dist/wu-review.js.map +1 -0
  146. package/dist/wu-spawn-prompt-builders.js +296 -40
  147. package/dist/wu-spawn-prompt-builders.js.map +1 -1
  148. package/dist/wu-spawn-strategy-resolver.js +126 -14
  149. package/dist/wu-spawn-strategy-resolver.js.map +1 -1
  150. package/dist/wu-unblock.js +52 -22
  151. package/dist/wu-unblock.js.map +1 -1
  152. package/package.json +13 -8
  153. package/packs/agent-runtime/agent-heartbeat.ts +163 -0
  154. package/packs/agent-runtime/auto-session-integration.ts +874 -0
  155. package/packs/agent-runtime/delegation-registry-schema.ts +220 -0
  156. package/packs/agent-runtime/delegation-registry-store.ts +269 -0
  157. package/packs/agent-runtime/delegation-tree.ts +328 -0
  158. package/packs/agent-runtime/index.ts +9 -0
  159. package/packs/agent-runtime/manifest.ts +109 -19
  160. package/packs/agent-runtime/manifest.yaml +150 -0
  161. package/packs/agent-runtime/memory-coordination-contract.ts +86 -0
  162. package/packs/agent-runtime/memory.d.ts +19 -0
  163. package/packs/agent-runtime/orchestration.ts +238 -23
  164. package/packs/agent-runtime/package.json +11 -2
  165. package/packs/agent-runtime/remote-controls/index.ts +7 -0
  166. package/packs/agent-runtime/remote-controls/operations.ts +399 -0
  167. package/packs/agent-runtime/remote-controls/port.ts +48 -0
  168. package/packs/agent-runtime/remote-controls/state-store.ts +258 -0
  169. package/packs/agent-runtime/remote-controls/types.ts +105 -0
  170. package/packs/agent-runtime/session-schema.ts +423 -0
  171. package/packs/agent-runtime/tool-impl/index.ts +1 -0
  172. package/packs/agent-runtime/tool-impl/remote-controls.mock.ts +252 -0
  173. package/packs/agent-runtime/tool-impl/remote-controls.ts +273 -0
  174. package/packs/agent-runtime/tsconfig.json +1 -1
  175. package/packs/agent-runtime/turn-lifecycle-events.ts +501 -0
  176. package/packs/sidekick/channel-ingress.ts +137 -0
  177. package/packs/sidekick/manifest.ts +74 -0
  178. package/packs/sidekick/manifest.yaml +88 -0
  179. package/packs/sidekick/package.json +3 -1
  180. package/packs/sidekick/sidekick-events.ts +517 -0
  181. package/packs/sidekick/src/adapters/cloud-queue.ts +101 -0
  182. package/packs/sidekick/src/adapters/control-plane-bridge.adapter.ts +378 -0
  183. package/packs/sidekick/src/adapters/filesystem-bridge.adapter.ts +224 -0
  184. package/packs/sidekick/src/domain/channel.types.ts +84 -0
  185. package/packs/sidekick/src/ports/channel-bridge.port.ts +75 -0
  186. package/packs/sidekick/src/routines/commit.ts +74 -0
  187. package/packs/sidekick/tool-impl/channel-tools.ts +47 -0
  188. package/packs/sidekick/tool-impl/memory-tools.ts +17 -0
  189. package/packs/sidekick/tool-impl/routine-commit.ts +102 -0
  190. package/packs/sidekick/tool-impl/routine-tools.ts +67 -7
  191. package/packs/sidekick/tool-impl/runtime-context.ts +4 -0
  192. package/packs/sidekick/tool-impl/storage.ts +3 -0
  193. package/packs/sidekick/tool-impl/system-tools.ts +7 -0
  194. package/packs/sidekick/tool-impl/task-tools.ts +46 -0
  195. package/packs/sidekick/tsconfig.json +1 -1
  196. package/packs/software-delivery/manifest-schema.ts +30 -0
  197. package/packs/software-delivery/manifest.ts +160 -11
  198. package/packs/software-delivery/manifest.yaml +210 -230
  199. package/packs/software-delivery/package.json +88 -3
  200. package/packs/software-delivery/src/commands/index.ts +5 -0
  201. package/packs/software-delivery/src/config/delivery-review-contract.ts +20 -0
  202. package/packs/software-delivery/src/config/env-accessors.ts +19 -0
  203. package/packs/software-delivery/src/config/index.ts +8 -0
  204. package/packs/software-delivery/src/config/normalize-config-keys.ts +19 -0
  205. package/packs/software-delivery/src/config/schemas/lumenflow-config-schema-types.ts +436 -0
  206. package/packs/software-delivery/src/config/workspace-reader.ts +310 -0
  207. package/packs/software-delivery/src/constants/backlog-patterns.ts +31 -0
  208. package/packs/software-delivery/src/constants/client-ids.ts +19 -0
  209. package/packs/software-delivery/src/constants/config-contract.ts +7 -0
  210. package/packs/software-delivery/src/constants/docs-layout-presets.ts +50 -0
  211. package/packs/software-delivery/src/constants/duration-constants.ts +20 -0
  212. package/packs/software-delivery/src/constants/gate-constants.ts +32 -0
  213. package/packs/software-delivery/src/constants/index.ts +29 -0
  214. package/packs/software-delivery/src/constants/lock-constants.ts +35 -0
  215. package/packs/software-delivery/src/constants/object-guards.ts +12 -0
  216. package/packs/software-delivery/src/constants/section-headings.ts +107 -0
  217. package/packs/software-delivery/src/constants/wu-cli-constants.ts +485 -0
  218. package/packs/software-delivery/src/constants/wu-domain-constants.ts +466 -0
  219. package/packs/software-delivery/src/constants/wu-git-constants.ts +7 -0
  220. package/packs/software-delivery/src/constants/wu-id-format.ts +327 -0
  221. package/packs/software-delivery/src/constants/wu-paths-constants.ts +358 -0
  222. package/packs/software-delivery/src/constants/wu-statuses.ts +287 -0
  223. package/packs/software-delivery/src/constants/wu-type-helpers.ts +67 -0
  224. package/packs/software-delivery/src/constants/wu-ui-constants.ts +267 -0
  225. package/packs/software-delivery/src/constants/wu-validation-constants.ts +73 -0
  226. package/packs/software-delivery/src/domain/index.ts +5 -0
  227. package/packs/software-delivery/src/domain/orchestration.constants.ts +168 -0
  228. package/packs/software-delivery/src/domain/orchestration.schemas.ts +239 -0
  229. package/packs/software-delivery/src/domain/orchestration.types.ts +178 -0
  230. package/packs/software-delivery/src/methodology/incremental-test.ts +90 -0
  231. package/packs/software-delivery/src/methodology/index.ts +6 -0
  232. package/packs/software-delivery/src/methodology/manual-test-validator.ts +292 -0
  233. package/packs/software-delivery/src/policy/coverage-gate.ts +270 -0
  234. package/packs/software-delivery/src/policy/gates-agent-mode.ts +223 -0
  235. package/packs/software-delivery/src/policy/gates-config-internal.ts +121 -0
  236. package/packs/software-delivery/src/policy/gates-config.ts +293 -0
  237. package/packs/software-delivery/src/policy/gates-coverage.ts +247 -0
  238. package/packs/software-delivery/src/policy/gates-presets.ts +134 -0
  239. package/packs/software-delivery/src/policy/gates-schemas.ts +173 -0
  240. package/packs/software-delivery/src/policy/index.ts +22 -0
  241. package/packs/software-delivery/src/policy/package-manager-resolver.ts +319 -0
  242. package/packs/software-delivery/src/policy/resolve-policy.ts +518 -0
  243. package/packs/software-delivery/src/ports/config.ports.ts +90 -0
  244. package/packs/software-delivery/src/ports/dashboard-renderer.port.ts +125 -0
  245. package/packs/software-delivery/src/ports/index.ts +10 -0
  246. package/packs/software-delivery/src/ports/sync-validator.ports.ts +59 -0
  247. package/packs/software-delivery/src/ports/wu-helpers.ports.ts +168 -0
  248. package/packs/software-delivery/src/ports/wu-state.ports.ts +241 -0
  249. package/packs/software-delivery/src/primitives/index.ts +5 -0
  250. package/packs/software-delivery/src/runtime/index.ts +6 -0
  251. package/packs/software-delivery/src/runtime/work-classifier.ts +561 -0
  252. package/packs/software-delivery/src/sandbox/index.ts +10 -0
  253. package/packs/software-delivery/src/sandbox/sandbox-allowlist.ts +118 -0
  254. package/packs/software-delivery/src/sandbox/sandbox-backend-linux.ts +88 -0
  255. package/packs/software-delivery/src/sandbox/sandbox-backend-macos.ts +154 -0
  256. package/packs/software-delivery/src/sandbox/sandbox-backend-windows.ts +47 -0
  257. package/packs/software-delivery/src/sandbox/sandbox-profile.ts +153 -0
  258. package/packs/software-delivery/src/schemas/index.ts +5 -0
  259. package/packs/software-delivery/src/state/date-utils.ts +158 -0
  260. package/packs/software-delivery/src/state/index.ts +15 -0
  261. package/packs/software-delivery/src/state/state-machine.ts +119 -0
  262. package/packs/software-delivery/src/state/wu-doc-types.ts +51 -0
  263. package/packs/software-delivery/src/state/wu-paths.ts +381 -0
  264. package/packs/software-delivery/src/state/wu-schema.ts +1139 -0
  265. package/packs/software-delivery/src/state/wu-state-schema.ts +255 -0
  266. package/packs/software-delivery/src/state/wu-yaml.ts +338 -0
  267. package/packs/software-delivery/src/types.d.ts +16 -0
  268. package/packs/software-delivery/tool-impl/wu-lifecycle-tools.ts +18 -0
  269. package/packs/software-delivery/tsconfig.json +28 -2
  270. package/templates/core/AGENTS.md.template +76 -17
  271. package/templates/core/LUMENFLOW.md.template +265 -66
  272. package/templates/core/_frameworks/lumenflow/wu-sizing-guide.md.template +180 -116
  273. package/templates/core/ai/onboarding/agent-invocation-guide.md.template +26 -8
  274. package/templates/core/ai/onboarding/existing-project-bootstrap.md.template +171 -0
  275. package/templates/core/ai/onboarding/first-15-mins.md.template +3 -1
  276. package/templates/core/ai/onboarding/first-wu-mistakes.md.template +1 -1
  277. package/templates/core/ai/onboarding/initiative-orchestration.md.template +46 -30
  278. package/templates/core/ai/onboarding/quick-ref-commands.md.template +36 -33
  279. package/templates/core/ai/onboarding/release-process.md.template +8 -7
  280. package/templates/core/ai/onboarding/starting-prompt.md.template +2 -0
  281. package/templates/core/ai/onboarding/troubleshooting-wu-done.md.template +62 -0
  282. package/templates/vendors/claude/.claude/CLAUDE.md.template +29 -54
  283. package/templates/vendors/cursor/.cursor/rules/lumenflow.md.template +24 -52
  284. package/templates/vendors/windsurf/.windsurf/rules/lumenflow.md.template +24 -52
  285. package/packs/agent-runtime/.turbo/turbo-build.log +0 -4
  286. package/packs/sidekick/.turbo/turbo-build.log +0 -4
  287. package/packs/software-delivery/.turbo/turbo-build.log +0 -4
@@ -17,7 +17,9 @@ import { minimatch } from 'minimatch';
17
17
  import { loadInvariants, INVARIANT_TYPES } from '@lumenflow/core/invariants-runner';
18
18
  import { validateSpawnArgs, generateExecutionModeSection, generateThinkToolGuidance, } from '@lumenflow/core/wu-spawn-helpers';
19
19
  import { findProjectRoot, getConfig } from '@lumenflow/core/config';
20
- import { BRANCHES, CONFIG_FILES, DIRECTORIES, LUMENFLOW_PATHS, REMOTES, } from '@lumenflow/core/wu-constants';
20
+ import { StreamWatchdogConfigSchema } from '@lumenflow/core/config-schema';
21
+ import { CONFIG_FILES, DIRECTORIES, LUMENFLOW_PATHS } from '@lumenflow/core/wu-constants';
22
+ import { resolveIntegrationTargetRef } from '@lumenflow/core/integration-target';
21
23
  import { generateClientSkillsGuidance, generateSkillsSelectionSection, } from '@lumenflow/core/wu-spawn-skills';
22
24
  // WU-1253: Template loader for extracted prompt templates
23
25
  // WU-1898: Import evaluateCondition to gate templates by frontmatter conditions
@@ -30,7 +32,7 @@ import { TRUNCATION_WARNING_BANNER, SPAWN_END_SENTINEL, generateTestGuidance, ge
30
32
  // WU-1900: Import work classifier for domain-aware prompt generation
31
33
  import { classifyWork, TEST_METHODOLOGY_HINTS, } from '@lumenflow/core/work-classifier';
32
34
  // WU-1288: Import resolvePolicy for methodology policy resolution
33
- import { resolvePolicy } from '@lumenflow/core/resolve-policy';
35
+ import { resolvePolicy } from '@lumenflow/packs-software-delivery/policy/resolve-policy';
34
36
  // WU-1240: Import memory context integration for spawn prompts
35
37
  import { generateMemoryContextSection, checkMemoryLayerInitialized, getMemoryContextMaxSize, } from '@lumenflow/core/wu-spawn-context';
36
38
  import { generateCompletionWorkflowSection as generateSharedCompletionWorkflowSection } from './wu-spawn-completion.js';
@@ -48,7 +50,9 @@ export { resolvePolicy };
48
50
  const SPAWN_PROMPT_BUILDERS_DIR = path.dirname(fileURLToPath(import.meta.url));
49
51
  const DEFAULT_TEMPLATE_BASE_DIR = findProjectRoot(SPAWN_PROMPT_BUILDERS_DIR);
50
52
  const DEFAULT_WORKTREES_DIR_SEGMENT = DIRECTORIES.WORKTREES.replace(/\/+$/g, '');
51
- const PRIMARY_MAIN_REF = `${REMOTES.ORIGIN}/${BRANCHES.MAIN}`;
53
+ function getPrimaryMainRef() {
54
+ return resolveIntegrationTargetRef();
55
+ }
52
56
  const LANE_GUIDANCE_TEMPLATE_ID_PREFIX = 'lane-guidance-';
53
57
  const DESIGN_CONTEXT_TEMPLATE_ID_PREFIX = 'design-context-';
54
58
  const VERIFICATION_TEMPLATE_ID_PREFIX = 'verification-';
@@ -75,6 +79,7 @@ const TEMPLATE_IDS = {
75
79
  const PRE_EXISTING_SKIP_GATES_REASON = 'pre-existing on main';
76
80
  const PRE_EXISTING_SKIP_GATES_FIX_WU = 'WU-XXXX';
77
81
  const PROJECT_LEVEL_SKIP_GATES_GUIDANCE = 'Project-level instructions win when they conflict with default skip-gates guidance';
82
+ const WATCHDOG_LIVENESS_SECTION_HEADING = '## Watchdog-Safe Liveness Contract';
78
83
  const VERIFICATION_TEMPLATE_IDS = new Set([
79
84
  'documentation-directive',
80
85
  'visual-directive',
@@ -199,29 +204,75 @@ function resolveAgentCoordinationSection(templates, id) {
199
204
  AGENT_COORDINATION_SECTION: fallback,
200
205
  });
201
206
  }
202
- function resolveActionSection(templates, doc, id, config) {
203
- const fallback = generateActionSection(doc, id, config);
207
+ function resolveWatchdogHeartbeatCadenceSeconds(config) {
208
+ return StreamWatchdogConfigSchema.parse(config?.agents?.stream_watchdog ?? {})
209
+ .heartbeat_cadence_seconds;
210
+ }
211
+ export function generateWatchdogLivenessContractSection(config) {
212
+ const heartbeatCadenceSeconds = resolveWatchdogHeartbeatCadenceSeconds(config);
213
+ return `${WATCHDOG_LIVENESS_SECTION_HEADING}
214
+
215
+ Some orchestration harnesses apply a stdout-silence watchdog during long
216
+ read/reasoning windows. While you are working silently:
217
+
218
+ 1. Emit a \`[status]\` stdout line every ${heartbeatCadenceSeconds}s.
219
+ 2. Keep the line short and progress-oriented (for example:
220
+ \`[status] reading prompt builders\`).
221
+ 3. Do not wait for a tool call or gate run to prove liveness.
222
+ 4. Keep doing the scoped work; these status lines are heartbeat signals, not
223
+ completion claims.
224
+
225
+ Configured watchdog cadence: ${heartbeatCadenceSeconds}s. Even if the client
226
+ already streams its own progress, keep this explicit stdout heartbeat so the
227
+ saved brief artifact and the operator runbook stay aligned.`;
228
+ }
229
+ function resolveActionSection(templates, doc, id, roleContract, delegationId, config) {
230
+ const fallback = generateActionSection(doc, id, roleContract, delegationId, config);
204
231
  const isAlreadyClaimed = Boolean(doc.claimed_at && doc.worktree_path);
232
+ const actualRole = roleContract?.actual_role;
233
+ const roleHintBlock = actualRole || delegationId
234
+ ? `\n\n**Expected session identity after claim:**\n- lifecycle_role: ${actualRole?.lifecycle_role ?? 'executor'}\n- specialty_profile: ${actualRole?.specialty_profile ?? 'general'}${delegationId ? `\n- delegation_id: ${delegationId}` : ''}\n- Confirm these values on the active session record so mem:roster and addressed signals stay accurate.`
235
+ : '';
236
+ const appendRoleHint = (resolved) => roleHintBlock && !resolved.includes('Expected session identity after claim')
237
+ ? `${resolved}${roleHintBlock}`
238
+ : resolved;
205
239
  if (isAlreadyClaimed) {
206
- return resolveTemplateSection(templates, TEMPLATE_IDS.actionClaimed, fallback);
240
+ return appendRoleHint(resolveTemplateSection(templates, TEMPLATE_IDS.actionClaimed, fallback));
207
241
  }
208
- return resolveTemplateSection(templates, TEMPLATE_IDS.actionUnclaimed, fallback, {
242
+ return appendRoleHint(resolveTemplateSection(templates, TEMPLATE_IDS.actionUnclaimed, fallback, {
209
243
  WORKTREE_PATH_HINT: resolveClaimWorktreePathHint(doc.lane, id, config),
210
244
  WU_EVENTS_PATH: LUMENFLOW_PATHS.WU_EVENTS,
211
- });
245
+ }));
212
246
  }
247
+ /**
248
+ * WU-2666: Codex constraints resolution.
249
+ *
250
+ * Tokens mirror the 8 critical-rule numbering from generateConstraints() so
251
+ * template overrides remain semantically equivalent. The template MUST render
252
+ * all 8 rules (7 when TDD is omitted). See BRIEF_PARITY_CONTRACT for the
253
+ * CI-enforced parity patterns.
254
+ */
213
255
  function resolveCodexConstraintsSection(templates, id, includeTddCheckpoint) {
214
256
  const fallback = generateCodexConstraints(id, { includeTddCheckpoint });
257
+ const tddBlock = includeTddCheckpoint
258
+ ? `1. **TDD CHECKPOINT** (VERIFY BEFORE IMPLEMENTATION)
259
+ - Did you write tests BEFORE implementation?
260
+ - Is there at least one failing test for each acceptance criterion?
261
+ - Never skip the RED phase — failing tests prove the test works
262
+
263
+ `
264
+ : '';
215
265
  return resolveTemplateSection(templates, TEMPLATE_IDS.codexConstraints, fallback, {
216
- TDD_CHECKPOINT_BLOCK: includeTddCheckpoint
217
- ? '1. **TDD checkpoint**: tests BEFORE implementation; never skip RED\n'
218
- : '',
219
- STOP_NUM: String(includeTddCheckpoint ? 2 : 1),
220
- VERIFY_NUM: String(includeTddCheckpoint ? 3 : 2),
221
- FABRICATE_NUM: String(includeTddCheckpoint ? 4 : 3),
222
- GIT_NUM: String(includeTddCheckpoint ? 5 : 4),
223
- SCOPE_NUM: String(includeTddCheckpoint ? 6 : 5),
224
- SKIP_GATES_NUM: String(includeTddCheckpoint ? 7 : 6),
266
+ TDD_CHECKPOINT_BLOCK: tddBlock,
267
+ ANTI_LOOP_NUM: String(includeTddCheckpoint ? 2 : 1),
268
+ STOP_ASK_NUM: String(includeTddCheckpoint ? 3 : 2),
269
+ VERIFY_NUM: String(includeTddCheckpoint ? 4 : 3),
270
+ NEVER_FAB_NUM: String(includeTddCheckpoint ? 5 : 4),
271
+ GIT_NUM: String(includeTddCheckpoint ? 6 : 5),
272
+ MEM_NUM: String(includeTddCheckpoint ? 7 : 6),
273
+ SKIP_GATES_NUM: String(includeTddCheckpoint ? 8 : 7),
274
+ PRIMARY_MAIN_REF: getPrimaryMainRef(),
275
+ PRE_EXISTING_SKIP_GATES_COMMAND: formatPreExistingSkipGatesCommand(id),
225
276
  PROJECT_LEVEL_SKIP_GATES_GUIDANCE,
226
277
  });
227
278
  }
@@ -554,7 +605,7 @@ ${neverFabNum}. NEVER FABRICATE COMPLETION
554
605
 
555
606
  ${gitNum}. GIT WORKFLOW (CRITICAL - GitHub rules reject merge commits)
556
607
  - GitHub REJECTS merge commits on main
557
- - ALWAYS use \`git rebase ${PRIMARY_MAIN_REF}\` before push
608
+ - ALWAYS use \`git rebase ${getPrimaryMainRef()}\` before push
558
609
  - Push to main via \`git push origin lane/...:main\` (fast-forward only)
559
610
  - NEVER use \`git merge\` on main branch
560
611
  - Let \`pnpm wu:done\` handle the merge workflow
@@ -573,25 +624,88 @@ ${skipGatesNum}. SKIP-GATES POLICY LAYERING (WU-1142)
573
624
  - This prevents getting stuck on infrastructure debt
574
625
  </constraints>`;
575
626
  }
627
+ /**
628
+ * WU-2666: Codex/Markdown rendering of the same critical rules as
629
+ * {@link generateConstraints}. Semantic parity — not verbatim — is the
630
+ * guarantee: every critical rule that appears in the Claude (XML) constraints
631
+ * block MUST also appear in the Codex (Markdown) block with the same named
632
+ * rule headers. See BRIEF_PARITY_CONTRACT for the enforceable patterns.
633
+ *
634
+ * Prior to WU-2666, Codex's constraints block was 6 items and silently omitted
635
+ * ANTI-LOOP GUARD, STOP-AND-ASK TRIGGERS, and MEMORY LAYER COORDINATION — the
636
+ * exact load-bearing guardrails that INIT-057 Codex agents needed.
637
+ */
576
638
  export function generateCodexConstraints(id, options) {
577
639
  const includeTdd = options?.includeTddCheckpoint !== false;
578
- const tddLine = includeTdd
579
- ? '1. **TDD checkpoint**: tests BEFORE implementation; never skip RED'
640
+ const tddBlock = includeTdd
641
+ ? `1. **TDD CHECKPOINT** (VERIFY BEFORE IMPLEMENTATION)
642
+ - Did you write tests BEFORE implementation?
643
+ - Is there at least one failing test for each acceptance criterion?
644
+ - Never skip the RED phase — failing tests prove the test works
645
+
646
+ `
580
647
  : '';
581
- const stopNum = includeTdd ? 2 : 1;
582
- const verifyNum = includeTdd ? 3 : 2;
583
- const fabricateNum = includeTdd ? 4 : 3;
584
- const gitNum = includeTdd ? 5 : 4;
585
- const scopeNum = includeTdd ? 6 : 5;
586
- const skipGatesNum = includeTdd ? 7 : 6;
648
+ // WU-2666: Renumber in lockstep with generateConstraints(). Same rules,
649
+ // same order, same headings only the rendering shell differs.
650
+ const antiLoopNum = includeTdd ? 2 : 1;
651
+ const stopAskNum = includeTdd ? 3 : 2;
652
+ const verifyNum = includeTdd ? 4 : 3;
653
+ const neverFabNum = includeTdd ? 5 : 4;
654
+ const gitNum = includeTdd ? 6 : 5;
655
+ const memNum = includeTdd ? 7 : 6;
656
+ const skipGatesNum = includeTdd ? 8 : 7;
587
657
  return `## Constraints (Critical)
588
658
 
589
- ${tddLine}${tddLine ? '\n' : ''}${stopNum}. **Stop on errors**: if UnsafeAny command fails, report BLOCKED (never DONE) with the error
590
- ${verifyNum}. **Verify before success**: run \`pnpm gates\` in the worktree, then run \`pnpm wu:verify --id ${id}\` (from the shared checkout)
591
- ${fabricateNum}. **No fabrication**: if blockers remain or verification fails, report INCOMPLETE
592
- ${gitNum}. **Git workflow**: avoid merge commits; let \`pnpm wu:done\` handle completion
593
- ${scopeNum}. **Scope discipline**: stay within \`code_paths\`; capture out-of-scope issues via \`pnpm mem:create\`
594
- ${skipGatesNum}. **Skip-gates for pre-existing**: if gates fail due to pre-existing issue on main, the default audited path is \`--skip-gates --reason "pre-existing" --fix-wu WU-XXX\`. If AGENTS.md or project-level instructions are stricter, follow those instead. ${PROJECT_LEVEL_SKIP_GATES_GUIDANCE}`;
659
+ CRITICAL RULES - ENFORCE BEFORE EVERY ACTION:
660
+
661
+ ${tddBlock}${antiLoopNum}. **ANTI-LOOP GUARD** (LumenFlow §7.3)
662
+
663
+ - Max 3 attempts per unique error before escalating
664
+ - If same error repeats 3x, STOP and report with full context
665
+ - Retry with different approach, not same command
666
+
667
+ ${stopAskNum}. **STOP-AND-ASK TRIGGERS** (LumenFlow §7.2 - narrow scope)
668
+
669
+ - Policy changes, auth/permissions modifications
670
+ - PII/safety issues, cloud spend, secrets, backups
671
+ - Same error repeats 3x
672
+ - For ordinary errors: fix and retry autonomously (up to 3 attempts)
673
+
674
+ ${verifyNum}. **VERIFY COMPLETION** before reporting success
675
+
676
+ - Run \`pnpm gates\` in the worktree, then \`pnpm wu:verify --id ${id}\` (from the shared checkout)
677
+ - Exit 0 = passed, Exit 1 = INCOMPLETE
678
+ - Never report "done" if verification fails
679
+
680
+ ${neverFabNum}. **NEVER FABRICATE COMPLETION**
681
+
682
+ - If blockers remain, report INCOMPLETE
683
+ - If verification fails, summarize failures
684
+ - Honesty over false completion
685
+
686
+ ${gitNum}. **GIT WORKFLOW** (CRITICAL - GitHub rules reject merge commits)
687
+
688
+ - GitHub REJECTS merge commits on main
689
+ - ALWAYS use \`git rebase ${getPrimaryMainRef()}\` before push
690
+ - Push to main via \`git push origin lane/...:main\` (fast-forward only)
691
+ - NEVER use \`git merge\` on main branch
692
+ - Let \`pnpm wu:done\` handle the merge workflow
693
+
694
+ ${memNum}. **MEMORY LAYER COORDINATION** (INIT-007)
695
+
696
+ - Use \`pnpm mem:checkpoint --wu ${id}\` to save progress before risky operations
697
+ - Check \`pnpm mem:inbox --wu ${id}\` periodically for parallel signals from other agents
698
+ - Checkpoint triggers (WU-1943): checkpoint after each acceptance criterion completed, checkpoint before gates, checkpoint every 30 tool calls
699
+
700
+ ${skipGatesNum}. **SKIP-GATES POLICY LAYERING** (WU-1142)
701
+
702
+ - If gates fail, rerun \`pnpm wu:prep --id ${id}\` from the worktree; it checks main safely and prints skip-gates guidance when appropriate
703
+ - If \`wu:prep\` reports the failure is pre-existing on main, the default audited path is: \`${formatPreExistingSkipGatesCommand(id)}\`
704
+ - If AGENTS.md, the WU prompt, or project-level policy says to stop on gate failures, stop and surface the failure instead of using skip-gates autonomously
705
+ - ${PROJECT_LEVEL_SKIP_GATES_GUIDANCE}
706
+ - Stay within \`code_paths\`; capture out-of-scope issues via \`pnpm mem:create\`
707
+ - Do NOT use \`git stash\` or mutate local main just to prove a pre-existing failure
708
+ - This prevents getting stuck on infrastructure debt`;
595
709
  }
596
710
  // ─── Section Generators ───
597
711
  /**
@@ -831,13 +945,48 @@ export function generateWorktreePathGuidance(worktreePath) {
831
945
  if (!worktreePath) {
832
946
  return '';
833
947
  }
834
- return `## Worktree Path Guidance (WU-2362)
948
+ return `## Worktree Path Guidance (WU-2362, WU-2655)
835
949
 
836
950
  **Your worktree:** \`${worktreePath}\`
837
951
 
952
+ ### First Action: cd to your declared worktree
953
+
954
+ **Before ANY Read/Write/Edit tool call, run:**
955
+
956
+ \`\`\`bash
957
+ cd ${worktreePath}
958
+ pwd # MUST print a path ending in "${worktreePath}"
959
+ \`\`\`
960
+
961
+ ### Absolute Paths Required for Write/Edit (WU-2655)
962
+
963
+ Parallel-agent cwd-inheritance trap: when an orchestrator running in
964
+ worktree-A spawns you for worktree-B, your process may inherit the
965
+ orchestrator's cwd. Relative paths then resolve against the wrong
966
+ worktree and your writes leak into worktree-A. This exact failure was
967
+ reported by the WU-2638 agent during INIT-057 Wave 0.
968
+
969
+ **Rules:**
970
+
971
+ 1. Use ABSOLUTE paths for every Write/Edit tool call, rooted at the
972
+ declared worktree.
973
+ 2. Compute the root via \`git rev-parse --show-toplevel\` AFTER your
974
+ \`cd\`, then prepend it to every path.
975
+ 3. If you invoke \`pnpm file:write\` or \`pnpm file:edit\` (vendor-agnostic
976
+ CLI), pass \`--worktree-root "$(git rev-parse --show-toplevel)"\` so
977
+ the CLI rejects any path that escapes the declared worktree.
978
+
979
+ \`\`\`bash
980
+ # Machine-enforced guard (vendor-agnostic) — use when available:
981
+ WORKTREE_ROOT=$(git rev-parse --show-toplevel)
982
+ pnpm file:write --worktree-root "$WORKTREE_ROOT" \\
983
+ --path "$WORKTREE_ROOT/src/feature.ts" --content "..."
984
+ \`\`\`
985
+
838
986
  ### Finding the Worktree Root
839
987
 
840
- Sub-agents may inherit the parent's cwd (main checkout). To find the actual worktree root:
988
+ Sub-agents may inherit the parent's cwd (main checkout or a sibling
989
+ worktree). To find the actual worktree root:
841
990
 
842
991
  \`\`\`bash
843
992
  # Get the worktree root (not main checkout)
@@ -866,7 +1015,8 @@ touch "$WORKTREE_ROOT/.lumenflow/agent-runs/code-reviewer.stamp"
866
1015
 
867
1016
  - Stamps on main get overwritten by worktree merge
868
1017
  - \`wu:done\` validates stamps exist in the worktree branch
869
- - Parallel WUs in other lanes won't see your stamps if on main`;
1018
+ - Parallel WUs in other lanes won't see your stamps if on main
1019
+ - Relative-path writes in parallel-spawned agents leak across worktrees (WU-2655)`;
870
1020
  }
871
1021
  /**
872
1022
  * Generate the Bug Discovery section (WU-1592, WU-2284)
@@ -1020,12 +1170,16 @@ ${sections.join('\n\n')}`;
1020
1170
  * @param {string} id - WU ID
1021
1171
  * @returns {string} Action section content
1022
1172
  */
1023
- export function generateActionSection(doc, id, config) {
1173
+ export function generateActionSection(doc, id, roleContract, delegationId, config) {
1024
1174
  const isAlreadyClaimed = doc.claimed_at && doc.worktree_path;
1175
+ const actualRole = roleContract?.actual_role;
1176
+ const roleHintBlock = actualRole || delegationId
1177
+ ? `\n\n**Expected session identity after claim:**\n- lifecycle_role: ${actualRole?.lifecycle_role ?? 'executor'}\n- specialty_profile: ${actualRole?.specialty_profile ?? 'general'}${delegationId ? `\n- delegation_id: ${delegationId}` : ''}\n- Confirm these values on the active session record so mem:roster and addressed signals stay accurate.`
1178
+ : '';
1025
1179
  if (isAlreadyClaimed) {
1026
1180
  return `This WU is already claimed. Continue implementation in worktree following all standards above.
1027
1181
 
1028
- cd ${doc.worktree_path}`;
1182
+ cd ${doc.worktree_path}${roleHintBlock}`;
1029
1183
  }
1030
1184
  const claimWorktreePathHint = resolveClaimWorktreePathHint(doc.lane, id, config);
1031
1185
  return `**FIRST: Claim this WU before starting work:**
@@ -1040,7 +1194,7 @@ Then implement following all standards above.
1040
1194
  **CRITICAL:** Never use \`git worktree add\` directly. Always use \`pnpm wu:claim\` to ensure:
1041
1195
  - Event tracking in ${LUMENFLOW_PATHS.WU_EVENTS}
1042
1196
  - Lane lock acquisition (WIP=1 enforcement)
1043
- - Session tracking for context recovery`;
1197
+ - Session tracking for context recovery${roleHintBlock}`;
1044
1198
  }
1045
1199
  /**
1046
1200
  * Generate the Completion Workflow section for sub-agents (WU-2682).
@@ -1255,6 +1409,7 @@ export function generateTaskInvocation(doc, id, strategy, options = {}) {
1255
1409
  // WU-2362: Worktree path guidance for sub-agents
1256
1410
  const worktreePathHint = resolveWorktreePathHint(doc, id, config);
1257
1411
  const worktreeGuidance = resolveTemplateSection(templates, TEMPLATE_IDS.worktreePathGuidance, generateWorktreePathGuidance(doc.worktree_path));
1412
+ const watchdogLivenessContract = generateWatchdogLivenessContractSection(config);
1258
1413
  // WU-1134: Worktree block recovery guidance
1259
1414
  // WU-1253: Try template for worktree-recovery
1260
1415
  const worktreeBlockRecovery = templates.get('worktree-recovery') ||
@@ -1311,6 +1466,10 @@ ${mandatorySection}${invariantsPriorArt ? `---\n\n${invariantsPriorArt}\n\n` : '
1311
1466
  ${thinkingBlock}${skillsSection}
1312
1467
  ${memoryContextSection ? `---\n\n${memoryContextSection}\n\n` : ''}---
1313
1468
 
1469
+ ${watchdogLivenessContract}
1470
+
1471
+ ---
1472
+
1314
1473
  ${mandatoryStandards}
1315
1474
 
1316
1475
  ---
@@ -1369,7 +1528,7 @@ ${laneSelection}
1369
1528
 
1370
1529
  ${laneGuidance}${laneGuidance ? '\n\n---\n\n' : ''}## Action
1371
1530
 
1372
- ${resolveActionSection(templates, doc, id, config)}
1531
+ ${resolveActionSection(templates, doc, id, options.roleContract, options.delegationId, config)}
1373
1532
 
1374
1533
  ---
1375
1534
 
@@ -1445,7 +1604,7 @@ export function generateCodexPrompt(doc, id, strategy, options = {}) {
1445
1604
  const templates = tryLoadTemplates(clientName, templateContext, templateBaseDir);
1446
1605
  const mandatorySection = resolveMandatoryAgentSection(templates, mandatoryAgents, id);
1447
1606
  const implementationContext = resolveImplementationContextSection(templates, implementationContextFallback);
1448
- const action = resolveActionSection(templates, doc, id, config);
1607
+ const action = resolveActionSection(templates, doc, id, options.roleContract, options.delegationId, config);
1449
1608
  const constraints = resolveCodexConstraintsSection(templates, id, shouldIncludeTddCheckpoint);
1450
1609
  const testGuidanceFallback = [
1451
1610
  generateRequiredVerificationSection(doc),
@@ -1472,6 +1631,7 @@ export function generateCodexPrompt(doc, id, strategy, options = {}) {
1472
1631
  const designContextSection = resolveDesignContextSection(templates, classification);
1473
1632
  // WU-2368: DB-risk verification guidance when code_paths touch database files
1474
1633
  const dbRiskGuidance = resolveTemplateSection(templates, TEMPLATE_IDS.dbRiskVerification, generateDbRiskVerificationGuidance(codePaths));
1634
+ const watchdogLivenessContract = generateWatchdogLivenessContractSection(config);
1475
1635
  const executionModeSection = generateExecutionModeSection(options);
1476
1636
  const thinkToolGuidance = generateThinkToolGuidance(options);
1477
1637
  const thinkingSections = [executionModeSection, thinkToolGuidance]
@@ -1538,6 +1698,10 @@ ${readBeforeWrite}
1538
1698
  ${designContextSection ? `---\n\n${designContextSection}\n\n` : ''}${skillsSection}
1539
1699
  ${memoryContextSection ? `---\n\n${memoryContextSection}\n\n` : ''}---
1540
1700
 
1701
+ ${watchdogLivenessContract}
1702
+
1703
+ ---
1704
+
1541
1705
  ## Action
1542
1706
 
1543
1707
  ${action}
@@ -1572,4 +1736,96 @@ ${constraints}
1572
1736
  ${SPAWN_END_SENTINEL}
1573
1737
  `;
1574
1738
  }
1739
+ /**
1740
+ * WU-2666: Parity contract — load-bearing methodology sections that every
1741
+ * supported --client brief MUST include. Adding a new client or generator
1742
+ * without these sections is a CI failure.
1743
+ *
1744
+ * Section IDs match the mission-critical list in WU-2666's description:
1745
+ * TDD RED-first, worktree discipline, constraints block, skill directives,
1746
+ * memory/coordination, bug discovery, completion workflow.
1747
+ */
1748
+ export const BRIEF_PARITY_CONTRACT = [
1749
+ {
1750
+ id: 'tdd-red-first',
1751
+ description: 'TDD checkpoint with RED-first rule (feature/enhancement WUs)',
1752
+ patterns: ['TDD CHECKPOINT', 'RED phase', 'tests BEFORE implementation'],
1753
+ },
1754
+ {
1755
+ id: 'worktree-discipline',
1756
+ description: 'Git/worktree discipline: rebase before push, never merge on main',
1757
+ patterns: ['GIT WORKFLOW', 'git rebase', 'fast-forward', 'NEVER use `git merge`'],
1758
+ },
1759
+ {
1760
+ id: 'constraints-block',
1761
+ description: 'Constraints block declaring critical rules enforced before every action',
1762
+ patterns: [
1763
+ 'CRITICAL RULES - ENFORCE BEFORE EVERY ACTION',
1764
+ 'ANTI-LOOP GUARD',
1765
+ 'STOP-AND-ASK',
1766
+ 'VERIFY COMPLETION',
1767
+ 'NEVER FABRICATE',
1768
+ 'SKIP-GATES',
1769
+ ],
1770
+ },
1771
+ {
1772
+ id: 'skills-directive',
1773
+ description: 'Skills selection directive telling the agent to load relevant skills (universal — client-specific activation syntax like /skill is not required here)',
1774
+ patterns: ['## Skills Selection', 'wu-lifecycle', 'worktree-discipline'],
1775
+ },
1776
+ {
1777
+ id: 'memory-coordination',
1778
+ description: 'Memory layer coordination: checkpoint + inbox for parallel-agent signals',
1779
+ patterns: ['MEMORY LAYER COORDINATION', 'mem:checkpoint', 'mem:inbox'],
1780
+ },
1781
+ {
1782
+ id: 'watchdog-liveness',
1783
+ description: 'Watchdog-safe liveness contract: explicit stdout heartbeat during silent work',
1784
+ patterns: [
1785
+ 'Watchdog-Safe Liveness Contract',
1786
+ '`[status]` stdout line every',
1787
+ 'stdout-silence watchdog',
1788
+ ],
1789
+ },
1790
+ {
1791
+ id: 'bug-discovery',
1792
+ description: 'Mid-WU bug capture via mem:create; no raw wu:create for discovered issues',
1793
+ patterns: ['## Bug Discovery', 'pnpm mem:create', 'wu:create'],
1794
+ },
1795
+ {
1796
+ id: 'completion-workflow',
1797
+ description: 'Autonomous completion workflow invoking wu:done after gates pass',
1798
+ patterns: ['## Completion Workflow', 'pnpm wu:done', 'pnpm gates'],
1799
+ },
1800
+ ];
1801
+ /**
1802
+ * WU-2666: Canonical supported brief clients. New client variants MUST be
1803
+ * added here so the parity contract test covers them — otherwise a client
1804
+ * could ship without guardrails. The five names match resolveClientName().
1805
+ */
1806
+ export const SUPPORTED_BRIEF_CLIENTS = [
1807
+ 'claude-code',
1808
+ 'codex-cli',
1809
+ 'cursor',
1810
+ 'gemini-cli',
1811
+ 'windsurf',
1812
+ ];
1813
+ export function renderBriefForClient(args) {
1814
+ const { client, doc, id, strategy, config, roleContract, delegationId } = args;
1815
+ const clientContext = { name: client };
1816
+ if (client === 'codex-cli') {
1817
+ return generateCodexPrompt(doc, id, strategy, {
1818
+ client: clientContext,
1819
+ config,
1820
+ roleContract,
1821
+ delegationId,
1822
+ });
1823
+ }
1824
+ return generateTaskInvocation(doc, id, strategy, {
1825
+ client: clientContext,
1826
+ config,
1827
+ roleContract,
1828
+ delegationId,
1829
+ });
1830
+ }
1575
1831
  //# sourceMappingURL=wu-spawn-prompt-builders.js.map