devflow-kit 3.15.0 → 3.17.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 (106) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +8 -45
  3. package/dist/agents/code.md +2 -5
  4. package/dist/agents/design.md +1 -1
  5. package/dist/agents/fix.md +1 -2
  6. package/dist/agents/git.md +1 -2
  7. package/dist/agents/harden.md +1 -3
  8. package/dist/agents/refactor.md +1 -2
  9. package/dist/agents/review.md +1 -1
  10. package/dist/cli/commands/compliance-prompts.js +2 -2
  11. package/dist/cli/commands/init.js +5 -6
  12. package/dist/cli/commands/uninstall.js +1 -1
  13. package/dist/commands/bug-analysis.md +1 -1
  14. package/dist/commands/code-review.md +2 -2
  15. package/dist/commands/plan.md +12 -40
  16. package/dist/compliance-off/commands/bug-analysis.md +1 -1
  17. package/dist/compliance-off/commands/code-review.md +2 -2
  18. package/dist/compliance-off/commands/plan.md +12 -40
  19. package/dist/compliance-off/skills/git/references/tracker/_contract.md +1 -1
  20. package/dist/compliance-off/skills/git/references/tracker/github/ensure-pr-ready.md +3 -4
  21. package/dist/compliance-off/skills/git/references/tracker/jira/ensure-pr-ready.md +3 -4
  22. package/dist/compliance-off/skills/git/references/tracker/linear/ensure-pr-ready.md +3 -4
  23. package/dist/core/installed-variants.js +1 -1
  24. package/dist/core/mds-variants.js +6 -8
  25. package/dist/core/plugins.js +5 -40
  26. package/dist/core/retired-shipped-names.js +7 -0
  27. package/dist/curation-compliance-off/commands/bug-analysis.md +1 -1
  28. package/dist/curation-compliance-off/commands/code-review.md +2 -2
  29. package/dist/curation-compliance-off/commands/plan.md +12 -40
  30. package/dist/curation-off/agents/code.md +2 -5
  31. package/dist/curation-off/agents/design.md +1 -1
  32. package/dist/curation-off/agents/fix.md +1 -2
  33. package/dist/curation-off/agents/harden.md +1 -3
  34. package/dist/curation-off/agents/refactor.md +1 -2
  35. package/dist/curation-off/agents/review.md +1 -1
  36. package/dist/curation-off/commands/bug-analysis.md +1 -1
  37. package/dist/curation-off/commands/code-review.md +2 -2
  38. package/dist/curation-off/commands/plan.md +12 -40
  39. package/dist/curation-tdd-off/agents/code.md +2 -5
  40. package/dist/skills/git/references/tracker/_contract.md +1 -1
  41. package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +3 -3
  42. package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +3 -3
  43. package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +3 -3
  44. package/dist/targets/claude-code/curation-install.js +28 -3
  45. package/dist/targets/claude-code/language-stamp.js +1 -2
  46. package/dist/{cli/commands → targets/claude-code}/legacy-sweep.js +45 -12
  47. package/dist/tdd-off/agents/code.md +2 -5
  48. package/dist/variant-axes.json +0 -20
  49. package/package.json +2 -3
  50. package/src/assets/agents/_partials/_code.mds +1 -2
  51. package/src/assets/agents/code.mds +1 -3
  52. package/src/assets/agents/design.mds +1 -1
  53. package/src/assets/agents/git.mds +1 -2
  54. package/src/assets/agents/harden.mds +1 -3
  55. package/src/assets/agents/plan.md +10 -7
  56. package/src/assets/agents/review.mds +1 -1
  57. package/src/assets/agents/test.md +1 -2
  58. package/src/assets/agents/tracker.md +1 -5
  59. package/src/assets/agents/validate.md +0 -1
  60. package/src/assets/commands/_partials/_compliance.mds +0 -1
  61. package/src/assets/commands/_partials/_decisions.mds +2 -3
  62. package/src/assets/commands/_partials/_docs_root.mds +1 -1
  63. package/src/assets/commands/_partials/_plan_contract.mds +0 -56
  64. package/src/assets/commands/bug-analysis.mds +1 -1
  65. package/src/assets/commands/code-review.mds +2 -2
  66. package/src/assets/commands/plan.mds +12 -40
  67. package/src/assets/mds/git/_ops.mds +3 -20
  68. package/src/assets/mds/git/_ops_steps.mds +8 -6
  69. package/src/assets/mds/tracker/_common.mds +3 -14
  70. package/src/assets/mds/tracker/_contract.mds +1 -1
  71. package/src/assets/mds/tracker/_github.mds +0 -32
  72. package/src/assets/mds/tracker/_jira.mds +0 -31
  73. package/src/assets/mds/tracker/_linear.mds +0 -31
  74. package/src/assets/mds/tracker/_steps.mds +0 -6
  75. package/src/assets/scripts/pr-evidence.cjs +3 -268
  76. package/src/assets/scripts/resolve-base.cjs +1 -3
  77. package/src/assets/scripts/verify-evidence.cjs +13 -18
  78. package/src/assets/skills/agent-references/SKILL.md +3 -3
  79. package/src/assets/skills/agent-references/references/commands/plan-levels.md +8 -8
  80. package/src/assets/skills/agent-references/references/synthesize/planning.md +1 -1
  81. package/src/assets/skills/docs-framework/SKILL.md +5 -19
  82. package/src/assets/skills/docs-framework/references/patterns.md +1 -2
  83. package/dist/commands/dynamic-build.md +0 -1218
  84. package/dist/commands/dynamic-plan.md +0 -447
  85. package/dist/commands/dynamic-profile.md +0 -102
  86. package/dist/commands/dynamic-tickets.md +0 -555
  87. package/dist/compliance-off/commands/dynamic-build.md +0 -1197
  88. package/dist/compliance-off/commands/dynamic-tickets.md +0 -555
  89. package/dist/curation-compliance-off/commands/dynamic-build.md +0 -1161
  90. package/dist/curation-compliance-off/commands/dynamic-tickets.md +0 -515
  91. package/dist/curation-off/commands/dynamic-build.md +0 -1182
  92. package/dist/curation-off/commands/dynamic-plan.md +0 -406
  93. package/dist/curation-off/commands/dynamic-tickets.md +0 -515
  94. package/dist/skills/git/references/tracker/github/post-wave-report.md +0 -44
  95. package/dist/skills/git/references/tracker/jira/post-wave-report.md +0 -49
  96. package/dist/skills/git/references/tracker/linear/post-wave-report.md +0 -49
  97. package/src/assets/commands/_partials/_engine.mds +0 -216
  98. package/src/assets/commands/_partials/_factory.mds +0 -122
  99. package/src/assets/commands/_partials/_preamble.mds +0 -112
  100. package/src/assets/commands/_partials/_roster.mds +0 -31
  101. package/src/assets/commands/_partials/_ticket_template.mds +0 -56
  102. package/src/assets/commands/_partials/_wave.mds +0 -123
  103. package/src/assets/commands/dynamic-build.mds +0 -882
  104. package/src/assets/commands/dynamic-plan.mds +0 -289
  105. package/src/assets/commands/dynamic-profile.mds +0 -103
  106. package/src/assets/commands/dynamic-tickets.mds +0 -281
