@exaudeus/workrail 3.27.0 → 3.29.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 (160) hide show
  1. package/dist/console/assets/{index-FtTaDku8.js → index-BZ6HkxGf.js} +1 -1
  2. package/dist/console/index.html +1 -1
  3. package/dist/manifest.json +3 -3
  4. package/docs/README.md +57 -0
  5. package/docs/adrs/001-hybrid-storage-backend.md +38 -0
  6. package/docs/adrs/002-four-layer-context-classification.md +38 -0
  7. package/docs/adrs/003-checkpoint-trigger-strategy.md +35 -0
  8. package/docs/adrs/004-opt-in-encryption-strategy.md +36 -0
  9. package/docs/adrs/005-agent-first-workflow-execution-tokens.md +105 -0
  10. package/docs/adrs/006-append-only-session-run-event-log.md +76 -0
  11. package/docs/adrs/007-resume-and-checkpoint-only-sessions.md +51 -0
  12. package/docs/adrs/008-blocked-nodes-architectural-upgrade.md +178 -0
  13. package/docs/adrs/009-bridge-mode-single-instance-mcp.md +195 -0
  14. package/docs/adrs/010-release-pipeline.md +89 -0
  15. package/docs/architecture/README.md +7 -0
  16. package/docs/architecture/refactor-audit.md +364 -0
  17. package/docs/authoring-v2.md +527 -0
  18. package/docs/authoring.md +873 -0
  19. package/docs/changelog-recent.md +201 -0
  20. package/docs/configuration.md +505 -0
  21. package/docs/ctc-mcp-proposal.md +518 -0
  22. package/docs/design/README.md +22 -0
  23. package/docs/design/agent-cascade-protocol.md +96 -0
  24. package/docs/design/autonomous-console-design-candidates.md +253 -0
  25. package/docs/design/autonomous-console-design-review.md +111 -0
  26. package/docs/design/autonomous-platform-mvp-discovery.md +525 -0
  27. package/docs/design/claude-code-source-deep-dive.md +713 -0
  28. package/docs/design/console-cyberpunk-ui-discovery.md +504 -0
  29. package/docs/design/console-execution-trace-candidates-final.md +160 -0
  30. package/docs/design/console-execution-trace-candidates.md +211 -0
  31. package/docs/design/console-execution-trace-design-candidates-v2.md +113 -0
  32. package/docs/design/console-execution-trace-design-review.md +74 -0
  33. package/docs/design/console-execution-trace-discovery.md +394 -0
  34. package/docs/design/console-execution-trace-final-review.md +77 -0
  35. package/docs/design/console-execution-trace-review.md +92 -0
  36. package/docs/design/console-performance-discovery.md +415 -0
  37. package/docs/design/console-ui-backlog.md +280 -0
  38. package/docs/design/daemon-architecture-discovery.md +853 -0
  39. package/docs/design/daemon-design-candidates.md +318 -0
  40. package/docs/design/daemon-design-review-findings.md +119 -0
  41. package/docs/design/daemon-engine-design-candidates.md +210 -0
  42. package/docs/design/daemon-engine-design-review.md +131 -0
  43. package/docs/design/daemon-execution-engine-discovery.md +280 -0
  44. package/docs/design/daemon-gap-analysis.md +554 -0
  45. package/docs/design/daemon-owns-console-plan.md +168 -0
  46. package/docs/design/daemon-owns-console-review.md +91 -0
  47. package/docs/design/daemon-owns-console.md +195 -0
  48. package/docs/design/data-model-erd.md +11 -0
  49. package/docs/design/design-candidates-consolidate-dev-staleness.md +98 -0
  50. package/docs/design/design-candidates-walk-cache-depth-limit.md +80 -0
  51. package/docs/design/design-review-consolidate-dev-staleness.md +54 -0
  52. package/docs/design/design-review-walk-cache-depth-limit.md +48 -0
  53. package/docs/design/implementation-plan-consolidate-dev-staleness.md +142 -0
  54. package/docs/design/implementation-plan-walk-cache-depth-limit.md +141 -0
  55. package/docs/design/layer3b-ghost-nodes-design-candidates.md +229 -0
  56. package/docs/design/layer3b-ghost-nodes-design-review.md +93 -0
  57. package/docs/design/layer3b-ghost-nodes-implementation-plan.md +219 -0
  58. package/docs/design/list-workflows-latency-fix-plan.md +128 -0
  59. package/docs/design/list-workflows-latency-fix-review.md +55 -0
  60. package/docs/design/list-workflows-latency-fix.md +109 -0
  61. package/docs/design/native-context-management-api.md +11 -0
  62. package/docs/design/performance-sweep-2026-04.md +96 -0
  63. package/docs/design/routines-guide.md +219 -0
  64. package/docs/design/sequence-diagrams.md +11 -0
  65. package/docs/design/subagent-design-principles.md +220 -0
  66. package/docs/design/temporal-patterns-design-candidates.md +312 -0
  67. package/docs/design/temporal-patterns-design-review-findings.md +163 -0
  68. package/docs/design/test-isolation-from-config-file.md +335 -0
  69. package/docs/design/v2-core-design-locks.md +2746 -0
  70. package/docs/design/v2-lock-registry.json +734 -0
  71. package/docs/design/workflow-authoring-v2.md +1044 -0
  72. package/docs/design/workflow-docs-spec.md +218 -0
  73. package/docs/design/workflow-extension-points.md +687 -0
  74. package/docs/design/workrail-auto-trigger-system.md +359 -0
  75. package/docs/design/workrail-config-file-discovery.md +513 -0
  76. package/docs/docker.md +110 -0
  77. package/docs/generated/v2-lock-closure-plan.md +26 -0
  78. package/docs/generated/v2-lock-coverage.json +797 -0
  79. package/docs/generated/v2-lock-coverage.md +177 -0
  80. package/docs/ideas/backlog.md +3927 -0
  81. package/docs/ideas/design-candidates-mcp-resilience.md +208 -0
  82. package/docs/ideas/design-review-findings-mcp-resilience.md +119 -0
  83. package/docs/ideas/implementation_plan.md +249 -0
  84. package/docs/ideas/third-party-workflow-setup-design-thinking.md +1948 -0
  85. package/docs/implementation/02-architecture.md +316 -0
  86. package/docs/implementation/04-testing-strategy.md +124 -0
  87. package/docs/implementation/09-simple-workflow-guide.md +835 -0
  88. package/docs/implementation/13-advanced-validation-guide.md +874 -0
  89. package/docs/implementation/README.md +21 -0
  90. package/docs/integrations/claude-code.md +300 -0
  91. package/docs/integrations/firebender.md +315 -0
  92. package/docs/migration/v0.1.0.md +147 -0
  93. package/docs/naming-conventions.md +45 -0
  94. package/docs/planning/README.md +104 -0
  95. package/docs/planning/github-ticketing-playbook.md +195 -0
  96. package/docs/plans/README.md +24 -0
  97. package/docs/plans/agent-managed-ticketing-design.md +605 -0
  98. package/docs/plans/agentic-orchestration-roadmap.md +112 -0
  99. package/docs/plans/assessment-gates-engine-handoff.md +536 -0
  100. package/docs/plans/content-coherence-and-references.md +151 -0
  101. package/docs/plans/library-extraction-plan.md +340 -0
  102. package/docs/plans/mr-review-workflow-redesign.md +1451 -0
  103. package/docs/plans/native-context-management-epic.md +11 -0
  104. package/docs/plans/perf-fixes-design-candidates.md +225 -0
  105. package/docs/plans/perf-fixes-design-review-findings.md +61 -0
  106. package/docs/plans/perf-fixes-new-issues-candidates.md +264 -0
  107. package/docs/plans/perf-fixes-new-issues-review.md +110 -0
  108. package/docs/plans/prompt-fragments.md +53 -0
  109. package/docs/plans/ui-ux-workflow-design-candidates.md +120 -0
  110. package/docs/plans/ui-ux-workflow-discovery.md +100 -0
  111. package/docs/plans/ui-ux-workflow-review.md +48 -0
  112. package/docs/plans/v2-followup-enhancements.md +587 -0
  113. package/docs/plans/workflow-categories-candidates.md +105 -0
  114. package/docs/plans/workflow-categories-discovery.md +110 -0
  115. package/docs/plans/workflow-categories-review.md +51 -0
  116. package/docs/plans/workflow-discovery-model-candidates.md +94 -0
  117. package/docs/plans/workflow-discovery-model-discovery.md +74 -0
  118. package/docs/plans/workflow-discovery-model-review.md +48 -0
  119. package/docs/plans/workflow-source-setup-phase-1.md +245 -0
  120. package/docs/plans/workflow-source-setup-phase-2.md +361 -0
  121. package/docs/plans/workflow-staleness-detection-candidates.md +104 -0
  122. package/docs/plans/workflow-staleness-detection-review.md +58 -0
  123. package/docs/plans/workflow-staleness-detection.md +80 -0
  124. package/docs/plans/workflow-v2-design.md +69 -0
  125. package/docs/plans/workflow-v2-roadmap.md +74 -0
  126. package/docs/plans/workflow-validation-design.md +98 -0
  127. package/docs/plans/workflow-validation-roadmap.md +108 -0
  128. package/docs/plans/workrail-platform-vision.md +420 -0
  129. package/docs/reference/agent-context-cleaner-snippet.md +94 -0
  130. package/docs/reference/agent-context-guidance.md +140 -0
  131. package/docs/reference/context-optimization.md +284 -0
  132. package/docs/reference/example-workflow-repository-template/.github/workflows/validate.yml +125 -0
  133. package/docs/reference/example-workflow-repository-template/README.md +268 -0
  134. package/docs/reference/example-workflow-repository-template/workflows/example-workflow.json +80 -0
  135. package/docs/reference/external-workflow-repositories.md +916 -0
  136. package/docs/reference/feature-flags-architecture.md +472 -0
  137. package/docs/reference/feature-flags.md +349 -0
  138. package/docs/reference/god-tier-workflow-validation.md +272 -0
  139. package/docs/reference/loop-optimization.md +209 -0
  140. package/docs/reference/loop-validation.md +176 -0
  141. package/docs/reference/loops.md +465 -0
  142. package/docs/reference/mcp-platform-constraints.md +59 -0
  143. package/docs/reference/recovery.md +88 -0
  144. package/docs/reference/releases.md +177 -0
  145. package/docs/reference/troubleshooting.md +105 -0
  146. package/docs/reference/workflow-execution-contract.md +998 -0
  147. package/docs/roadmap/README.md +22 -0
  148. package/docs/roadmap/legacy-planning-status.md +103 -0
  149. package/docs/roadmap/now-next-later.md +70 -0
  150. package/docs/roadmap/open-work-inventory.md +389 -0
  151. package/docs/tickets/README.md +39 -0
  152. package/docs/tickets/next-up.md +76 -0
  153. package/docs/workflow-management.md +317 -0
  154. package/docs/workflow-templates.md +423 -0
  155. package/docs/workflow-validation.md +184 -0
  156. package/docs/workflows.md +254 -0
  157. package/package.json +3 -1
  158. package/spec/authoring-spec.json +61 -16
  159. package/workflows/workflow-for-workflows.json +252 -93
  160. package/workflows/workflow-for-workflows.v2.json +188 -77
