devflow-kit 3.5.0 → 3.7.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 +178 -1
- package/README.md +10 -6
- package/dist/agents/code.md +7 -11
- package/dist/agents/{diagnose.md → debug.md} +4 -4
- package/dist/agents/{code-fix.md → fix.md} +7 -8
- package/dist/agents/{scrutinize.md → harden.md} +6 -6
- package/dist/agents/{code-edit.md → refactor.md} +8 -9
- package/dist/agents/review.md +2 -0
- package/dist/cli/agents-view/render.js +1 -1
- package/dist/cli/commands/gates.js +276 -0
- package/dist/cli/commands/init-seed.js +9 -1
- package/dist/cli/commands/init.js +34 -11
- package/dist/cli/commands/learning.js +12 -12
- package/dist/cli/commands/legacy-hooks.js +1 -1
- package/dist/cli/commands/memory.js +18 -0
- package/dist/cli/commands/uninstall.js +111 -5
- package/dist/cli.js +2 -0
- package/dist/commands/bug-analysis.md +21 -17
- package/dist/commands/code-review.md +65 -66
- package/dist/commands/debug.md +17 -17
- package/dist/commands/dynamic-build.md +104 -116
- package/dist/commands/dynamic-plan.md +13 -11
- package/dist/commands/dynamic-profile.md +9 -7
- package/dist/commands/dynamic-tickets.md +13 -11
- package/dist/commands/explore.md +15 -15
- package/dist/commands/implement.md +80 -154
- package/dist/commands/plan.md +34 -66
- package/dist/commands/release.md +11 -7
- package/dist/commands/research.md +14 -10
- package/dist/commands/resolve.md +44 -88
- package/dist/commands/self-review.md +44 -44
- package/dist/core/agent-models.js +47 -11
- package/dist/core/{learning-tuning-config.js → curate-tuning-config.js} +14 -14
- package/dist/core/echo-value.js +42 -0
- package/dist/core/evidence-policy.js +17 -5
- package/dist/core/gate-level.js +213 -0
- package/dist/core/learning-queue-cleanup.js +1 -1
- package/dist/core/manifest.js +26 -10
- package/dist/core/migrations.js +63 -44
- package/dist/core/model-discovery.js +7 -1
- package/dist/core/plugins.js +14 -12
- package/dist/core/project-paths.js +3 -3
- package/dist/core/tracker.js +5 -33
- 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 +7 -11
- package/dist/learning-off/agents/{diagnose.md → debug.md} +4 -4
- package/dist/learning-off/agents/{code-fix.md → fix.md} +7 -8
- package/dist/learning-off/agents/{scrutinize.md → harden.md} +6 -6
- package/dist/learning-off/agents/{code-edit.md → refactor.md} +8 -9
- package/dist/learning-off/agents/review.md +2 -0
- package/dist/learning-off/commands/bug-analysis.md +9 -9
- package/dist/learning-off/commands/code-review.md +54 -59
- package/dist/learning-off/commands/debug.md +6 -10
- package/dist/learning-off/commands/dynamic-build.md +98 -112
- package/dist/learning-off/commands/dynamic-plan.md +5 -5
- package/dist/learning-off/commands/dynamic-profile.md +1 -1
- package/dist/learning-off/commands/dynamic-tickets.md +5 -5
- package/dist/learning-off/commands/explore.md +4 -8
- package/dist/learning-off/commands/implement.md +68 -146
- package/dist/learning-off/commands/plan.md +23 -58
- package/dist/learning-off/commands/release.md +4 -2
- package/dist/learning-off/commands/research.md +2 -2
- package/dist/learning-off/commands/resolve.md +33 -81
- package/dist/learning-off/commands/self-review.md +32 -36
- package/dist/skills/git/references/pr/check-merge-readiness.md +2 -0
- package/dist/skills/git/references/pr/update-pr-evidence.md +4 -6
- package/dist/skills/git/references/tracker/github/ensure-pr-ready.md +7 -9
- package/dist/skills/git/references/tracker/jira/ensure-pr-ready.md +7 -15
- package/dist/skills/git/references/tracker/linear/ensure-pr-ready.md +7 -15
- package/dist/targets/claude-code/installer.js +117 -84
- package/dist/targets/claude-code/learning-install.js +15 -3
- package/dist/targets/claude-code/tracker-servers.js +1 -1
- package/package.json +1 -1
- package/src/assets/agents/_partials/_code.mds +7 -8
- package/src/assets/agents/code.mds +4 -7
- package/src/assets/agents/{learning.md → curate.md} +8 -10
- package/src/assets/agents/{diagnose.mds → debug.mds} +4 -4
- package/src/assets/agents/evaluate.md +4 -4
- package/src/assets/agents/{code-fix.mds → fix.mds} +5 -5
- package/src/assets/agents/{scrutinize.mds → harden.mds} +6 -6
- package/src/assets/agents/{simplify.md → polish.md} +4 -4
- package/src/assets/agents/{code-edit.mds → refactor.mds} +6 -6
- package/src/assets/agents/review.mds +2 -0
- package/src/assets/agents/synthesize.md +2 -2
- package/src/assets/agents/test.md +2 -2
- package/src/assets/commands/_partials/_compliance.mds +1 -1
- package/src/assets/commands/_partials/_decisions.mds +26 -6
- package/src/assets/commands/_partials/_engine.mds +15 -15
- 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 +4 -2
- package/src/assets/commands/_partials/_roster.mds +4 -4
- package/src/assets/commands/_partials/_settings.mds +2 -2
- package/src/assets/commands/_partials/_wave.mds +10 -17
- package/src/assets/commands/bug-analysis.mds +7 -7
- package/src/assets/commands/code-review.mds +51 -56
- package/src/assets/commands/debug.mds +2 -2
- package/src/assets/commands/dynamic-build.mds +67 -74
- package/src/assets/commands/implement.mds +65 -127
- package/src/assets/commands/plan.mds +21 -61
- package/src/assets/commands/release.mds +5 -1
- package/src/assets/commands/resolve.mds +28 -76
- package/src/assets/commands/self-review.mds +27 -27
- package/src/assets/mds/git/_ops_steps.mds +3 -3
- package/src/assets/mds/git/_pr.mds +6 -6
- package/src/assets/mds/tracker/_common.mds +23 -12
- package/src/assets/mds/tracker/_github.mds +2 -9
- package/src/assets/mds/tracker/_jira.mds +2 -15
- package/src/assets/mds/tracker/_linear.mds +2 -15
- package/src/assets/scripts/ci-wait.cjs +22 -4
- package/src/assets/scripts/claude-md-audit.cjs +66 -51
- package/src/assets/scripts/hooks/assets/orchestrator-charter.md +4 -3
- package/src/assets/scripts/hooks/background-memory-update +404 -95
- 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 +13 -2
- package/src/assets/scripts/hooks/json-parse +18 -3
- package/src/assets/scripts/hooks/lib/learning-store.cjs +1 -1
- package/src/assets/scripts/hooks/lib/project-paths.cjs +4 -4
- package/src/assets/scripts/hooks/memory-permission +358 -0
- package/src/assets/scripts/hooks/preamble +1 -1
- package/src/assets/scripts/hooks/session-start-context +60 -47
- package/src/assets/scripts/hooks/session-start-memory +26 -5
- package/src/assets/scripts/lib/project-config.cjs +19 -4
- package/src/assets/scripts/resolve-settings.cjs +200 -32
- package/src/assets/scripts/verify-evidence.cjs +726 -9
- package/src/assets/skills/agent-references/SKILL.md +14 -6
- package/src/assets/skills/agent-references/references/commands/code-review-levels.md +19 -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/commands/plan-levels.md +40 -0
- package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +1 -1
- package/src/assets/skills/agent-references/references/synthesize/planning.md +9 -22
- package/src/assets/skills/agent-references/references/synthesize/review.md +11 -11
- package/src/assets/skills/apply-decisions/SKILL.md +6 -4
- package/src/assets/skills/docs-framework/SKILL.md +3 -3
- 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/src/assets/skills/agent-references/references/{learning → curate}/maintain.md +0 -0
|
@@ -5,7 +5,7 @@ output-dir: dist/commands
|
|
|
5
5
|
@import { knowledge_load, knowledge_writeback } from "./_partials/_knowledge.mds"
|
|
6
6
|
@import { decisions_load } from "./_partials/_decisions.mds"
|
|
7
7
|
@import { docs_root } from "./_partials/_docs_root.mds"
|
|
8
|
-
@import { evidence_policy
|
|
8
|
+
@import { evidence_policy } from "./_partials/_evidence_policy.mds"
|
|
9
9
|
@import { issue_ref_grammar, issue_capture_contract } from "./_partials/_tracker.mds"
|
|
10
10
|
@import { test_plan_line } from "./_partials/_plan_contract.mds"
|
|
11
11
|
@import { publication_gate } from "./_partials/_publication.mds"
|
|
@@ -46,15 +46,7 @@ $ARGUMENTS
|
|
|
46
46
|
|
|
47
47
|
### Re-validation Continuation Path
|
|
48
48
|
|
|
49
|
-
When the user explicitly asks to re-validate, re-check, or re-run quality gates after making their own changes:
|
|
50
|
-
|
|
51
|
-
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.
|
|
52
|
-
2. **Skip Phase 2** — no Code agent needed, user already made changes.
|
|
53
|
-
3. **Detect FILES_CHANGED**: `git diff --name-only {base_branch}...HEAD`
|
|
54
|
-
4. **Run Phases 3-8** — Simplify, Self-Review, Alignment, the one full Validate, QA Testing and the conditional Re-Validate, on the detected changes.
|
|
55
|
-
5. **Proceed to Phase 9** (Open PR), **Phase 11** (Evidence) and **Phase 12** (Report).
|
|
56
|
-
|
|
57
|
-
If the user prompt does NOT match re-validation, proceed with the full pipeline below.
|
|
49
|
+
When the user explicitly asks to re-validate, re-check, or re-run quality gates after making their own changes, run `d="${CLAUDE_CONFIG_DIR:-}"; case "$d" in /*) ;; *) d="$HOME/.claude" ;; esac; printf '%s\n' "$d"` in Bash, Read `<that directory>/skills/devflow:agent-references/references/commands/implement-revalidate.md` with the Read tool and follow it. Otherwise proceed with the full pipeline below.
|
|
58
50
|
|
|
59
51
|
### Phase 1: Setup
|
|
60
52
|
|
|
@@ -64,7 +56,7 @@ If the user prompt does NOT match re-validation, proceed with the full pipeline
|
|
|
64
56
|
**Produces:** TASK_ID, BASE_BRANCH, EXECUTION_PLAN, FEATURE_KNOWLEDGE, FEATURE_KNOWLEDGE_RULES, PR_DESCRIPTION_GUIDANCE, ISSUE_NUMBER, ISSUE_PR_LINK, EVIDENCE_POLICY, ISSUE_REQUIRED, APPLY_CONVENTIONS, REQUIRE_NON_AUTHOR_APPROVAL, PR_EXCEPTIONS, TEST_PLAN, EVIDENCE_FILE, PR_TEST_PLAN_BLOCK, REVIEW_PUBLICATION
|
|
65
57
|
<!-- learning:end -->
|
|
66
58
|
|
|
67
|
-
Record the current branch name as `BASE_BRANCH
|
|
59
|
+
Record the current branch name as `BASE_BRANCH`. Stop the run unless it matches `^[A-Za-z0-9._/+@,#-]{1,200}$`, telling the user it allows only ASCII letters, digits and `._/+@,#-`, at most 200.
|
|
68
60
|
|
|
69
61
|
{{docs_root()}}
|
|
70
62
|
|
|
@@ -122,11 +114,6 @@ The two tests this command does make are its own under every provider:
|
|
|
122
114
|
`setup-task` fetches whatever it is handed — so the command would derive a
|
|
123
115
|
branch from a failed lookup and drop the request on the floor.
|
|
124
116
|
|
|
125
|
-
The cost of the count gate is a one-word task description (`/implement refactor`)
|
|
126
|
-
reaching `setup-task` as an issue reference, where it fails the lookup and is
|
|
127
|
-
reported. That is the direction the failure has to fall: an unfetched issue is
|
|
128
|
-
visible, a silently discarded request is not.
|
|
129
|
-
|
|
130
117
|
**Capture from Git agent output** (used throughout flow):
|
|
131
118
|
- `TASK_ID`: The branch name created by Git agent (use as TASK_ID for rest of flow)
|
|
132
119
|
- `BASE_BRANCH`: Branch this feature was created from (for PR target)
|
|
@@ -135,13 +122,7 @@ visible, a silently discarded request is not.
|
|
|
135
122
|
|
|
136
123
|
{{issue_capture_contract()}}
|
|
137
124
|
|
|
138
|
-
**Ticket link, only when `ISSUE_REQUIRED` is `true`:** when the capture above holds no `ISSUE_PR_LINK` (absent, or `(none)`),
|
|
139
|
-
- **Record an exception** — the user gives the reason as free text. Render it with the grammar below, as kind `ticket-link`; when the rendered reason is empty, ask for it once more, and stop as below if it is empty again.
|
|
140
|
-
- **Stop** — report `BLOCKED (no ticket link)`, name the branch setup-task created (`TASK_ID`) and `BASE_BRANCH` so it can be reused or removed, and give the remedy: create or link the tracker issue and re-run `/implement` with its reference, or — for a team that does not want ticket links — commit `.devflow/project.json` as `{"version":1,"evidence":"standard"}` on the default branch; a machine with compliance enabled still resolves `required` whatever that file says. Spawn nothing further.
|
|
141
|
-
|
|
142
|
-
{{evidence_exception()}}
|
|
143
|
-
|
|
144
|
-
**Record the exception at once**, before any Code spawn: write the rendered section as the `## Evidence Exceptions` section of `{worktree}/.devflow/docs/handoff-{branch_slug}.md`, creating the file if absent, and set `PR_EXCEPTIONS` to that section. The file is its one home until the PR exists: every later write to the file keeps the section byte-identical, the Phase 9 Git spawn passes it verbatim as `PR_EXCEPTIONS`, and the file is deleted only once the PR exists — after Phase 9, under every strategy. With no exception recorded, `PR_EXCEPTIONS` is `(none)`.
|
|
125
|
+
**Ticket link, only when `ISSUE_REQUIRED` is `true`:** when the capture above holds no `ISSUE_PR_LINK` (absent, or `(none)`), run `d="${CLAUDE_CONFIG_DIR:-}"; case "$d" in /*) ;; *) d="$HOME/.claude" ;; esac; printf '%s\n' "$d"` in Bash, Read `<that directory>/skills/devflow:agent-references/references/commands/implement-evidence-asks.md` with the Read tool (once per run), then run its ticket link ask and **Record the exception at once** as it directs, before any Code spawn. `PR_EXCEPTIONS` is `(none)` until an exception is recorded.
|
|
145
126
|
|
|
146
127
|
**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.
|
|
147
128
|
|
|
@@ -157,9 +138,7 @@ node "$HOME/.devflow/scripts/verify-evidence.cjs" check tp "{worktree}/.devflow/
|
|
|
157
138
|
|
|
158
139
|
`exit=0` passes. On any other result, rewrite the section once — the script names the failing line and its code on stderr — and check again. Still failing, or no line to write, means the test plan is **missing**: drop the `## Test Plan` section from the file.
|
|
159
140
|
|
|
160
|
-
**Missing test plan, only when `EVIDENCE_POLICY` is `required`:** when the check above leaves the test plan missing,
|
|
161
|
-
- **Record an exception** — the user gives the reason as free text. Render it with the exception grammar above, as kind `test-plan`; when the rendered reason is empty, ask for it once more, and stop as below if it is empty again. Add the rendered line to the `## Evidence Exceptions` section of `{worktree}/.devflow/docs/handoff-{branch_slug}.md` — after any `ticket-link` line, creating the section and the file when absent — and set `PR_EXCEPTIONS` to that section, under the same rules as the record above.
|
|
162
|
-
- **Stop** — report `BLOCKED (no test plan)`, name `TASK_ID` and `BASE_BRANCH` so the branch can be reused or removed, and give the remedy: state the acceptance criteria in the task, the issue or a `/plan` document (its `## Test Plan` section is copied) and re-run `/implement`, or — for a team that does not want test plans enforced — commit `.devflow/project.json` as `{"version":1,"evidence":"standard"}` on the default branch; a machine with compliance enabled still resolves `required` whatever that file says. Spawn nothing further.
|
|
141
|
+
**Missing test plan, only when `EVIDENCE_POLICY` is `required`:** when the check above leaves the test plan missing, Read the evidence-asks reference as in the ticket link step (when this run has not) and run its missing test plan ask before any Code spawn.
|
|
163
142
|
|
|
164
143
|
When `EVIDENCE_POLICY` is `standard`, a missing test plan is never asked about: carry `Test plan: missing` to the Phase 12 report.
|
|
165
144
|
|
|
@@ -176,15 +155,15 @@ node "$HOME/.devflow/scripts/verify-evidence.cjs" render --plan "{worktree}/.dev
|
|
|
176
155
|
{{settings.settings_resolve()}}
|
|
177
156
|
|
|
178
157
|
{{publication_gate()}}
|
|
179
|
-
Phase 11 passes the resolved value to
|
|
158
|
+
Phase 11 passes the resolved value to the evidence script (`publish`), which decides what each value means for the evidence comment. From the same line: {{compliance.compliance_frameworks()}}
|
|
180
159
|
|
|
181
160
|
{{compliance.compliance_inject()}}
|
|
182
161
|
|
|
183
|
-
Pass `COMPLIANCE_DIRECTIVE` to every Code and
|
|
162
|
+
Pass `COMPLIANCE_DIRECTIVE` to every Code and Fix spawn, on a line of its own.
|
|
184
163
|
|
|
185
164
|
{{decisions_load()}}
|
|
186
165
|
<!-- learning:on -->
|
|
187
|
-
Pass `DECISIONS_CONTEXT` to Code agent (Phase 2) and
|
|
166
|
+
Pass `DECISIONS_CONTEXT` to Code agent (Phase 2) and Harden agent (Phase 4).
|
|
188
167
|
|
|
189
168
|
<!-- learning:end -->
|
|
190
169
|
{{knowledge_load()}}
|
|
@@ -197,14 +176,14 @@ Pass `DECISIONS_CONTEXT` to Code agent (Phase 2) and Scrutinize agent (Phase 4).
|
|
|
197
176
|
Based on Setup context (plan document, issue body, or conversation context), use the three-strategy framework:
|
|
198
177
|
|
|
199
178
|
**Strategy Selection**:
|
|
200
|
-
- If plan document provided: use `execution-strategy` from frontmatter (
|
|
201
|
-
- Otherwise:
|
|
179
|
+
- If plan document provided: use `execution-strategy` from frontmatter (if absent, use the table below)
|
|
180
|
+
- Otherwise: SINGLE_CODE_AGENT, because there is no Subtask Breakdown to split
|
|
202
181
|
|
|
203
|
-
| Strategy | When |
|
|
204
|
-
|
|
205
|
-
| **SINGLE_CODE_AGENT** | Default. Coherent A→Z implementation |
|
|
206
|
-
| **SEQUENTIAL_CODE_AGENTS** |
|
|
207
|
-
| **PARALLEL_CODE_AGENTS** | True artifact independence (rare) |
|
|
182
|
+
| Strategy | When |
|
|
183
|
+
|----------|------|
|
|
184
|
+
| **SINGLE_CODE_AGENT** | Default. Coherent A→Z implementation |
|
|
185
|
+
| **SEQUENTIAL_CODE_AGENTS** | The plan writes >= 10 files or has >= 7 steps |
|
|
186
|
+
| **PARALLEL_CODE_AGENTS** | True artifact independence (rare) |
|
|
208
187
|
|
|
209
188
|
---
|
|
210
189
|
|
|
@@ -227,7 +206,7 @@ DECISIONS_CONTEXT: {decisions_context}
|
|
|
227
206
|
|
|
228
207
|
---
|
|
229
208
|
|
|
230
|
-
**SEQUENTIAL_CODE_AGENTS** (
|
|
209
|
+
**SEQUENTIAL_CODE_AGENTS** (>= 10 files or >= 7 steps):
|
|
231
210
|
|
|
232
211
|
Spawn Code agents one at a time. Each appends its own phase section to the handoff file, and the next reads only the section before it:
|
|
233
212
|
|
|
@@ -311,33 +290,33 @@ DECISIONS_CONTEXT: {decisions_context}
|
|
|
311
290
|
- Different files/modules with no imports between them
|
|
312
291
|
- Each subtask is self-contained
|
|
313
292
|
|
|
314
|
-
### Phase 3:
|
|
293
|
+
### Phase 3: Polish
|
|
315
294
|
|
|
316
|
-
**Produces:**
|
|
317
|
-
**Requires:**
|
|
295
|
+
**Produces:** POLISH_OUTPUT
|
|
296
|
+
**Requires:** BASE_BRANCH
|
|
318
297
|
|
|
319
|
-
After the Code agent completes, spawn
|
|
298
|
+
After the Code agent completes, spawn Polish agent to polish the code. The Phase 6 Validate covers its commits. `{branch_diff}` is the output of `git diff --name-only --diff-filter=d {BASE_BRANCH}...HEAD`, run again at each spawn.
|
|
320
299
|
|
|
321
300
|
```
|
|
322
|
-
Agent(subagent_type="
|
|
323
|
-
"
|
|
301
|
+
Agent(subagent_type="Polish"):
|
|
302
|
+
"Polish recently implemented code
|
|
324
303
|
Task: {task description}
|
|
325
|
-
FILES_CHANGED: {
|
|
304
|
+
FILES_CHANGED: {branch_diff}
|
|
326
305
|
Focus on code modified by Code agent, apply project standards, enhance clarity
|
|
327
306
|
Commit any improvements with a conventional-commit message."
|
|
328
307
|
```
|
|
329
308
|
|
|
330
309
|
### Phase 4: Self-Review
|
|
331
310
|
|
|
332
|
-
**Produces:**
|
|
333
|
-
**Requires:**
|
|
311
|
+
**Produces:** HARDEN_OUTPUT
|
|
312
|
+
**Requires:** BASE_BRANCH
|
|
334
313
|
|
|
335
|
-
After
|
|
314
|
+
After Polish agent completes, spawn Harden agent as the quality gate:
|
|
336
315
|
|
|
337
316
|
```
|
|
338
|
-
Agent(subagent_type="
|
|
317
|
+
Agent(subagent_type="Harden"):
|
|
339
318
|
"TASK_DESCRIPTION: {task description}
|
|
340
|
-
FILES_CHANGED: {
|
|
319
|
+
FILES_CHANGED: {branch_diff}
|
|
341
320
|
<!-- learning:on -->
|
|
342
321
|
DECISIONS_CONTEXT: {decisions_context}
|
|
343
322
|
<!-- learning:end -->
|
|
@@ -345,20 +324,20 @@ FEATURE_KNOWLEDGE: {feature_knowledge_rules}
|
|
|
345
324
|
Evaluate 9 pillars, fix P0/P1 issues, report status"
|
|
346
325
|
```
|
|
347
326
|
|
|
348
|
-
|
|
327
|
+
Harden 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.
|
|
349
328
|
|
|
350
329
|
### Phase 5: Alignment Check
|
|
351
330
|
|
|
352
331
|
**Produces:** ALIGNMENT_RESULT
|
|
353
|
-
**Requires:**
|
|
332
|
+
**Requires:** BASE_BRANCH, EXECUTION_PLAN
|
|
354
333
|
|
|
355
|
-
After
|
|
334
|
+
After Harden agent passes, spawn Evaluate agent to validate alignment. Evaluate agent receives `FEATURE_KNOWLEDGE_RULES` as acceptance context only; pattern and anti-pattern judgments belong to Harden agent:
|
|
356
335
|
|
|
357
336
|
```
|
|
358
337
|
Agent(subagent_type="Evaluate"):
|
|
359
338
|
"ORIGINAL_REQUEST: {task description or issue content}
|
|
360
339
|
EXECUTION_PLAN: {execution plan from Phase 1}
|
|
361
|
-
FILES_CHANGED: {
|
|
340
|
+
FILES_CHANGED: {branch_diff}
|
|
362
341
|
ACCEPTANCE_CRITERIA: {extracted criteria if available}
|
|
363
342
|
FEATURE_KNOWLEDGE: {feature_knowledge_rules}
|
|
364
343
|
Validate alignment with request and plan. Report ALIGNED or MISALIGNED with details."
|
|
@@ -370,9 +349,9 @@ Validate alignment with request and plan. Report ALIGNED or MISALIGNED with deta
|
|
|
370
349
|
1. Extract misalignment details from Evaluate agent output
|
|
371
350
|
2. Increment `alignment_fix_count`
|
|
372
351
|
3. If `alignment_fix_count <= 2`:
|
|
373
|
-
- Spawn
|
|
352
|
+
- Spawn Fix agent to fix misalignments:
|
|
374
353
|
```
|
|
375
|
-
Agent(subagent_type="
|
|
354
|
+
Agent(subagent_type="Fix"):
|
|
376
355
|
"OPERATION: alignment-fix
|
|
377
356
|
TASK_ID: {task-id}
|
|
378
357
|
TASK_DESCRIPTION: Fix alignment issues
|
|
@@ -391,11 +370,11 @@ Validate alignment with request and plan. Report ALIGNED or MISALIGNED with deta
|
|
|
391
370
|
**Produces:** VALIDATION_RESULT, VALIDATED_HEAD
|
|
392
371
|
**Requires:** BASE_BRANCH
|
|
393
372
|
|
|
394
|
-
Validate takes the one full-suite slot, after every commit it must cover: Code,
|
|
373
|
+
Validate takes the one full-suite slot, after every commit it must cover: Code, Polish, Harden and the alignment fixes. After Evaluate agent passes, spawn Validate agent. `FILES_CHANGED` is the branch diff:
|
|
395
374
|
|
|
396
375
|
```
|
|
397
376
|
Agent(subagent_type="Validate"):
|
|
398
|
-
"FILES_CHANGED: {
|
|
377
|
+
"FILES_CHANGED: {branch_diff}
|
|
399
378
|
VALIDATION_SCOPE: full
|
|
400
379
|
Run build, typecheck, lint, test. Report pass/fail with failure details."
|
|
401
380
|
```
|
|
@@ -404,9 +383,9 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
|
|
|
404
383
|
1. Extract failure details from Validate agent output
|
|
405
384
|
2. Increment `validation_retry_count`
|
|
406
385
|
3. If `validation_retry_count <= 2`:
|
|
407
|
-
- Spawn
|
|
386
|
+
- Spawn Fix agent with fix context:
|
|
408
387
|
```
|
|
409
|
-
Agent(subagent_type="
|
|
388
|
+
Agent(subagent_type="Fix"):
|
|
410
389
|
"OPERATION: validation-fix
|
|
411
390
|
TASK_ID: {task-id}
|
|
412
391
|
TASK_DESCRIPTION: Fix validation failures
|
|
@@ -436,7 +415,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
|
|
|
436
415
|
### Phase 7: QA Testing
|
|
437
416
|
|
|
438
417
|
**Produces:** QA_RESULT
|
|
439
|
-
**Requires:**
|
|
418
|
+
**Requires:** BASE_BRANCH, EXECUTION_PLAN, TEST_PLAN, VALIDATED_HEAD
|
|
440
419
|
|
|
441
420
|
After Phase 6 passes, spawn Test agent for scenario-based acceptance testing:
|
|
442
421
|
|
|
@@ -444,7 +423,7 @@ After Phase 6 passes, spawn Test agent for scenario-based acceptance testing:
|
|
|
444
423
|
Agent(subagent_type="Test"):
|
|
445
424
|
"ORIGINAL_REQUEST: {task description or issue content}
|
|
446
425
|
EXECUTION_PLAN: {execution plan from Phase 1}
|
|
447
|
-
FILES_CHANGED: {
|
|
426
|
+
FILES_CHANGED: {branch_diff}
|
|
448
427
|
ACCEPTANCE_CRITERIA: {extracted criteria if available}
|
|
449
428
|
TEST_PLAN: {the TP lines of the evidence file's ## Test Plan section, or (none)}
|
|
450
429
|
Design and execute scenario-based acceptance tests. Report PASS or FAIL with evidence."
|
|
@@ -458,9 +437,9 @@ After every Test agent run — PASS or FAIL, first run or retry — append its T
|
|
|
458
437
|
1. Extract failure details from Test agent output
|
|
459
438
|
2. Increment `qa_retry_count`
|
|
460
439
|
3. If `qa_retry_count <= 2`:
|
|
461
|
-
- Spawn
|
|
440
|
+
- Spawn Fix agent to fix QA failures:
|
|
462
441
|
```
|
|
463
|
-
Agent(subagent_type="
|
|
442
|
+
Agent(subagent_type="Fix"):
|
|
464
443
|
"OPERATION: qa-fix
|
|
465
444
|
TASK_ID: {task-id}
|
|
466
445
|
TASK_DESCRIPTION: Fix QA test failures
|
|
@@ -483,7 +462,7 @@ Run this phase only if a qa-fix committed (`git rev-parse HEAD` differs from `VA
|
|
|
483
462
|
|
|
484
463
|
```
|
|
485
464
|
Agent(subagent_type="Validate"):
|
|
486
|
-
"FILES_CHANGED: {output of `git diff --name-only VALIDATED_HEAD..HEAD`}
|
|
465
|
+
"FILES_CHANGED: {output of `git diff --name-only --diff-filter=d VALIDATED_HEAD..HEAD`}
|
|
487
466
|
VALIDATION_SCOPE: changed-only
|
|
488
467
|
Verify the qa-fix commits did not break anything."
|
|
489
468
|
```
|
|
@@ -515,7 +494,7 @@ COMMIT_UNCOMMITTED: false
|
|
|
515
494
|
Open the pull request for this branch and return the pre-flight summary."
|
|
516
495
|
```
|
|
517
496
|
|
|
518
|
-
`COMMIT_UNCOMMITTED: false` keeps the Git agent from committing a stray file: the Code,
|
|
497
|
+
`COMMIT_UNCOMMITTED: false` keeps the Git agent from committing a stray file: the Code, Polish, Harden and Fix agents commit their own work. Capture the `- **PR**: #{number}` line of its `### Branch` as `PR_NUMBER`, its `### Uncommitted files` list and its `TRACEABILITY: DEGRADED ({reason})` lines for the Phase 12 report. If it returns `### Status: BLOCKED` or no PR number, report its reason to the user and stop at the report (Phase 12); Phases 10 and 11 do not run.
|
|
519
498
|
|
|
520
499
|
### Phase 10: CI Status Gate
|
|
521
500
|
|
|
@@ -524,7 +503,7 @@ Open the pull request for this branch and return the pre-flight summary."
|
|
|
524
503
|
|
|
525
504
|
Run under every strategy: Phase 9 opened the PR.
|
|
526
505
|
|
|
527
|
-
**Push first, outside the gate block.** The gate reads CI for the pushed head, and the
|
|
506
|
+
**Push first, outside the gate block.** The gate reads CI for the pushed head, and the Polish, Harden and Fix commits reach the PR only by a push. Push once — never force, and no retry:
|
|
528
507
|
|
|
529
508
|
```bash
|
|
530
509
|
git push origin HEAD; echo "exit=$?"
|
|
@@ -539,9 +518,9 @@ git push origin HEAD; echo "exit=$?"
|
|
|
539
518
|
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.
|
|
540
519
|
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.
|
|
541
520
|
<!-- learning:on -->
|
|
542
|
-
6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="
|
|
521
|
+
6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES`, `DECISIONS_CONTEXT` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Fix 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.
|
|
543
522
|
<!-- learning:off -->
|
|
544
|
-
6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="
|
|
523
|
+
6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Fix 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.
|
|
545
524
|
<!-- learning:end -->
|
|
546
525
|
7. **Budget**: at most 3 waits and 2 fixes in all. When one is spent, report the current status and proceed.
|
|
547
526
|
<!-- /PATTERN: ci-status-gate -->
|
|
@@ -553,25 +532,21 @@ git push origin HEAD; echo "exit=$?"
|
|
|
553
532
|
|
|
554
533
|
Run once, after Phase 10, under every strategy: the PR exists by now, opened in Phase 9. The re-validation path has no CI gate and runs this phase straight after Phase 9. Skip it only when Phase 9 stopped the run. A `ci` TP reads `INDETERMINATE` only when the CI gate could not tell or did not run.
|
|
555
534
|
|
|
556
|
-
**Push first.** Every claim is keyed to the HEAD an agent reported, and a
|
|
535
|
+
**Push first.** Every claim is keyed to the HEAD an agent reported, and a Harden or Fix agent may have committed without pushing; a claim whose SHA is not in the PR reads `UNVERIFIED`. So push the branch once before the script — never force, and no retry:
|
|
557
536
|
|
|
558
537
|
```bash
|
|
559
538
|
git push origin HEAD; echo "exit=$?"
|
|
560
539
|
```
|
|
561
540
|
|
|
562
|
-
`exit=0` continues to the
|
|
541
|
+
`exit=0` continues to the script. Any other result, a rejected non-fast-forward push included, does not block: record `TRACEABILITY: DEGRADED (evidence push failed)` for the Phase 12 report and run the script anyway.
|
|
563
542
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
EVIDENCE_FILE: .devflow/docs/evidence-{branch_slug}.md
|
|
569
|
-
REVIEW_PUBLICATION: {REVIEW_PUBLICATION resolved in Phase 1, or auto}
|
|
570
|
-
WORKTREE_PATH: {worktree}
|
|
571
|
-
Update the PR's test-plan block and post its evidence comment."
|
|
543
|
+
**Then refresh, inline.** The refresh is plumbing, so no Git agent runs it: `verify-evidence.cjs publish` is the whole `update-pr-evidence` operation — verify, the scrubbed block edit with its read-back, the scrubbed evidence comment — in one call. Use the Bash tool with `timeout: 180000`:
|
|
544
|
+
|
|
545
|
+
```bash
|
|
546
|
+
cd "{worktree}" && node "$HOME/.devflow/scripts/verify-evidence.cjs" publish --pr {PR_NUMBER} --evidence ".devflow/docs/evidence-{branch_slug}.md" --publication {REVIEW_PUBLICATION resolved in Phase 1, or auto}; echo "exit=$?"
|
|
572
547
|
```
|
|
573
548
|
|
|
574
|
-
|
|
549
|
+
Drop the `--evidence` pair when that file does not exist or its path does not match `^[A-Za-z0-9._/-]{1,255}$`. `{PR_NUMBER}` is digits only, and the publication value is `auto`, `full`, `off` or `stub`. Capture its stdout as `EVIDENCE_RESULT`: the `## PR Evidence` block — its `EVIDENCE` line and its `**Body**:` / `**Comment**:` line — and any `TRACEABILITY: DEGRADED ({reason})` lines after it (exit 0), or the one line `TRACEABILITY: DEGRADED (evidence unavailable)` (exit 2). Empty stdout or any other exit is `TRACEABILITY: DEGRADED (evidence unavailable)`. It never blocks: whatever it returns, continue to Phase 12.
|
|
575
550
|
|
|
576
551
|
### Phase 12: Report
|
|
577
552
|
|
|
@@ -581,7 +556,7 @@ Display completion summary with phase status, PR info, and next steps.
|
|
|
581
556
|
|
|
582
557
|
Show the test plan's evidence from Phase 11: `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`.
|
|
583
558
|
|
|
584
|
-
If any Git agent output emitted `TRACEABILITY: DEGRADED ({reason})` lines during the run, or Phase 10's push or Phase 11's
|
|
559
|
+
If any Git agent output emitted `TRACEABILITY: DEGRADED ({reason})` lines during the run, or Phase 10's push, Phase 11's push or Phase 11's script output carried one, surface them verbatim in the report under a `### Traceability` subsection so the user can act on them.
|
|
585
560
|
|
|
586
561
|
If Phase 9 listed uncommitted files, show them as a `### Uncommitted files` subsection: the user commits them or discards them.
|
|
587
562
|
|
|
@@ -595,71 +570,34 @@ If Phase 1 recorded an evidence exception, show its `## Evidence Exceptions` lin
|
|
|
595
570
|
/implement (orchestrator - spawns agents only)
|
|
596
571
|
│
|
|
597
572
|
├─ Re-validation Path (when user says "re-validate"/"re-check"/"re-run gates")
|
|
598
|
-
│ └─ Branch safety → skip Phase 2 →
|
|
573
|
+
│ └─ Branch safety → skip Phase 2 → record BASE_BRANCH → Phases 3-8 → Phase 9, 11, 12
|
|
599
574
|
│
|
|
600
575
|
├─ Phase 1: Setup
|
|
601
|
-
│ └─ Plan document parsing (if .md path provided) - extracts execution plan, strategy, frontmatter issue
|
|
602
|
-
│ └─ Git agent (operation: setup-task) - creates feature branch, fetches issue
|
|
603
|
-
│ └─ Ticket-link ask (no linked ticket, issue required) - record a self-attested exception or stop
|
|
604
|
-
│ └─ Test plan (evidence file) - copy or author TP lines, check them, render the PR block; missing under a required policy: record a test-plan exception or stop
|
|
605
|
-
│
|
|
606
576
|
├─ Phase 2: Implement (3-strategy framework)
|
|
607
|
-
|
|
608
|
-
│ ├─ SEQUENTIAL_CODE_AGENTS (15%): N Code agents with handoff summaries
|
|
609
|
-
│ └─ PARALLEL_CODE_AGENTS (5%): N Code agents in single message (rare)
|
|
610
|
-
│
|
|
611
|
-
├─ Phase 3: Simplify
|
|
612
|
-
│ └─ Simplify agent (refines code clarity and consistency)
|
|
613
|
-
│
|
|
577
|
+
├─ Phase 3: Polish
|
|
614
578
|
├─ Phase 4: Self-Review
|
|
615
|
-
│ └─ Scrutinize agent (quality gate, fixes P0/P1; status PASS | FIXED | BLOCKED)
|
|
616
|
-
│
|
|
617
579
|
├─ Phase 5: Alignment Check
|
|
618
|
-
│ └─ Evaluate agent (validates alignment - reports only, no fixes)
|
|
619
|
-
│ └─ If MISALIGNED: Code-fix agent loop (max 2 iterations) → re-check alignment
|
|
620
|
-
│
|
|
621
580
|
├─ Phase 6: Validate (the one full-suite slot)
|
|
622
|
-
│ └─ Validate agent (build, typecheck, lint, test over the branch diff)
|
|
623
|
-
│ └─ If FAIL: Code-fix agent loop (max 2 retries) → re-validate at the new HEAD
|
|
624
|
-
│ └─ If PASS: record VALIDATED_HEAD, gate:validate claim → evidence file
|
|
625
|
-
│
|
|
626
581
|
├─ Phase 7: QA Testing
|
|
627
|
-
│ └─ Test agent (scenario-based acceptance tests, TEST_PLAN) → one claim per TP row → evidence file
|
|
628
|
-
│ └─ If FAIL: Code-fix agent loop (max 2 retries) → re-test
|
|
629
|
-
│
|
|
630
582
|
├─ Phase 8: Re-Validate (only if a qa-fix committed)
|
|
631
|
-
│ └─ Validate agent (changed-only over VALIDATED_HEAD..HEAD) → gate:validate claim
|
|
632
|
-
│
|
|
633
583
|
├─ Phase 9: Open PR (every strategy, outside the strategy branches)
|
|
634
|
-
│ └─ Git agent (operation: ensure-pr-ready) - commits nothing (COMMIT_UNCOMMITTED: false), pushes, opens the PR with the pasted link line, exceptions and test-plan block, D11-scrubbed body
|
|
635
|
-
│
|
|
636
584
|
├─ Phase 10: CI Status Gate (every strategy)
|
|
637
|
-
│ └─ Push the branch, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code-fix agent on FAILING (3 waits + 2 fixes)
|
|
638
|
-
│
|
|
639
585
|
├─ Phase 11: Evidence (every strategy, once the PR exists)
|
|
640
|
-
│ └─ Push the branch (never force; a failure is DEGRADED, not a stop)
|
|
641
|
-
│ └─ Git agent (update-pr-evidence) - test-plan block + evidence comment; never blocks
|
|
642
|
-
│
|
|
643
586
|
├─ Phase 12: Report
|
|
644
587
|
│
|
|
645
588
|
└─ Feature Knowledge Write-Back (Conditional)
|
|
646
|
-
└─ Knowledge agent (if documented area changed AND knowledge enabled)
|
|
647
589
|
```
|
|
648
590
|
|
|
649
591
|
## Principles
|
|
650
592
|
|
|
651
|
-
1. **Orchestration only** - Command spawns agents, never does work itself; the inline calls are the bounded plumbing the charter allows: the Phase 10 and Phase 11 pushes, the Phase 10 ci-wait call and the evidence script checks
|
|
652
|
-
2. **
|
|
653
|
-
3. **
|
|
654
|
-
4. **
|
|
655
|
-
5. **
|
|
656
|
-
6. **
|
|
657
|
-
7. **
|
|
658
|
-
8. **
|
|
659
|
-
9. **Validate agent owns validation** - Never run `npm test`, `npm run build`, or similar in main session; always delegate to Validate agent
|
|
660
|
-
10. **Code-fix agent owns fixes** - Never implement fixes in main session; spawn Code-fix agent for validation failures and alignment fixes
|
|
661
|
-
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
|
|
662
|
-
12. **CI awareness** - CI status is checked before merge under every strategy, once Phase 9 has opened the PR; test-plan evidence (Phase 11) is recorded under every strategy once the PR exists
|
|
593
|
+
1. **Orchestration only** - Command spawns agents, never does work itself; the inline calls are the bounded plumbing the charter allows: the Phase 10 and Phase 11 pushes, the Phase 10 ci-wait call, the Phase 11 evidence publish call and the evidence script checks
|
|
594
|
+
2. **Agent ownership** - Each agent owns its output completely
|
|
595
|
+
3. **Honest reporting** - Display agent outputs directly
|
|
596
|
+
4. **Strict delegation** - Never perform agent work in main session. "Spawn X" means call Agent tool with X, not do X's work yourself
|
|
597
|
+
5. **Validate agent owns validation** - Never run `npm test`, `npm run build`, or similar in main session; always delegate to Validate agent
|
|
598
|
+
6. **Fix agent owns fixes** - Never implement fixes in main session; spawn Fix agent for validation failures and alignment fixes
|
|
599
|
+
7. **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
|
|
600
|
+
8. **CI awareness** - CI status is checked before merge under every strategy, once Phase 9 has opened the PR; test-plan evidence (Phase 11) is recorded under every strategy once the PR exists
|
|
663
601
|
|
|
664
602
|
## Error Handling
|
|
665
603
|
|