@@ -1,216 +0,0 @@
1
- @define gate1_postcode():
2
- ### GATE 1 — Post-code pipeline
3
-
4
- Run in this order:
5
-
6
- 1. **Polish agent**
7
- 2. **Harden agent** — 9-pillar self-review (deep structural analysis); returns `{"status": "PASS" | "FIXED" | "BLOCKED"}`
8
- - BLOCKED (a P0 issue cannot be fixed in scope), or a missing or unrecognised status, which counts as BLOCKED → stop the pass and escalate as `harden-blocked`; Validate does not run on code Harden could not accept
9
- 3. **Validate agent** — build / typecheck / lint / test; returns `{"verdict": "PASS" | "FAIL", "details": "..."}`. It runs last and unconditionally: one full run over the HEAD that Polish and Harden left, so it covers their commits
10
- - FAIL → Fix agent fix (max 2 retries), each followed by a Validate agent re-run
11
- - If still FAIL after 2 retries → escalate as `validation-exhausted`
12
-
13
- **Gate 1 contains NO Evaluate agent and NO Test agent.** Those are Gate 2 only.
14
-
15
- Depth scales to change size and budget: a one-line fix gets a lighter pass.
16
-
17
- **Cadence — Gate 1 runs at exactly two points per ticket:**
18
- 1. **Gate 1 #1** — immediately after the initial Code agent implementation (inside `implement_bundle()`). An escalated result — Validate exhausted, or Harden BLOCKED — returns early: the ticket's engine returns `ESCALATED` with one escalation, and Gate 2 and the review pass never run on a broken or unfinished build.
19
- 2. **Gate 1 #2** — the final gate, after all Gate-2 fixes and the entire review pass have completed. Harden BLOCKED here is `ESCALATED` as well.
20
- @end
21
-
22
- @define gate2_acceptance():
23
- ### GATE 2 — Acceptance gate (per ticket, plan-scoped)
24
-
25
- Gate 2 fires once: after the implement-bundle and before the review pass. It does not re-run after review-fixes (those get Gate 1 only).
26
-
27
- **Evaluate agent** (only if a plan exists):
28
- - Run `evaluator_panel()`
29
- - If the Evaluate agent returns FAIL (either lens failed): fix-and-continue — a Fix agent applies the demanded fixes and self-verifies its own build (batched as in the review pass if numerous). The recorded verdict becomes `FAIL-FIXED` (fixes applied, not re-evaluated); Gate 2 then proceeds. In SINGLE mode the run reports it as `UNVERIFIED`, never PASS.
30
-
31
- **Test agent** (only if acceptance criteria or a test plan exist):
32
- - Scenario-based acceptance tests covering functionality, API contracts, performance
33
- - FAIL → fix-and-continue — a Fix agent applies the demanded fixes and self-verifies its own build. The recorded verdict becomes `FAIL-FIXED`; Gate 2 then proceeds. In SINGLE mode the run reports it as `UNVERIFIED`, never PASS.
34
- - BLOCKED (no result), or any other or missing verdict → no fix, and the run never reports PASS.
35
-
36
- **When Gate 2 inputs are absent:**
37
- - No plan → skip the Evaluate agent silently (note in output: "Gate 2 Evaluate agent skipped — no plan available")
38
- - No acceptance criteria and no test plan → skip Test agent silently (note in output: "Gate 2 Test agent skipped — no criteria available")
39
- @end
40
-
41
- @define evaluator_panel():
42
- ### Evaluate agent spawn (one agent, two lenses)
43
-
44
- Run one Evaluate agent whose prompt names both lenses, as the SINGLE skeleton's Gate 2 prompt words them: acceptance criteria (negative criteria included) and scope or intent drift. FAIL when either lens fails.
45
- @end
46
-
47
- @define implement_bundle():
48
- ### Implement bundle
49
-
50
- Run in order:
51
-
52
- ```
53
- <!-- curation:on -->
54
- Code(agentType:"Code", prompt: "OPERATION: implement" first line, then full task + plan + DECISIONS_CONTEXT + COMPLIANCE_DIRECTIVE + handoff if sequential)
55
- <!-- curation:off -->
56
- Code(agentType:"Code", prompt: "OPERATION: implement" first line, then full task + plan + COMPLIANCE_DIRECTIVE + handoff if sequential)
57
- <!-- curation:end -->
58
- → gate1_postcode()
59
- → gate2_acceptance() ← Gate 2 runs HERE — before the review pass, not after
60
- ```
61
-
62
- <!-- curation:on -->
63
- Every Code-family agent prompt opens with `OPERATION: <mode>` as its first line: `implement` and `issue-fix` go to `agentType:"Code"`, `validation-fix`, `alignment-fix` and `qa-fix` go to `agentType:"Fix"`. It must include: task description, implementation plan (if one exists), relevant DECISIONS_CONTEXT (the index you loaded before authoring), the compliance directive (`COMPLIANCE_DIRECTIVE` — every Code prompt carries it when it is not empty, fix prompts included), and any PRIOR_PHASE_SUMMARY / HANDOFF_FILE for sequential multi-phase tickets.
64
- <!-- curation:off -->
65
- Every Code-family agent prompt opens with `OPERATION: <mode>` as its first line: `implement` and `issue-fix` go to `agentType:"Code"`, `validation-fix`, `alignment-fix` and `qa-fix` go to `agentType:"Fix"`. It must include: task description, implementation plan (if one exists), the compliance directive (`COMPLIANCE_DIRECTIVE` — every Code prompt carries it when it is not empty, fix prompts included), and any PRIOR_PHASE_SUMMARY / HANDOFF_FILE for sequential multi-phase tickets.
66
- <!-- curation:end -->
67
- @end
68
-
69
- @define review_pass():
70
- ### Review → verify → fix (single pass)
71
-
72
- The review pass runs exactly ONCE per ticket. One full-branch review → one adversarial verification → one batched fix phase → final Gate 1 (#2). Budget scales roster and verification votes, NEVER the number of passes.
73
-
74
- **Step 1 — Spawn Review agents in parallel (one agent() per focus)**
75
-
76
- **Review scope:** the entire branch diff, `DIFF_RANGE: {base commit}...HEAD`; the base commit is the 40 or 64 hex commit that the ticket branch was forked from, as the setup step reported it; a ticket with none stops `base-missing`.
77
-
78
- Core Review agents (always, 8 total): security, architecture, performance, complexity, consistency, regression, testing, reliability
79
-
80
- Conditional by file type detected in the diff (add these when relevant):
81
- - `.ts` / `.tsx` → typescript
82
- - `.tsx` / `.jsx` → react, accessibility, ui-design
83
- - `.css` / `.scss` → ui-design
84
- - `.go` → go
85
- - `.java` → java
86
- - `.py` → python
87
- - `.rs` → rust
88
- - database schema / query files → database
89
- - `package.json` / `go.mod` / `Cargo.toml` / etc. → dependencies
90
- - Markdown / doc files → documentation
91
-
92
- **Spawn pacing:** launch Review agents in staggered chunks of 4–6 (sequential groups of parallel spawns).
93
-
94
- **Review agent result contract:** every Review agent must return a structured result with fields `focus`, `reviewed: true`, `filesExamined`, and `findings`. Each item in `findings` must carry: `file` (path of the primary file the finding relates to, or `null` if scope is unknown), `description` (one-sentence issue statement), and `severity` (`critical | high | medium | low`). A result is DEAD if: the agent returned null, threw, returned a guard string, or `reviewed !== true`. A DEAD Review agent is never treated as a clean reviewer. Retry once sequentially. If still dead after retry: record the focus in `coverageGaps`. A pass with any coverage gaps can never early-exit as clean, and the run verdict can never be PASS; escalate with message "review coverage incomplete: <focus>".
95
-
96
- **Step 2 — Adversarial finding verification**
97
-
98
- Before any fix, verify findings with 2–3 agents, one per lens of the skeleton's verification panel.
99
-
100
- Majority-survives: a finding needs >50% of verification lenses to confirm it. Strip unconfirmed findings.
101
-
102
- **Step 3 — Early exit or fix**
103
-
104
- If no surviving findings: return early (no fixes needed). Any coverageGaps are carried in the return — they block a PASS verdict downstream, not the early exit.
105
-
106
- If survivors remain: batch the confirmed findings for fixing: group findings by file — one file per set of sub-batches, chunked at max 5 findings per sub-batch; never mix two files in one batch. A finding with no `file` field is its own singleton batch. Sub-batches for the same file run sequentially (never two Code agents editing the same file concurrently); sub-batches for distinct files run via `parallel()` in staggered chunks of ~5. Each Code agent's prompt pins a return contract: `{"status": "fixed"|"blocked", "commitShas": [...], "unresolved": [...]}` — a chunk is FIXED only when `result.status === "fixed"` AND `commitShas` is non-empty AND `result.unresolved` is empty; never decide disposition from status alone. A non-empty `unresolved` list means the agent named work it could not complete — carry the whole chunk into `survivingFindings` rather than guessing which findings the strings map to. `survivingFindings` = findings not addressed: fix Code agent dead/failed/blocked/deferred or committed but left work named in `unresolved`. The fixing Code agent **self-verifies its own fix builds** (build/typecheck per the Code agent's Running commands block, once over its whole batch). Do not run Gate 1 or Gate 2 inside the pass (no Validate, Polish, Harden, Evaluate or Test agent).
107
- @end
108
-
109
- @define concurrency_doctrine():
110
- ### Code agent concurrency doctrine
111
-
112
- **DEFAULT: SEQUENTIAL.** Parallelism is the rare, tightly-gated exception.
113
-
114
- - **Same task → sequential Code agents with handoff. Never parallel.**
115
- - **Different tasks may parallelize, but only when all three bars hold:**
116
- 1. Completely different areas of the code — different files/modules, no imports between them, no shared contracts/interfaces
117
- 2. Different feature logic — they do not touch the same feature's logic or cooperate on a single outcome
118
- 3. Different goals — they are not two steps converging on the same end state
119
- - "They look independent" is not sufficient. If two tasks are somewhat related — they touch the same feature, one's completion makes the other meaningful, or they march toward a shared goal — run them sequentially.
120
- - **When in doubt, sequential.** Parallel must be affirmatively justified against all three bars.
121
-
122
- This applies to both: multiple Code agents working on a single ticket and multi-ticket scheduling in a wave.
123
- @end
124
-
125
- @define build_execution_doctrine():
126
- ### Build execution doctrine — the Running commands block
127
-
128
- The Code, Fix, Refactor, Validate and Test agents each carry this `## Running commands` block in their bodies, so each prompt in this engine names the block ("your Running commands block") instead of copying it:
129
-
130
- Run builds, typechecks, lints and tests in the foreground, each with an explicit Bash `timeout` above its expected run time. The ceiling is 600000 ms, or `BASH_MAX_TIMEOUT_MS` when set (`echo ${BASH_MAX_TIMEOUT_MS:-600000}`).
131
-
132
- - Capture, then tail, in one Bash call: `LOG=$(mktemp); echo "LOG=$LOG"; <command> >"$LOG" 2>&1; rc=$?; tail -n 40 "$LOG"; printf '\nEXIT=%s\n' "$rc"`. The last `EXIT=` line is the result; never decide one from a grep count.
133
- - Never background a build or test, and never poll across turns: no `sleep` or `true` turns, no sentinel-file checks, no Monitor.
134
- - Prefer the scoped command for the change; for the whole set, one workspace command over per-package loops.
135
- - A run past its timeout moves to the background: no tool call, even a Read, until its end notice, then Read the last `EXIT=` line of the file the move names, not `$LOG`; it alone sets the label, not the notice. With none read it is BLOCKED: report its duration and log path. Report only after the end notice.
136
- - A run expected to exceed the ceiling may be split into parts, run in sequence.
137
- - Never re-run a command when nothing it reads has changed.
138
- - Never wrap a build or test command in `sh -c`, `bash -c`, `python3 -c` or `node -e`: permission rules deny wrapped commands they allow directly.
139
- - The same rules hold inside a dynamic Workflow sub-agent.
140
-
141
- **Cheapest-sufficient validation:** iterate with the fastest check that proves the change — `tsc --noEmit`, `cargo check`, `go vet`, a single test file. Reserve full builds and whole-suite runs for the final gates.
142
-
143
- **One build gate per phase:** batch related fixes, validate once. A fix-pass Code agent runs one light check over its whole batch, never one per fix. After the wave, the full-workspace regression is the human's job.
144
- @end
145
-
146
- @define engine_output_schema():
147
- ### Engine output schema
148
-
149
- Each ticket engine run returns a structured result. The engine fills `verdict`: the SINGLE skeleton's `overallVerdict`, or `ESCALATED` from the ticket-link or branch stop. The wave merges `PASS` and `UNVERIFIED` and quarantines every other value, or none.
150
-
151
- ```json
152
- {
153
- "ticket": "string — ticket ID or description",
154
- "branch": "string — the branch this ticket's setup-task created, or (none)",
155
- "verdict": "PASS | UNVERIFIED | PARTIAL | FAIL | ESCALATED",
156
- "issueId": "string — the Issue ID captured from this ticket's setup-task Handoff Values, or (none)",
157
- "issuePrLink": "string — the PR link line captured from the same block, or (none)",
158
- "survivingFindings": [
159
- {
160
- "focus": "string — Review agent focus area",
161
- "file": "string — primary file the finding relates to, or null if scope unknown",
162
- "description": "string — one-sentence issue statement",
163
- "severity": "critical | high | medium | low",
164
- "status": "surviving"
165
- }
166
- ],
167
- "fixedFindings": [
168
- {
169
- "focus": "string — Review agent focus area",
170
- "file": "string — primary file the finding relates to, or null if scope unknown",
171
- "description": "string — one-sentence issue statement",
172
- "severity": "critical | high | medium | low",
173
- "status": "fixed",
174
- "commitShas": ["string — commit SHAs from the fix Code agent"]
175
- }
176
- ],
177
- "reviewCoverage": {
178
- "failedFocuses": ["string — focus areas where Review agent died after retry"],
179
- "complete": "boolean — true iff no coverage gaps"
180
- },
181
- "escalations": [
182
- {
183
- "type": "merge-conflict | gate2-fail | validation-exhausted | harden-blocked | ambiguous-resolution | review-coverage-incomplete | dependency-blocked | engine-crash | ticket-link-missing | branch-missing | base-missing",
184
- "description": "string"
185
- }
186
- ],
187
- "gate2": {
188
- "evaluateVerdict": "PASS | FAIL | FAIL-FIXED | SKIPPED",
189
- "testVerdict": "PASS | FAIL | FAIL-FIXED | SKIPPED | BLOCKED",
190
- "skipReasons": ["string — why a gate was skipped, if applicable"]
191
- }
192
- }
193
- ```
194
- @end
195
-
196
- @define engine_invariants():
197
- ### Engine invariants
198
-
199
- 1. **Code is written only by the Code family (Code, Fix).** No other agent type writes code.
200
- 2. **Findings are verified before any fix is written.** Unverified findings are not passed to the Code agent.
201
- 3. **All written code passes Gate 1.** No code merge, commit, or handoff before Polish agent + Harden agent + Validate agent (in that order).
202
- 4. **Gate 2 runs once, at implementation acceptance.**
203
- 5. **NEVER auto-merge to main or master.** All merges target the integration branch.
204
- 6. **No unauthorized tracker or remote side-effects.** Sub-agents NEVER create issues/PRs on the tracker, comment on them, or push beyond the ticket-authorized branch unless the ticket, plan, or user explicitly authorizes that exact action. This applies to whatever tracker is resolved, not to one vendor. Proposed follow-ups go in the run report.
205
- 7. **The review pass runs exactly ONCE per ticket.** Never author additional cycles or a delta re-review of fix commits.
206
- @end
207
-
208
- @export gate1_postcode
209
- @export gate2_acceptance
210
- @export evaluator_panel
211
- @export implement_bundle
212
- @export review_pass
213
- @export concurrency_doctrine
214
- @export build_execution_doctrine
215
- @export engine_output_schema
216
- @export engine_invariants
@@ -1,122 +0,0 @@
1
- @define factory_shape():
2
- ### Ticket-factory pipeline shape (generalized)
3
-
4
- ---
5
-
6
- #### Stage 1 — Draft (one agent per ticket, parallelisable)
7
-
8
- Spawn one Design agent or Synthesize agent per candidate ticket. DRAFT_SCHEMA:
9
-
10
- ```json
11
- {
12
- "type": "object",
13
- "required": ["title", "summary", "wave", "dependsOn", "scope", "acceptanceCriteria", "openQuestions"],
14
- "properties": {
15
- "title": { "type": "string" },
16
- "summary": { "type": "string" },
17
- "wave": { "type": "number" },
18
- "dependsOn": { "type": "array", "items": { "type": "string" } },
19
- "scope": { "type": "object",
20
- "properties": { "in": { "type": "array", "items": { "type": "string" } },
21
- "out": { "type": "array", "items": { "type": "string" } } } },
22
- "acceptanceCriteria":{ "type": "array", "items": { "type": "string" } },
23
- "openQuestions": { "type": "array", "items": { "type": "string" } }
24
- }
25
- }
26
- ```
27
-
28
- ---
29
-
30
- #### Stage 2 — Two-lens review (parallel per ticket)
31
-
32
- For each draft, run two independent Review agents **in parallel**, one per lens, with the checks and severities the skeleton's review prompts state: Lens A, planner-readiness (a cold read), and Lens B, accuracy and scope discipline. A scope hole is a thing the feature obviously needs that neither In nor Out names. A smuggled anti-feature is a scope item the initiative explicitly excludes.
33
-
34
- REVIEW_SCHEMA:
35
-
36
- ```json
37
- {
38
- "type": "object",
39
- "required": ["verdict", "findings"],
40
- "properties": {
41
- "verdict": { "type": "string", "enum": ["ready", "needs-work"] },
42
- "findings": { "type": "array", "items": {
43
- "type": "object",
44
- "required": ["severity", "issue", "suggestion"],
45
- "properties": {
46
- "severity": { "type": "string", "enum": ["critical", "major", "minor"] },
47
- "issue": { "type": "string" },
48
- "suggestion": { "type": "string" }
49
- }
50
- }}
51
- }
52
- }
53
- ```
54
-
55
- ---
56
-
57
- #### Stage 3 — Revise (one agent per ticket, per review findings)
58
-
59
- For each ticket, spawn one Synthesize agent or Design agent to apply review findings. REVISE_SCHEMA:
60
-
61
- ```json
62
- {
63
- "type": "object",
64
- "required": ["title", "changesMade", "remainingConcerns"],
65
- "properties": {
66
- "title": { "type": "string" },
67
- "changesMade": { "type": "array", "items": { "type": "string" } },
68
- "remainingConcerns":{ "type": "array", "items": { "type": "string" } }
69
- }
70
- }
71
- ```
72
-
73
- ---
74
-
75
- #### Stage 4 — Whole-set cross-critic (single agent, sees all revised tickets)
76
-
77
- One Design agent reviews the full revised set for set-level issues, not individual prose quality, on the four axes the skeleton's cross-critic prompt names: coverage, overlaps and contradictions, the dependency graph, and acceptance-criteria coherence. The dependency-graph check also flags a dependency that a ticket needs but does not declare.
78
-
79
- CRITIC_SCHEMA:
80
-
81
- ```json
82
- {
83
- "type": "object",
84
- "required": ["setVerdict", "perTicketAmendments", "trackingGuidance"],
85
- "properties": {
86
- "setVerdict": { "type": "string" },
87
- "perTicketAmendments": { "type": "array", "items": {
88
- "type": "object",
89
- "required": ["title", "amendments"],
90
- "properties": {
91
- "title": { "type": "string" },
92
- "amendments": { "type": "array", "items": { "type": "string" } }
93
- }
94
- }},
95
- "trackingGuidance": { "type": "string" }
96
- }
97
- }
98
- ```
99
-
100
- ---
101
-
102
- #### Stage 5 — Per-ticket amend (parallel, only tickets with amendments)
103
-
104
- ---
105
-
106
- #### Stage 6 — Assemble tracking issue
107
-
108
- One Synthesize agent writes the tracking-issue document from the final ticket set + critic guidance.
109
-
110
- ---
111
-
112
- #### Usage notes
113
-
114
- - Each schema is its stage's return shape, passed as `schema:`: `{ agentType: "Design", schema: DRAFT_SCHEMA }`, `{ agentType: "Review", schema: REVIEW_SCHEMA }`, `{ agentType: "Synthesize", schema: REVISE_SCHEMA }`, `{ agentType: "Design", schema: CRITIC_SCHEMA }`. A field that the host script's `Return:` line adds joins the schema.
115
- - The `candidates` array is **what the model proposed + user confirmed** — never hardcoded.
116
- - The `initiative` variable is the raw user input (a description, a spec doc path, or inline text) — read it and distill before passing to agents.
117
- - The `constraints` variable is optional: any cross-cutting rules (naming discipline, scope filters, authority order) the user supplied.
118
- - Write each ticket's artifact file inside an agent, with the ticket body template above.
119
- - For large initiatives (more than ~8 tickets), chunk the `parallel(map())` fan-outs into batches (e.g. `for` loop over slices, `await`-ing each batch) so agent concurrency stays bounded and provider rate limits are respected.
120
- @end
121
-
122
- @export factory_shape
@@ -1,112 +0,0 @@
1
- @import "./_decisions.mds" as decisions
2
-
3
- A partial: the Workflow-authoring preamble that the three Workflow hosts
4
- (dynamic-build, dynamic-plan and dynamic-tickets) share, and the decisions step
5
- that precedes authoring.
6
-
7
- D-DECISIONS-AUTHORING-STEP: the "DECISIONS_CONTEXT — obtain BEFORE authoring" step
8
- is its own define, `authoring_decisions()`, expanded by the same three hosts right
9
- after their settings block, so the gate in it reads a line already resolved.
10
- `authoring_preamble()` carries no decisions text. D-LEARNING-VARIANTS: the whole of
11
- `authoring_decisions()` is a curation-on arm, so a curation-off build carries no decisions
12
- step.
13
-
14
- D-DECISIONS-DECLARED-ONLY: the step names, as the receivers of the index, only the
15
- agent types whose contract declares `DECISIONS_CONTEXT` among the valid
16
- `agentType`s. `tests/decisions/decisions-seam.test.ts` computes the declared set
17
- from the agent sources and holds every pass sentence to it.
18
-
19
- @define authoring_preamble():
20
- ## Your task: author a Claude Code dynamic Workflow and run it
21
-
22
- You (the main model) author the Workflow script body inline and pass it to the `Workflow` tool.
23
-
24
- ### Workflow runtime contract
25
-
26
- A workflow script must begin with a pure-literal export:
27
-
28
- ```js
29
- export const meta = {
30
- name: "devflow-dynamic-...", // flat hyphenated namespace — always prefix devflow-dynamic-
31
- description: "...",
32
- phases: ["..."]
33
- };
34
- ```
35
-
36
- The script body uses only these hooks:
37
-
38
- ```js
39
- agent(prompt, opts) // spawn a sub-agent; opts.agentType resolves devflow installed agents
40
- parallel(thunks) // barrier — awaits all; concurrency capped ~min(16, cores-2)
41
- pipeline(items, ...fns) // stream items through stages (no barrier between stages)
42
- phase(name, fn) // named phase boundary for resume / progress
43
- log(msg) // structured log
44
- workflow(fn) // nest one level
45
- ```
46
-
47
- Globals available in the script body: `args`, `budget`, `workflow()`.
48
-
49
- **The script body has NO filesystem / Node.js / CLI access** — no tracker CLI of any kind, `gh` included. All file reading, issue fetching, git operations and shell commands happen inside the agents the script spawns. There is no `fs`, `exec` or `fetch` in scope.
50
-
51
- ### Agent reuse via agentType
52
-
53
- Spawn devflow agents with:
54
-
55
- ```js
56
- agent("your prompt here", { agentType: "Code" })
57
- ```
58
-
59
- Valid `agentType` values: Code, Fix, Validate, Polish, Harden, Evaluate, Test, Review, Git, Synthesize, Design, Architect.
60
-
61
- **Omit `opts.model` whenever `agentType` is set.** The agent frontmatter sets its own model tier, and `opts.model` overrides it.
62
-
63
- Do not write logic that depends on an agent listing its own skills.
64
-
65
- ### Pre-flight self-check — required before the first live `Workflow` call
66
-
67
- Audit the script against this checklist:
68
-
69
- - **`meta` is a pure literal** — `name` and `description` present; no variables, function calls, spreads or template interpolation anywhere inside `meta`.
70
- - **Every `pipeline(x, …)` / `parallel(x)` first argument is a real array** — never a function, object, or possibly-undefined value. If it derives from a prior agent result, coerce it: `parallel((maybeList || []).map(...))`.
71
- - **No reference to a possibly-undefined field** — guard every cross-result field access with optional chaining.
72
- - **`.filter(Boolean)` before mapping over `agent()` / `parallel()` results** — an agent can return `null` (skipped, or died after retries); strip nulls before `.map` or field access. filter(Boolean) is crash-safety only; it must never convert missing required coverage into success.
73
- - **`phase()` titles match the phases declared in `meta`** — every `phase("…")` call has a matching declared phase, and vice-versa.
74
-
75
- Then run a syntax gate: write the authored script to a fresh, run-unique scratch file `/tmp/df-wf-check-<meta.name>-<epoch-seconds>.js` (never a prior run's path), run `node --check` on that file, and only then pass the script text to the `Workflow` tool.
76
-
77
- ### Budget scaling
78
-
79
- Scale the Review roster and the verification votes to the `budget` global: fewer at a low budget, more at a high budget. Never hardcode a roster size.
80
-
81
- ### Handoff convention for sequential Code agents within a ticket
82
-
83
- When a ticket requires multiple sequential Code agent phases, each Code agent appends its own `## Phase {N} Implementation Summary` section, at most 8,192 bytes, to `{toplevel}/.devflow/docs/handoff-{branch_slug}.md`, `{branch_slug}` being the ticket's branch name with every `/` replaced by `-`, and `{toplevel}` being `git rev-parse --show-toplevel` in the checkout the ticket's branch is in — never a subdirectory. It never rewrites an earlier section. The next Code agent reads, via HANDOFF_FILE input, only the section of the phase immediately before its own, not the whole file. PRIOR_PHASE_SUMMARY is the in-context form. The code is authoritative over the summaries.
84
-
85
- ### IRON RULE (LLM-vs-plumbing)
86
-
87
- **Author no deterministic feature code:** no parsers, schedulers, topological sorts, dependency-graph helpers or confidence formulas. The workflow's agents do all issue reading, dependency reasoning and scheduling by judgment at runtime.
88
-
89
- ### SAFETY BANNER
90
-
91
- **NEVER merge to main or master** — the workflow merges to an integration branch only. This rule must appear as an `engine_invariants()` note in every workflow that touches git.
92
- @end
93
-
94
- @define authoring_decisions():
95
- <!-- curation:on -->
96
- ### DECISIONS_CONTEXT — obtain BEFORE authoring
97
-
98
- {{decisions.decisions_gate()}}
99
-
100
- {{decisions.decisions_locate()}}
101
-
102
- Before you author the workflow script, read `{ledger}/.devflow/curation/index.md`. If the file is absent or empty, set `DECISIONS_CONTEXT` to `(none)`; otherwise use the file content as `DECISIONS_CONTEXT`.
103
-
104
- Then inject the relevant DECISIONS_CONTEXT into the prompts of the Code, Fix, Design, Architect, Review and Harden agents, which follow `devflow:apply-decisions`. Those are the agent types above whose contract declares it; every other agent type gets no decisions context.
105
-
106
- {{decisions.decisions_slice()}} The script carries one `DECISIONS_CONTEXT` for every agent, so cut it once, over the whole run.
107
-
108
- <!-- curation:end -->
109
- @end
110
-
111
- @export authoring_preamble
112
- @export authoring_decisions
@@ -1,31 +0,0 @@
1
- @define agent_roster():
2
- ### Confirmed agent roster
3
-
4
- Model tiers are for reference only; never pass `opts.model`.
5
-
6
- | agentType | Model tier | Role |
7
- |---|---|---|
8
- | Code | sonnet | Implements the plan and fixes review findings |
9
- | Fix | sonnet | Fixes the listed validation, alignment and QA failures |
10
- | Validate | haiku | Build / typecheck / lint / test — fast correctness gate |
11
- | Polish | sonnet | Reduces complexity, removes duplication, improves readability |
12
- | Harden | opus | 9-pillar self-review — deep structural analysis |
13
- | Evaluate | sonnet | Plan-fidelity / alignment — "was the plan implemented correctly?" |
14
- | Test | sonnet | Scenario-based acceptance tests against acceptance criteria |
15
- | Review | opus | Focus-parameterized code review |
16
- | Git | haiku | Branches, commits, merges, worktree management |
17
- | Synthesize | haiku | Aggregates multi-agent outputs |
18
- | Design | opus | Gap analysis: tickets, critics, wave reads |
19
- | Architect | opus | Plans, anti-pattern review |
20
- @end
21
-
22
- @define agent_caveats():
23
- ### Agent caveats
24
-
25
- - **The Code family writes every fix** — Code for review findings, Fix for gate failures; no other agent type writes code. Finding verification uses adversarial Review passes.
26
- - **Review agents are focus-parameterized.** Make one `agent()` call with `agentType: "Review"` per focus, with the focus in the prompt. Never batch focuses into one Review call.
27
- - Give each agent its full context in its prompt.
28
- @end
29
-
30
- @export agent_roster
31
- @export agent_caveats
@@ -1,56 +0,0 @@
1
- @define ticket_body_template():
2
- ### Ticket body template
3
-
4
- ---
5
-
6
- **Wave:** N
7
- **Depends on:** {ISSUE_REF}, {ISSUE_REF} (or "none")
8
- **Issue:** {ISSUE_REF} — written only by `/devflow:dynamic-tickets`' filing step, after the workflow; a drafting agent never writes it
9
-
10
- ---
11
-
12
- ## Summary
13
-
14
- One paragraph: what this ticket implements and why it exists in this wave.
15
-
16
- ## Scope
17
-
18
- **In scope:**
19
- - Explicit list of what this ticket covers
20
- - Named deliverables (files, functions, APIs, schemas)
21
-
22
- **Out of scope (anti-features — do NOT implement):**
23
- - Explicit list of what this ticket deliberately excludes
24
- - Related things that belong to other tickets
25
- - Future work that must NOT be anticipated
26
-
27
- At least one anti-feature is required per ticket.
28
-
29
- ## Invariants
30
-
31
- System properties that MUST remain true after this ticket is merged:
32
- - Backward compatibility guarantees (if any)
33
- - Data integrity constraints
34
- - Performance contracts inherited from prior work
35
-
36
- ## Acceptance criteria
37
-
38
- Numbered, for the Evaluate and Test agents.
39
-
40
- 1. POSITIVE: The system MUST...
41
- 2. POSITIVE: The API MUST return...
42
- 3. NEGATIVE: The system MUST NOT...
43
- 4. NEGATIVE: Existing behavior X MUST NOT regress...
44
-
45
- (Minimum: at least one negative criterion)
46
-
47
- ## Open questions
48
-
49
- Questions that must be answered before implementation begins. If none, write "None".
50
-
51
- ---
52
-
53
- **Note for wave scheduler — `Depends on:` cardinality and grammar:** the field lists **zero or more** provider-canonical issue references this ticket must wait for, comma-separated, or the literal `none`. Each entry is one `{ISSUE_REF}`; under `github` an `{ISSUE_REF}` is `#`-prefixed, so a two-dependency ticket renders `Depends on: #{n}, #{n}`. Write the reference exactly as the tracker renders it — never a bare number, never a URL, never a title. The `Wave: N` label is a human-readable hint; actual ordering is determined by reading the `Depends on` relationships.
54
- @end
55
-
56
- @export ticket_body_template