@@ -0,0 +1,873 @@
1
+ # Workflow Authoring Guide
2
+
3
+ > Generated from `spec/authoring-spec.json`. Do not edit this file by hand.
4
+
5
+ Canonical current rules for authoring good WorkRail workflows. workflow.schema.json remains the source of truth for legal structure.
6
+
7
+ ## Principles
8
+ - Schema defines what is valid. These rules define what is good.
9
+ - Prefer current authoring rules over design rationale or historical notes.
10
+ - Keep prompts user-voiced without losing explicit protocol requirements.
11
+ - Keep boundary-owned response supplements separate from workflow-authored prompt text.
12
+
13
+ ## Consumers
14
+ - `docs`
15
+ - `tooling`
16
+ - `workflow-for-workflows`
17
+ - `future-linting`
18
+
19
+ ## Change protocol
20
+ - When a workflow feature lands or changes, update the schema and runtime first.
21
+ - Then update this authoring spec so guidance matches the shipped behavior.
22
+ - Then regenerate or update human-facing docs and examples derived from this spec.
23
+ - Do not leave authoring guidance behind the runtime.
24
+ - Increment `version` when any required-level rule is added, removed, or materially changed. Add a `changelog` entry for the new version.
25
+
26
+ ## Quickstart
27
+ ### start-from-real-sources
28
+ - **Level**: required
29
+ - **Status**: active
30
+ - **Scope**: workflow.authoring, documentation.authoring, tooling.workflow-authoring
31
+ - **Rule**: When authoring a workflow from scratch, start from the schema, current runtime behavior, and modern example workflows before drafting prompts.
32
+ - **Why**: Good workflow authoring starts from how WorkRail actually works, not from stale habits or isolated docs.
33
+ - **Enforced by**: advisory
34
+
35
+ **Checks**
36
+ - Read the schema and at least one modern workflow before drafting.
37
+ - Do not rely on outdated workflow patterns as the starting point.
38
+
39
+ **Anti-patterns**
40
+ - Drafting a workflow from memory without checking current schema or examples
41
+
42
+ **Source refs**
43
+ - `spec/workflow.schema.json` (schema) — Legal structure and supported fields.
44
+ - `src/application/services/validation-engine.ts` (runtime) — Validator-enforced authoring rules.
45
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Current modern example.
46
+
47
+ ### validate-early-and-often
48
+ - **Level**: required
49
+ - **Status**: active
50
+ - **Scope**: workflow.authoring, ci.validation, validator.implementation
51
+ - **Rule**: Validate early while authoring, not only at the end.
52
+ - **Why**: Small validation loops catch structural mistakes before they accumulate into major rework.
53
+ - **Enforced by**: validator, ci, advisory
54
+
55
+ **Checks**
56
+ - Run real validators while drafting and after major structural changes.
57
+ - Use generated docs or examples only after the spec itself validates.
58
+
59
+ **Anti-patterns**
60
+ - Only validating after a large authoring session is finished
61
+
62
+ **Source refs**
63
+ - `docs/workflow-validation.md` (documentation) — Validation workflow for authors.
64
+ - `scripts/validate-workflows-registry.ts` (validator) — Registry validation surface.
65
+
66
+ ### author-in-phases
67
+ - **Level**: recommended
68
+ - **Status**: active
69
+ - **Scope**: workflow.authoring, tooling.workflow-authoring
70
+ - **Rule**: Author workflows in phases: define shape first, then prompts, then validation/refinement.
71
+ - **Why**: Separating structure, prompt design, and validation makes workflows easier to reason about and revise.
72
+ - **Enforced by**: advisory
73
+
74
+ **Checks**
75
+ - Get step/loop structure right before polishing prompt voice.
76
+ - Use validation as a dedicated pass, not just a cleanup afterthought.
77
+
78
+ **Anti-patterns**
79
+ - Polishing prompt wording before the workflow structure is stable
80
+
81
+
82
+ ## Current authoring rules
83
+
84
+ ## Workflow structure
85
+ ### schema-is-legal-truth
86
+ - **Level**: required
87
+ - **Status**: active
88
+ - **Scope**: workflow.definition, documentation.authoring, tooling.workflow-authoring
89
+ - **Rule**: Treat workflow.schema.json as the source of truth for legal structure.
90
+ - **Why**: A second schema will drift.
91
+ - **Enforced by**: advisory
92
+
93
+ **Checks**
94
+ - Do not restate field legality unless the point is authoring quality rather than legality.
95
+ - If this spec mentions a field shape, it should be guidance, not a competing schema.
96
+
97
+ **Anti-patterns**
98
+ - Encoding field legality in multiple docs or specs
99
+ - Treating prose docs as authoritative over schema
100
+
101
+ **Source refs**
102
+ - `spec/workflow.schema.json` (schema) — Legal workflow structure lives here.
103
+
104
+ ### runtime-behavior-beats-prose
105
+ - **Level**: required
106
+ - **Status**: active
107
+ - **Scope**: documentation.authoring, documentation.validation, tooling.workflow-authoring
108
+ - **Rule**: When docs and runtime behavior disagree, update the docs to match runtime or fix runtime immediately.
109
+ - **Why**: Authors need one trustworthy mental model.
110
+ - **Enforced by**: advisory
111
+
112
+ **Checks**
113
+ - Compare guidance against validator and renderer behavior before declaring a rule canonical.
114
+ - Do not leave known mismatches unresolved.
115
+
116
+ **Anti-patterns**
117
+ - Documented behavior that runtime no longer supports
118
+ - Validator behavior that contradicts authoring guidance without a tracked fix
119
+
120
+ **Source refs**
121
+ - `src/application/services/validation-engine.ts` (runtime) — Structural authoring invariants enforced by runtime validation.
122
+ - `src/v2/durable-core/domain/prompt-renderer.ts` (runtime) — Prompt rendering and runtime prompt behavior.
123
+
124
+
125
+ ## Prompt voice
126
+ ### user-voiced-prompts
127
+ - **Level**: recommended
128
+ - **Status**: active
129
+ - **Scope**: workflow.description, step.prompt, step.prompt-fragment
130
+ - **Rule**: Write prompts as direct user intent rather than workflow-engine narration.
131
+ - **Why**: Agents follow user-voiced instructions more naturally than middleware prose.
132
+ - **Enforced by**: advisory
133
+
134
+ **Checks**
135
+ - The opening sentence should sound like a direct ask, not system narration.
136
+ - The step should still be understandable without workflow-internal jargon.
137
+
138
+ **Anti-patterns**
139
+ - Provide a loop control artifact.
140
+ - Input contract: ...
141
+ - Part A / Part B / Rules: ... when the structure adds ceremony rather than clarity
142
+
143
+ **Example refs**
144
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` — See the sharpened user-voiced prompts in the current lean coding workflow.
145
+
146
+ ### protocol-footers-stay-explicit
147
+ - **Level**: required
148
+ - **Status**: active
149
+ - **Scope**: step.output-requirements, step.context-capture, loop.decision.prompt
150
+ - **Rule**: Keep exact protocol requirements explicit when the engine needs a specific output shape, artifact, or context capture.
151
+ - **Why**: Voice improvements must not make the workflow ambiguous or unrunnable.
152
+ - **Enforced by**: advisory
153
+
154
+ **Checks**
155
+ - If the step must emit a specific artifact or capture specific context, say that plainly.
156
+ - Do not hide exact output requirements behind prose-only wording.
157
+
158
+ **Anti-patterns**
159
+ - Removing explicit output shape because it sounds too workflow-y
160
+ - Replacing exact capture requirements with vague summary prose
161
+
162
+ **Example refs**
163
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` — Uses compact Capture footers and explicit loop-control wording.
164
+
165
+ **Source refs**
166
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Uses explicit capture footers and shape-preserving loop outputs.
167
+
168
+
169
+ ## Prompt composition
170
+ ### prefer-structured-prompt-composition
171
+ - **Level**: recommended
172
+ - **Status**: active
173
+ - **Scope**: prompt.composition, step.prompt, step.prompt-fragment, prompt.templates
174
+ - **Rule**: Prefer structured prompt composition over duplicating large prompt branches inline.
175
+ - **Why**: Shared structure is easier to maintain and easier for agents to reason about than repeated prose branches.
176
+ - **Enforced by**: advisory
177
+
178
+ **Checks**
179
+ - Use prompt fragments for conditional branches instead of repeating near-identical prompt blocks.
180
+ - Use context templates for small runtime substitutions, not for complex logic.
181
+ - Keep the base prompt readable without forcing readers to mentally diff three branches.
182
+
183
+ **Anti-patterns**
184
+ - Copy-pasting QUICK, STANDARD, and THOROUGH branches inline when only a few lines differ
185
+ - Encoding runtime logic in prose when promptFragments or templates are the right mechanism
186
+
187
+ **Example refs**
188
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` — Uses prompt fragments and context templates to keep prompts slimmer at render time.
189
+
190
+ **Source refs**
191
+ - `docs/authoring.md` (documentation) — Documents context templates and prompt fragments.
192
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Uses prompt fragments to slim mode-specific prompt branches.
193
+
194
+ ### templates-are-for-simple-substitution
195
+ - **Level**: recommended
196
+ - **Status**: active
197
+ - **Scope**: prompt.templates, step.prompt, step.prompt-fragment
198
+ - **Rule**: Use context variable templates for simple substitution, not for hidden control flow or expression-heavy prompt logic.
199
+ - **Why**: Templates are easy to read when they substitute concrete values and hard to trust when they become a second programming language.
200
+ - **Enforced by**: advisory
201
+
202
+ **Checks**
203
+ - A template token should read like a variable lookup, not a mini expression engine.
204
+ - If the prompt logic branches, prefer prompt fragments or explicit workflow control flow.
205
+
206
+ **Anti-patterns**
207
+ - Expression-heavy template syntax inside prompts
208
+ - Using templates to hide control-flow decisions that should be explicit in the workflow
209
+
210
+ **Source refs**
211
+ - `src/v2/durable-core/domain/context-template-resolver.ts` (runtime) — Runtime template resolution only handles simple identifier dot-paths.
212
+ - `src/v2/durable-core/domain/prompt-renderer.ts` (runtime) — Templates are resolved at prompt render time.
213
+
214
+ ### prompt-fragments-for-conditional-variants
215
+ - **Level**: recommended
216
+ - **Status**: active
217
+ - **Scope**: prompt.composition, step.prompt-fragment, step.prompt
218
+ - **Rule**: Use prompt fragments for conditional prompt variants when the base prompt stays the same and only focused instructions differ.
219
+ - **Why**: Prompt fragments keep authored prompts smaller and make render-time differences explicit.
220
+ - **Enforced by**: advisory
221
+
222
+ **Checks**
223
+ - Keep the base prompt readable and put conditional additions into fragments.
224
+ - Do not move the entire prompt into fragments if most of it is always present.
225
+
226
+ **Anti-patterns**
227
+ - Repeating an entire prompt three times for small rigor-mode differences
228
+ - Using fragments when there is no stable base prompt
229
+
230
+ **Source refs**
231
+ - `docs/authoring.md` (documentation) — Conditional prompt fragments are documented explicitly.
232
+ - `src/v2/durable-core/domain/prompt-renderer.ts` (runtime) — Prompt fragments are assembled at render time.
233
+ - `src/application/services/validation-engine.ts` (validator) — Prompt fragment structure is validated.
234
+
235
+ ### extension-points-over-hardcoded-binding-slots
236
+ - **Level**: recommended
237
+ - **Status**: active
238
+ - **Scope**: workflow.extension-points, prompt.composition, workflow.definition
239
+ - **Rule**: Use extension points when a workflow wants stable project-overridable delegation seams rather than hardcoding bound routine or workflow names inline.
240
+ - **Why**: Extension points make delegated customization explicit, inspectable, and project-overridable without conflating rebinding with routine injection.
241
+ - **Enforced by**: advisory
242
+
243
+ **Checks**
244
+ - Declare extension points at the workflow level when bindings are part of the contract.
245
+ - Avoid hidden or undocumented binding slots in prompts.
246
+ - Prefer `templateCall` when the real goal is reusable inline routine structure, visible injected steps, or parent-step confirmation behavior.
247
+ - Use extension points only when the seam is intentionally delegated and may need project-level rebinding.
248
+
249
+ **Anti-patterns**
250
+ - Hardcoding team-customizable routine names in prompt text without an extension-point declaration
251
+ - Using `{{wr.bindings.*}}` tokens in a workflow that declares no extension points
252
+ - Using extension points where `templateCall` would better represent the parent workflow's real structure
253
+ - Expecting `{{wr.bindings.*}}` to change which routine gets injected inline
254
+
255
+ **Source refs**
256
+ - `docs/authoring.md` (documentation) — Extension points are documented for workflow authors.
257
+ - `src/application/services/compiler/resolve-bindings.ts` (runtime) — Binding resolution depends on declared extension points.
258
+ - `src/application/services/validation-engine.ts` (validator) — Extension point declarations and binding-token usage are validated.
259
+
260
+
261
+ ## Compiler features (middleware)
262
+ ### declare-features-for-cross-cutting-concerns
263
+ - **Level**: recommended
264
+ - **Status**: active
265
+ - **Scope**: workflow.features, workflow.definition
266
+ - **Rule**: Declare compiler features when a workflow uses cross-cutting capabilities that benefit from systematic injection across all steps.
267
+ - **Why**: Features inject constraints, procedure steps, and verification checks at compile time. Declaring them ensures consistent behavior across every step without repeating guidance in each prompt.
268
+ - **Enforced by**: advisory
269
+
270
+ **Checks**
271
+ - If the workflow delegates work to subagents, declare `wr.features.subagent_guidance`.
272
+ - If the workflow uses optional capabilities (delegation, web, code execution), declare `wr.features.capabilities`.
273
+ - If the workflow uses Memory MCP for context recall or persistence, declare `wr.features.memory_context`.
274
+ - Do not duplicate feature-injected guidance in metaGuidance or step prompts. Let the compiler handle it.
275
+
276
+ **Anti-patterns**
277
+ - Hand-writing delegation discipline rules in metaGuidance when `wr.features.subagent_guidance` would inject them systematically
278
+ - Repeating Memory MCP usage instructions in every step instead of declaring `wr.features.memory_context`
279
+ - Declaring features the workflow does not actually use
280
+
281
+ **Source refs**
282
+ - `src/application/services/compiler/feature-registry.ts` (runtime) — Canonical closed-set feature definitions and injection logic.
283
+ - `spec/workflow.schema.json` (schema) — The features array field on the workflow definition.
284
+
285
+ ### features-are-closed-set
286
+ - **Level**: required
287
+ - **Status**: active
288
+ - **Scope**: workflow.features
289
+ - **Rule**: Only declare features from the closed set owned by WorkRail. Do not invent feature IDs.
290
+ - **Why**: Features modify compiled content that becomes part of the workflow hash. User-defined features would break deterministic compilation.
291
+ - **Enforced by**: runtime, validator
292
+
293
+ **Checks**
294
+ - Every feature ID in the `features` array must resolve in the feature registry.
295
+ - Unknown feature IDs cause a compile-time error.
296
+ - Known features: `wr.features.subagent_guidance` (delegation discipline for workflows that spawn subagents), `wr.features.memory_context` (Memory MCP usage constraints for cross-step/cross-session recall).
297
+
298
+ **Anti-patterns**
299
+ - Inventing feature IDs like `wr.features.my_custom_thing`
300
+
301
+ **Source refs**
302
+ - `src/application/services/compiler/feature-registry.ts` (runtime) — The registry rejects unknown feature IDs at compile time.
303
+
304
+ ### declare-capabilities-for-optional-tool-use
305
+ - **Level**: recommended
306
+ - **Status**: active
307
+ - **Scope**: workflow.features
308
+ - **Rule**: Declare `wr.features.capabilities` when the workflow depends on optional capabilities (delegation, web access, code execution, etc.) that may not be available in every environment.
309
+ - **Why**: The capabilities feature injects constraint and graceful-degradation guidance at every step. Without it, agents silently assume optional capabilities are available and produce brittle workflows that fail in restricted environments.
310
+ - **Enforced by**: advisory
311
+
312
+ **Checks**
313
+ - If the workflow uses delegation, web access, code execution, or any other capability that may be unavailable, declare `wr.features.capabilities`.
314
+ - If delegation is also used, declare both `wr.features.capabilities` and `wr.features.subagent_guidance` -- they inject different guidance.
315
+ - Do not declare `wr.features.capabilities` for workflows that only use standard file/tool access available in all environments.
316
+
317
+ **Anti-patterns**
318
+ - Skipping `wr.features.capabilities` for a workflow that delegates to subagents or fetches from the web, leaving agents with no degradation guidance when the capability is absent
319
+ - Declaring `wr.features.capabilities` for a workflow that only uses universally-available tools like Read, Write, and Bash
320
+
321
+ **Source refs**
322
+ - `src/application/services/compiler/feature-registry.ts` (runtime) — Canonical feature definition for wr.features.capabilities, including injected constraints and procedure steps.
323
+
324
+
325
+ ## Workflow references
326
+ ### references-are-for-runtime-companion-material
327
+ - **Level**: recommended
328
+ - **Status**: active
329
+ - **Scope**: workflow.references, workflow.definition
330
+ - **Rule**: Declare references only for documents the running workflow may genuinely need while executing its task.
331
+ - **Why**: References are surfaced to the agent at workflow start and become part of the workflow hash. Maintainer-only or authoring-only references add cognitive load and hash churn without improving runtime execution.
332
+ - **Enforced by**: advisory
333
+
334
+ **Checks**
335
+ - Keep references that materially help the running workflow perform its task.
336
+ - Prefer rubrics, target-system specs, policies, or playbooks that constrain runtime judgment.
337
+ - If removing a reference would not make the running workflow materially worse at execution, remove it.
338
+
339
+ **Anti-patterns**
340
+ - Adding workflow-schema references to ordinary execution workflows that are not authoring or validation workflows
341
+ - Adding authoring-spec or provenance references to workflows whose runtime task is unrelated to workflow authoring
342
+ - Using references to justify a workflow's design to maintainers instead of helping the running agent do the task
343
+
344
+
345
+ ## Response supplements and delivery-owned guidance
346
+ ### keep-boundary-owned-guidance-out-of-step-prompts
347
+ - **Level**: recommended
348
+ - **Status**: active
349
+ - **Scope**: response.supplement, step.prompt, prompt.composition, documentation.authoring, tooling.workflow-authoring
350
+ - **Rule**: Use response supplements for short, boundary-owned guidance that should stay structurally separate from the workflow-authored step prompt.
351
+ - **Why**: Mixing delivery-owned instructions into the main prompt weakens user voice and makes it harder for agents to distinguish the core task from WorkRail logistics.
352
+ - **Enforced by**: advisory
353
+
354
+ **Checks**
355
+ - If the text is system-owned or delivery-owned rather than part of the workflow author's actual step instruction, prefer a response supplement.
356
+ - If the text should appear only at start or resume, prefer a response supplement over repeating it in every authored prompt.
357
+ - Keep the main step prompt readable as a direct user ask even without the supplement.
358
+
359
+ **Anti-patterns**
360
+ - Inlining notes onboarding into every step prompt
361
+ - Mixing WorkRail delivery framing directly into workflow-authored instructions
362
+ - Treating boundary logistics as normal step prose
363
+
364
+ **Source refs**
365
+ - `src/mcp/response-supplements.ts` (runtime) — Canonical supplement policy lives here.
366
+ - `src/mcp/v2-response-formatter.ts` (runtime) — Supplements are rendered as separate MCP content items here.
367
+
368
+ ### one-time-supplements-are-policy-not-durable-state
369
+ - **Level**: recommended
370
+ - **Status**: active
371
+ - **Scope**: response.supplement, documentation.authoring, tooling.workflow-authoring
372
+ - **Rule**: Model one-time response supplements as delivery policy unless exact display history is part of workflow semantics.
373
+ - **Why**: Presentation rules should not leak into durable execution state unless the system truly needs to remember delivery history as part of execution correctness.
374
+ - **Enforced by**: advisory
375
+
376
+ **Checks**
377
+ - Use per_lifecycle when the guidance should appear on every eligible lifecycle.
378
+ - Use once_per_session with an explicit emitOn lifecycle when one lifecycle should own the message.
379
+ - Do not persist shown/not-shown state unless exact delivery history becomes a real execution requirement.
380
+
381
+ **Anti-patterns**
382
+ - Adding durable session state for purely presentational guidance
383
+ - Calling something once_per_session while still emitting it on multiple lifecycles
384
+ - Treating supplement delivery history as part of core workflow meaning when it is only presentation policy
385
+
386
+ **Source refs**
387
+ - `src/mcp/response-supplements.ts` (runtime) — Defines per_lifecycle vs once_per_session delivery semantics.
388
+
389
+
390
+ ## Loops and control flow
391
+ ### loop-control-semantic-correctness
392
+ - **Level**: required
393
+ - **Status**: active
394
+ - **Scope**: loop.decision.prompt, loop.decision.output-example
395
+ - **Rule**: Loop decision prompts must allow both `continue` and `stop` semantically and in the output example.
396
+ - **Why**: Hardcoding `continue` in the example artifact creates contradictory instructions.
397
+ - **Enforced by**: validator, ci, advisory
398
+
399
+ **Checks**
400
+ - Prompt text allows both outcomes.
401
+ - Example output shows the required shape without forcing one decision.
402
+
403
+ **Anti-patterns**
404
+ - Output exactly ... `decision`: `continue`
405
+ - Prompt text says to stop, but the example output only permits continue
406
+
407
+ **Example refs**
408
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` — Current loop decision steps show shape-only output examples.
409
+
410
+ **Source refs**
411
+ - `scripts/validate-workflows-registry.ts` (validator) — Registry validation should preserve semantically correct discoverable workflows.
412
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Current loop decision prompts show shape-only output examples.
413
+
414
+ ### loops-need-real-exit-rules
415
+ - **Level**: required
416
+ - **Status**: active
417
+ - **Scope**: loop.step, loop.decision
418
+ - **Rule**: Loops must have explicit exit rules, bounded iterations, and a clear reason for another pass.
419
+ - **Why**: Unclear loops invite runaway iteration or ceremonial extra passes.
420
+ - **Enforced by**: validator, ci, advisory
421
+
422
+ **Checks**
423
+ - The loop has a max iteration bound.
424
+ - The decision step explains why another pass is or is not needed.
425
+ - The loop does not rely on vibes-only continuation criteria.
426
+
427
+ **Anti-patterns**
428
+ - Retry until it feels done
429
+ - Continue while confidence is low without defining how confidence is evaluated
430
+
431
+ ### forced-self-audit-over-vibes
432
+ - **Level**: recommended
433
+ - **Status**: active
434
+ - **Scope**: step.self-audit, loop.pre-check
435
+ - **Rule**: When a workflow needs a self-audit, use concrete rubric-driven checks rather than vibes-only booleans.
436
+ - **Why**: Agents will often take the easy path if the workflow lets them self-certify confidence without evidence.
437
+ - **Enforced by**: advisory
438
+
439
+ **Checks**
440
+ - Score concrete dimensions instead of asking whether the agent still feels fuzzy.
441
+ - Require brief evidence for each scored dimension when the audit matters.
442
+
443
+ **Anti-patterns**
444
+ - `stillFuzzy = true|false`
445
+ - `contextAuditNeeded = true|false` without an explicit rubric
446
+
447
+ **Example refs**
448
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` — Phase 0 uses a context-clarity rubric instead of a vibes-only confidence flag.
449
+
450
+
451
+ ## Confirmation discipline
452
+ ### confirm-only-for-real-human-decisions
453
+ - **Level**: recommended
454
+ - **Status**: active
455
+ - **Scope**: step.confirmation, workflow.rigor-policy, workflow.authoring
456
+ - **Rule**: Use confirmation gates for real human decisions or review barriers, not as routine ceremony.
457
+ - **Why**: Unnecessary confirmations slow workflows down and teach agents to interrupt instead of act.
458
+ - **Enforced by**: advisory
459
+
460
+ **Checks**
461
+ - A confirmation step should protect a genuine human choice, review checkpoint, or PR boundary.
462
+ - Do not require confirmation just because a step modified a file or finished a phase.
463
+
464
+ **Anti-patterns**
465
+ - Confirming every draft or artifact creation by default
466
+ - Using requireConfirmation as a substitute for clear loop or rigor policy
467
+
468
+ **Source refs**
469
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Uses confirmation for real review barriers like MultiPR checkpoints.
470
+
471
+
472
+ ## Assessment gates
473
+ ### assessment-use-for-bounded-judgment
474
+ - **Level**: recommended
475
+ - **Status**: active
476
+ - **Scope**: workflow.assessments, step.assessment-refs, step.assessment-consequences
477
+ - **Rule**: Use assessment gates when a step needs the agent to submit a bounded, durable judgment before the workflow can safely advance -- not for generic scoring or ceremony.
478
+ - **Why**: Assessment gates force explicit structured reasoning at a decision point and durably record the result. Generic scoring that never affects routing adds noise without value.
479
+ - **Enforced by**: advisory
480
+
481
+ **Checks**
482
+ - The assessment is at a step where a wrong answer would produce a bad handoff.
483
+ - At least one dimension has a consequence that keeps the step pending and requires follow-up.
484
+ - The assessment result is durably recorded and useful to a future resume agent.
485
+
486
+ **Anti-patterns**
487
+ - Using assessments as a generic five-level scoring rubric with no routing consequence
488
+ - Declaring an assessment but never referencing it from any step
489
+
490
+ **Source refs**
491
+ - `workflows/mr-review-workflow.agentic.v2.json` (example) — Uses a three-dimension readiness gate on the final validation step.
492
+ - `workflows/bug-investigation.agentic.v2.json` (example) — Uses a single-dimension diagnosis readiness gate before handoff.
493
+
494
+ ### assessment-dimension-orthogonality
495
+ - **Level**: required
496
+ - **Status**: active
497
+ - **Scope**: workflow.assessments
498
+ - **Rule**: Each dimension in an assessment must capture a distinct failure mode that the other dimensions cannot catch. A dimension that restates existing workflow state (such as a generic 'confidence' dimension that mirrors the workflow's confidence band) adds ceremony without structure.
499
+ - **Why**: The value of multiple dimensions is that each one independently blocks advancement for a different reason. Correlated or vague dimensions collapse to a single gate with extra steps.
500
+ - **Enforced by**: advisory
501
+
502
+ **Checks**
503
+ - Each dimension is independently checkable without needing to know the result of the others.
504
+ - No dimension restates a context variable the workflow already computes (e.g. recommendationConfidenceBand).
505
+ - A 'low' rating on any one dimension alone justifies a follow-up, regardless of the others.
506
+
507
+ **Anti-patterns**
508
+ - A single 'confidence' dimension that mirrors the workflow's existing confidence band
509
+ - Multiple dimensions that all reduce to 'did I do a good job overall'
510
+ - Dimensions so correlated that one being low always means the others are low too
511
+
512
+ ### assessment-v1-constraints
513
+ - **Level**: required
514
+ - **Status**: active
515
+ - **Scope**: step.assessment-refs, step.assessment-consequences
516
+ - **Rule**: A step may declare one or more assessmentRefs and at most one assessmentConsequences entry. When assessmentConsequences is present, at least one ref is required. Use anyEqualsLevel as the trigger -- the engine checks all submitted dimensions across all referenced assessments and fires if any equals that level.
517
+ - **Why**: Multiple refs allow composing separate orthogonal assessment definitions (e.g. quality-gate + coverage-gate) behind a single blocking consequence, without forcing unrelated dimensions into one monolithic definition.
518
+ - **Enforced by**: validator
519
+
520
+ **Checks**
521
+ - At least one assessmentRefs entry when assessmentConsequences is present.
522
+ - No more than one assessmentConsequences entry per step.
523
+ - The consequence uses anyEqualsLevel to declare which level blocks -- not a named dimension.
524
+
525
+ **Anti-patterns**
526
+ - Trying to encode multiple consequences via workarounds
527
+
528
+
529
+ ## Delegation and subagents
530
+ ### bounded-delegation
531
+ - **Level**: required
532
+ - **Status**: active
533
+ - **Scope**: workflow.meta-guidance, step.delegation-checkpoint
534
+ - **Rule**: Delegate bounded cognitive routines, not ownership of the full workflow or task.
535
+ - **Why**: Main-agent ownership preserves context, accountability, and synthesis quality.
536
+ - **Enforced by**: advisory
537
+
538
+ **Checks**
539
+ - Subagents have a bounded mission.
540
+ - The main agent still owns strategy, synthesis, and final decisions.
541
+
542
+ **Anti-patterns**
543
+ - Handing the full task to a subagent and accepting its result wholesale
544
+ - Treating named builder or researcher roles as alternate owners
545
+
546
+ **Source refs**
547
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Delegation checkpoints keep the main agent as the synthesizer and decision-maker.
548
+
549
+ ### batched-checkpoints-over-ad-hoc-optionality
550
+ - **Level**: recommended
551
+ - **Status**: active
552
+ - **Scope**: step.delegation-checkpoint, workflow.rigor-policy
553
+ - **Rule**: Prefer a few explicit fan-out and fan-in checkpoints over many optional one-off subagent calls.
554
+ - **Why**: This is easier to reason about, fits the runtime cost model better, and reduces agent corner-cutting.
555
+ - **Enforced by**: advisory
556
+
557
+ **Checks**
558
+ - Use delegation at deliberate review barriers rather than sprinkling optional single calls everywhere.
559
+ - Use rigor or trigger rules to determine when a batch is mandatory.
560
+
561
+ **Anti-patterns**
562
+ - If it helps, maybe run one subagent
563
+ - Optional challenge wording at high-value decision points
564
+
565
+ **Example refs**
566
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` — Uses explicit challenge, audit, and verification barriers.
567
+
568
+
569
+ ## Subagent synthesis and claim adoption
570
+ ### subagent-output-is-evidence
571
+ - **Level**: required
572
+ - **Status**: active
573
+ - **Scope**: synthesis.design, synthesis.plan-audit, synthesis.slice-verification, synthesis.final-verification
574
+ - **Rule**: Treat subagent output as evidence, not truth or authority.
575
+ - **Why**: Delegation improves perspective, but the main agent still owns judgment.
576
+ - **Enforced by**: advisory
577
+
578
+ **Checks**
579
+ - The main agent states what it agrees with, rejects, or still doubts.
580
+ - The workflow does not let subagent output silently become the decision.
581
+
582
+ **Anti-patterns**
583
+ - Accepting subagent conclusions wholesale
584
+ - Treating multiple subagent agreement as automatic truth
585
+
586
+ ### verify-high-impact-claims
587
+ - **Level**: required
588
+ - **Status**: active
589
+ - **Scope**: synthesis.claim-adoption
590
+ - **Rule**: Any subagent finding that changes a decision must be classified as `Confirmed`, `Plausible`, or `Rejected`.
591
+ - **Why**: Decision-driving claims need explicit handling rather than vague agreement.
592
+ - **Enforced by**: advisory
593
+
594
+ **Checks**
595
+ - `Confirmed` claims cite primary evidence such as code, artifacts, spec, tests/build, or direct workflow context.
596
+ - `Plausible` claims do not drive the decision until verified.
597
+ - `Rejected` claims say why they failed against fuller context or direct evidence.
598
+
599
+ **Anti-patterns**
600
+ - Subagent agreement alone is enough for `Confirmed`
601
+ - Using delegated findings as blockers or green lights without verification
602
+
603
+ **Example refs**
604
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` — Major synthesis checkpoints use Confirmed / Plausible / Rejected for decision-driving findings.
605
+
606
+ **Source refs**
607
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` (example) — Major synthesis checkpoints use Confirmed / Plausible / Rejected for adopted claims.
608
+
609
+
610
+ ## Discouraged legacy patterns
611
+ ### avoid-heavy-clarification-front-doors
612
+ - **Level**: discouraged
613
+ - **Status**: active
614
+ - **Scope**: legacy.patterns, workflow.authoring
615
+ - **Rule**: Avoid large up-front clarification batteries when the workflow can discover context with tools first and ask only the real remaining questions.
616
+ - **Why**: Heavy intake creates ceremony and often asks the user things the agent could have learned itself.
617
+ - **Enforced by**: advisory
618
+
619
+ **Checks**
620
+ - Prefer targeted questioning after exploration over blanket intake questionnaires.
621
+
622
+ **Anti-patterns**
623
+ - Multiple broad clarification prompts before any repo exploration
624
+ - Learning-path or experience-level questionnaires that do not affect workflow correctness
625
+
626
+ ### avoid-pseudo-dsl-meta-guidance
627
+ - **Level**: discouraged
628
+ - **Status**: active
629
+ - **Scope**: legacy.patterns, workflow.meta-guidance
630
+ - **Rule**: Avoid pseudo-functions, fake DSLs, or teaching-product helper syntax in meta guidance.
631
+ - **Why**: Pseudo-DSL prose is harder to trust, harder to maintain, and usually weaker than either plain rules or real composition features.
632
+ - **Enforced by**: advisory
633
+
634
+ **Checks**
635
+ - Meta guidance should read like rules, not pretend code.
636
+
637
+ **Anti-patterns**
638
+ - fun adaptToPath(content) = ...
639
+ - Helper-function prose that mimics an API but is not actually executable
640
+
641
+ ### avoid-local-regex-validation-when-real-validators-exist
642
+ - **Level**: discouraged
643
+ - **Status**: active
644
+ - **Scope**: legacy.patterns, documentation.validation, workflow.authoring
645
+ - **Rule**: Avoid local regex-style validation heuristics when a real workflow validator exists.
646
+ - **Why**: Approximate checks drift fast and create false confidence.
647
+ - **Enforced by**: advisory
648
+
649
+ **Checks**
650
+ - Use real validators as the gate and keep heuristics secondary at most.
651
+
652
+ **Anti-patterns**
653
+ - Treating hand-written regex checks as the final proof of correctness
654
+
655
+
656
+ ## Examples
657
+ ### examples-must-stay-modern-and-validated
658
+ - **Level**: required
659
+ - **Status**: active
660
+ - **Scope**: workflow.authoring, documentation.authoring, tooling.workflow-authoring
661
+ - **Rule**: Examples used by this spec should be modern, still validated, and still representative of current authoring guidance.
662
+ - **Why**: Examples quietly drifting out of date undermines the trustworthiness of the whole authoring system.
663
+ - **Enforced by**: advisory
664
+
665
+ **Checks**
666
+ - Example refs should point to workflows that still validate.
667
+ - Review example refs when the referenced workflow changes materially.
668
+
669
+ **Anti-patterns**
670
+ - Keeping a canonical example ref after the workflow has drifted into a legacy style
671
+
672
+ **Example refs**
673
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` — Current example of modern prompt composition, delegation barriers, and loop semantics.
674
+
675
+
676
+ ## Validation
677
+ ### validator-first
678
+ - **Level**: required
679
+ - **Status**: active
680
+ - **Scope**: workflow.authoring, tooling.workflow-authoring, ci.validation
681
+ - **Rule**: Use real workflow validators and runtime-equivalent validation as the gate for correctness.
682
+ - **Why**: Validator behavior is the executable truth for whether a workflow is actually runnable.
683
+ - **Enforced by**: runtime, validator, ci
684
+
685
+ **Checks**
686
+ - Validate against the same workflow runtime would discover and execute.
687
+ - Do not rely on regex-style local approximations when a real validator exists.
688
+
689
+ **Anti-patterns**
690
+ - Docs-only validation
691
+ - File-shape checks that ignore runtime registry resolution
692
+
693
+ **Source refs**
694
+ - `scripts/validate-workflows-registry.ts` (validator) — Registry validation is part of the real validation surface.
695
+ - `src/application/services/validation-engine.ts` (validator) — Structural validation logic lives here.
696
+
697
+ ### validation-bar-must-match-runtime
698
+ - **Level**: required
699
+ - **Status**: active
700
+ - **Scope**: documentation.validation, validator.implementation
701
+ - **Rule**: Validation guidance must align with the same discovery, resolution, normalization, compilation, and lifecycle behavior that runtime uses.
702
+ - **Why**: A workflow that passes guidance-level validation but fails at runtime is a trust failure.
703
+ - **Enforced by**: validator, ci, advisory
704
+
705
+ **Checks**
706
+ - Validation docs should describe the same phases runtime actually depends on.
707
+ - If runtime adds a new contract surface, update authoring guidance and validation docs.
708
+
709
+ **Anti-patterns**
710
+ - Saying a workflow is valid because the file parses even though registry resolution or runtime compilation can still fail
711
+
712
+
713
+ ## Artifacts and planning surfaces
714
+ ### artifact-canonicality
715
+ - **Level**: recommended
716
+ - **Status**: active
717
+ - **Scope**: artifact.plan, artifact.spec, artifact.verification
718
+ - **Rule**: When multiple human-facing artifacts exist, say which one is canonical for which concern.
719
+ - **Why**: Ambiguous ownership between plan, spec, and verification artifacts causes drift.
720
+ - **Enforced by**: advisory
721
+
722
+ **Checks**
723
+ - If both a behavior artifact and an implementation artifact exist, define the boundary explicitly.
724
+ - Verification steps should know which artifact is the source of truth for behavior.
725
+
726
+ **Anti-patterns**
727
+ - Plan and spec both contain acceptance criteria with no stated source of truth
728
+ - Verification steps check one artifact while planning updates a different one
729
+
730
+ **Example refs**
731
+ - `workflows/coding-task-workflow-agentic.lean.v2.json` — Uses explicit spec vs implementation-plan ownership.
732
+
733
+
734
+ ## Planned guidance
735
+
736
+ > This section is future-facing. It is **not** current runtime truth or current engine support.
737
+
738
+ ## Planned delegation packets and outputs
739
+ ### delegation-package
740
+ - **Level**: recommended
741
+ - **Status**: planned
742
+ - **Scope**: delegation.context-packet
743
+ - **Rule**: Every subagent should receive a self-contained context packet with mission, current decision, relevant files or artifacts, constraints, and expected deliverable shape.
744
+ - **Why**: Subagents do not inherit parent context cleanly today, and the engine should make the packet explicit.
745
+ - **Enforced by**: planned, advisory
746
+
747
+ **Checks**
748
+ - The context packet should be inspectable.
749
+ - The packet should be curated rather than hidden full-session inheritance.
750
+
751
+ **Anti-patterns**
752
+ - Assuming a subagent implicitly knows the parent context
753
+
754
+ ### subagent-results-should-be-structured
755
+ - **Level**: recommended
756
+ - **Status**: planned
757
+ - **Scope**: delegation.result-envelope, synthesis.claim-adoption, step.delegation-checkpoint
758
+ - **Rule**: Delegated routines should return a structured result envelope rather than only freeform notes.
759
+ - **Why**: Parents can synthesize, verify, and reject subagent claims much more reliably when results are shaped consistently.
760
+ - **Enforced by**: planned, advisory
761
+
762
+ **Checks**
763
+ - A good result envelope includes findings, assumptions, missing context, confidence, and claims requiring verification.
764
+ - Decision-driving claims should be easy for the parent to inspect without rereading the entire deliverable.
765
+
766
+ **Anti-patterns**
767
+ - Freeform delegated output with no separation between findings, assumptions, and uncertainty
768
+ - Subagent output that hides which claims still need parent verification
769
+
770
+ ### subagent-output-discloses-assumptions
771
+ - **Level**: recommended
772
+ - **Status**: planned
773
+ - **Scope**: delegation.result-envelope, synthesis.claim-adoption
774
+ - **Rule**: Subagent output should disclose the assumptions it depended on.
775
+ - **Why**: The parent cannot judge a delegated finding properly if the hidden assumptions stay hidden.
776
+ - **Enforced by**: planned, advisory
777
+
778
+ **Checks**
779
+ - High-impact findings name the assumptions they depend on.
780
+ - Assumptions are separated from findings, not buried in prose.
781
+
782
+ **Anti-patterns**
783
+ - Delegated recommendations that read as certain but rely on unstated assumptions
784
+
785
+ ### subagent-output-discloses-missing-context
786
+ - **Level**: recommended
787
+ - **Status**: planned
788
+ - **Scope**: delegation.result-envelope, delegation.context-packet
789
+ - **Rule**: Subagent output should disclose what context it was missing or uncertain about.
790
+ - **Why**: The parent needs to know whether a finding is weak because the delegated context packet was incomplete.
791
+ - **Enforced by**: planned, advisory
792
+
793
+ **Checks**
794
+ - Missing context is called out explicitly instead of implied through hedging.
795
+
796
+ **Anti-patterns**
797
+ - A confident delegated result that omits obvious context gaps
798
+
799
+ ### subagent-output-exposes-confidence
800
+ - **Level**: recommended
801
+ - **Status**: planned
802
+ - **Scope**: delegation.result-envelope, synthesis.claim-adoption
803
+ - **Rule**: Subagent output should expose confidence for its key findings or recommendations.
804
+ - **Why**: The parent needs a fast read on which delegated conclusions are tentative versus well-supported.
805
+ - **Enforced by**: planned, advisory
806
+
807
+ **Checks**
808
+ - Confidence is attached to findings or recommendations, not hidden in a general disclaimer.
809
+
810
+ **Anti-patterns**
811
+ - All findings are presented with the same implied confidence
812
+
813
+ ### high-impact-findings-must-be-easy-to-verify
814
+ - **Level**: recommended
815
+ - **Status**: planned
816
+ - **Scope**: delegation.result-envelope, synthesis.claim-adoption
817
+ - **Rule**: High-impact delegated findings should be easy for the parent to verify against primary evidence.
818
+ - **Why**: The parent should not have to reverse-engineer a delegated deliverable to validate the claims that change the decision.
819
+ - **Enforced by**: planned, advisory
820
+
821
+ **Checks**
822
+ - Decision-driving claims are surfaced explicitly.
823
+ - The output makes it obvious what should be verified in code, artifacts, or tests.
824
+
825
+ **Anti-patterns**
826
+ - Burying the finding that changes the decision inside a long prose dump
827
+
828
+
829
+ ## Scope catalog
830
+ - `workflow.definition`: Whole-workflow authored shape
831
+ - `workflow.description`: Top-level workflow description text
832
+ - `workflow.meta-guidance`: Workflow-level meta guidance
833
+ - `workflow.extension-points`: Workflow-level extension point declarations and binding slots
834
+ - `workflow.features`: Compiler feature declarations (closed-set middleware injected at compile time)
835
+ - `step.prompt`: Primary step prompt text
836
+ - `step.prompt-fragment`: Conditional prompt fragment text
837
+ - `step.prompt-blocks`: Structured prompt blocks or shared prompt composition structures
838
+ - `step.output-requirements`: Explicit artifact or output requirements in a step
839
+ - `step.context-capture`: Explicit context values a step must capture
840
+ - `step.self-audit`: A step asking the agent to assess its own understanding or confidence
841
+ - `step.delegation-checkpoint`: A step that explicitly fans out to subagents and later synthesizes
842
+ - `step.confirmation`: A step that deliberately pauses for human confirmation
843
+ - `loop.step`: The loop construct itself
844
+ - `loop.pre-check`: Checks done before entering a loop or another pass
845
+ - `loop.decision.prompt`: Prompt that decides whether a loop continues or stops
846
+ - `loop.decision`: The loop decision checkpoint as a whole
847
+ - `loop.decision.output-example`: Example artifact or output shape shown in a loop decision step
848
+ - `workflow.rigor-policy`: Rules that differ by QUICK, STANDARD, or THOROUGH rigor
849
+ - `prompt.composition`: Prompt assembly strategy including fragments, templates, and shared structure
850
+ - `prompt.templates`: Context variable templates and prompt-time substitution
851
+ - `response.supplement`: Boundary-owned supplemental instructions delivered alongside a workflow step
852
+ - `synthesis.design`: Design synthesis after delegated or external review
853
+ - `synthesis.plan-audit`: Plan-audit synthesis after delegated review
854
+ - `synthesis.slice-verification`: Slice verification synthesis after delegated review
855
+ - `synthesis.final-verification`: Final verification synthesis after delegated review
856
+ - `synthesis.claim-adoption`: Rules for adopting or rejecting subagent claims
857
+ - `workflow.authoring`: General workflow authoring behavior
858
+ - `tooling.workflow-authoring`: Authoring helpers, generation tools, or workflow-for-workflows logic
859
+ - `documentation.authoring`: Human-facing authoring documentation
860
+ - `documentation.validation`: Validation-focused documentation
861
+ - `validator.implementation`: Workflow validator implementation and behavior
862
+ - `ci.validation`: CI validation surfaces for workflows
863
+ - `artifact.plan`: Implementation-planning artifacts
864
+ - `artifact.spec`: Behavior/specification artifacts
865
+ - `artifact.verification`: Verification or handoff artifacts
866
+ - `delegation.context-packet`: Structured context passed to subagents
867
+ - `delegation.result-envelope`: Structured result shape returned by subagents
868
+ - `legacy.patterns`: Older authoring patterns that should now be discouraged or avoided
869
+ - `workflow.references`: The workflow-level references array declaring external documents surfaced at start time.
870
+ - `workflow.assessments`: The workflow-level assessments array declaring reusable assessment gate definitions.
871
+ - `step.assessment-refs`: The step-level assessmentRefs array referencing declared assessment gate definitions.
872
+ - `step.assessment-consequences`: The step-level assessmentConsequences array declaring blocking consequences when gate dimension levels are met.
873
+