devflow-kit 3.1.0 → 3.3.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 +52 -0
- package/README.md +2 -2
- package/dist/cli/agents-view/render.js +69 -15
- package/dist/cli/agents-view/state.js +40 -14
- package/dist/cli/commands/agents.js +135 -45
- package/dist/cli/commands/init.js +128 -53
- package/dist/cli/commands/learning.js +61 -13
- package/dist/cli/commands/memory.js +35 -14
- package/dist/cli/commands/uninstall.js +163 -39
- package/dist/commands/code-review.md +1 -3
- package/dist/commands/debug.md +15 -12
- package/dist/commands/dynamic-build.md +172 -135
- package/dist/commands/dynamic-plan.md +9 -3
- package/dist/commands/explore.md +10 -4
- package/dist/commands/implement.md +149 -145
- package/dist/commands/plan.md +13 -9
- package/dist/commands/release.md +8 -2
- package/dist/commands/research.md +8 -2
- package/dist/commands/resolve.md +28 -19
- package/dist/commands/self-review.md +16 -13
- package/dist/core/agent-frontmatter.js +25 -0
- package/dist/core/agent-models.js +201 -36
- package/dist/core/agent-state.js +27 -5
- package/dist/core/assets.js +1 -1
- package/dist/core/feature-config.js +68 -10
- package/dist/core/flags.js +24 -0
- package/dist/core/learning-queue-cleanup.js +10 -11
- package/dist/core/learning-tuning-config.js +8 -0
- package/dist/core/linked-path.js +46 -0
- package/dist/core/plugins.js +16 -5
- package/dist/core/queue-drain.js +31 -0
- package/dist/hud/components/learning-counts.js +54 -8
- package/dist/skills/git/references/tracker/github/create-release.md +2 -2
- package/dist/skills/git/references/tracker/github/gather-release-evidence.md +1 -1
- package/dist/skills/git/references/tracker/jira/create-release.md +2 -2
- package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +1 -1
- package/dist/skills/git/references/tracker/linear/create-release.md +2 -2
- package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +1 -1
- package/dist/targets/claude-code/installer.js +36 -9
- package/dist/targets/claude-code/post-install.js +128 -38
- package/package.json +1 -1
- package/src/assets/agents/code.md +85 -35
- package/src/assets/agents/design.md +12 -0
- package/src/assets/agents/diagnose.md +18 -11
- package/src/assets/agents/evaluate.md +17 -24
- package/src/assets/agents/knowledge.md +7 -3
- package/src/assets/agents/learning.md +4 -6
- package/src/assets/agents/research.md +21 -0
- package/src/assets/agents/review.md +12 -0
- package/src/assets/agents/scrutinize.md +37 -9
- package/src/assets/agents/simplify.md +24 -0
- package/src/assets/agents/skim.md +6 -2
- package/src/assets/agents/synthesize.md +18 -0
- package/src/assets/agents/test.md +19 -11
- package/src/assets/agents/triage.md +8 -0
- package/src/assets/agents/validate.md +20 -11
- package/src/assets/commands/_partials/_engine.mds +36 -55
- package/src/assets/commands/_partials/_knowledge.mds +1 -3
- package/src/assets/commands/_partials/_plan_contract.mds +1 -1
- package/src/assets/commands/_partials/_tracker.mds +1 -1
- package/src/assets/commands/_partials/_wave.mds +8 -6
- package/src/assets/commands/code-review.mds +1 -3
- package/src/assets/commands/debug.mds +13 -8
- package/src/assets/commands/dynamic-build.mds +126 -72
- package/src/assets/commands/dynamic-plan.mds +7 -1
- package/src/assets/commands/explore.mds +9 -1
- package/src/assets/commands/implement.mds +147 -141
- package/src/assets/commands/plan.mds +12 -8
- package/src/assets/commands/release.md +8 -2
- package/src/assets/commands/research.mds +8 -2
- package/src/assets/commands/resolve.mds +27 -16
- package/src/assets/commands/self-review.mds +15 -10
- package/src/assets/mds/tracker/_common.mds +1 -1
- package/src/assets/mds/tracker/_github.mds +2 -2
- package/src/assets/mds/tracker/_jira.mds +2 -2
- package/src/assets/mds/tracker/_linear.mds +2 -2
- package/src/assets/scripts/ci-wait.cjs +636 -0
- package/src/assets/scripts/hooks/assets/orchestrator-charter.md +4 -3
- package/src/assets/scripts/hooks/background-memory-update +356 -17
- package/src/assets/scripts/hooks/capture-prompt +4 -3
- package/src/assets/scripts/hooks/capture-question +4 -3
- package/src/assets/scripts/hooks/capture-turn +4 -3
- package/src/assets/scripts/hooks/ensure-devflow-init +13 -1
- package/src/assets/scripts/hooks/ensure-root-gitignore +122 -10
- package/src/assets/scripts/hooks/git-marker +71 -0
- package/src/assets/scripts/hooks/json-helper.cjs +12 -145
- package/src/assets/scripts/hooks/json-parse +24 -129
- package/src/assets/scripts/hooks/lib/learning-store.cjs +169 -64
- package/src/assets/scripts/hooks/lib/render-decisions.cjs +1 -1
- package/src/assets/scripts/hooks/memory-worker +10 -0
- package/src/assets/scripts/hooks/pre-compact-memory +66 -14
- package/src/assets/scripts/hooks/preamble +9 -1
- package/src/assets/scripts/hooks/queue-append +53 -21
- package/src/assets/scripts/hooks/session-start-context +108 -29
- package/src/assets/scripts/hooks/session-start-memory +33 -11
- package/src/assets/scripts/release-trace.cjs +27 -10
- package/src/assets/skills/accessibility/SKILL.md +1 -1
- package/src/assets/skills/apply-decisions/SKILL.md +12 -82
- package/src/assets/skills/apply-feature-knowledge/SKILL.md +8 -42
- package/src/assets/skills/architecture/SKILL.md +1 -1
- package/src/assets/skills/boundary-validation/SKILL.md +1 -1
- package/src/assets/skills/complexity/SKILL.md +1 -1
- package/src/assets/skills/compliance/SKILL.md +1 -1
- package/src/assets/skills/consistency/SKILL.md +1 -1
- package/src/assets/skills/database/SKILL.md +1 -1
- package/src/assets/skills/dependencies/SKILL.md +1 -1
- package/src/assets/skills/dependency-research/SKILL.md +3 -6
- package/src/assets/skills/design-review/SKILL.md +1 -1
- package/src/assets/skills/docs-framework/SKILL.md +1 -1
- package/src/assets/skills/documentation/SKILL.md +1 -1
- package/src/assets/skills/gap-analysis/SKILL.md +1 -1
- package/src/assets/skills/git/SKILL.md +1 -1
- package/src/assets/skills/go/SKILL.md +1 -1
- package/src/assets/skills/java/SKILL.md +1 -1
- package/src/assets/skills/patterns/SKILL.md +1 -1
- package/src/assets/skills/performance/SKILL.md +1 -1
- package/src/assets/skills/python/SKILL.md +1 -1
- package/src/assets/skills/qa/SKILL.md +1 -3
- package/src/assets/skills/quality-gates/SKILL.md +9 -12
- package/src/assets/skills/quality-gates/references/report-template.md +20 -20
- package/src/assets/skills/react/SKILL.md +1 -1
- package/src/assets/skills/regression/SKILL.md +1 -1
- package/src/assets/skills/reliability/SKILL.md +1 -1
- package/src/assets/skills/research-codebase/SKILL.md +1 -1
- package/src/assets/skills/research-competitor/SKILL.md +1 -1
- package/src/assets/skills/research-external/SKILL.md +1 -1
- package/src/assets/skills/research-technology/SKILL.md +1 -1
- package/src/assets/skills/review-methodology/SKILL.md +1 -1
- package/src/assets/skills/rust/SKILL.md +1 -1
- package/src/assets/skills/security/SKILL.md +1 -1
- package/src/assets/skills/software-design/SKILL.md +1 -1
- package/src/assets/skills/test-driven-development/SKILL.md +15 -33
- package/src/assets/skills/testing/SKILL.md +1 -1
- package/src/assets/skills/typescript/SKILL.md +1 -1
- package/src/assets/skills/ui-design/SKILL.md +1 -1
- package/src/assets/skills/worktree-support/SKILL.md +3 -55
- package/src/assets/skills/worktree-support/references/discovery.md +48 -0
- package/src/assets/skills/worktree-support/references/roots.md +2 -2
|
@@ -171,12 +171,18 @@ If present, note its contents as `PREFERENCE_PROFILE`. This will be used to auto
|
|
|
171
171
|
|
|
172
172
|
**3. Resolve ticket input**
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
What follows the command is bound once, here. Every later step names it `COMMAND_INPUT` and never restates it:
|
|
175
|
+
|
|
176
|
+
<command-input>
|
|
177
|
+
$ARGUMENTS
|
|
178
|
+
</command-input>
|
|
179
|
+
|
|
180
|
+
Determine the ticket source from `COMMAND_INPUT` (in priority order):
|
|
175
181
|
- A directory of ticket `.md` files (from `/devflow:dynamic-tickets` output)
|
|
176
182
|
- A list of candidate issue references or issue URLs
|
|
177
183
|
- Inline ticket descriptions passed as args
|
|
178
184
|
|
|
179
|
-
**Issue-reference grammar (L1 — command layer, permissive and provider-blind):** scan
|
|
185
|
+
**Issue-reference grammar (L1 — command layer, permissive and provider-blind):** scan `COMMAND_INPUT` for candidate issue references — a `#`-prefixed token and a bare digit run are both candidates — and collect them in source order as the raw token list `ISSUE_REFS`. Forward that list to the Git agent **verbatim**: the command never renders, normalises, pads, strips or coerces a token, and never rules a candidate out. Under `github` a token matching `^#?[1-9][0-9]{0,8}$` **is** a reference and the Git agent renders it as `#{n}`.
|
|
180
186
|
|
|
181
187
|
**A token of any other shape is neither coerced nor dropped silently — and no producer-side grammar check rejects it before the fetch.** Adjudication belongs to the operation that runs, and each one answers in its own Output block: `fetch-issue` strips a leading `#` and takes the text branch, so a non-numeric token is used as a **search term** and the operation returns the first open match or nothing; `fetch-issues-batch` resolves each token to an issue number, drops the ones it cannot resolve, and names them in `NOT_FOUND ({refs})` beside the issues it did fetch. Read the outcome from the operation that ran — a token's shape is a verdict nowhere, and there is nothing upstream holding it back.
|
|
182
188
|
|
|
@@ -398,7 +404,7 @@ Every line of a `## Test Plan` section, or of a PR's test-plan block, follows th
|
|
|
398
404
|
|
|
399
405
|
#### Consumption by Gate 2
|
|
400
406
|
|
|
401
|
-
The Evaluate agent
|
|
407
|
+
The Evaluate agent receives: the per-ticket plan + the numbered acceptance criteria (positive and negative).
|
|
402
408
|
|
|
403
409
|
The Test agent receives: the test plan's TP lines, once `check tp` has admitted them.
|
|
404
410
|
|
package/dist/commands/explore.md
CHANGED
|
@@ -15,7 +15,13 @@ Explore a codebase area by spawning parallel agents for flow tracing, dependency
|
|
|
15
15
|
|
|
16
16
|
## Input
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
What follows `/explore` is bound once, here. Every later step names it `COMMAND_INPUT` and never restates it:
|
|
19
|
+
|
|
20
|
+
<command-input>
|
|
21
|
+
$ARGUMENTS
|
|
22
|
+
</command-input>
|
|
23
|
+
|
|
24
|
+
`COMMAND_INPUT` is one of:
|
|
19
25
|
- Area description: "how does the auth system work"
|
|
20
26
|
- Flow question: "trace the request lifecycle"
|
|
21
27
|
- Empty: use conversation context
|
|
@@ -82,6 +88,8 @@ Based on Skim agent findings, spawn 2-3 `Agent(subagent_type="Explore")` agents
|
|
|
82
88
|
|
|
83
89
|
Adjust explorer focus based on the specific exploration question.
|
|
84
90
|
|
|
91
|
+
Ask each explorer for a final report of at most about 1,500 tokens: findings with file:line references, not file dumps.
|
|
92
|
+
|
|
85
93
|
### Phase 4: Synthesize
|
|
86
94
|
|
|
87
95
|
**Produces:** MERGED_FINDINGS
|
|
@@ -142,7 +150,7 @@ If the settings line says `KNOWLEDGE=off`, skip write-back entirely. The machine
|
|
|
142
150
|
**Step 2 — Evaluate whether write-back is warranted:**
|
|
143
151
|
|
|
144
152
|
Only proceed if **at least one** of these is true:
|
|
145
|
-
- This workflow changed files in a directory that is documented by an existing feature knowledge base (a documented area changed).
|
|
153
|
+
- This workflow changed files in a directory that is documented by an existing feature knowledge base (a documented area changed). Knowledge bases are written through at that point, never on a background schedule.
|
|
146
154
|
- This workflow surfaced durable, cross-cutting knowledge about a codebase area that would help future agents working in the same area — patterns, anti-patterns, integration points, gotchas not visible from a single file read.
|
|
147
155
|
|
|
148
156
|
**Never spawn unconditionally.** If neither condition is met, skip write-back silently.
|
|
@@ -159,8 +167,6 @@ DIRECTORIES: {list of primary directories touched by this workflow}
|
|
|
159
167
|
FILES_CHANGED: {list of files changed}
|
|
160
168
|
DECISIONS_CONTEXT: {DECISIONS_CONTEXT if available, else (none)}
|
|
161
169
|
|
|
162
|
-
Load the devflow:feature-knowledge skill and follow its authoring process.
|
|
163
|
-
|
|
164
170
|
Write the knowledge base to:
|
|
165
171
|
{worktree}/.devflow/features/{slug}/KNOWLEDGE.md
|
|
166
172
|
|
|
@@ -16,13 +16,19 @@ Orchestrate a single task through implementation by spawning specialized agents.
|
|
|
16
16
|
|
|
17
17
|
## Input
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
What follows `/implement` is bound once, here. Every later step names it `COMMAND_INPUT` and never restates it:
|
|
20
|
+
|
|
21
|
+
<command-input>
|
|
22
|
+
$ARGUMENTS
|
|
23
|
+
</command-input>
|
|
24
|
+
|
|
25
|
+
`COMMAND_INPUT` is one of:
|
|
20
26
|
- Plan document path: `.devflow/docs/design/42-jwt-auth.2026-04-07_1430.md` (path to an existing `.md` file)
|
|
21
27
|
- Issue reference: `#42`
|
|
22
28
|
- Task description: "implement JWT auth"
|
|
23
29
|
- Empty: use conversation context
|
|
24
30
|
|
|
25
|
-
**Issue-reference grammar (L1 — command layer, permissive and provider-blind):** scan
|
|
31
|
+
**Issue-reference grammar (L1 — command layer, permissive and provider-blind):** scan `COMMAND_INPUT` for candidate issue references — a `#`-prefixed token and a bare digit run are both candidates — and collect them in source order as the raw token list `ISSUE_REFS`. Forward that list to the Git agent **verbatim**: the command never renders, normalises, pads, strips or coerces a token, and never rules a candidate out. Under `github` a token matching `^#?[1-9][0-9]{0,8}$` **is** a reference and the Git agent renders it as `#{n}`.
|
|
26
32
|
|
|
27
33
|
**A token of any other shape is neither coerced nor dropped silently — and no producer-side grammar check rejects it before the fetch.** Adjudication belongs to the operation that runs, and each one answers in its own Output block: `fetch-issue` strips a leading `#` and takes the text branch, so a non-numeric token is used as a **search term** and the operation returns the first open match or nothing; `fetch-issues-batch` resolves each token to an issue number, drops the ones it cannot resolve, and names them in `NOT_FOUND ({refs})` beside the issues it did fetch. Read the outcome from the operation that ran — a token's shape is a verdict nowhere, and there is nothing upstream holding it back.
|
|
28
34
|
|
|
@@ -39,7 +45,7 @@ When the user explicitly asks to re-validate, re-check, or re-run quality gates
|
|
|
39
45
|
1. **Branch safety check**: If on a protected branch (main, master, develop, etc.), run Phase 1 to create/switch to a work branch. If already on a work branch, skip Phase 1.
|
|
40
46
|
2. **Skip Phase 2** — no Code agent needed, user already made changes.
|
|
41
47
|
3. **Detect FILES_CHANGED**: `git diff --name-only {base_branch}...HEAD`
|
|
42
|
-
4. **Run Phases 3-8** — full
|
|
48
|
+
4. **Run Phases 3-8** — Simplify, Self-Review, Alignment, the one full Validate, QA Testing and the conditional Re-Validate, on the detected changes.
|
|
43
49
|
5. **Proceed to Phase 10** (Create PR), **Phase 10b** (Evidence) and **Phase 11** (Report).
|
|
44
50
|
|
|
45
51
|
If the user prompt does NOT match re-validation, proceed with the full pipeline below.
|
|
@@ -48,8 +54,6 @@ If the user prompt does NOT match re-validation, proceed with the full pipeline
|
|
|
48
54
|
|
|
49
55
|
**Produces:** TASK_ID, BASE_BRANCH, EXECUTION_PLAN, DECISIONS_CONTEXT, FEATURE_KNOWLEDGE, PR_DESCRIPTION_GUIDANCE, ISSUE_NUMBER, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, PR_EXCEPTIONS, TEST_PLAN, EVIDENCE_FILE, PR_TEST_PLAN_BLOCK, REVIEW_PUBLICATION
|
|
50
56
|
|
|
51
|
-
**Load Companion Skills** — Load via Skill tool: `devflow:test-driven-development`, `devflow:patterns`, `devflow:dependency-research`. If a skill fails to load, continue without it.
|
|
52
|
-
|
|
53
57
|
Record the current branch name as `BASE_BRANCH` - this will be the PR target.
|
|
54
58
|
|
|
55
59
|
**Docs root (D-DOCS-ROOT).** Every `.devflow/docs/` path this command reads or writes lives at the checkout's toplevel, never under the directory the session started in. Resolve `{worktree}` from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`) — by running
|
|
@@ -70,7 +74,7 @@ Accept the output only when it is exactly two lines: `exit=0` last and, before i
|
|
|
70
74
|
|
|
71
75
|
Set `EVIDENCE_POLICY`, `ISSUE_REQUIRED`, `APPLY_CONVENTIONS` and `REQUIRE_NON_AUTHOR_APPROVAL` from the accepted line. Pass agents only the three mechanism inputs, never `EVIDENCE_POLICY`. Report `Evidence policy: {EVIDENCE_POLICY} (source: {SOURCE})`, plus any `WARN` tokens as advisory, once in the final report.
|
|
72
76
|
|
|
73
|
-
**Plan Document Handling** (when
|
|
77
|
+
**Plan Document Handling** (when `COMMAND_INPUT` is a path ending in `.md`):
|
|
74
78
|
1. Read the plan document from the path provided
|
|
75
79
|
2. Extract from YAML frontmatter: `execution-strategy`, `context-risk`, `issue` number
|
|
76
80
|
3. Extract from body: Subtask Breakdown, Implementation Plan, Patterns to Follow, Acceptance Criteria
|
|
@@ -81,23 +85,25 @@ Set `EVIDENCE_POLICY`, `ISSUE_REQUIRED`, `APPLY_CONVENTIONS` and `REQUIRE_NON_AU
|
|
|
81
85
|
|
|
82
86
|
If `PR_DESCRIPTION_GUIDANCE` was not set above (non-plan paths: issue input or task description), set it to `(none)`.
|
|
83
87
|
|
|
88
|
+
**Empty input.** When `COMMAND_INPUT` is empty — a plan handoff arrives this way, with the plan already in the conversation — there is no argument to name the branch from, and the Git agent sees none of this conversation. Write the description yourself: one line, taken from the plan's title or, with no plan, from the conversation. Send it as the setup-task `TASK_DESCRIPTION` below.
|
|
89
|
+
|
|
84
90
|
Spawn Git agent to set up task environment. The Git agent derives the branch name automatically from the issue or task description:
|
|
85
91
|
|
|
86
92
|
```
|
|
87
93
|
Agent(subagent_type="Git"):
|
|
88
94
|
"OPERATION: setup-task
|
|
89
95
|
BASE_BRANCH: {current branch name}
|
|
90
|
-
ISSUE_INPUT: {
|
|
91
|
-
TASK_DESCRIPTION: {
|
|
96
|
+
ISSUE_INPUT: {COMMAND_INPUT verbatim, when it is a single whitespace-delimited token that does not end in .md; when it ends in .md, the plan frontmatter's issue value verbatim unless absent or pending — otherwise omit}
|
|
97
|
+
TASK_DESCRIPTION: {COMMAND_INPUT verbatim, when it is two or more whitespace-delimited tokens; when COMMAND_INPUT is empty, the one-line description you wrote above — otherwise omit}
|
|
92
98
|
ISSUE_REQUIRED: {ISSUE_REQUIRED}
|
|
93
99
|
APPLY_CONVENTIONS: {APPLY_CONVENTIONS}
|
|
94
|
-
PLAN_ARTIFACT_PATH: {path to plan document if
|
|
100
|
+
PLAN_ARTIFACT_PATH: {path to plan document if COMMAND_INPUT ends in .md, otherwise (none)}
|
|
95
101
|
Derive branch name from issue or description, create feature branch, and fetch issue if specified.
|
|
96
102
|
Return the branch setup summary."
|
|
97
103
|
```
|
|
98
104
|
|
|
99
105
|
The issue token is forwarded **unclassified**, and the routing is decided by
|
|
100
|
-
SHAPE alone — how many tokens
|
|
106
|
+
SHAPE alone — how many tokens `COMMAND_INPUT` has, and whether it ends in `.md`.
|
|
101
107
|
|
|
102
108
|
`setup-task` is the one step that has resolved a provider, and therefore the only
|
|
103
109
|
one that knows what an issue reference looks like on this machine: `#123`,
|
|
@@ -158,7 +164,7 @@ Note: the section reaches a public PR body. The Code agent re-checks every line
|
|
|
158
164
|
|
|
159
165
|
**Test plan.** Before any Code spawn, give the task a test plan in the evidence file `{worktree}/.devflow/docs/evidence-{branch_slug}.md` (`EVIDENCE_FILE`) — unlike the handoff file, it stays after the PR exists. It holds up to three sections, in this order and nothing else: `## Test Plan`; `## Evidence Exceptions`, a byte copy of `PR_EXCEPTIONS` present only while that is not `(none)`; and `## Claims`, always last, so every claim is appended at the end of the file. Create the file if absent; if it exists, replace its `## Test Plan` and `## Evidence Exceptions` sections and keep `## Claims` byte-identical.
|
|
160
166
|
|
|
161
|
-
Write the `## Test Plan` section: when
|
|
167
|
+
Write the `## Test Plan` section: when `COMMAND_INPUT` is a plan document with a `## Test Plan` section, copy that section's lines verbatim; otherwise write one TP line per acceptance criterion the plan, the issue or the task text states, numbered from `TP-1`. Never invent a criterion, and word every scenario yourself in plain words: the lines reach the PR body, so a scenario holds no `#`, `@` or `/` — no issue reference, mention, closing keyword target or URL — and the files a TP covers go in its `files:` field. Each line follows the TP-line contract:
|
|
162
168
|
|
|
163
169
|
**Test-plan line (TP).** Write every test-plan entry as one line in exactly this shape. `TP_LINE_RE` in `pr-evidence.cjs` parses it and refuses any other line.
|
|
164
170
|
|
|
@@ -237,7 +243,7 @@ The index is one direct file read, written at render time by `render-decisions.c
|
|
|
237
243
|
|
|
238
244
|
When `DECISIONS_CONTEXT` is not `(none)`, follow `devflow:apply-decisions` to scan the index, identify plausibly-relevant entries, Read full entry bodies on demand, and cite verbatim IDs in downstream agent prompts and reasoning.
|
|
239
245
|
|
|
240
|
-
Pass to Code agent (Phase 2) and Scrutinize agent (Phase
|
|
246
|
+
Pass to Code agent (Phase 2) and Scrutinize agent (Phase 4).
|
|
241
247
|
|
|
242
248
|
### Load Feature Knowledge
|
|
243
249
|
|
|
@@ -307,7 +313,8 @@ Based on Setup context (plan document, issue body, or conversation context), use
|
|
|
307
313
|
|
|
308
314
|
```
|
|
309
315
|
Agent(subagent_type="Code"):
|
|
310
|
-
"
|
|
316
|
+
"OPERATION: implement
|
|
317
|
+
TASK_ID: {task-id}
|
|
311
318
|
TASK_DESCRIPTION: {description}
|
|
312
319
|
BASE_BRANCH: {base branch}
|
|
313
320
|
EXECUTION_PLAN: {full plan from setup context}
|
|
@@ -333,7 +340,8 @@ Spawn Code agents one at a time, passing handoff summaries between phases:
|
|
|
333
340
|
**Phase 1 Code agent:**
|
|
334
341
|
```
|
|
335
342
|
Agent(subagent_type="Code"):
|
|
336
|
-
"
|
|
343
|
+
"OPERATION: implement
|
|
344
|
+
TASK_ID: {task-id}
|
|
337
345
|
TASK_DESCRIPTION: {phase 1 description}
|
|
338
346
|
BASE_BRANCH: {base branch}
|
|
339
347
|
EXECUTION_PLAN: {phase 1 steps}
|
|
@@ -353,7 +361,8 @@ HANDOFF_FILE: {worktree}/.devflow/docs/handoff-{branch_slug}.md"
|
|
|
353
361
|
**Phase 2+ Code agents** (after prior phase completes):
|
|
354
362
|
```
|
|
355
363
|
Agent(subagent_type="Code"):
|
|
356
|
-
"
|
|
364
|
+
"OPERATION: implement
|
|
365
|
+
TASK_ID: {task-id}
|
|
357
366
|
TASK_DESCRIPTION: {phase N description}
|
|
358
367
|
BASE_BRANCH: {base branch}
|
|
359
368
|
EXECUTION_PLAN: {phase N steps}
|
|
@@ -384,7 +393,8 @@ Spawn multiple Code agents **in a single message**, each with independent subtas
|
|
|
384
393
|
|
|
385
394
|
```
|
|
386
395
|
Agent(subagent_type="Code"): # Code agent 1
|
|
387
|
-
"
|
|
396
|
+
"OPERATION: implement
|
|
397
|
+
TASK_ID: {task-id}-part1
|
|
388
398
|
TASK_DESCRIPTION: {independent subtask 1}
|
|
389
399
|
BASE_BRANCH: {base branch}
|
|
390
400
|
EXECUTION_PLAN: {subtask 1 steps}
|
|
@@ -399,7 +409,8 @@ ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
|
|
|
399
409
|
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}"
|
|
400
410
|
|
|
401
411
|
Agent(subagent_type="Code"): # Code agent 2 (same message)
|
|
402
|
-
"
|
|
412
|
+
"OPERATION: implement
|
|
413
|
+
TASK_ID: {task-id}-part2
|
|
403
414
|
TASK_DESCRIPTION: {independent subtask 2}
|
|
404
415
|
BASE_BRANCH: {base branch}
|
|
405
416
|
EXECUTION_PLAN: {subtask 2 steps}
|
|
@@ -420,74 +431,28 @@ ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}"
|
|
|
420
431
|
- Different files/modules with no imports between them
|
|
421
432
|
- Each subtask is self-contained
|
|
422
433
|
|
|
423
|
-
### Phase 3:
|
|
424
|
-
|
|
425
|
-
**Produces:** VALIDATION_RESULT
|
|
426
|
-
**Requires:** FILES_CHANGED
|
|
427
|
-
|
|
428
|
-
After Code agent completes, spawn Validate agent to verify correctness:
|
|
429
|
-
|
|
430
|
-
```
|
|
431
|
-
Agent(subagent_type="Validate", model="haiku"):
|
|
432
|
-
"FILES_CHANGED: {list of files from Code agent output}
|
|
433
|
-
VALIDATION_SCOPE: full
|
|
434
|
-
Run build, typecheck, lint, test. Report pass/fail with failure details."
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
**If FAIL:**
|
|
438
|
-
1. Extract failure details from Validate agent output
|
|
439
|
-
2. Increment `validation_retry_count`
|
|
440
|
-
3. If `validation_retry_count <= 2`:
|
|
441
|
-
- Spawn Code agent with fix context:
|
|
442
|
-
```
|
|
443
|
-
Agent(subagent_type="Code"):
|
|
444
|
-
"TASK_ID: {task-id}
|
|
445
|
-
TASK_DESCRIPTION: Fix validation failures
|
|
446
|
-
OPERATION: validation-fix
|
|
447
|
-
VALIDATION_FAILURES: {parsed failures from Validate agent}
|
|
448
|
-
SCOPE: Fix only the listed failures, no other changes
|
|
449
|
-
CREATE_PR: false
|
|
450
|
-
ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
|
|
451
|
-
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
452
|
-
COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
|
|
453
|
-
```
|
|
454
|
-
- Loop back to Phase 3 (re-validate)
|
|
455
|
-
4. If `validation_retry_count > 2`: Report failures to user and halt
|
|
456
|
-
|
|
457
|
-
**If PASS:** append a `gate:validate` claim, then continue to Phase 4.
|
|
458
|
-
|
|
459
|
-
**Evidence claims** are lines appended to the `## Claims` section of `EVIDENCE_FILE` — the file's last section, created when absent. Append only: never edit or remove a claim; the last valid one per target wins. Each line takes exactly one of these shapes, where `<head>` is the 40-hex `HEAD:` the agent's report shows:
|
|
460
|
-
|
|
461
|
-
```
|
|
462
|
-
- gate:validate PASS sha:<head> by:validate
|
|
463
|
-
- TP-<n> <PASS|FAIL|SKIP> sha:<head> by:test exit:<0-255>
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
- `gate:validate` — after a Phase 3 or Phase 6 PASS.
|
|
467
|
-
- `TP-<n>` — after every Phase 8 run, one line per `### Test Plan Evidence` row whose TP is in `TEST_PLAN`, with the row's outcome; the line ends at `by:test` when the row's Exit is not a number from 0 to 255.
|
|
468
|
-
- Append nothing from a report whose `HEAD:` is not a single 40-hex SHA — a reported before/after change included — and say so in the Phase 11 report.
|
|
469
|
-
|
|
470
|
-
### Phase 4: Simplify
|
|
434
|
+
### Phase 3: Simplify
|
|
471
435
|
|
|
472
436
|
**Produces:** SIMPLIFY_OUTPUT
|
|
473
437
|
**Requires:** FILES_CHANGED
|
|
474
438
|
|
|
475
|
-
After
|
|
439
|
+
After the Code agent completes, spawn Simplify agent to polish the code. The Phase 6 Validate covers its commits.
|
|
476
440
|
|
|
477
441
|
```
|
|
478
442
|
Agent(subagent_type="Simplify"):
|
|
479
443
|
"Simplify recently implemented code
|
|
480
444
|
Task: {task description}
|
|
481
445
|
FILES_CHANGED: {list of files from Code agent output}
|
|
482
|
-
Focus on code modified by Code agent, apply project standards, enhance clarity
|
|
446
|
+
Focus on code modified by Code agent, apply project standards, enhance clarity
|
|
447
|
+
Commit any improvements with a conventional-commit message."
|
|
483
448
|
```
|
|
484
449
|
|
|
485
|
-
### Phase
|
|
450
|
+
### Phase 4: Self-Review
|
|
486
451
|
|
|
487
452
|
**Produces:** SCRUTINIZE_OUTPUT
|
|
488
453
|
**Requires:** FILES_CHANGED
|
|
489
454
|
|
|
490
|
-
After Simplify agent completes, spawn Scrutinize agent as
|
|
455
|
+
After Simplify agent completes, spawn Scrutinize agent as the quality gate:
|
|
491
456
|
|
|
492
457
|
```
|
|
493
458
|
Agent(subagent_type="Scrutinize"):
|
|
@@ -498,32 +463,14 @@ FEATURE_KNOWLEDGE: {feature_knowledge}
|
|
|
498
463
|
Evaluate 9 pillars, fix P0/P1 issues, report status"
|
|
499
464
|
```
|
|
500
465
|
|
|
501
|
-
|
|
466
|
+
Scrutinize agent reports `### Status: PASS | FIXED | BLOCKED`. **If BLOCKED:** report to user and halt. **If PASS or FIXED:** continue to Phase 5. A FIXED status commits fixes and starts no Validate of its own: the Phase 6 run covers them.
|
|
502
467
|
|
|
503
|
-
### Phase
|
|
504
|
-
|
|
505
|
-
**Produces:** REVALIDATION_RESULT
|
|
506
|
-
**Requires:** SCRUTINIZE_OUTPUT
|
|
507
|
-
|
|
508
|
-
If Scrutinize agent made code changes (status: FIXED), spawn Validate agent to verify:
|
|
509
|
-
|
|
510
|
-
```
|
|
511
|
-
Agent(subagent_type="Validate", model="haiku"):
|
|
512
|
-
"FILES_CHANGED: {files modified by Scrutinize agent}
|
|
513
|
-
VALIDATION_SCOPE: changed-only
|
|
514
|
-
Verify Scrutinize agent's fixes didn't break anything."
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
**If FAIL:** Report to user - Scrutinize agent broke tests, needs manual intervention.
|
|
518
|
-
|
|
519
|
-
**If PASS:** append a `gate:validate` claim (Phase 3's **Evidence claims**), then continue to Phase 7.
|
|
520
|
-
|
|
521
|
-
### Phase 7: Alignment Check
|
|
468
|
+
### Phase 5: Alignment Check
|
|
522
469
|
|
|
523
470
|
**Produces:** ALIGNMENT_RESULT
|
|
524
471
|
**Requires:** FILES_CHANGED, EXECUTION_PLAN
|
|
525
472
|
|
|
526
|
-
After Scrutinize agent passes
|
|
473
|
+
After Scrutinize agent passes, spawn Evaluate agent to validate alignment. Evaluate agent receives `FEATURE_KNOWLEDGE` as acceptance context only; pattern and anti-pattern judgments belong to Scrutinize agent:
|
|
527
474
|
|
|
528
475
|
```
|
|
529
476
|
Agent(subagent_type="Evaluate"):
|
|
@@ -535,7 +482,7 @@ FEATURE_KNOWLEDGE: {feature_knowledge}
|
|
|
535
482
|
Validate alignment with request and plan. Report ALIGNED or MISALIGNED with details."
|
|
536
483
|
```
|
|
537
484
|
|
|
538
|
-
**If ALIGNED:** Continue to Phase
|
|
485
|
+
**If ALIGNED:** Continue to Phase 6
|
|
539
486
|
|
|
540
487
|
**If MISALIGNED:**
|
|
541
488
|
1. Extract misalignment details from Evaluate agent output
|
|
@@ -544,9 +491,9 @@ Validate alignment with request and plan. Report ALIGNED or MISALIGNED with deta
|
|
|
544
491
|
- Spawn Code agent to fix misalignments:
|
|
545
492
|
```
|
|
546
493
|
Agent(subagent_type="Code"):
|
|
547
|
-
"
|
|
494
|
+
"OPERATION: alignment-fix
|
|
495
|
+
TASK_ID: {task-id}
|
|
548
496
|
TASK_DESCRIPTION: Fix alignment issues
|
|
549
|
-
OPERATION: alignment-fix
|
|
550
497
|
MISALIGNMENTS: {structured misalignments from Evaluate agent}
|
|
551
498
|
SCOPE: Fix only the listed misalignments, no other changes
|
|
552
499
|
CREATE_PR: false
|
|
@@ -554,22 +501,62 @@ Validate alignment with request and plan. Report ALIGNED or MISALIGNED with deta
|
|
|
554
501
|
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
555
502
|
COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
|
|
556
503
|
```
|
|
557
|
-
-
|
|
504
|
+
- Loop back to Phase 5 (re-check alignment). The fix is not validated here: the Phase 6 run covers it.
|
|
505
|
+
4. If `alignment_fix_count > 2`: Report misalignments to user for decision
|
|
506
|
+
|
|
507
|
+
### Phase 6: Validate
|
|
508
|
+
|
|
509
|
+
**Produces:** VALIDATION_RESULT, VALIDATED_HEAD
|
|
510
|
+
**Requires:** BASE_BRANCH
|
|
511
|
+
|
|
512
|
+
Validate takes the one full-suite slot, after every commit it must cover: Code, Simplify, Scrutinize and the alignment fixes. After Evaluate agent passes, spawn Validate agent. `FILES_CHANGED` is the branch diff, because the Code agent's own list misses the Simplify, Scrutinize and fix commits (`{base}` is `BASE_BRANCH`):
|
|
513
|
+
|
|
514
|
+
```
|
|
515
|
+
Agent(subagent_type="Validate"):
|
|
516
|
+
"FILES_CHANGED: {output of `git diff --name-only {base}...HEAD`}
|
|
517
|
+
VALIDATION_SCOPE: full
|
|
518
|
+
Run build, typecheck, lint, test. Report pass/fail with failure details."
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
**If FAIL:**
|
|
522
|
+
1. Extract failure details from Validate agent output
|
|
523
|
+
2. Increment `validation_retry_count`
|
|
524
|
+
3. If `validation_retry_count <= 2`:
|
|
525
|
+
- Spawn Code agent with fix context:
|
|
558
526
|
```
|
|
559
|
-
Agent(subagent_type="
|
|
560
|
-
"
|
|
561
|
-
|
|
527
|
+
Agent(subagent_type="Code"):
|
|
528
|
+
"OPERATION: validation-fix
|
|
529
|
+
TASK_ID: {task-id}
|
|
530
|
+
TASK_DESCRIPTION: Fix validation failures
|
|
531
|
+
VALIDATION_FAILURES: {parsed failures from Validate agent}
|
|
532
|
+
SCOPE: Fix only the listed failures, no other changes
|
|
533
|
+
CREATE_PR: false
|
|
534
|
+
ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
|
|
535
|
+
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
536
|
+
COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
|
|
562
537
|
```
|
|
563
|
-
-
|
|
564
|
-
|
|
565
|
-
|
|
538
|
+
- Loop back to Phase 6 (re-validate at the new HEAD, full scope)
|
|
539
|
+
4. If `validation_retry_count > 2`: Report failures to user and halt
|
|
540
|
+
|
|
541
|
+
**If PASS:** append a `gate:validate` claim, run `git rev-parse HEAD` and record the result as `VALIDATED_HEAD`, then continue to Phase 7.
|
|
542
|
+
|
|
543
|
+
**Evidence claims** are lines appended to the `## Claims` section of `EVIDENCE_FILE` — the file's last section, created when absent. Append only: never edit or remove a claim; the last valid one per target wins. Each line takes exactly one of these shapes, where `<head>` is the 40-hex `HEAD:` the agent's report shows:
|
|
544
|
+
|
|
545
|
+
```
|
|
546
|
+
- gate:validate PASS sha:<head> by:validate
|
|
547
|
+
- TP-<n> <PASS|FAIL|SKIP> sha:<head> by:test exit:<0-255>
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
- `gate:validate` — after a Phase 6 or Phase 8 PASS.
|
|
551
|
+
- `TP-<n>` — after every Phase 7 run, one line per `### Test Plan Evidence` row whose TP is in `TEST_PLAN`, with the row's outcome; the line ends at `by:test` when the row's Exit is not a number from 0 to 255.
|
|
552
|
+
- Append nothing from a report whose `HEAD:` is not a single 40-hex SHA — a reported before/after change included — and say so in the Phase 11 report.
|
|
566
553
|
|
|
567
|
-
### Phase
|
|
554
|
+
### Phase 7: QA Testing
|
|
568
555
|
|
|
569
556
|
**Produces:** QA_RESULT
|
|
570
|
-
**Requires:** FILES_CHANGED, EXECUTION_PLAN, TEST_PLAN
|
|
557
|
+
**Requires:** FILES_CHANGED, EXECUTION_PLAN, TEST_PLAN, VALIDATED_HEAD
|
|
571
558
|
|
|
572
|
-
After
|
|
559
|
+
After Phase 6 passes, spawn Test agent for scenario-based acceptance testing:
|
|
573
560
|
|
|
574
561
|
```
|
|
575
562
|
Agent(subagent_type="Test"):
|
|
@@ -581,9 +568,9 @@ TEST_PLAN: {the TP lines of the evidence file's ## Test Plan section, or (none)}
|
|
|
581
568
|
Design and execute scenario-based acceptance tests. Report PASS or FAIL with evidence."
|
|
582
569
|
```
|
|
583
570
|
|
|
584
|
-
After every Test agent run — PASS or FAIL, first run or retry — append its TP claims (Phase
|
|
571
|
+
After every Test agent run — PASS or FAIL, first run or retry — append its TP claims (Phase 6's **Evidence claims**).
|
|
585
572
|
|
|
586
|
-
**If PASS:** Continue to Phase
|
|
573
|
+
**If PASS:** Continue to Phase 8
|
|
587
574
|
|
|
588
575
|
**If FAIL:**
|
|
589
576
|
1. Extract failure details from Test agent output
|
|
@@ -592,9 +579,9 @@ After every Test agent run — PASS or FAIL, first run or retry — append its T
|
|
|
592
579
|
- Spawn Code agent to fix QA failures:
|
|
593
580
|
```
|
|
594
581
|
Agent(subagent_type="Code"):
|
|
595
|
-
"
|
|
582
|
+
"OPERATION: qa-fix
|
|
583
|
+
TASK_ID: {task-id}
|
|
596
584
|
TASK_DESCRIPTION: Fix QA test failures
|
|
597
|
-
OPERATION: qa-fix
|
|
598
585
|
QA_FAILURES: {structured failures from Test agent}
|
|
599
586
|
SCOPE: Fix only the listed failures, no other changes
|
|
600
587
|
CREATE_PR: false
|
|
@@ -602,15 +589,26 @@ After every Test agent run — PASS or FAIL, first run or retry — append its T
|
|
|
602
589
|
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
603
590
|
COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
|
|
604
591
|
```
|
|
605
|
-
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
592
|
+
- Loop back to Phase 7 (re-run Test agent). The fix is not validated here: Phase 8 covers it.
|
|
593
|
+
4. If `qa_retry_count > 2`: Report QA failures to user for decision. The run stops at the report (Phase 11), so Phases 8 and 9 do not run.
|
|
594
|
+
|
|
595
|
+
### Phase 8: Re-Validate (only if a qa-fix committed)
|
|
596
|
+
|
|
597
|
+
**Produces:** REVALIDATION_RESULT
|
|
598
|
+
**Requires:** QA_RESULT, VALIDATED_HEAD
|
|
599
|
+
|
|
600
|
+
Run this phase only if a qa-fix committed (`git rev-parse HEAD` differs from `VALIDATED_HEAD`); otherwise skip it and continue to Phase 9. Spawn Validate agent over what changed since the Phase 6 run:
|
|
601
|
+
|
|
602
|
+
```
|
|
603
|
+
Agent(subagent_type="Validate"):
|
|
604
|
+
"FILES_CHANGED: {output of `git diff --name-only VALIDATED_HEAD..HEAD`}
|
|
605
|
+
VALIDATION_SCOPE: changed-only
|
|
606
|
+
Verify the qa-fix commits did not break anything."
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
**If FAIL:** Report the failures to user and halt.
|
|
610
|
+
|
|
611
|
+
**If PASS:** append a `gate:validate` claim (Phase 6's **Evidence claims**), then continue to Phase 9.
|
|
614
612
|
|
|
615
613
|
### Phase 9: CI Status Gate
|
|
616
614
|
|
|
@@ -619,14 +617,22 @@ After every Test agent run — PASS or FAIL, first run or retry — append its T
|
|
|
619
617
|
|
|
620
618
|
Strategy-conditional: run when the PR already exists — **SINGLE_CODE_AGENT** and **SEQUENTIAL_CODE_AGENTS** (the Phase 2 Code agent with `CREATE_PR: true` creates it); skip for **PARALLEL_CODE_AGENTS** (its unified PR is created in Phase 10).
|
|
621
619
|
|
|
620
|
+
**Push first, outside the gate block.** The gate reads CI for the pushed head, and the Simplify, Scrutinize and fix commits reach the PR only by a push. Push once — never force, and no retry:
|
|
621
|
+
|
|
622
|
+
```bash
|
|
623
|
+
git push origin HEAD; echo "exit=$?"
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
`exit=0` continues to the gate. Any other result, a rejected non-fast-forward push included, records `TRACEABILITY: DEGRADED (ci push failed)` for the Phase 11 report, reports "CI status unknown — verify manually before merging" and proceeds to Phase 10 without waiting. `PR_NUMBER` is the number in `PR_URL`.
|
|
627
|
+
|
|
622
628
|
<!-- PATTERN: ci-status-gate -->
|
|
623
|
-
1.
|
|
629
|
+
1. Wait: run `cd {worktree} && HEAD_SHA=$(git rev-parse HEAD) && node "$HOME/.devflow/scripts/ci-wait.cjs" --pr {PR_NUMBER} --head "$HEAD_SHA"` through the Bash tool with `timeout: 600000`. Each run is one wait of at most 570 seconds and prints one line, `CI <STATUS> pr=… head=… failing=… pending=… waited=…` (INDETERMINATE adds `reason=…`). A missing or unparseable line, a status outside the six below, or a non-zero exit is INDETERMINATE.
|
|
624
630
|
2. **If PASSING** → proceed to Phase 10.
|
|
625
631
|
3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to Phase 10.
|
|
626
|
-
4. **If PENDING**
|
|
627
|
-
5. **If INDETERMINATE**
|
|
628
|
-
6. **If FAILING** → report failing checks. Spawn `Agent(subagent_type="Code")` with `COMPLIANCE_FRAMEWORKS`
|
|
629
|
-
7. **
|
|
632
|
+
4. **If PENDING** and fewer than 3 waits have run → wait again (step 1). After the third wait → report "CI still running — verify manually before merging" and proceed.
|
|
633
|
+
5. **If INDETERMINATE** and fewer than 3 waits have run → wait again (step 1). After the third wait → report "CI status unknown — verify manually before merging" and proceed.
|
|
634
|
+
6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Code")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_FRAMEWORKS`, `CI_FAILURES` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Code agent fetches the full names and reads the logs itself and this command reads none. After a fix, push with the command above and, if a wait remains, wait again (step 1); a failed push records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and stops waiting. After the second fix still FAILING → report the failing checks and proceed.
|
|
635
|
+
7. **Budget**: at most 3 waits and 2 fixes in all. When one is spent, report the current status and proceed.
|
|
630
636
|
<!-- /PATTERN: ci-status-gate -->
|
|
631
637
|
|
|
632
638
|
### Phase 10: Create PR
|
|
@@ -640,9 +646,9 @@ Strategy-conditional: run when the PR already exists — **SINGLE_CODE_AGENT** a
|
|
|
640
646
|
|
|
641
647
|
```
|
|
642
648
|
Agent(subagent_type="Code"):
|
|
643
|
-
"
|
|
649
|
+
"OPERATION: pr-create
|
|
650
|
+
TASK_ID: {task-id}
|
|
644
651
|
TASK_DESCRIPTION: Create the unified PR for the parallel implementation
|
|
645
|
-
OPERATION: pr-create
|
|
646
652
|
BASE_BRANCH: {base branch}
|
|
647
653
|
CREATE_PR: true
|
|
648
654
|
PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
|
|
@@ -692,7 +698,7 @@ Display completion summary with phase status, PR info, and next steps.
|
|
|
692
698
|
|
|
693
699
|
Show the test plan's evidence from Phase 10b: `Test plan: {VERIFIED-CI + ATTESTED-LOCAL}/{total} verified (VERIFIED-CI {n}, ATTESTED-LOCAL {n})`, read from the `EVIDENCE` line and never inferred, then its `**Body**:` / `**Comment**:` line verbatim. Without an `EVIDENCE` line, show `Test plan: evidence unavailable`; with no test plan, `Test plan: missing`.
|
|
694
700
|
|
|
695
|
-
If any Git agent output emitted `TRACEABILITY: DEGRADED ({reason})` lines during the run, or Phase 10b's push recorded one, surface them verbatim in the report under a `### Traceability` subsection so the user can act on them.
|
|
701
|
+
If any Git agent output emitted `TRACEABILITY: DEGRADED ({reason})` lines during the run, or Phase 9's push or Phase 10b's push recorded one, surface them verbatim in the report under a `### Traceability` subsection so the user can act on them.
|
|
696
702
|
|
|
697
703
|
If Phase 1 recorded an evidence exception, show its `## Evidence Exceptions` lines in the report.
|
|
698
704
|
|
|
@@ -723,7 +729,7 @@ If the settings line says `KNOWLEDGE=off`, skip write-back entirely. The machine
|
|
|
723
729
|
**Step 2 — Evaluate whether write-back is warranted:**
|
|
724
730
|
|
|
725
731
|
Only proceed if **at least one** of these is true:
|
|
726
|
-
- This workflow changed files in a directory that is documented by an existing feature knowledge base (a documented area changed).
|
|
732
|
+
- This workflow changed files in a directory that is documented by an existing feature knowledge base (a documented area changed). Knowledge bases are written through at that point, never on a background schedule.
|
|
727
733
|
- This workflow surfaced durable, cross-cutting knowledge about a codebase area that would help future agents working in the same area — patterns, anti-patterns, integration points, gotchas not visible from a single file read.
|
|
728
734
|
|
|
729
735
|
**Never spawn unconditionally.** If neither condition is met, skip write-back silently.
|
|
@@ -740,8 +746,6 @@ DIRECTORIES: {list of primary directories touched by this workflow}
|
|
|
740
746
|
FILES_CHANGED: {list of files changed}
|
|
741
747
|
DECISIONS_CONTEXT: {DECISIONS_CONTEXT if available, else (none)}
|
|
742
748
|
|
|
743
|
-
Load the devflow:feature-knowledge skill and follow its authoring process.
|
|
744
|
-
|
|
745
749
|
Write the knowledge base to:
|
|
746
750
|
{worktree}/.devflow/features/{slug}/KNOWLEDGE.md
|
|
747
751
|
|
|
@@ -782,30 +786,30 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
782
786
|
│ ├─ SEQUENTIAL_CODE_AGENTS (15%): N Code agents with handoff summaries
|
|
783
787
|
│ └─ PARALLEL_CODE_AGENTS (5%): N Code agents in single message (rare)
|
|
784
788
|
│
|
|
785
|
-
├─ Phase 3:
|
|
786
|
-
│ └─ Validate agent (build, typecheck, lint, test)
|
|
787
|
-
│ └─ If FAIL: Code agent fix loop (max 2 retries) → re-validate
|
|
788
|
-
│ └─ If PASS: gate:validate claim → evidence file
|
|
789
|
-
│
|
|
790
|
-
├─ Phase 4: Simplify
|
|
789
|
+
├─ Phase 3: Simplify
|
|
791
790
|
│ └─ Simplify agent (refines code clarity and consistency)
|
|
792
791
|
│
|
|
793
|
-
├─ Phase
|
|
794
|
-
│ └─ Scrutinize agent (
|
|
792
|
+
├─ Phase 4: Self-Review
|
|
793
|
+
│ └─ Scrutinize agent (quality gate, fixes P0/P1; status PASS | FIXED | BLOCKED)
|
|
795
794
|
│
|
|
796
|
-
├─ Phase
|
|
797
|
-
│ └─ Validate agent (verify Scrutinize agent fixes)
|
|
798
|
-
│
|
|
799
|
-
├─ Phase 7: Alignment Check
|
|
795
|
+
├─ Phase 5: Alignment Check
|
|
800
796
|
│ └─ Evaluate agent (validates alignment - reports only, no fixes)
|
|
801
|
-
│ └─ If MISALIGNED: Code agent fix loop (max 2 iterations) →
|
|
797
|
+
│ └─ If MISALIGNED: Code agent fix loop (max 2 iterations) → re-check alignment
|
|
798
|
+
│
|
|
799
|
+
├─ Phase 6: Validate (the one full-suite slot)
|
|
800
|
+
│ └─ Validate agent (build, typecheck, lint, test over the branch diff)
|
|
801
|
+
│ └─ If FAIL: Code agent fix loop (max 2 retries) → re-validate at the new HEAD
|
|
802
|
+
│ └─ If PASS: record VALIDATED_HEAD, gate:validate claim → evidence file
|
|
802
803
|
│
|
|
803
|
-
├─ Phase
|
|
804
|
+
├─ Phase 7: QA Testing
|
|
804
805
|
│ └─ Test agent (scenario-based acceptance tests, TEST_PLAN) → one claim per TP row → evidence file
|
|
805
|
-
│ └─ If FAIL: Code agent fix loop (max 2 retries) →
|
|
806
|
+
│ └─ If FAIL: Code agent fix loop (max 2 retries) → re-test
|
|
807
|
+
│
|
|
808
|
+
├─ Phase 8: Re-Validate (only if a qa-fix committed)
|
|
809
|
+
│ └─ Validate agent (changed-only over VALIDATED_HEAD..HEAD) → gate:validate claim
|
|
806
810
|
│
|
|
807
811
|
├─ Phase 9: CI Status Gate (SINGLE_CODE_AGENT + SEQUENTIAL_CODE_AGENTS; skipped for PARALLEL_CODE_AGENTS)
|
|
808
|
-
│ └─
|
|
812
|
+
│ └─ Push the branch, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code agent on FAILING (3 waits + 2 fixes)
|
|
809
813
|
│
|
|
810
814
|
├─ Phase 10: Create PR (if needed)
|
|
811
815
|
│ └─ SINGLE_CODE_AGENT: already created by the Phase 2 Code agent
|
|
@@ -824,7 +828,7 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
824
828
|
|
|
825
829
|
## Principles
|
|
826
830
|
|
|
827
|
-
1. **Orchestration only** - Command spawns agents, never does work itself
|
|
831
|
+
1. **Orchestration only** - Command spawns agents, never does work itself; the inline calls are the bounded plumbing the charter allows: the Phase 9 and Phase 10b pushes, the Phase 9 ci-wait call and the evidence script checks
|
|
828
832
|
2. **Plan-first** - Plan documents from `/plan` skip exploration/planning overhead entirely
|
|
829
833
|
3. **Coherence-first** - Single Code agent produces more consistent code (default ~80% of tasks)
|
|
830
834
|
4. **Agent ownership** - Each agent owns its output completely
|
|
@@ -834,7 +838,7 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
834
838
|
8. **Strict delegation** - Never perform agent work in main session. "Spawn X" means call Agent tool with X, not do X's work yourself
|
|
835
839
|
9. **Validate agent owns validation** - Never run `npm test`, `npm run build`, or similar in main session; always delegate to Validate agent
|
|
836
840
|
10. **Code agent owns fixes** - Never implement fixes in main session; spawn Code agent for validation failures and alignment fixes
|
|
837
|
-
11. **Loop limits** - Max 2 validation retries, max 2 alignment fix iterations before escalating to user
|
|
841
|
+
11. **Loop limits** - Max 2 validation retries, max 2 alignment fix iterations, max 2 QA retries before escalating to user; the CI gate allows at most 3 waits and 2 fixes
|
|
838
842
|
12. **CI awareness** - CI status is checked before merge for SINGLE_CODE_AGENT and SEQUENTIAL_CODE_AGENTS, whose PR exists from Phase 2; skipped for PARALLEL_CODE_AGENTS, whose PR is created in Phase 10; test-plan evidence (Phase 10b) is recorded under every strategy once the PR exists
|
|
839
843
|
|
|
840
844
|
## Error Handling
|