devflow-kit 3.4.0 → 3.6.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.
- package/CHANGELOG.md +127 -0
- package/README.md +12 -8
- package/dist/agents/code.md +39 -182
- package/dist/agents/{diagnose.md → debug.md} +4 -4
- package/dist/agents/design.md +0 -1
- package/dist/agents/fix.md +165 -0
- package/dist/agents/git.md +31 -693
- package/dist/agents/{scrutinize.md → harden.md} +9 -6
- package/dist/agents/knowledge.md +8 -2
- package/dist/agents/refactor.md +133 -0
- package/dist/agents/research.md +6 -0
- package/dist/agents/review.md +0 -4
- package/dist/agents/skim.md +4 -0
- package/dist/agents/triage.md +8 -1
- package/dist/cli/agents-view/render.js +1 -1
- package/dist/cli/commands/behavior-prompts.js +77 -0
- package/dist/cli/commands/behavior.js +123 -0
- package/dist/cli/commands/flags.js +8 -2
- package/dist/cli/commands/init-seed.js +7 -3
- package/dist/cli/commands/init.js +75 -8
- package/dist/cli/commands/learning.js +12 -12
- package/dist/cli/commands/legacy-hooks.js +1 -1
- package/dist/cli/commands/rules.js +16 -0
- package/dist/cli/commands/tracker.js +112 -15
- package/dist/cli/commands/uninstall.js +111 -5
- package/dist/cli.js +2 -0
- package/dist/commands/bug-analysis.md +22 -18
- package/dist/commands/code-review.md +25 -29
- package/dist/commands/debug.md +36 -15
- package/dist/commands/dynamic-build.md +64 -78
- package/dist/commands/dynamic-plan.md +18 -14
- package/dist/commands/dynamic-profile.md +8 -6
- package/dist/commands/dynamic-tickets.md +19 -15
- package/dist/commands/explore.md +14 -14
- package/dist/commands/implement.md +122 -225
- package/dist/commands/plan.md +32 -47
- package/dist/commands/release.md +12 -7
- package/dist/commands/research.md +26 -15
- package/dist/commands/resolve.md +53 -92
- package/dist/commands/self-review.md +42 -42
- package/dist/core/agent-frontmatter.js +101 -0
- package/dist/core/agent-models.js +47 -11
- package/dist/core/compliance-compose.js +6 -4
- package/dist/core/{learning-tuning-config.js → curate-tuning-config.js} +14 -14
- package/dist/core/feature-switch.js +23 -2
- package/dist/core/flags.js +111 -0
- package/dist/core/learning-queue-cleanup.js +1 -1
- package/dist/core/manifest.js +11 -3
- package/dist/core/mds-variants.js +68 -26
- package/dist/core/migrations.js +63 -44
- package/dist/core/plugins.js +49 -70
- package/dist/core/project-paths.js +3 -7
- package/dist/core/proxy-log.js +1 -1
- package/dist/core/proxy-state.js +1 -1
- package/dist/core/tracker.js +120 -2
- package/dist/hud/codex-usage.js +247 -0
- package/dist/hud/components/codex-quota.js +37 -0
- package/dist/hud/components/usage-quota.js +1 -1
- package/dist/hud/config.js +1 -0
- package/dist/hud/index.js +16 -3
- package/dist/hud/render.js +3 -1
- package/dist/learning-off/agents/code.md +37 -180
- package/dist/learning-off/agents/{diagnose.md → debug.md} +4 -4
- package/dist/learning-off/agents/design.md +0 -1
- package/dist/learning-off/agents/fix.md +161 -0
- package/dist/learning-off/agents/{scrutinize.md → harden.md} +9 -6
- package/dist/learning-off/agents/knowledge.md +8 -2
- package/dist/learning-off/agents/refactor.md +129 -0
- package/dist/learning-off/agents/research.md +6 -0
- package/dist/learning-off/agents/review.md +0 -4
- package/dist/learning-off/agents/skim.md +4 -0
- package/dist/learning-off/agents/triage.md +8 -1
- package/dist/learning-off/commands/bug-analysis.md +12 -12
- package/dist/learning-off/commands/code-review.md +14 -22
- package/dist/learning-off/commands/debug.md +24 -8
- package/dist/learning-off/commands/dynamic-build.md +58 -74
- package/dist/learning-off/commands/dynamic-plan.md +12 -10
- package/dist/learning-off/commands/dynamic-profile.md +2 -2
- package/dist/learning-off/commands/dynamic-tickets.md +13 -11
- package/dist/learning-off/commands/explore.md +3 -7
- package/dist/learning-off/commands/implement.md +110 -217
- package/dist/learning-off/commands/plan.md +21 -39
- package/dist/learning-off/commands/release.md +7 -4
- package/dist/learning-off/commands/research.md +16 -9
- package/dist/learning-off/commands/resolve.md +42 -85
- package/dist/learning-off/commands/self-review.md +30 -34
- package/dist/skills/git/references/learn-conventions.md +27 -3
- package/dist/skills/git/references/pr/check-ci-status.md +19 -0
- package/dist/skills/git/references/pr/check-merge-readiness.md +21 -0
- package/dist/skills/git/references/pr/fetch-review-threads.md +30 -0
- package/dist/skills/git/references/pr/post-resolution-summary.md +18 -0
- package/dist/skills/git/references/pr/post-review-summary.md +20 -0
- package/dist/skills/git/references/pr/resolve-review-threads.md +28 -4
- package/dist/skills/git/references/pr/update-pr-evidence.md +17 -6
- package/dist/skills/git/references/pr/validate-branch.md +26 -0
- package/dist/skills/git/references/tracker/github/associate-release.md +24 -0
- package/dist/skills/git/references/tracker/github/backlink-shipped-issues.md +31 -1
- package/dist/skills/git/references/tracker/github/create-release.md +30 -1
- package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +89 -2
- package/dist/skills/git/references/tracker/github/ensure-traceable-issue.md +16 -1
- package/dist/skills/git/references/tracker/github/fetch-issue.md +36 -1
- package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +47 -1
- package/dist/skills/git/references/tracker/github/gather-release-evidence.md +25 -0
- package/dist/skills/git/references/tracker/github/manage-debt.md +21 -1
- package/dist/skills/git/references/tracker/github/post-wave-report.md +15 -1
- package/dist/skills/git/references/tracker/github/setup-task.md +41 -1
- package/dist/skills/git/references/tracker/jira/associate-release.md +24 -0
- package/dist/skills/git/references/tracker/jira/backlink-shipped-issues.md +31 -1
- package/dist/skills/git/references/tracker/jira/create-release.md +30 -1
- package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +89 -2
- package/dist/skills/git/references/tracker/jira/ensure-traceable-issue.md +16 -1
- package/dist/skills/git/references/tracker/jira/fetch-issue.md +36 -1
- package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +47 -1
- package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +25 -0
- package/dist/skills/git/references/tracker/jira/manage-debt.md +21 -1
- package/dist/skills/git/references/tracker/jira/post-wave-report.md +15 -1
- package/dist/skills/git/references/tracker/jira/setup-task.md +41 -1
- package/dist/skills/git/references/tracker/linear/associate-release.md +24 -0
- package/dist/skills/git/references/tracker/linear/backlink-shipped-issues.md +31 -1
- package/dist/skills/git/references/tracker/linear/create-release.md +30 -1
- package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +89 -2
- package/dist/skills/git/references/tracker/linear/ensure-traceable-issue.md +16 -1
- package/dist/skills/git/references/tracker/linear/fetch-issue.md +36 -1
- package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +47 -1
- package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +25 -0
- package/dist/skills/git/references/tracker/linear/manage-debt.md +21 -1
- package/dist/skills/git/references/tracker/linear/post-wave-report.md +15 -1
- package/dist/skills/git/references/tracker/linear/setup-task.md +41 -1
- package/dist/targets/claude-code/agent-type-owner.js +164 -0
- package/dist/targets/claude-code/behavior-install.js +111 -0
- package/dist/targets/claude-code/installer.js +177 -77
- package/dist/targets/claude-code/learning-install.js +9 -1
- package/dist/targets/claude-code/tracker-install.js +33 -16
- package/dist/targets/claude-code/tracker-servers.js +107 -0
- package/package.json +4 -3
- package/src/assets/agents/_partials/_code.mds +109 -0
- package/src/assets/agents/code.mds +18 -222
- package/src/assets/agents/{learning.md → curate.md} +22 -72
- package/src/assets/agents/{diagnose.mds → debug.mds} +4 -4
- package/src/assets/agents/design.mds +0 -1
- package/src/assets/agents/evaluate.md +11 -5
- package/src/assets/agents/explore.md +58 -0
- package/src/assets/agents/fix.mds +113 -0
- package/src/assets/agents/git.mds +31 -693
- package/src/assets/agents/{scrutinize.mds → harden.mds} +9 -6
- package/src/assets/agents/knowledge.mds +8 -2
- package/src/assets/agents/{simplify.md → polish.md} +7 -4
- package/src/assets/agents/refactor.mds +81 -0
- package/src/assets/agents/research.mds +6 -0
- package/src/assets/agents/review.mds +0 -4
- package/src/assets/agents/skim.mds +4 -0
- package/src/assets/agents/synthesize.md +26 -352
- package/src/assets/agents/test.md +10 -2
- package/src/assets/agents/tracker.md +20 -7
- package/src/assets/agents/triage.mds +8 -1
- package/src/assets/agents/validate.md +5 -0
- package/src/assets/commands/_partials/_compliance.mds +36 -0
- package/src/assets/commands/_partials/_decisions.mds +26 -6
- package/src/assets/commands/_partials/_engine.mds +17 -17
- package/src/assets/commands/_partials/_evidence_policy.mds +0 -17
- package/src/assets/commands/_partials/_knowledge.mds +14 -9
- package/src/assets/commands/_partials/_preamble.mds +5 -3
- package/src/assets/commands/_partials/_roster.mds +6 -5
- package/src/assets/commands/_partials/_wave.mds +2 -2
- package/src/assets/commands/bug-analysis.mds +10 -10
- package/src/assets/commands/code-review.mds +12 -22
- package/src/assets/commands/debug.mds +24 -2
- package/src/assets/commands/dynamic-build.mds +34 -51
- package/src/assets/commands/dynamic-plan.mds +4 -3
- package/src/assets/commands/dynamic-tickets.mds +5 -4
- package/src/assets/commands/explore.mds +1 -1
- package/src/assets/commands/implement.mds +108 -201
- package/src/assets/commands/plan.mds +19 -44
- package/src/assets/commands/release.mds +8 -3
- package/src/assets/commands/research.mds +14 -7
- package/src/assets/commands/resolve.mds +37 -82
- package/src/assets/commands/self-review.mds +27 -27
- package/src/assets/mds/.mdsroot +4 -0
- package/src/assets/mds/git/_ops.mds +383 -0
- package/src/assets/mds/git/_ops_pr.mds +201 -0
- package/src/assets/mds/git/_ops_steps.mds +147 -0
- package/src/assets/mds/git/_pr.mds +45 -50
- package/src/assets/mds/git/_references.mds +6 -3
- package/src/assets/mds/tracker/_common.mds +5 -5
- package/src/assets/mds/tracker/_contract.mds +4 -3
- package/src/assets/mds/tracker/_github.mds +60 -14
- package/src/assets/mds/tracker/_jira.mds +60 -14
- package/src/assets/mds/tracker/_linear.mds +60 -14
- package/src/assets/mds/tracker/_steps.mds +10 -9
- package/src/assets/rules/behavior.md +6 -0
- package/src/assets/scripts/hooks/assets/orchestrator-charter.md +5 -3
- package/src/assets/scripts/hooks/capture-prompt +1 -1
- package/src/assets/scripts/hooks/capture-question +1 -1
- package/src/assets/scripts/hooks/capture-turn +1 -1
- package/src/assets/scripts/hooks/json-helper.cjs +2 -2
- package/src/assets/scripts/hooks/lib/learning-store.cjs +1 -1
- package/src/assets/scripts/hooks/lib/project-paths.cjs +4 -10
- package/src/assets/scripts/hooks/preamble +1 -1
- package/src/assets/scripts/hooks/session-start-context +58 -45
- package/src/assets/scripts/verify-evidence.cjs +726 -9
- package/src/assets/skills/agent-references/SKILL.md +37 -0
- package/src/assets/skills/agent-references/references/commands/implement-evidence-asks.md +35 -0
- package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +15 -0
- package/src/assets/skills/agent-references/references/curate/maintain.md +71 -0
- package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +71 -0
- package/src/assets/skills/agent-references/references/synthesize/design.md +36 -0
- package/src/assets/skills/agent-references/references/synthesize/exploration.md +38 -0
- package/src/assets/skills/agent-references/references/synthesize/planning.md +60 -0
- package/src/assets/skills/agent-references/references/synthesize/research.md +61 -0
- package/src/assets/skills/agent-references/references/synthesize/review.md +76 -0
- package/src/assets/skills/apply-decisions/SKILL.md +6 -4
- package/src/assets/skills/compliance/SKILL.md +1 -1
- package/src/assets/skills/docs-framework/SKILL.md +81 -84
- package/src/assets/skills/docs-framework/references/patterns.md +14 -25
- package/src/assets/skills/docs-framework/references/violations.md +7 -7
- package/src/assets/skills/gap-analysis/SKILL.md +0 -16
- package/src/assets/skills/gap-analysis/references/compliance.md +19 -0
- package/src/assets/skills/qa/SKILL.md +1 -1
- package/src/assets/skills/quality-gates/SKILL.md +7 -7
- package/src/assets/skills/quality-gates/references/report-template.md +7 -7
- package/dist/skills/git/references/pr/ensure-pr-ready.md +0 -24
|
@@ -41,7 +41,7 @@ Spawn devflow agents with:
|
|
|
41
41
|
agent("your prompt here", { agentType: "Code" })
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Valid `agentType` values: Code, Validate,
|
|
44
|
+
Valid `agentType` values: Code, Fix, Validate, Polish, Harden, Evaluate, Test, Review, Git, Synthesize, Knowledge, Design.
|
|
45
45
|
|
|
46
46
|
**OMIT `opts.model` whenever `agentType` is set.** The agent frontmatter carries its own model tier (Code→sonnet, Validate→haiku, Review→opus, etc.) and that tier is honored automatically. Passing `opts.model` overrides it — always a mistake.
|
|
47
47
|
|
|
@@ -65,7 +65,7 @@ The `budget` global governs depth. Scale Review agent roster and verification vo
|
|
|
65
65
|
|
|
66
66
|
### Handoff convention for sequential Code agents within a ticket
|
|
67
67
|
|
|
68
|
-
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-scoped to prevent concurrent session clobber), `{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 compact in-context form; the handoff file is the durable form that survives context compaction. Code is authoritative, summaries are supplementary.
|
|
68
|
+
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-scoped to prevent concurrent session clobber), `{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 compact in-context form; the handoff file is the durable form that survives context compaction. Code is authoritative, summaries are supplementary.
|
|
69
69
|
|
|
70
70
|
### IRON RULE (LLM-vs-plumbing)
|
|
71
71
|
|
|
@@ -91,23 +91,25 @@ The accepted line is the only source of these values: the script alone folds the
|
|
|
91
91
|
|
|
92
92
|
When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
|
|
93
93
|
|
|
94
|
-
The decisions ledger belongs to the repository, not to one checkout:
|
|
94
|
+
The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy, a subdirectory session the repository root's. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
97
|
git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
Line 1 is the checkout's toplevel, line 2 the
|
|
100
|
+
Line 1 is the checkout's toplevel, line 2 the common git directory. A git older than 2.31 echoes `--path-format=absolute` back as a line of its own first. `{ledger}` is the first that applies:
|
|
101
101
|
|
|
102
102
|
1. **The main worktree** — line 2 without its trailing `/.git`, when the output is exactly two lines each beginning with `/`, line 2 ends in `/.git`, and the directory left once it is removed is not your home directory and contains a `.devflow/` directory.
|
|
103
103
|
2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
|
|
104
104
|
3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
|
|
105
105
|
|
|
106
|
-
This is the rule the learning hooks apply
|
|
106
|
+
This is the rule the learning hooks apply, so you read the index the Curate agent writes.
|
|
107
107
|
|
|
108
108
|
Before you author the workflow script, read `{ledger}/.devflow/learning/index.md`. If the file is absent or empty, set `DECISIONS_CONTEXT` to `(none)`; otherwise use the file content as `DECISIONS_CONTEXT`.
|
|
109
109
|
|
|
110
|
-
The script body cannot perform this read — you (the main model) do it before authoring. Then inject the relevant DECISIONS_CONTEXT into the prompts of the Code, Design, Knowledge, Review and
|
|
110
|
+
The script body cannot perform this read — you (the main model) do it before authoring. Then inject the relevant DECISIONS_CONTEXT into the prompts of the Code, Fix, Design, Knowledge, 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.
|
|
111
|
+
|
|
112
|
+
Hand each agent that takes `DECISIONS_CONTEXT` a slice, not the whole index: the index lines whose title, scope or area touch the files and task it works on, verbatim, led by `(slice: N of M entries — full index: <absolute index path>)` and closed by the index footer. When unsure, include the line. Siblings over one diff share ONE slice. The script carries one `DECISIONS_CONTEXT` for every agent, so cut it once, over the whole run.
|
|
111
113
|
|
|
112
114
|
---
|
|
113
115
|
|
|
@@ -121,11 +123,12 @@ The following agentType values are valid. Model tiers are shown for reference
|
|
|
121
123
|
|
|
122
124
|
| agentType | Model tier | Role |
|
|
123
125
|
|-----------|-----------|------|
|
|
124
|
-
| Code | sonnet |
|
|
126
|
+
| Code | sonnet | Implements the plan and fixes review findings — the Code family is the ONLY one that writes code |
|
|
127
|
+
| Fix | sonnet | Fixes the listed validation, alignment and QA failures — part of the Code family |
|
|
125
128
|
| Validate | haiku | Build / typecheck / lint / test — fast correctness gate |
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
| Evaluate |
|
|
129
|
+
| Polish | sonnet | Reduces complexity, removes duplication, improves readability |
|
|
130
|
+
| Harden | opus | 9-pillar self-review — deep structural analysis |
|
|
131
|
+
| Evaluate | sonnet | Plan-fidelity / alignment — "was the plan implemented correctly?" |
|
|
129
132
|
| Test | sonnet | Scenario-based acceptance tests against acceptance criteria |
|
|
130
133
|
| Review | opus | Focus-parameterized code review — spawn ONE agent() per focus area |
|
|
131
134
|
| Git | haiku | Git operations — branches, commits, merges, worktree management |
|
|
@@ -135,7 +138,7 @@ The following agentType values are valid. Model tiers are shown for reference
|
|
|
135
138
|
|
|
136
139
|
### Agent caveats
|
|
137
140
|
|
|
138
|
-
- **
|
|
141
|
+
- **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 agent-style passes (§6.3 of design doc). Risk-assessment and tech-debt routing live in the post-code pipeline + escalation doctrine.
|
|
139
142
|
- **Always omit `opts.model` with `agentType`.** Each agent honors its own frontmatter model tier; overriding it defeats the per-agent specialization.
|
|
140
143
|
- **Review agents are focus-parameterized.** Each focus is a SEPARATE `agent()` call with `agentType: "Review"` and the focus baked into the prompt. Do NOT batch multiple focuses into one Review agent call — that defeats parallel specialization.
|
|
141
144
|
- **Do not depend on agents enumerating their own skills.** Skills are loaded (spike F5 confirmed) but self-reporting is imperfect. Write agent prompts that give the agent full context directly.
|
|
@@ -186,7 +189,7 @@ Author the resolved `ISSUE_REQUIRED` and `APPLY_CONVENTIONS` into the workflow s
|
|
|
186
189
|
|
|
187
190
|
**Set the compliance lens** from that line: `COMPLIANCE_FRAMEWORKS` is the settings line's `COMPLIANCE` with `generic` written `none`: `off`, `none`, or the framework ids the machine and this repository declare.
|
|
188
191
|
|
|
189
|
-
Pass it as `complianceFrameworks` when invoking the workflow; the engine
|
|
192
|
+
Pass it as `complianceFrameworks` when invoking the workflow; the engine builds `COMPLIANCE_DIRECTIVE` from it and hands that to every Code and Fix agent.
|
|
190
193
|
|
|
191
194
|
**0c. Resolve the docs root**
|
|
192
195
|
|
|
@@ -268,7 +271,7 @@ If a number is found, record it as the command-level `ISSUE_NUMBER`:
|
|
|
268
271
|
- **SINGLE mode:** it is the ticket's own reference. Pass it as `issueNumber: <number>` when invoking the workflow; the engine hands it to setup-task as `ISSUE_INPUT`. If none is found, pass nothing.
|
|
269
272
|
- **WAVE mode:** it is the tracking issue. Only steps 2 and 3 after the workflow use it: step 2 for the wave report, step 3 for the wave block's tracking line. It never reaches a ticket: each ticket's engine gets that ticket's own reference as `issueInput`.
|
|
270
273
|
|
|
271
|
-
Never pass `ISSUE_PR_LINK` into the workflow. The engine binds each ticket's `ISSUE_NUMBER` and `ISSUE_PR_LINK` from that ticket's own setup-task Output (`### Handoff Values`), never from the token it passed in, and
|
|
274
|
+
Never pass `ISSUE_PR_LINK` into the workflow. The engine binds each ticket's `ISSUE_NUMBER` and `ISSUE_PR_LINK` from that ticket's own setup-task Output (`### Handoff Values`), never from the token it passed in, and returns that ticket's `issuePrLink` for the wave PR's related line. No `- **PR link line**:` captured ⇒ `ISSUE_PR_LINK` is `"(none)"` and the ticket's related line carries no closing reference.
|
|
272
275
|
|
|
273
276
|
---
|
|
274
277
|
|
|
@@ -294,6 +297,7 @@ const ISSUE_INPUT = args.issueInput || args.issueNumber || "(none)"; // this ti
|
|
|
294
297
|
const ISSUE_REQUIRED = String(args.issueRequired) === "false" ? "false" : "true"; // Pre-authoring step 0; only an explicit false turns it off — absent or unrecognised fails closed, like the resolver
|
|
295
298
|
const APPLY_CONVENTIONS = String(args.applyConventions) === "false" ? "false" : "true";
|
|
296
299
|
const COMPLIANCE_FRAMEWORKS = /^(?:off|none|[a-z][a-z0-9-]{0,15}(?:,[a-z][a-z0-9-]{0,15}){0,7})$/.test(String(args.complianceFrameworks)) ? String(args.complianceFrameworks) : "off"; // Pre-authoring step 0b; any other shape is no lens
|
|
300
|
+
const COMPLIANCE_DIRECTIVE = COMPLIANCE_FRAMEWORKS === "off" ? "" : `When the task touches regulated surface (data models, auth flows, logging/observability, payments, IaC, retention), invoke Skill(skill="devflow:compliance") and load references/{id}.md only for the ids in ${COMPLIANCE_FRAMEWORKS} (none: generic controls only); never fabricate guidance for a framework you were not given.`; // D-COMPLIANCE-INJECT: empty when the lens is off, so a Code or Fix spawn then carries nothing about compliance; otherwise the one line _compliance.mds renders as compliance_directive(), with the validated ids in place of <ids>
|
|
297
301
|
|
|
298
302
|
// Phase 1: Git setup — declare the operation; the agent owns the process, the branch name included
|
|
299
303
|
const setup = await phase("setup", () =>
|
|
@@ -310,7 +314,7 @@ Return: {"branch": "<the - **Branch name**: value under your ### Branch, or (non
|
|
|
310
314
|
// An Issue ID is a bare number or a KEY-number, per the provider; any other value — "none", blank, prose — is no capture, so the stop fails closed.
|
|
311
315
|
const ISSUE_ID_SHAPE = /^(?:[1-9][0-9]{0,8}|[A-Z][A-Z0-9_]{0,9}-[1-9][0-9]{0,8})$/;
|
|
312
316
|
const ISSUE_NUMBER = ISSUE_ID_SHAPE.test(String(setup?.issueId ?? "")) ? setup.issueId : "(none)"; // the captured Issue ID; "(none)" ⇒ none was captured
|
|
313
|
-
const ISSUE_PR_LINK = setup?.prLinkLine || "(none)"; // "(none)" ⇒
|
|
317
|
+
const ISSUE_PR_LINK = setup?.prLinkLine || "(none)"; // "(none)" ⇒ the wave PR carries no closing reference for this ticket
|
|
314
318
|
// The branch setup-task created, as it reported it: every later phase and the merge use it. The engine never names one.
|
|
315
319
|
const BRANCH = typeof setup?.branch === "string" && setup.branch.trim() !== "" && setup.branch.trim() !== "(none)" ? setup.branch : "(none)";
|
|
316
320
|
|
|
@@ -336,9 +340,7 @@ ${PLAN ? `Implementation plan:\n${PLAN}` : "No plan provided — use best judgme
|
|
|
336
340
|
Relevant architectural decisions (apply devflow:apply-decisions algorithm):
|
|
337
341
|
${DECISIONS_CONTEXT}
|
|
338
342
|
|
|
339
|
-
|
|
340
|
-
ISSUE_PR_LINK: ${ISSUE_PR_LINK}
|
|
341
|
-
COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
|
|
343
|
+
${COMPLIANCE_DIRECTIVE}
|
|
342
344
|
|
|
343
345
|
When you build or run tests to verify your work, follow your Running commands block.
|
|
344
346
|
|
|
@@ -348,16 +350,16 @@ After implementing, commit your changes with a conventional-commit message and r
|
|
|
348
350
|
- Any open questions or blockers`, { agentType: "Code" })
|
|
349
351
|
);
|
|
350
352
|
|
|
351
|
-
// Phase 3: Gate 1 #1 — post-code pipeline:
|
|
353
|
+
// Phase 3: Gate 1 #1 — post-code pipeline: Polish agent → Harden agent → Validate agent.
|
|
352
354
|
// Validate runs last and unconditionally, so its one full run covers every commit the pass made (see gate1_postcode()).
|
|
353
355
|
const gate1 = await phase("gate1", async () => {
|
|
354
|
-
await agent(`
|
|
356
|
+
await agent(`Polish and reduce complexity of recent changes on branch ${BRANCH}. Commit any improvements.`, { agentType: "Polish" });
|
|
355
357
|
|
|
356
|
-
const
|
|
357
|
-
Return: {"status": "PASS" | "FIXED" | "BLOCKED"}`, { agentType: "
|
|
358
|
-
// Anything but an explicit PASS or FIXED is a stop: a
|
|
359
|
-
if (!["PASS", "FIXED"].includes(
|
|
360
|
-
return { verdict: "ESCALATED", type: "
|
|
358
|
+
const harden = await agent(`9-pillar self-review of recent changes on branch ${BRANCH}. Fix P0/P1 issues and commit the fixes.
|
|
359
|
+
Return: {"status": "PASS" | "FIXED" | "BLOCKED"}`, { agentType: "Harden" });
|
|
360
|
+
// Anything but an explicit PASS or FIXED is a stop: a Harden that returned no status, or one this skeleton does not know, has not accepted the code.
|
|
361
|
+
if (!["PASS", "FIXED"].includes(harden?.status)) {
|
|
362
|
+
return { verdict: "ESCALATED", type: "harden-blocked", reason: harden?.status === "BLOCKED" ? "Harden agent returned BLOCKED: a P0 issue cannot be fixed in scope" : "Harden agent returned no recognised status: counted as BLOCKED" };
|
|
361
363
|
}
|
|
362
364
|
|
|
363
365
|
const validation = await agent(`Run build, typecheck, lint, and tests on branch ${BRANCH}.
|
|
@@ -373,22 +375,20 @@ Return: {"verdict": "PASS" | "FAIL", "details": "..."}`, { agentType: "Validate"
|
|
|
373
375
|
Fix the validation failures on branch ${BRANCH}:
|
|
374
376
|
${failureDetails}
|
|
375
377
|
DECISIONS_CONTEXT: ${DECISIONS_CONTEXT}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
|
|
379
|
-
Commit fixes with conventional-commit message.`, { agentType: "Code" });
|
|
378
|
+
${COMPLIANCE_DIRECTIVE}
|
|
379
|
+
Commit fixes with conventional-commit message.`, { agentType: "Fix" });
|
|
380
380
|
const recheck = await agent(`Re-run build, typecheck, lint, tests on branch ${BRANCH} after fix attempt ${attempt} (follow your Running commands block).
|
|
381
381
|
Return: {"verdict": "PASS" | "FAIL", "details": "..."}`, { agentType: "Validate" });
|
|
382
382
|
if (recheck?.verdict === "PASS") break;
|
|
383
383
|
failureDetails = recheck?.details || failureDetails;
|
|
384
|
-
if (attempt === 2) return { verdict: "ESCALATED", type: "validation-exhausted", reason: "Validation exhausted after 2
|
|
384
|
+
if (attempt === 2) return { verdict: "ESCALATED", type: "validation-exhausted", reason: "Validation exhausted after 2 Fix agent attempts" };
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
return { verdict: "PASS" };
|
|
389
389
|
});
|
|
390
390
|
|
|
391
|
-
// Gate 1 #1 stop, before Gate 2: an exhausted Validate or a BLOCKED
|
|
391
|
+
// Gate 1 #1 stop, before Gate 2: an exhausted Validate or a BLOCKED Harden leaves a broken or unfinished build,
|
|
392
392
|
// so Gate 2 and the review pass never run on it — a correctness stop, like the ticket-link and branch stops.
|
|
393
393
|
if (gate1.verdict === "ESCALATED") {
|
|
394
394
|
return { ticket: TICKET, branch: BRANCH, verdict: "ESCALATED", issueId: ISSUE_NUMBER, issuePrLink: ISSUE_PR_LINK, escalations: [{ type: gate1.type, description: gate1.reason }] };
|
|
@@ -416,10 +416,8 @@ Return: {"verdict": "PASS" | "FAIL", "rationale": "..."} — FAIL if either answ
|
|
|
416
416
|
Fix the alignment issues identified by the Evaluate agent on branch ${BRANCH}:
|
|
417
417
|
${evaluation?.rationale || "see the Evaluate agent's report"}
|
|
418
418
|
DECISIONS_CONTEXT: ${DECISIONS_CONTEXT}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
|
|
422
|
-
Self-verify your fix compiles, following your Running commands block. Commit fixes.`, { agentType: "Code" });
|
|
419
|
+
${COMPLIANCE_DIRECTIVE}
|
|
420
|
+
Self-verify your fix compiles, following your Running commands block. Commit fixes.`, { agentType: "Fix" });
|
|
423
421
|
evalVerdict = "FAIL-FIXED"; // issues found, fixes applied, not re-evaluated by design
|
|
424
422
|
}
|
|
425
423
|
}
|
|
@@ -438,10 +436,8 @@ Cover: functionality, API contracts, performance, and cover every TEST_PLAN scen
|
|
|
438
436
|
Fix the failing acceptance test scenarios on branch ${BRANCH}:
|
|
439
437
|
${testResult.failures}
|
|
440
438
|
DECISIONS_CONTEXT: ${DECISIONS_CONTEXT}
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
|
|
444
|
-
Self-verify your fix compiles and the scenarios pass, following your Running commands block. Commit fixes.`, { agentType: "Code" });
|
|
439
|
+
${COMPLIANCE_DIRECTIVE}
|
|
440
|
+
Self-verify your fix compiles and the scenarios pass, following your Running commands block. Commit fixes.`, { agentType: "Fix" });
|
|
445
441
|
testVerdict = "FAIL-FIXED"; // issues found, fixes applied, not re-evaluated by design
|
|
446
442
|
}
|
|
447
443
|
}
|
|
@@ -558,9 +554,7 @@ ${chunk.map((f, n) => `${n + 1}. ${f.file ? `${f.file}${f.line ? `:${f.line}` :
|
|
|
558
554
|
SCOPE: ${chunk.map((f, n) => `${n + 1}=${CAREFUL_SEVERITIES.has(String(f.severity).toLowerCase()) ? "Careful" : "Standard"}`).join(", ")}
|
|
559
555
|
PUSH: false
|
|
560
556
|
DECISIONS_CONTEXT: ${DECISIONS_CONTEXT}
|
|
561
|
-
|
|
562
|
-
ISSUE_PR_LINK: ${ISSUE_PR_LINK}
|
|
563
|
-
COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
|
|
557
|
+
${COMPLIANCE_DIRECTIVE}
|
|
564
558
|
Fix all findings in this batch. Self-verify your fix compiles, following your Running commands block. Commit with conventional-commit message.
|
|
565
559
|
Return: {"status": "fixed"|"blocked", "commitShas": ["<sha>"], "unresolved": ["<description of any finding that could not be fixed>"]}`, { agentType: "Code" });
|
|
566
560
|
chunkResults.push({ chunk, result: r });
|
|
@@ -596,16 +590,16 @@ Return: {"status": "fixed"|"blocked", "commitShas": ["<sha>"], "unresolved": ["<
|
|
|
596
590
|
return { survivingFindings: notAddressed, fixedFindings, coverageGaps };
|
|
597
591
|
});
|
|
598
592
|
|
|
599
|
-
// Phase 5.5: Gate 1 #2 — FINAL post-fix gate (
|
|
593
|
+
// Phase 5.5: Gate 1 #2 — FINAL post-fix gate (Polish agent → Harden agent → full Validate agent, Validate last and unconditional).
|
|
600
594
|
// Runs ONCE, after the review pass. Inside the pass the Code agent self-verified its own fixes;
|
|
601
595
|
// this is the build gate before the branch is handed back. See gate1_postcode() cadence.
|
|
602
596
|
const gate1Final = await phase("gate1-final", async () => {
|
|
603
|
-
await agent(`
|
|
597
|
+
await agent(`Polish and reduce complexity of recent changes on branch ${BRANCH}. Commit any improvements.`, { agentType: "Polish" });
|
|
604
598
|
|
|
605
|
-
const
|
|
606
|
-
Return: {"status": "PASS" | "FIXED" | "BLOCKED"}`, { agentType: "
|
|
607
|
-
if (!["PASS", "FIXED"].includes(
|
|
608
|
-
return { verdict: "ESCALATED", type: "
|
|
599
|
+
const harden = await agent(`9-pillar self-review of recent changes on branch ${BRANCH}. Fix P0/P1 issues and commit the fixes.
|
|
600
|
+
Return: {"status": "PASS" | "FIXED" | "BLOCKED"}`, { agentType: "Harden" });
|
|
601
|
+
if (!["PASS", "FIXED"].includes(harden?.status)) {
|
|
602
|
+
return { verdict: "ESCALATED", type: "harden-blocked", reason: harden?.status === "BLOCKED" ? "Final Gate 1 Harden agent returned BLOCKED: a P0 issue cannot be fixed in scope" : "Final Gate 1 Harden agent returned no recognised status: counted as BLOCKED" };
|
|
609
603
|
}
|
|
610
604
|
|
|
611
605
|
const validation = await agent(`Run build, typecheck, lint, and tests on branch ${BRANCH} (final gate after all fixing).
|
|
@@ -619,15 +613,13 @@ Return: {"verdict": "PASS" | "FAIL", "details": "..."}`, { agentType: "Validate"
|
|
|
619
613
|
Fix the final validation failures on branch ${BRANCH}:
|
|
620
614
|
${failureDetails}
|
|
621
615
|
DECISIONS_CONTEXT: ${DECISIONS_CONTEXT}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
COMPLIANCE_FRAMEWORKS: ${COMPLIANCE_FRAMEWORKS}
|
|
625
|
-
Self-verify your fix compiles. Commit fixes with conventional-commit message.`, { agentType: "Code" });
|
|
616
|
+
${COMPLIANCE_DIRECTIVE}
|
|
617
|
+
Self-verify your fix compiles. Commit fixes with conventional-commit message.`, { agentType: "Fix" });
|
|
626
618
|
const recheck = await agent(`Re-run build, typecheck, lint, tests on branch ${BRANCH} (final gate, after fix attempt ${attempt}; follow your Running commands block).
|
|
627
619
|
Return: {"verdict": "PASS" | "FAIL", "details": "..."}`, { agentType: "Validate" });
|
|
628
620
|
if (recheck?.verdict === "PASS") break;
|
|
629
621
|
failureDetails = recheck?.details || failureDetails;
|
|
630
|
-
if (attempt === 2) return { verdict: "ESCALATED", type: "validation-exhausted", reason: "Final Gate 1 validation exhausted after 2
|
|
622
|
+
if (attempt === 2) return { verdict: "ESCALATED", type: "validation-exhausted", reason: "Final Gate 1 validation exhausted after 2 Fix agent attempts" };
|
|
631
623
|
}
|
|
632
624
|
}
|
|
633
625
|
|
|
@@ -707,12 +699,12 @@ Run builds, typechecks, lints and tests in the foreground, each with an explicit
|
|
|
707
699
|
The standard implementation unit for one ticket. Run in order:
|
|
708
700
|
|
|
709
701
|
```
|
|
710
|
-
Code(agentType:"Code", prompt: "OPERATION: implement" first line, then full task + plan + DECISIONS_CONTEXT +
|
|
702
|
+
Code(agentType:"Code", prompt: "OPERATION: implement" first line, then full task + plan + DECISIONS_CONTEXT + COMPLIANCE_DIRECTIVE + handoff if sequential)
|
|
711
703
|
→ gate1_postcode()
|
|
712
704
|
→ gate2_acceptance() ← Gate 2 runs HERE — before the review pass, not after
|
|
713
705
|
```
|
|
714
706
|
|
|
715
|
-
Every Code agent prompt opens with `OPERATION: <mode>` as its first line
|
|
707
|
+
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.
|
|
716
708
|
|
|
717
709
|
Gate 2 runs at implementation acceptance — this matches devflow's deliberate placement: "evaluation is part of implementation acceptance, not post-review" (§6.1).
|
|
718
710
|
|
|
@@ -720,12 +712,12 @@ Gate 2 runs at implementation acceptance — this matches devflow's deliberate p
|
|
|
720
712
|
|
|
721
713
|
ORDER IS LOAD-BEARING. Run exactly in this sequence:
|
|
722
714
|
|
|
723
|
-
1. **
|
|
724
|
-
2. **
|
|
725
|
-
- 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 `
|
|
726
|
-
3. **Validate agent** — build / typecheck / lint / test; returns `{"verdict": "PASS" | "FAIL", "details": "..."}`. It runs LAST and UNCONDITIONALLY: one full run over the HEAD that
|
|
715
|
+
1. **Polish agent** — reduce complexity, remove duplication
|
|
716
|
+
2. **Harden agent** — 9-pillar self-review (deep structural analysis); returns `{"status": "PASS" | "FIXED" | "BLOCKED"}`
|
|
717
|
+
- 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
|
|
718
|
+
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 whether or not Harden changed code
|
|
727
719
|
- Build/test commands follow `build_execution_doctrine()`: the Validate agent's Running commands block, foreground under an explicit Bash timeout.
|
|
728
|
-
- FAIL →
|
|
720
|
+
- FAIL → Fix agent fix (max 2 retries), each followed by a Validate agent re-run
|
|
729
721
|
- If still FAIL after 2 retries → escalate as `validation-exhausted` (do not loop endlessly)
|
|
730
722
|
|
|
731
723
|
**Gate 1 contains NO Evaluate agent and NO Test agent.** Those are Gate 2 only.
|
|
@@ -733,8 +725,8 @@ ORDER IS LOAD-BEARING. Run exactly in this sequence:
|
|
|
733
725
|
Depth scales to change size + budget: a trivial one-line fix warrants a lighter pass; a multi-file refactor warrants the full depth.
|
|
734
726
|
|
|
735
727
|
**Cadence — Gate 1 runs at exactly TWO points per ticket:**
|
|
736
|
-
1. **Gate 1 #1** — immediately after the initial Code agent implementation (inside `implement_bundle()`). An escalated result — Validate exhausted, or
|
|
737
|
-
2. **Gate 1 #2** — the FINAL gate, after ALL Gate-2 fixes AND the entire review pass have completed.
|
|
728
|
+
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.
|
|
729
|
+
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.
|
|
738
730
|
|
|
739
731
|
It does NOT run inside the review pass, nor after each individual Gate-2 / review / QA fix. At those points the fixing Code agent self-verifies its OWN build compiles (see `review_pass()` and the Code agent's Running commands block). The final Gate 1 #2 is the invariant that all written code passes before merge.
|
|
740
732
|
|
|
@@ -746,11 +738,11 @@ Gate 2 inputs are produced by `/devflow:dynamic-plan`'s plan-challenge step —
|
|
|
746
738
|
|
|
747
739
|
**Evaluate agent** (only if a plan exists):
|
|
748
740
|
- Run `evaluator_panel()` — see that block for the one spawn and the two lenses it names
|
|
749
|
-
- If the Evaluate agent returns FAIL (either lens failed): fix-and-continue — the demanded fixes are applied by a
|
|
741
|
+
- If the Evaluate agent returns FAIL (either lens failed): fix-and-continue — the demanded fixes are applied by a Fix agent that self-verifies its own build (batched per the review-pass batching doctrine if numerous). The recorded verdict becomes `FAIL-FIXED` (issues found, fixes applied, not re-evaluated by design); Gate 2 then proceeds. In SINGLE mode the run reports it as `UNVERIFIED`, never PASS.
|
|
750
742
|
|
|
751
743
|
**Test agent** (only if acceptance criteria or a test plan exist):
|
|
752
744
|
- Scenario-based acceptance tests covering functionality, API contracts, performance
|
|
753
|
-
- FAIL → fix-and-continue — a
|
|
745
|
+
- 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.
|
|
754
746
|
|
|
755
747
|
**When Gate 2 inputs are absent:**
|
|
756
748
|
- No plan → skip the Evaluate agent silently (note in output: "Gate 2 Evaluate agent skipped — no plan available")
|
|
@@ -865,13 +857,13 @@ Majority-survives: a finding needs >50% of verification lenses to confirm it. St
|
|
|
865
857
|
|
|
866
858
|
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.
|
|
867
859
|
|
|
868
|
-
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 — same-file edits in `parallel()` cause index contention and lost fixes); sub-batches for DISTINCT files run via `parallel()` in staggered chunks of ~5, same pacing bar as the Review spawn path (different code areas — safe per concurrency doctrine). 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 agent, no
|
|
860
|
+
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 — same-file edits in `parallel()` cause index contention and lost fixes); sub-batches for DISTINCT files run via `parallel()` in staggered chunks of ~5, same pacing bar as the Review spawn path (different code areas — safe per concurrency doctrine). 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 agent, no Polish agent, no Harden agent, no Evaluate agent, no Test agent). The engine runs ONE final Gate 1 after the pass exits — see the `gate1_postcode()` cadence (Gate 1 #2).
|
|
869
861
|
|
|
870
862
|
### Engine invariants (non-negotiable)
|
|
871
863
|
|
|
872
|
-
1. **Code is written ONLY by Code
|
|
864
|
+
1. **Code is written ONLY by the Code family (Code, Fix).** No other agent type writes code — not Review agent, not Evaluate agent.
|
|
873
865
|
2. **Findings are verified before any fix is written.** The adversarial verification step is not optional; unverified findings are not passed to the Code agent.
|
|
874
|
-
3. **All written code passes Gate 1.** No code merge, commit, or handoff before
|
|
866
|
+
3. **All written code passes Gate 1.** No code merge, commit, or handoff before Polish agent + Harden agent + Validate agent (in that order — Validate last, so its one run covers the commits of the two before it).
|
|
875
867
|
4. **Gate 2 runs once, at implementation acceptance.** It does not re-run after review-fixes.
|
|
876
868
|
5. **NEVER auto-merge to main or master.** All merges target the integration branch. The user merges to main themselves.
|
|
877
869
|
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.
|
|
@@ -913,7 +905,7 @@ Each ticket engine run returns a structured result. The Synthesize agent or the
|
|
|
913
905
|
},
|
|
914
906
|
"escalations": [
|
|
915
907
|
{
|
|
916
|
-
"type": "merge-conflict | gate2-fail | validation-exhausted |
|
|
908
|
+
"type": "merge-conflict | gate2-fail | validation-exhausted | harden-blocked | ambiguous-resolution | review-coverage-incomplete | dependency-blocked | engine-crash | ticket-link-missing | branch-missing",
|
|
917
909
|
"description": "string"
|
|
918
910
|
}
|
|
919
911
|
],
|
|
@@ -1013,7 +1005,7 @@ Two parallel sibling tickets can produce real git conflicts. The resolution is *
|
|
|
1013
1005
|
**Resolution procedure:**
|
|
1014
1006
|
|
|
1015
1007
|
1. Git agent detects the conflict and reports the conflicting files + sections
|
|
1016
|
-
2. Spawn a Code agent whose prompt opens with `OPERATION: implement` and carries `
|
|
1008
|
+
2. Spawn a Code agent whose prompt opens with `OPERATION: implement` and carries `COMPLIANCE_DIRECTIVE` (when it is not empty) and `DECISIONS_CONTEXT`, with FULL intent context:
|
|
1017
1009
|
- Both ticket descriptions and plans
|
|
1018
1010
|
- The conflicting diff sections (both sides)
|
|
1019
1011
|
- Relevant ADRs from DECISIONS_CONTEXT (loaded by main model before authoring)
|
|
@@ -1272,19 +1264,13 @@ git -C "{integration worktree root}" push origin HEAD; echo "exit=$?"
|
|
|
1272
1264
|
|
|
1273
1265
|
Note: `auto` is NOT fail-open — under `auto`, the Git agent probes the repository visibility and treats any error or unrecognised value as PUBLIC (mode STUB). What each value does is decided by the Git agent's publication gate (`references/publication-gate.md` step 2); this partial only resolves the value.
|
|
1274
1266
|
|
|
1275
|
-
Then spawn:
|
|
1267
|
+
Then run the script inline — it is the whole `update-pr-evidence` operation, with no Git agent spawn — through the Bash tool with `timeout: 180000`:
|
|
1276
1268
|
|
|
1277
|
-
```
|
|
1278
|
-
|
|
1279
|
-
"OPERATION: update-pr-evidence
|
|
1280
|
-
PR_NUMBER: {n}
|
|
1281
|
-
EVIDENCE_FILE: .devflow/docs/evidence-wave-{slug}.md
|
|
1282
|
-
REVIEW_PUBLICATION: {REVIEW_PUBLICATION resolved above, or auto}
|
|
1283
|
-
WORKTREE_PATH: {integration worktree root}
|
|
1284
|
-
Update the wave PR's test-plan block and post its evidence comment."
|
|
1269
|
+
```bash
|
|
1270
|
+
cd "{integration worktree root}" && node "$HOME/.devflow/scripts/verify-evidence.cjs" publish --pr {n} --evidence ".devflow/docs/evidence-wave-{slug}.md" --publication {REVIEW_PUBLICATION resolved above, or auto}; echo "exit=$?"
|
|
1285
1271
|
```
|
|
1286
1272
|
|
|
1287
|
-
`
|
|
1273
|
+
`{n}` is the number admitted above, and the publication value is `auto`, `full`, `off` or `stub`. `publish` decides what each publication value means for the evidence comment. Report its `## PR Evidence` block — its `EVIDENCE` line and its `**Body**:` / `**Comment**:` line — with any `TRACEABILITY: DEGRADED ({reason})` lines after it, or its `TRACEABILITY: DEGRADED (evidence unavailable)` line; empty stdout or any other exit ⇒ `TRACEABILITY: DEGRADED (evidence refresh failed)`. Whatever it returns, the run ends here.
|
|
1288
1274
|
|
|
1289
1275
|
---
|
|
1290
1276
|
|
|
@@ -41,7 +41,7 @@ Spawn devflow agents with:
|
|
|
41
41
|
agent("your prompt here", { agentType: "Code" })
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Valid `agentType` values: Code, Validate,
|
|
44
|
+
Valid `agentType` values: Code, Fix, Validate, Polish, Harden, Evaluate, Test, Review, Git, Synthesize, Knowledge, Design.
|
|
45
45
|
|
|
46
46
|
**OMIT `opts.model` whenever `agentType` is set.** The agent frontmatter carries its own model tier (Code→sonnet, Validate→haiku, Review→opus, etc.) and that tier is honored automatically. Passing `opts.model` overrides it — always a mistake.
|
|
47
47
|
|
|
@@ -65,7 +65,7 @@ The `budget` global governs depth. Scale Review agent roster and verification vo
|
|
|
65
65
|
|
|
66
66
|
### Handoff convention for sequential Code agents within a ticket
|
|
67
67
|
|
|
68
|
-
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-scoped to prevent concurrent session clobber), `{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 compact in-context form; the handoff file is the durable form that survives context compaction. Code is authoritative, summaries are supplementary.
|
|
68
|
+
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-scoped to prevent concurrent session clobber), `{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 compact in-context form; the handoff file is the durable form that survives context compaction. Code is authoritative, summaries are supplementary.
|
|
69
69
|
|
|
70
70
|
### IRON RULE (LLM-vs-plumbing)
|
|
71
71
|
|
|
@@ -91,23 +91,25 @@ The accepted line is the only source of these values: the script alone folds the
|
|
|
91
91
|
|
|
92
92
|
When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
|
|
93
93
|
|
|
94
|
-
The decisions ledger belongs to the repository, not to one checkout:
|
|
94
|
+
The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy, a subdirectory session the repository root's. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
97
|
git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
Line 1 is the checkout's toplevel, line 2 the
|
|
100
|
+
Line 1 is the checkout's toplevel, line 2 the common git directory. A git older than 2.31 echoes `--path-format=absolute` back as a line of its own first. `{ledger}` is the first that applies:
|
|
101
101
|
|
|
102
102
|
1. **The main worktree** — line 2 without its trailing `/.git`, when the output is exactly two lines each beginning with `/`, line 2 ends in `/.git`, and the directory left once it is removed is not your home directory and contains a `.devflow/` directory.
|
|
103
103
|
2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
|
|
104
104
|
3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
|
|
105
105
|
|
|
106
|
-
This is the rule the learning hooks apply
|
|
106
|
+
This is the rule the learning hooks apply, so you read the index the Curate agent writes.
|
|
107
107
|
|
|
108
108
|
Before you author the workflow script, read `{ledger}/.devflow/learning/index.md`. If the file is absent or empty, set `DECISIONS_CONTEXT` to `(none)`; otherwise use the file content as `DECISIONS_CONTEXT`.
|
|
109
109
|
|
|
110
|
-
The script body cannot perform this read — you (the main model) do it before authoring. Then inject the relevant DECISIONS_CONTEXT into the prompts of the Code, Design, Knowledge, Review and
|
|
110
|
+
The script body cannot perform this read — you (the main model) do it before authoring. Then inject the relevant DECISIONS_CONTEXT into the prompts of the Code, Fix, Design, Knowledge, 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.
|
|
111
|
+
|
|
112
|
+
Hand each agent that takes `DECISIONS_CONTEXT` a slice, not the whole index: the index lines whose title, scope or area touch the files and task it works on, verbatim, led by `(slice: N of M entries — full index: <absolute index path>)` and closed by the index footer. When unsure, include the line. Siblings over one diff share ONE slice. The script carries one `DECISIONS_CONTEXT` for every agent, so cut it once, over the whole run.
|
|
111
113
|
|
|
112
114
|
---
|
|
113
115
|
|
|
@@ -121,11 +123,12 @@ The following agentType values are valid. Model tiers are shown for reference
|
|
|
121
123
|
|
|
122
124
|
| agentType | Model tier | Role |
|
|
123
125
|
|-----------|-----------|------|
|
|
124
|
-
| Code | sonnet |
|
|
126
|
+
| Code | sonnet | Implements the plan and fixes review findings — the Code family is the ONLY one that writes code |
|
|
127
|
+
| Fix | sonnet | Fixes the listed validation, alignment and QA failures — part of the Code family |
|
|
125
128
|
| Validate | haiku | Build / typecheck / lint / test — fast correctness gate |
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
| Evaluate |
|
|
129
|
+
| Polish | sonnet | Reduces complexity, removes duplication, improves readability |
|
|
130
|
+
| Harden | opus | 9-pillar self-review — deep structural analysis |
|
|
131
|
+
| Evaluate | sonnet | Plan-fidelity / alignment — "was the plan implemented correctly?" |
|
|
129
132
|
| Test | sonnet | Scenario-based acceptance tests against acceptance criteria |
|
|
130
133
|
| Review | opus | Focus-parameterized code review — spawn ONE agent() per focus area |
|
|
131
134
|
| Git | haiku | Git operations — branches, commits, merges, worktree management |
|
|
@@ -135,7 +138,7 @@ The following agentType values are valid. Model tiers are shown for reference
|
|
|
135
138
|
|
|
136
139
|
### Agent caveats
|
|
137
140
|
|
|
138
|
-
- **
|
|
141
|
+
- **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 agent-style passes (§6.3 of design doc). Risk-assessment and tech-debt routing live in the post-code pipeline + escalation doctrine.
|
|
139
142
|
- **Always omit `opts.model` with `agentType`.** Each agent honors its own frontmatter model tier; overriding it defeats the per-agent specialization.
|
|
140
143
|
- **Review agents are focus-parameterized.** Each focus is a SEPARATE `agent()` call with `agentType: "Review"` and the focus baked into the prompt. Do NOT batch multiple focuses into one Review agent call — that defeats parallel specialization.
|
|
141
144
|
- **Do not depend on agents enumerating their own skills.** Skills are loaded (spike F5 confirmed) but self-reporting is imperfect. Write agent prompts that give the agent full context directly.
|
|
@@ -168,7 +171,7 @@ git -C "{start}" rev-parse --show-toplevel
|
|
|
168
171
|
|
|
169
172
|
and using its one-line output. If the command fails (outside a git repository), `{worktree}` is the start directory itself. Every docs path below is written `{worktree}/.devflow/docs/…`; a repo-relative docs path handed to an agent always travels with a `WORKTREE_PATH` naming the checkout it is relative to.
|
|
170
173
|
|
|
171
|
-
Pass `{worktree}` to the workflow as its `root` argument
|
|
174
|
+
Pass `{worktree}` to the workflow as its `root` argument, and its `slug` argument: the `{slug}` of the ticket directory (`tickets/{slug}/{ts}/`) when that is the ticket source, otherwise `wave`.
|
|
172
175
|
|
|
173
176
|
**1. Apply decisions context**
|
|
174
177
|
|
|
@@ -250,7 +253,8 @@ const DECISIONS_CONTEXT = args.decisionsContext || ""; // injected before auth
|
|
|
250
253
|
const PREFERENCE_PROFILE = args.preferenceProfile || ""; // injected before authoring
|
|
251
254
|
const TP_CONTRACT = args.tpContract || ""; // the "Test-plan line (TP)" contract below — its paragraph and four bullets — passed verbatim as tpContract when invoking the workflow, never pasted into this script (it holds backticks)
|
|
252
255
|
const slug = args.slug || "wave";
|
|
253
|
-
const
|
|
256
|
+
const now = new Date(), two = (n) => String(n).padStart(2, '0');
|
|
257
|
+
const ts = `${now.getFullYear()}-${two(now.getMonth() + 1)}-${two(now.getDate())}_${two(now.getHours())}${two(now.getMinutes())}`;
|
|
254
258
|
const ROOT = args.root; // {worktree} from Pre-authoring setup: the checkout's toplevel, never cwd
|
|
255
259
|
const OUTDIR = `${ROOT}/.devflow/docs/design/${slug}/${ts}`;
|
|
256
260
|
|
|
@@ -350,7 +354,7 @@ Auto-resolved decisions: ${JSON.stringify(resolved && resolved.autoResolved)}
|
|
|
350
354
|
Decisions needed: ${JSON.stringify(resolved && resolved.decisionsNeeded)}
|
|
351
355
|
Output directory: ${OUTDIR}
|
|
352
356
|
|
|
353
|
-
For each ticket, write ${OUTDIR}/{ticket-slug}-plan.md containing:
|
|
357
|
+
For each ticket, write ${OUTDIR}/{ticket-slug}-plan.md, {ticket-slug} being the ticket's file name without .md when it came from a ticket directory, otherwise the ticket title run through title.toLowerCase().replace(/[^a-z0-9]+/g, '-') with nothing trimmed, containing:
|
|
354
358
|
- ## Implementation Plan
|
|
355
359
|
- The plan body (incorporate cross-plan amendments)
|
|
356
360
|
- ## Acceptance Criteria (numbered, positive + negative)
|
|
@@ -41,7 +41,7 @@ Spawn devflow agents with:
|
|
|
41
41
|
agent("your prompt here", { agentType: "Code" })
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Valid `agentType` values: Code, Validate,
|
|
44
|
+
Valid `agentType` values: Code, Fix, Validate, Polish, Harden, Evaluate, Test, Review, Git, Synthesize, Knowledge, Design.
|
|
45
45
|
|
|
46
46
|
**OMIT `opts.model` whenever `agentType` is set.** The agent frontmatter carries its own model tier (Code→sonnet, Validate→haiku, Review→opus, etc.) and that tier is honored automatically. Passing `opts.model` overrides it — always a mistake.
|
|
47
47
|
|
|
@@ -65,7 +65,7 @@ The `budget` global governs depth. Scale Review agent roster and verification vo
|
|
|
65
65
|
|
|
66
66
|
### Handoff convention for sequential Code agents within a ticket
|
|
67
67
|
|
|
68
|
-
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-scoped to prevent concurrent session clobber), `{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 compact in-context form; the handoff file is the durable form that survives context compaction. Code is authoritative, summaries are supplementary.
|
|
68
|
+
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-scoped to prevent concurrent session clobber), `{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 compact in-context form; the handoff file is the durable form that survives context compaction. Code is authoritative, summaries are supplementary.
|
|
69
69
|
|
|
70
70
|
### IRON RULE (LLM-vs-plumbing)
|
|
71
71
|
|
|
@@ -91,23 +91,25 @@ The accepted line is the only source of these values: the script alone folds the
|
|
|
91
91
|
|
|
92
92
|
When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
|
|
93
93
|
|
|
94
|
-
The decisions ledger belongs to the repository, not to one checkout:
|
|
94
|
+
The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy, a subdirectory session the repository root's. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
97
|
git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
Line 1 is the checkout's toplevel, line 2 the
|
|
100
|
+
Line 1 is the checkout's toplevel, line 2 the common git directory. A git older than 2.31 echoes `--path-format=absolute` back as a line of its own first. `{ledger}` is the first that applies:
|
|
101
101
|
|
|
102
102
|
1. **The main worktree** — line 2 without its trailing `/.git`, when the output is exactly two lines each beginning with `/`, line 2 ends in `/.git`, and the directory left once it is removed is not your home directory and contains a `.devflow/` directory.
|
|
103
103
|
2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
|
|
104
104
|
3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
|
|
105
105
|
|
|
106
|
-
This is the rule the learning hooks apply
|
|
106
|
+
This is the rule the learning hooks apply, so you read the index the Curate agent writes.
|
|
107
107
|
|
|
108
108
|
Before you author the workflow script, read `{ledger}/.devflow/learning/index.md`. If the file is absent or empty, set `DECISIONS_CONTEXT` to `(none)`; otherwise use the file content as `DECISIONS_CONTEXT`.
|
|
109
109
|
|
|
110
|
-
The script body cannot perform this read — you (the main model) do it before authoring. Then inject the relevant DECISIONS_CONTEXT into the prompts of the Code, Design, Knowledge, Review and
|
|
110
|
+
The script body cannot perform this read — you (the main model) do it before authoring. Then inject the relevant DECISIONS_CONTEXT into the prompts of the Code, Fix, Design, Knowledge, 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.
|
|
111
|
+
|
|
112
|
+
Hand each agent that takes `DECISIONS_CONTEXT` a slice, not the whole index: the index lines whose title, scope or area touch the files and task it works on, verbatim, led by `(slice: N of M entries — full index: <absolute index path>)` and closed by the index footer. When unsure, include the line. Siblings over one diff share ONE slice. The script carries one `DECISIONS_CONTEXT` for every agent, so cut it once, over the whole run.
|
|
111
113
|
|
|
112
114
|
---
|
|
113
115
|
|