devflow-kit 3.3.0 → 3.5.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 +47 -0
- package/README.md +8 -4
- package/dist/agents/code-edit.md +133 -0
- package/dist/agents/code-fix.md +165 -0
- package/dist/agents/code.md +187 -0
- package/{src/assets → dist}/agents/design.md +1 -2
- package/{src/assets → dist}/agents/diagnose.md +1 -2
- package/dist/agents/git.md +33 -722
- package/{src/assets → dist}/agents/knowledge.md +12 -5
- package/{src/assets → dist}/agents/research.md +8 -2
- package/{src/assets → dist}/agents/review.md +8 -11
- package/{src/assets → dist}/agents/scrutinize.md +4 -1
- package/dist/agents/skim.md +152 -0
- package/{src/assets → dist}/agents/triage.md +9 -2
- 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 +134 -5
- package/dist/cli/commands/learning.js +38 -3
- package/dist/cli/commands/rules.js +16 -0
- package/dist/cli/commands/tracker.js +112 -15
- package/dist/cli/commands/uninstall.js +42 -1
- package/dist/cli.js +2 -0
- package/dist/commands/bug-analysis.md +35 -13
- package/dist/commands/code-review.md +155 -69
- package/dist/commands/debug.md +39 -16
- package/dist/commands/dynamic-build.md +61 -72
- package/dist/commands/dynamic-plan.md +39 -25
- package/dist/commands/dynamic-profile.md +28 -14
- package/dist/commands/dynamic-tickets.md +38 -22
- package/dist/commands/explore.md +18 -16
- package/dist/commands/implement.md +121 -150
- package/dist/commands/plan.md +51 -31
- package/dist/commands/release.md +72 -6
- package/dist/commands/research.md +49 -20
- package/dist/commands/resolve.md +54 -46
- package/dist/commands/self-review.md +38 -25
- package/dist/core/agent-frontmatter.js +101 -0
- package/dist/core/agent-models.js +43 -0
- package/dist/core/assets.js +55 -10
- package/dist/core/claude-md-audit.js +190 -0
- package/dist/core/compliance-compose.js +6 -4
- package/dist/core/feature-switch.js +41 -1
- package/dist/core/flags.js +139 -0
- package/dist/core/fs-atomic.js +8 -3
- package/dist/core/learning-variants.js +213 -0
- package/dist/core/manifest.js +73 -3
- package/dist/core/mds-variants.js +98 -19
- package/dist/core/plugins.js +111 -72
- package/dist/core/project-paths.js +0 -4
- 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/learning-off/agents/code-edit.md +129 -0
- package/dist/learning-off/agents/code-fix.md +161 -0
- package/dist/learning-off/agents/code.md +183 -0
- package/dist/learning-off/agents/design.md +118 -0
- package/dist/learning-off/agents/diagnose.md +210 -0
- package/dist/learning-off/agents/knowledge.md +96 -0
- package/dist/learning-off/agents/research.md +155 -0
- package/dist/learning-off/agents/review.md +224 -0
- package/dist/learning-off/agents/scrutinize.md +120 -0
- package/{src/assets → dist/learning-off}/agents/skim.md +5 -8
- package/dist/learning-off/agents/triage.md +170 -0
- package/dist/learning-off/commands/bug-analysis.md +420 -0
- package/dist/learning-off/commands/code-review.md +530 -0
- package/dist/learning-off/commands/debug.md +314 -0
- package/dist/learning-off/commands/dynamic-build.md +1245 -0
- package/dist/learning-off/commands/dynamic-plan.md +426 -0
- package/dist/learning-off/commands/dynamic-profile.md +214 -0
- package/dist/learning-off/commands/dynamic-tickets.md +634 -0
- package/dist/learning-off/commands/explore.md +210 -0
- package/dist/learning-off/commands/implement.md +774 -0
- package/dist/learning-off/commands/plan.md +671 -0
- package/dist/learning-off/commands/release.md +311 -0
- package/dist/learning-off/commands/research.md +229 -0
- package/dist/learning-off/commands/resolve.md +842 -0
- package/dist/learning-off/commands/self-review.md +266 -0
- 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 +19 -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 +13 -0
- package/dist/skills/git/references/pr/validate-branch.md +26 -0
- package/dist/skills/git/references/tracker/_contract.md +33 -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 +38 -1
- package/dist/skills/git/references/tracker/github/fetch-issues-batch.md +49 -1
- package/dist/skills/git/references/tracker/github/gather-release-evidence.md +29 -0
- package/dist/skills/git/references/tracker/github/manage-debt.md +21 -1
- package/dist/skills/git/references/tracker/github/post-wave-report.md +17 -1
- package/dist/skills/git/references/tracker/github/setup-task.md +53 -1
- package/dist/skills/git/references/tracker/jira/associate-release.md +25 -1
- 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 +38 -1
- package/dist/skills/git/references/tracker/jira/fetch-issues-batch.md +49 -1
- package/dist/skills/git/references/tracker/jira/gather-release-evidence.md +29 -0
- package/dist/skills/git/references/tracker/jira/manage-debt.md +21 -1
- package/dist/skills/git/references/tracker/jira/post-wave-report.md +17 -1
- package/dist/skills/git/references/tracker/jira/setup-task.md +55 -3
- package/dist/skills/git/references/tracker/linear/associate-release.md +25 -1
- 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 +38 -1
- package/dist/skills/git/references/tracker/linear/fetch-issues-batch.md +49 -1
- package/dist/skills/git/references/tracker/linear/gather-release-evidence.md +29 -0
- package/dist/skills/git/references/tracker/linear/manage-debt.md +21 -1
- package/dist/skills/git/references/tracker/linear/post-wave-report.md +17 -1
- package/dist/skills/git/references/tracker/linear/setup-task.md +55 -3
- 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 +140 -37
- package/dist/targets/claude-code/language-stamp.js +185 -0
- package/dist/targets/claude-code/learning-install.js +497 -0
- 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-edit.mds +81 -0
- package/src/assets/agents/code-fix.mds +113 -0
- package/src/assets/agents/code.mds +135 -0
- package/src/assets/agents/design.mds +148 -0
- package/src/assets/agents/diagnose.mds +225 -0
- package/src/assets/agents/evaluate.md +8 -4
- package/src/assets/agents/explore.md +58 -0
- package/src/assets/agents/git.mds +33 -722
- package/src/assets/agents/knowledge.mds +131 -0
- package/src/assets/agents/learning.md +19 -69
- package/src/assets/agents/research.mds +182 -0
- package/src/assets/agents/review.mds +282 -0
- package/src/assets/agents/scrutinize.mds +135 -0
- package/src/assets/agents/simplify.md +3 -0
- package/src/assets/agents/skim.mds +165 -0
- package/src/assets/agents/synthesize.md +26 -352
- package/src/assets/agents/test.md +8 -0
- package/src/assets/agents/tracker.md +20 -7
- package/src/assets/agents/triage.mds +201 -0
- package/src/assets/agents/validate.md +13 -6
- package/src/assets/commands/_partials/_compliance.mds +41 -4
- package/src/assets/commands/_partials/_decisions.mds +33 -2
- package/src/assets/commands/_partials/_engine.mds +14 -6
- package/src/assets/commands/_partials/_knowledge.mds +25 -12
- package/src/assets/commands/_partials/_preamble.mds +34 -10
- package/src/assets/commands/_partials/_publication.mds +5 -4
- package/src/assets/commands/_partials/_roster.mds +4 -3
- package/src/assets/commands/_partials/_settings.mds +13 -5
- package/src/assets/commands/_partials/_wave.mds +9 -1
- package/src/assets/commands/bug-analysis.mds +27 -5
- package/src/assets/commands/code-review.mds +158 -52
- package/src/assets/commands/debug.mds +41 -3
- package/src/assets/commands/dynamic-build.mds +47 -27
- package/src/assets/commands/dynamic-plan.mds +40 -9
- package/src/assets/commands/dynamic-profile.mds +9 -1
- package/src/assets/commands/dynamic-tickets.mds +21 -6
- package/src/assets/commands/explore.mds +28 -2
- package/src/assets/commands/implement.mds +126 -129
- package/src/assets/commands/plan.mds +58 -14
- package/src/assets/commands/{release.md → release.mds} +30 -26
- package/src/assets/commands/research.mds +42 -11
- package/src/assets/commands/resolve.mds +59 -15
- package/src/assets/commands/self-review.mds +30 -5
- 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 +39 -44
- 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 +73 -0
- package/src/assets/mds/tracker/_github.mds +73 -16
- package/src/assets/mds/tracker/_jira.mds +77 -19
- package/src/assets/mds/tracker/_linear.mds +77 -19
- package/src/assets/mds/tracker/_mcp.mds +2 -2
- package/src/assets/mds/tracker/_steps.mds +98 -0
- package/src/assets/rules/behavior.md +6 -0
- package/src/assets/rules/context-economy.md +10 -0
- package/src/assets/rules/go.md +1 -0
- package/src/assets/rules/java.md +1 -0
- package/src/assets/rules/python.md +1 -0
- package/src/assets/rules/rust.md +1 -0
- package/src/assets/rules/typescript.md +1 -0
- package/src/assets/scripts/claude-md-audit.cjs +611 -0
- package/src/assets/scripts/hooks/assets/orchestrator-charter.md +3 -3
- package/src/assets/scripts/hooks/json-helper.cjs +13 -5
- package/src/assets/scripts/hooks/json-parse +34 -10
- package/src/assets/scripts/hooks/lib/project-paths.cjs +0 -6
- package/src/assets/scripts/hooks/session-start-context +315 -7
- package/src/assets/skills/agent-references/SKILL.md +33 -0
- package/src/assets/skills/agent-references/references/learning/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 +1 -1
- package/src/assets/skills/apply-feature-knowledge/SKILL.md +5 -5
- package/src/assets/skills/compliance/SKILL.md +1 -1
- package/src/assets/skills/docs-framework/SKILL.md +80 -83
- 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/feature-knowledge/SKILL.md +43 -12
- 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/quality-gates/SKILL.md +1 -1
- package/dist/skills/git/references/pr/ensure-pr-ready.md +0 -24
- package/src/assets/agents/code.md +0 -330
|
@@ -46,13 +46,13 @@ When the user explicitly asks to re-validate, re-check, or re-run quality gates
|
|
|
46
46
|
2. **Skip Phase 2** — no Code agent needed, user already made changes.
|
|
47
47
|
3. **Detect FILES_CHANGED**: `git diff --name-only {base_branch}...HEAD`
|
|
48
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.
|
|
49
|
-
5. **Proceed to Phase
|
|
49
|
+
5. **Proceed to Phase 9** (Open PR), **Phase 11** (Evidence) and **Phase 12** (Report).
|
|
50
50
|
|
|
51
51
|
If the user prompt does NOT match re-validation, proceed with the full pipeline below.
|
|
52
52
|
|
|
53
53
|
### Phase 1: Setup
|
|
54
54
|
|
|
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
|
|
55
|
+
**Produces:** TASK_ID, BASE_BRANCH, EXECUTION_PLAN, DECISIONS_CONTEXT, 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
|
|
56
56
|
|
|
57
57
|
Record the current branch name as `BASE_BRANCH` - this will be the PR target.
|
|
58
58
|
|
|
@@ -135,6 +135,7 @@ visible, a silently discarded request is not.
|
|
|
135
135
|
- `TASK_ID`: The branch name created by Git agent (use as TASK_ID for rest of flow)
|
|
136
136
|
- `BASE_BRANCH`: Branch this feature was created from (for PR target)
|
|
137
137
|
- `ISSUE_NUMBER`: the provider-canonical issue identifier for this task — the same value the Git agent emits as `ISSUE_ID` (if provided, or created by the Git agent's issue-first step in setup-task)
|
|
138
|
+
- `branch_slug`: `TASK_ID` with every `/` replaced by `-`. It names `handoff-{branch_slug}.md` and `evidence-{branch_slug}.md` only when it matches `^[A-Za-z0-9._-]{1,200}$`; any other branch name stops the run here, telling the user it cannot name those files.
|
|
138
139
|
|
|
139
140
|
**Capture from the Git agent's Output block, as written:** `ISSUE_REF` (the rendered reference in the `## Issue {ISSUE_REF}:` heading), `ISSUE_ID` (the `- **Issue ID**:` line under `### Handoff Values`), `ISSUE_CONTENT` (the body between the `<untrusted-issue-body>` markers), `ACCEPTANCE_CRITERIA`, `ISSUE_PR_LINK` (the `- **PR link line**:` line) and `ISSUE_BRANCH_TOKEN` (the `- **Branch token**:` line). Read every value from the block that emits it; never re-derive one value from another, and never infer any of them from a `TRACEABILITY: DEGRADED ({reason})` status line — a DEGRADED line is a status, not issue content.
|
|
140
141
|
|
|
@@ -160,7 +161,7 @@ Note: `ISSUE_CONTENT` stays inside its `<untrusted-issue-body>` markers wherever
|
|
|
160
161
|
|
|
161
162
|
Note: the section reaches a public PR body. The Code agent re-checks every line against this shape before it pastes, and the body's D11 scrub is the reason's secret scrub — rendering filters no secrets. A rendered reason carries no HTML or comment markers, link or image syntax, @-mentions, `#N` or full-URL references (no `/` survives), entities or shell-expansion characters; plain emphasis and `www.` or `GH-N` autolinks can remain — the requester authors the reason.
|
|
162
163
|
|
|
163
|
-
**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,
|
|
164
|
+
**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)`.
|
|
164
165
|
|
|
165
166
|
**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.
|
|
166
167
|
|
|
@@ -185,7 +186,7 @@ node "$HOME/.devflow/scripts/verify-evidence.cjs" check tp "{worktree}/.devflow/
|
|
|
185
186
|
- **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.
|
|
186
187
|
- **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.
|
|
187
188
|
|
|
188
|
-
When `EVIDENCE_POLICY` is `standard`, a missing test plan is never asked about: carry `Test plan: missing` to the Phase
|
|
189
|
+
When `EVIDENCE_POLICY` is `standard`, a missing test plan is never asked about: carry `Test plan: missing` to the Phase 12 report.
|
|
189
190
|
|
|
190
191
|
**Test-plan outputs**, set once before any Code spawn:
|
|
191
192
|
- `TEST_PLAN` — the TP lines of the evidence file's `## Test Plan` section, or `(none)` when the test plan is missing.
|
|
@@ -207,15 +208,23 @@ Accept the output only when it is exactly two lines: `exit=0` last and, before i
|
|
|
207
208
|
|
|
208
209
|
The accepted line is the only source of these values: the script alone folds the committed `.devflow/project.json`, the personal `.devflow/config.json` and the machine manifest.
|
|
209
210
|
|
|
210
|
-
**Resolve `REVIEW_PUBLICATION` per worktree:** take `REVIEW_PUBLICATION` from that worktree's settings line
|
|
211
|
+
**Resolve `REVIEW_PUBLICATION` per worktree:** take `REVIEW_PUBLICATION` from that worktree's settings line — the line resolved above for `{root}`, the worktree's root, by the settings block when this run has not yet resolved that root; multi-worktree repos may resolve different values per worktree. The line already caps the personal choice at the team's (D-PUBLICATION-CEILING), so it is `off`, `auto` or `full`, and `off` when the line was unresolvable.
|
|
211
212
|
|
|
212
213
|
**Evidence stub:** only when `EVIDENCE_POLICY` is `required`, a resolved `off` becomes `stub`, so a counts-only record still reaches the PR. `stub` is never a config value: the settings line never carries it.
|
|
213
214
|
|
|
214
215
|
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.
|
|
215
|
-
Phase
|
|
216
|
+
Phase 11 passes the resolved value to `update-pr-evidence`, which decides what each value means for the evidence comment. From the same 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.
|
|
217
|
+
|
|
218
|
+
**Set the compliance directive** from `COMPLIANCE_FRAMEWORKS`. `COMPLIANCE_DIRECTIVE` is empty when `COMPLIANCE_FRAMEWORKS` is `off`: a spawn line that holds only `{COMPLIANCE_DIRECTIVE}` is then left out, so a lens-off spawn carries nothing about compliance. Otherwise `COMPLIANCE_DIRECTIVE` is this one line, with `<ids>` replaced by the value of `COMPLIANCE_FRAMEWORKS`:
|
|
219
|
+
|
|
220
|
+
> 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 <ids> (none: generic controls only); never fabricate guidance for a framework you were not given.
|
|
221
|
+
|
|
222
|
+
Pass `COMPLIANCE_DIRECTIVE` to every Code and Code-fix spawn, on a line of its own.
|
|
216
223
|
|
|
217
224
|
### Load DECISIONS_CONTEXT
|
|
218
225
|
|
|
226
|
+
When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
|
|
227
|
+
|
|
219
228
|
The decisions ledger belongs to the repository, not to one checkout: in a linked worktree it lives in the main worktree, and a session started in a subdirectory reads the copy at the repository root. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
|
|
220
229
|
|
|
221
230
|
```bash
|
|
@@ -239,11 +248,11 @@ Attempt to read `{ledger}/.devflow/learning/index.md`.
|
|
|
239
248
|
|
|
240
249
|
The index is one direct file read, written at render time by `render-decisions.cjs` alongside `decisions.md`/`pitfalls.md` — no `.cjs` script runs here, and the index's own footer names the files that hold each entry's full body.
|
|
241
250
|
|
|
242
|
-
**Step 2 —
|
|
251
|
+
**Step 2 — Agents apply the decisions:**
|
|
243
252
|
|
|
244
|
-
When `DECISIONS_CONTEXT` is not `(none)`, follow `devflow:apply-decisions
|
|
253
|
+
When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it. They follow `devflow:apply-decisions`: scan the index, identify plausibly-relevant entries, Read full entry bodies on demand, and cite verbatim IDs in their reasoning. A host that uses the index in its own thread says so in its own step.
|
|
245
254
|
|
|
246
|
-
Pass to Code agent (Phase 2) and Scrutinize agent (Phase 4).
|
|
255
|
+
Pass `DECISIONS_CONTEXT` to Code agent (Phase 2) and Scrutinize agent (Phase 4).
|
|
247
256
|
|
|
248
257
|
### Load Feature Knowledge
|
|
249
258
|
|
|
@@ -273,27 +282,37 @@ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read on
|
|
|
273
282
|
|
|
274
283
|
Match the current task area and description against each index line (or frontmatter `description` + `directories` on fallback). Select entries whose documented area overlaps the current task. This is a relevance judgment — prefer specificity over breadth.
|
|
275
284
|
|
|
276
|
-
**Step 4 — Read selected
|
|
285
|
+
**Step 4 — Read each selected KB's Rules:**
|
|
277
286
|
|
|
278
|
-
For each selected entry,
|
|
287
|
+
For each selected entry, `{kb}` is `{worktree}/.devflow/features/{slug}/KNOWLEDGE.md`:
|
|
279
288
|
|
|
280
|
-
|
|
289
|
+
1. List its `##` headings with line numbers through Bash: `command grep -n '^## ' "{kb}"`. This only locates sections; the text of a KB comes from the Read view alone.
|
|
290
|
+
2. Read the `## Rules` range (its line to the next heading) with the Read tool, using `offset` and `limit`, and choose the one to three bullets most relevant to the current task. The choice is yours, made per KB.
|
|
291
|
+
3. If the KB has no `## Rules` section, choose one to three entries from its `## Anti-Patterns` or `## Gotchas` range the same way, and label them by that section's name instead of an ID.
|
|
281
292
|
|
|
282
|
-
|
|
293
|
+
When a KB contradicts the code you observe, **trust the code** — the code is the freshness mechanism; the KB may lag behind. A missing Rules section, a missing heading list and `(none)` are legitimate states, not errors.
|
|
294
|
+
|
|
295
|
+
**Step 5 — Set FEATURE_KNOWLEDGE and FEATURE_KNOWLEDGE_RULES:**
|
|
296
|
+
|
|
297
|
+
Write one block per selected KB. Paste each bullet verbatim from the Read view, never from a shell view. The path is relative to the checkout root; an agent resolves it under `WORKTREE_PATH` when one is provided.
|
|
283
298
|
|
|
284
299
|
```
|
|
285
300
|
--- Feature knowledge: {slug} ---
|
|
286
|
-
{
|
|
301
|
+
KB: .devflow/features/{slug}/KNOWLEDGE.md
|
|
302
|
+
Rules:
|
|
303
|
+
- **KB-AP-2** {bullet text, verbatim}
|
|
304
|
+
- **KB-INV-1** {bullet text, verbatim}
|
|
305
|
+
Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
|
|
287
306
|
```
|
|
288
307
|
|
|
289
|
-
If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set
|
|
308
|
+
A KB with no Rules section labels its entries `Rules ({section name}):` and gives them no ID. `FEATURE_KNOWLEDGE` is these blocks; `FEATURE_KNOWLEDGE_RULES` is the same blocks without the `Headings:` line. Both come from this one selection, and each spawn names the variable its recipient takes. If no KBs exist, no KBs are relevant, or `.devflow/features/` is absent, set both to `(none)`.
|
|
290
309
|
|
|
291
|
-
**One git call, then direct
|
|
310
|
+
**One git call, then direct reads — no `.cjs` script.** After resolving `{worktree}`, this step is 1 index read (or N frontmatter reads on fallback), plus one heading listing and one Rules read per selected KB, bounded by KB count.
|
|
292
311
|
|
|
293
312
|
### Phase 2: Implement
|
|
294
313
|
|
|
295
|
-
**Produces:** CODE_AGENT_OUTPUT, FILES_CHANGED
|
|
296
|
-
**Requires:** TASK_ID, BASE_BRANCH, EXECUTION_PLAN
|
|
314
|
+
**Produces:** CODE_AGENT_OUTPUT, FILES_CHANGED
|
|
315
|
+
**Requires:** TASK_ID, BASE_BRANCH, EXECUTION_PLAN
|
|
297
316
|
|
|
298
317
|
Based on Setup context (plan document, issue body, or conversation context), use the three-strategy framework:
|
|
299
318
|
|
|
@@ -319,23 +338,16 @@ TASK_DESCRIPTION: {description}
|
|
|
319
338
|
BASE_BRANCH: {base branch}
|
|
320
339
|
EXECUTION_PLAN: {full plan from setup context}
|
|
321
340
|
PATTERNS: {patterns from plan document or empty}
|
|
322
|
-
CREATE_PR: true
|
|
323
|
-
DOMAIN: {detected domain or 'fullstack'}
|
|
324
341
|
FEATURE_KNOWLEDGE: {feature_knowledge}
|
|
325
342
|
DECISIONS_CONTEXT: {decisions_context}
|
|
326
|
-
|
|
327
|
-
PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
|
|
328
|
-
ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
|
|
329
|
-
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
330
|
-
PR_EXCEPTIONS: {the ## Evidence Exceptions section of {worktree}/.devflow/docs/handoff-{branch_slug}.md verbatim, or (none)}
|
|
331
|
-
PR_TEST_PLAN_BLOCK: {PR_TEST_PLAN_BLOCK from Phase 1 verbatim, or (none)}"
|
|
343
|
+
{COMPLIANCE_DIRECTIVE}"
|
|
332
344
|
```
|
|
333
345
|
|
|
334
346
|
---
|
|
335
347
|
|
|
336
348
|
**SEQUENTIAL_CODE_AGENTS** (for HIGH/CRITICAL context risk):
|
|
337
349
|
|
|
338
|
-
Spawn Code agents one at a time
|
|
350
|
+
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:
|
|
339
351
|
|
|
340
352
|
**Phase 1 Code agent:**
|
|
341
353
|
```
|
|
@@ -346,14 +358,9 @@ TASK_DESCRIPTION: {phase 1 description}
|
|
|
346
358
|
BASE_BRANCH: {base branch}
|
|
347
359
|
EXECUTION_PLAN: {phase 1 steps}
|
|
348
360
|
PATTERNS: {patterns from plan document or empty}
|
|
349
|
-
CREATE_PR: false
|
|
350
|
-
DOMAIN: {phase 1 domain, e.g., 'backend'}
|
|
351
361
|
FEATURE_KNOWLEDGE: {feature_knowledge}
|
|
352
362
|
DECISIONS_CONTEXT: {decisions_context}
|
|
353
|
-
|
|
354
|
-
PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
|
|
355
|
-
ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
|
|
356
|
-
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
363
|
+
{COMPLIANCE_DIRECTIVE}
|
|
357
364
|
HANDOFF_REQUIRED: true
|
|
358
365
|
HANDOFF_FILE: {worktree}/.devflow/docs/handoff-{branch_slug}.md"
|
|
359
366
|
```
|
|
@@ -367,23 +374,16 @@ TASK_DESCRIPTION: {phase N description}
|
|
|
367
374
|
BASE_BRANCH: {base branch}
|
|
368
375
|
EXECUTION_PLAN: {phase N steps}
|
|
369
376
|
PATTERNS: {patterns from plan document or empty}
|
|
370
|
-
CREATE_PR: {true if last phase, false otherwise}
|
|
371
|
-
DOMAIN: {phase N domain, e.g., 'frontend'}
|
|
372
377
|
PRIOR_PHASE_SUMMARY: {summary from previous Code agent}
|
|
373
378
|
FILES_FROM_PRIOR_PHASE: {list of files created}
|
|
374
379
|
FEATURE_KNOWLEDGE: {feature_knowledge}
|
|
375
380
|
DECISIONS_CONTEXT: {decisions_context}
|
|
376
|
-
|
|
377
|
-
PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
|
|
378
|
-
ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
|
|
379
|
-
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
380
|
-
PR_EXCEPTIONS: {the ## Evidence Exceptions section of {worktree}/.devflow/docs/handoff-{branch_slug}.md verbatim, or (none)}
|
|
381
|
-
PR_TEST_PLAN_BLOCK: {PR_TEST_PLAN_BLOCK from Phase 1 verbatim, or (none)}
|
|
381
|
+
{COMPLIANCE_DIRECTIVE}
|
|
382
382
|
HANDOFF_REQUIRED: {true if not last phase}
|
|
383
383
|
HANDOFF_FILE: {worktree}/.devflow/docs/handoff-{branch_slug}.md"
|
|
384
384
|
```
|
|
385
385
|
|
|
386
|
-
**Handoff Protocol**: Each sequential Code agent receives the prior Code agent's implementation summary via PRIOR_PHASE_SUMMARY and FILES_FROM_PRIOR_PHASE. The Code agent's built-in branch orientation step handles git log scanning, file reading, and pattern discovery automatically.
|
|
386
|
+
**Handoff Protocol**: Each sequential Code agent receives the prior Code agent's implementation summary via PRIOR_PHASE_SUMMARY and FILES_FROM_PRIOR_PHASE. The Code agent's built-in branch orientation step handles git log scanning, file reading, and pattern discovery automatically. Each Code agent with HANDOFF_REQUIRED=true appends its own `## Phase {N} Implementation Summary` section, at most 8,192 bytes, to `{worktree}/.devflow/docs/handoff-{branch_slug}.md` (survives context compaction), never rewriting an earlier section and keeping any `## Evidence Exceptions` section byte-identical; the next Code agent reads only the section of the phase immediately before its own through HANDOFF_FILE. The orchestrator writes no phase section. Delete `{worktree}/.devflow/docs/handoff-{branch_slug}.md` once the PR exists — after Phase 9 (cleanup).
|
|
387
387
|
|
|
388
388
|
---
|
|
389
389
|
|
|
@@ -399,14 +399,9 @@ TASK_DESCRIPTION: {independent subtask 1}
|
|
|
399
399
|
BASE_BRANCH: {base branch}
|
|
400
400
|
EXECUTION_PLAN: {subtask 1 steps}
|
|
401
401
|
PATTERNS: {patterns}
|
|
402
|
-
CREATE_PR: false
|
|
403
|
-
DOMAIN: {subtask 1 domain}
|
|
404
402
|
FEATURE_KNOWLEDGE: {feature_knowledge}
|
|
405
403
|
DECISIONS_CONTEXT: {decisions_context}
|
|
406
|
-
|
|
407
|
-
PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
|
|
408
|
-
ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
|
|
409
|
-
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}"
|
|
404
|
+
{COMPLIANCE_DIRECTIVE}"
|
|
410
405
|
|
|
411
406
|
Agent(subagent_type="Code"): # Code agent 2 (same message)
|
|
412
407
|
"OPERATION: implement
|
|
@@ -415,14 +410,9 @@ TASK_DESCRIPTION: {independent subtask 2}
|
|
|
415
410
|
BASE_BRANCH: {base branch}
|
|
416
411
|
EXECUTION_PLAN: {subtask 2 steps}
|
|
417
412
|
PATTERNS: {patterns}
|
|
418
|
-
CREATE_PR: false
|
|
419
|
-
DOMAIN: {subtask 2 domain}
|
|
420
413
|
FEATURE_KNOWLEDGE: {feature_knowledge}
|
|
421
414
|
DECISIONS_CONTEXT: {decisions_context}
|
|
422
|
-
|
|
423
|
-
PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
|
|
424
|
-
ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
|
|
425
|
-
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}"
|
|
415
|
+
{COMPLIANCE_DIRECTIVE}"
|
|
426
416
|
```
|
|
427
417
|
|
|
428
418
|
**Independence criteria** (all must be true for PARALLEL_CODE_AGENTS):
|
|
@@ -459,7 +449,7 @@ Agent(subagent_type="Scrutinize"):
|
|
|
459
449
|
"TASK_DESCRIPTION: {task description}
|
|
460
450
|
FILES_CHANGED: {list of files from Code agent output}
|
|
461
451
|
DECISIONS_CONTEXT: {decisions_context}
|
|
462
|
-
FEATURE_KNOWLEDGE: {
|
|
452
|
+
FEATURE_KNOWLEDGE: {feature_knowledge_rules}
|
|
463
453
|
Evaluate 9 pillars, fix P0/P1 issues, report status"
|
|
464
454
|
```
|
|
465
455
|
|
|
@@ -470,7 +460,7 @@ Scrutinize agent reports `### Status: PASS | FIXED | BLOCKED`. **If BLOCKED:** r
|
|
|
470
460
|
**Produces:** ALIGNMENT_RESULT
|
|
471
461
|
**Requires:** FILES_CHANGED, EXECUTION_PLAN
|
|
472
462
|
|
|
473
|
-
After Scrutinize agent passes, spawn Evaluate agent to validate alignment. Evaluate agent receives `
|
|
463
|
+
After Scrutinize 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 Scrutinize agent:
|
|
474
464
|
|
|
475
465
|
```
|
|
476
466
|
Agent(subagent_type="Evaluate"):
|
|
@@ -478,7 +468,7 @@ Agent(subagent_type="Evaluate"):
|
|
|
478
468
|
EXECUTION_PLAN: {execution plan from Phase 1}
|
|
479
469
|
FILES_CHANGED: {list of files from Code agent output}
|
|
480
470
|
ACCEPTANCE_CRITERIA: {extracted criteria if available}
|
|
481
|
-
FEATURE_KNOWLEDGE: {
|
|
471
|
+
FEATURE_KNOWLEDGE: {feature_knowledge_rules}
|
|
482
472
|
Validate alignment with request and plan. Report ALIGNED or MISALIGNED with details."
|
|
483
473
|
```
|
|
484
474
|
|
|
@@ -488,18 +478,16 @@ Validate alignment with request and plan. Report ALIGNED or MISALIGNED with deta
|
|
|
488
478
|
1. Extract misalignment details from Evaluate agent output
|
|
489
479
|
2. Increment `alignment_fix_count`
|
|
490
480
|
3. If `alignment_fix_count <= 2`:
|
|
491
|
-
- Spawn Code agent to fix misalignments:
|
|
481
|
+
- Spawn Code-fix agent to fix misalignments:
|
|
492
482
|
```
|
|
493
|
-
Agent(subagent_type="Code"):
|
|
483
|
+
Agent(subagent_type="Code-fix"):
|
|
494
484
|
"OPERATION: alignment-fix
|
|
495
485
|
TASK_ID: {task-id}
|
|
496
486
|
TASK_DESCRIPTION: Fix alignment issues
|
|
497
487
|
MISALIGNMENTS: {structured misalignments from Evaluate agent}
|
|
498
488
|
SCOPE: Fix only the listed misalignments, no other changes
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
502
|
-
COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
|
|
489
|
+
DECISIONS_CONTEXT: {decisions_context}
|
|
490
|
+
{COMPLIANCE_DIRECTIVE}"
|
|
503
491
|
```
|
|
504
492
|
- Loop back to Phase 5 (re-check alignment). The fix is not validated here: the Phase 6 run covers it.
|
|
505
493
|
4. If `alignment_fix_count > 2`: Report misalignments to user for decision
|
|
@@ -522,18 +510,16 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
|
|
|
522
510
|
1. Extract failure details from Validate agent output
|
|
523
511
|
2. Increment `validation_retry_count`
|
|
524
512
|
3. If `validation_retry_count <= 2`:
|
|
525
|
-
- Spawn Code agent with fix context:
|
|
513
|
+
- Spawn Code-fix agent with fix context:
|
|
526
514
|
```
|
|
527
|
-
Agent(subagent_type="Code"):
|
|
515
|
+
Agent(subagent_type="Code-fix"):
|
|
528
516
|
"OPERATION: validation-fix
|
|
529
517
|
TASK_ID: {task-id}
|
|
530
518
|
TASK_DESCRIPTION: Fix validation failures
|
|
531
519
|
VALIDATION_FAILURES: {parsed failures from Validate agent}
|
|
532
520
|
SCOPE: Fix only the listed failures, no other changes
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
536
|
-
COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
|
|
521
|
+
DECISIONS_CONTEXT: {decisions_context}
|
|
522
|
+
{COMPLIANCE_DIRECTIVE}"
|
|
537
523
|
```
|
|
538
524
|
- Loop back to Phase 6 (re-validate at the new HEAD, full scope)
|
|
539
525
|
4. If `validation_retry_count > 2`: Report failures to user and halt
|
|
@@ -549,7 +535,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
|
|
|
549
535
|
|
|
550
536
|
- `gate:validate` — after a Phase 6 or Phase 8 PASS.
|
|
551
537
|
- `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
|
|
538
|
+
- 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 12 report.
|
|
553
539
|
|
|
554
540
|
### Phase 7: QA Testing
|
|
555
541
|
|
|
@@ -576,21 +562,19 @@ After every Test agent run — PASS or FAIL, first run or retry — append its T
|
|
|
576
562
|
1. Extract failure details from Test agent output
|
|
577
563
|
2. Increment `qa_retry_count`
|
|
578
564
|
3. If `qa_retry_count <= 2`:
|
|
579
|
-
- Spawn Code agent to fix QA failures:
|
|
565
|
+
- Spawn Code-fix agent to fix QA failures:
|
|
580
566
|
```
|
|
581
|
-
Agent(subagent_type="Code"):
|
|
567
|
+
Agent(subagent_type="Code-fix"):
|
|
582
568
|
"OPERATION: qa-fix
|
|
583
569
|
TASK_ID: {task-id}
|
|
584
570
|
TASK_DESCRIPTION: Fix QA test failures
|
|
585
571
|
QA_FAILURES: {structured failures from Test agent}
|
|
586
572
|
SCOPE: Fix only the listed failures, no other changes
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
590
|
-
COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
|
|
573
|
+
DECISIONS_CONTEXT: {decisions_context}
|
|
574
|
+
{COMPLIANCE_DIRECTIVE}"
|
|
591
575
|
```
|
|
592
576
|
- 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
|
|
577
|
+
4. If `qa_retry_count > 2`: Report QA failures to user for decision. The run stops at the report (Phase 12), so Phases 8 to 11 do not run.
|
|
594
578
|
|
|
595
579
|
### Phase 8: Re-Validate (only if a qa-fix committed)
|
|
596
580
|
|
|
@@ -610,12 +594,37 @@ Verify the qa-fix commits did not break anything."
|
|
|
610
594
|
|
|
611
595
|
**If PASS:** append a `gate:validate` claim (Phase 6's **Evidence claims**), then continue to Phase 9.
|
|
612
596
|
|
|
613
|
-
### Phase 9:
|
|
597
|
+
### Phase 9: Open PR
|
|
598
|
+
|
|
599
|
+
**Produces:** PR_NUMBER
|
|
600
|
+
**Requires:** BASE_BRANCH, TASK_ID, ISSUE_NUMBER, ISSUE_PR_LINK, PR_EXCEPTIONS, PR_TEST_PLAN_BLOCK, PR_DESCRIPTION_GUIDANCE, APPLY_CONVENTIONS, CODE_AGENT_OUTPUT
|
|
601
|
+
|
|
602
|
+
Run once, after the gates, under every strategy. This phase sits outside the strategy branches, so no run reaches the end with commits and no PR. No Code agent opens a PR: the Git agent does, and it pastes `ISSUE_PR_LINK`, `PR_EXCEPTIONS` and `PR_TEST_PLAN_BLOCK` through their paste gates and scrubs the body (D11) before `gh pr create`. This command renders no link line and creates no PR itself: the Git agent's Phase-1 rendering is the only one, forwarded verbatim.
|
|
603
|
+
|
|
604
|
+
```
|
|
605
|
+
Agent(subagent_type="Git"):
|
|
606
|
+
"OPERATION: ensure-pr-ready
|
|
607
|
+
WORKTREE_PATH: {worktree}
|
|
608
|
+
BASE_BRANCH: {base branch}
|
|
609
|
+
TASK_ID: {task-id}
|
|
610
|
+
ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
|
|
611
|
+
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
612
|
+
PR_EXCEPTIONS: {the ## Evidence Exceptions section of {worktree}/.devflow/docs/handoff-{branch_slug}.md verbatim, or (none)}
|
|
613
|
+
PR_TEST_PLAN_BLOCK: {PR_TEST_PLAN_BLOCK verbatim, or (none)}
|
|
614
|
+
PR_DESCRIPTION_GUIDANCE: {pr_description_guidance from Phase 1 unless it is (none), then the Code agents' reports from CODE_AGENT_OUTPUT in spawn order — Implementation, Commits and Key Decisions, and a sequential agent's ## Phase {N} Implementation Summary}
|
|
615
|
+
APPLY_CONVENTIONS: {APPLY_CONVENTIONS}
|
|
616
|
+
COMMIT_UNCOMMITTED: false
|
|
617
|
+
Open the pull request for this branch and return the pre-flight summary."
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
`COMMIT_UNCOMMITTED: false` keeps the Git agent from committing a stray file: the Code, Simplify, Scrutinize 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.
|
|
621
|
+
|
|
622
|
+
### Phase 10: CI Status Gate
|
|
614
623
|
|
|
615
624
|
**Produces:** CI_STATUS
|
|
616
|
-
**Requires:**
|
|
625
|
+
**Requires:** PR_NUMBER, FILES_CHANGED
|
|
617
626
|
|
|
618
|
-
|
|
627
|
+
Run under every strategy: Phase 9 opened the PR.
|
|
619
628
|
|
|
620
629
|
**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
630
|
|
|
@@ -623,52 +632,24 @@ Strategy-conditional: run when the PR already exists — **SINGLE_CODE_AGENT** a
|
|
|
623
632
|
git push origin HEAD; echo "exit=$?"
|
|
624
633
|
```
|
|
625
634
|
|
|
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
|
|
635
|
+
`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 12 report, reports "CI status unknown — verify manually before merging" and proceeds to Phase 11 without waiting.
|
|
627
636
|
|
|
628
637
|
<!-- PATTERN: ci-status-gate -->
|
|
629
638
|
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.
|
|
630
|
-
2. **If PASSING** → proceed to Phase
|
|
631
|
-
3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to Phase
|
|
639
|
+
2. **If PASSING** → proceed to Phase 11.
|
|
640
|
+
3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to Phase 11.
|
|
632
641
|
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
642
|
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 `
|
|
643
|
+
6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Code-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 Code-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.
|
|
635
644
|
7. **Budget**: at most 3 waits and 2 fixes in all. When one is spent, report the current status and proceed.
|
|
636
645
|
<!-- /PATTERN: ci-status-gate -->
|
|
637
646
|
|
|
638
|
-
### Phase
|
|
639
|
-
|
|
640
|
-
**Produces:** PR_URL
|
|
641
|
-
**Requires:** BASE_BRANCH, TASK_ID, PR_EXCEPTIONS, PR_TEST_PLAN_BLOCK
|
|
642
|
-
|
|
643
|
-
**For SEQUENTIAL_CODE_AGENTS**: the PR already exists — the last Phase 2 Code agent (`CREATE_PR: true`) created it, and Phase 9 has gated its CI.
|
|
644
|
-
|
|
645
|
-
**For PARALLEL_CODE_AGENTS**: spawn one Code agent to create the unified PR:
|
|
646
|
-
|
|
647
|
-
```
|
|
648
|
-
Agent(subagent_type="Code"):
|
|
649
|
-
"OPERATION: pr-create
|
|
650
|
-
TASK_ID: {task-id}
|
|
651
|
-
TASK_DESCRIPTION: Create the unified PR for the parallel implementation
|
|
652
|
-
BASE_BRANCH: {base branch}
|
|
653
|
-
CREATE_PR: true
|
|
654
|
-
PR_DESCRIPTION_GUIDANCE: {pr_description_guidance}
|
|
655
|
-
ISSUE_NUMBER: {ISSUE_ID captured in Phase 1, or (none)}
|
|
656
|
-
ISSUE_PR_LINK: {ISSUE_PR_LINK captured in Phase 1, or (none)}
|
|
657
|
-
PR_EXCEPTIONS: {the ## Evidence Exceptions section of {worktree}/.devflow/docs/handoff-{branch_slug}.md verbatim, or (none)}
|
|
658
|
-
PR_TEST_PLAN_BLOCK: {PR_TEST_PLAN_BLOCK from Phase 1 verbatim, or (none)}
|
|
659
|
-
COMPLIANCE_FRAMEWORKS: {COMPLIANCE_FRAMEWORKS}"
|
|
660
|
-
```
|
|
661
|
-
|
|
662
|
-
Its Responsibility 7 composes the body, pastes `ISSUE_PR_LINK`, `PR_EXCEPTIONS` and `PR_TEST_PLAN_BLOCK` through their paste gates and scrubs the body (D11) before `gh pr create`. This command renders no link line and creates no PR itself: the Git agent's Phase-1 rendering is the only one, forwarded verbatim.
|
|
663
|
-
|
|
664
|
-
**For SINGLE_CODE_AGENT**: PR is created by the Code agent (CREATE_PR: true) — the Code agent's Responsibility 7 handles Related Issues inclusion when ISSUE_NUMBER is provided.
|
|
665
|
-
|
|
666
|
-
### Phase 10b: Evidence
|
|
647
|
+
### Phase 11: Evidence
|
|
667
648
|
|
|
668
649
|
**Produces:** EVIDENCE_RESULT
|
|
669
|
-
**Requires:**
|
|
650
|
+
**Requires:** PR_NUMBER, EVIDENCE_FILE, REVIEW_PUBLICATION
|
|
670
651
|
|
|
671
|
-
Run once, after Phase 10, under every strategy: the PR exists by now
|
|
652
|
+
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.
|
|
672
653
|
|
|
673
654
|
**Push first.** Every claim is keyed to the HEAD an agent reported, and a Scrutinize 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 spawn — never force, and no retry:
|
|
674
655
|
|
|
@@ -676,29 +657,31 @@ Run once, after Phase 10, under every strategy: the PR exists by now under all t
|
|
|
676
657
|
git push origin HEAD; echo "exit=$?"
|
|
677
658
|
```
|
|
678
659
|
|
|
679
|
-
`exit=0` continues to the spawn. Any other result, a rejected non-fast-forward push included, does not block: record `TRACEABILITY: DEGRADED (evidence push failed)` for the Phase
|
|
660
|
+
`exit=0` continues to the spawn. 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 spawn anyway.
|
|
680
661
|
|
|
681
662
|
```
|
|
682
663
|
Agent(subagent_type="Git"):
|
|
683
664
|
"OPERATION: update-pr-evidence
|
|
684
|
-
PR_NUMBER: {
|
|
665
|
+
PR_NUMBER: {PR_NUMBER}
|
|
685
666
|
EVIDENCE_FILE: .devflow/docs/evidence-{branch_slug}.md
|
|
686
667
|
REVIEW_PUBLICATION: {REVIEW_PUBLICATION resolved in Phase 1, or auto}
|
|
687
668
|
WORKTREE_PATH: {worktree}
|
|
688
669
|
Update the PR's test-plan block and post its evidence comment."
|
|
689
670
|
```
|
|
690
671
|
|
|
691
|
-
Omit the `EVIDENCE_FILE` line when that file does not exist. Capture the op's `## PR Evidence` block — its `EVIDENCE` line and its `**Body**:` / `**Comment**:` line — as `EVIDENCE_RESULT`, or its `TRACEABILITY: DEGRADED ({reason})` line. It never blocks: whatever it returns, continue to Phase
|
|
672
|
+
Omit the `EVIDENCE_FILE` line when that file does not exist. Capture the op's `## PR Evidence` block — its `EVIDENCE` line and its `**Body**:` / `**Comment**:` line — as `EVIDENCE_RESULT`, or its `TRACEABILITY: DEGRADED ({reason})` line. It never blocks: whatever it returns, continue to Phase 12.
|
|
692
673
|
|
|
693
|
-
### Phase
|
|
674
|
+
### Phase 12: Report
|
|
694
675
|
|
|
695
|
-
**Requires:** VALIDATION_RESULT, ALIGNMENT_RESULT, QA_RESULT,
|
|
676
|
+
**Requires:** VALIDATION_RESULT, ALIGNMENT_RESULT, QA_RESULT, PR_NUMBER, EVIDENCE_RESULT
|
|
696
677
|
|
|
697
678
|
Display completion summary with phase status, PR info, and next steps.
|
|
698
679
|
|
|
699
|
-
Show the test plan's evidence from Phase
|
|
680
|
+
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`.
|
|
681
|
+
|
|
682
|
+
If any Git agent output emitted `TRACEABILITY: DEGRADED ({reason})` lines during the run, or Phase 10's push or Phase 11's push recorded one, surface them verbatim in the report under a `### Traceability` subsection so the user can act on them.
|
|
700
683
|
|
|
701
|
-
If
|
|
684
|
+
If Phase 9 listed uncommitted files, show them as a `### Uncommitted files` subsection: the user commits them or discards them.
|
|
702
685
|
|
|
703
686
|
If Phase 1 recorded an evidence exception, show its `## Evidence Exceptions` lines in the report.
|
|
704
687
|
|
|
@@ -712,17 +695,7 @@ git -C "{start}" rev-parse --show-toplevel
|
|
|
712
695
|
|
|
713
696
|
and use its one-line output. If the command fails (outside a git repository), `{worktree}` is the start directory itself. All paths below are relative to `{worktree}`.
|
|
714
697
|
|
|
715
|
-
**Step 1 — Check the opt-out gate, with `{root}` = `{worktree}`:**
|
|
716
|
-
|
|
717
|
-
**Resolve the settings line** once per worktree root, reusing a line this run already resolved for the same root. `{root}` is the worktree the values are for — the repository root when the run has one worktree:
|
|
718
|
-
|
|
719
|
-
```bash
|
|
720
|
-
node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
|
|
721
|
-
```
|
|
722
|
-
|
|
723
|
-
Accept the output only when it is exactly two lines: `exit=0` last and, before it, one line of the form `TRACKER=<github|jira|linear> TRACKER_SOURCE=<project|personal|machine|default> TRACKER_WARN=<none|mismatch|invalid> SITE=<none|https://<host>> KEY=<none|<key>> REVIEW_PUBLICATION=<off|auto|full> COMPLIANCE=<off|generic|<id>[,<id>…]> MEMORY=<on|off> LEARNING=<on|off> KNOWLEDGE=<on|off>` — these fields, in this order, nothing else, where `<host>` is a lowercase dotted host name alone, `<key>` is 2–10 of `A-Z`, `0-9` and `_` starting with a letter, and each `<id>` is one of `gdpr`, `hipaa`, `pci-dss`, `soc2`, `iso-27001`, `sox`. **Anything else** (a non-zero exit, no line, extra text, or a missing, reordered or unlisted field or value) ⇒ use `TRACKER=github TRACKER_SOURCE=default TRACKER_WARN=invalid SITE=none KEY=none REVIEW_PUBLICATION=off COMPLIANCE=generic MEMORY=on LEARNING=on KNOWLEDGE=off` instead.
|
|
724
|
-
|
|
725
|
-
The accepted line is the only source of these values: the script alone folds the committed `.devflow/project.json`, the personal `.devflow/config.json` and the machine manifest.
|
|
698
|
+
**Step 1 — Check the opt-out gate, with `{root}` = `{worktree}`:** take the settings line resolved above for that root, resolving it with the settings block when this run has not yet.
|
|
726
699
|
|
|
727
700
|
If the settings line says `KNOWLEDGE=off`, skip write-back entirely. The machine switch (`devflow knowledge --disable`), the repository and the personal settings can each turn knowledge off, and none can turn it back on (D-FEATURES-NARROW-ONLY). The fail-closed line says `KNOWLEDGE=off` too, so an unresolvable line skips write-back.
|
|
728
701
|
|
|
@@ -752,7 +725,7 @@ Write the knowledge base to:
|
|
|
752
725
|
Then update the index cache by performing a read-modify-write on:
|
|
753
726
|
{worktree}/.devflow/features/index.md
|
|
754
727
|
|
|
755
|
-
Index line format: `- **{slug}** — {areas} — {Use-when description}`
|
|
728
|
+
Index line format: `- **{slug}** — {areas} — {Use-when description}` — at most 300 characters, the description at most 220; reword a longer one, never cut it.
|
|
756
729
|
|
|
757
730
|
If the line for this slug already exists in index.md, replace it. If it does not exist, append it. If index.md does not exist, create it with just this line.
|
|
758
731
|
|
|
@@ -773,7 +746,7 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
773
746
|
/implement (orchestrator - spawns agents only)
|
|
774
747
|
│
|
|
775
748
|
├─ Re-validation Path (when user says "re-validate"/"re-check"/"re-run gates")
|
|
776
|
-
│ └─ Branch safety → skip Phase 2 → detect FILES_CHANGED → Phases 3-8 → Phase
|
|
749
|
+
│ └─ Branch safety → skip Phase 2 → detect FILES_CHANGED → Phases 3-8 → Phase 9, 11, 12
|
|
777
750
|
│
|
|
778
751
|
├─ Phase 1: Setup
|
|
779
752
|
│ └─ Plan document parsing (if .md path provided) - extracts execution plan, strategy, frontmatter issue
|
|
@@ -782,7 +755,7 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
782
755
|
│ └─ 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
|
|
783
756
|
│
|
|
784
757
|
├─ Phase 2: Implement (3-strategy framework)
|
|
785
|
-
│ ├─ SINGLE_CODE_AGENT (80%): One Code agent, full plan
|
|
758
|
+
│ ├─ SINGLE_CODE_AGENT (80%): One Code agent, full plan
|
|
786
759
|
│ ├─ SEQUENTIAL_CODE_AGENTS (15%): N Code agents with handoff summaries
|
|
787
760
|
│ └─ PARALLEL_CODE_AGENTS (5%): N Code agents in single message (rare)
|
|
788
761
|
│
|
|
@@ -794,33 +767,31 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
794
767
|
│
|
|
795
768
|
├─ Phase 5: Alignment Check
|
|
796
769
|
│ └─ Evaluate agent (validates alignment - reports only, no fixes)
|
|
797
|
-
│ └─ If MISALIGNED: Code agent
|
|
770
|
+
│ └─ If MISALIGNED: Code-fix agent loop (max 2 iterations) → re-check alignment
|
|
798
771
|
│
|
|
799
772
|
├─ Phase 6: Validate (the one full-suite slot)
|
|
800
773
|
│ └─ Validate agent (build, typecheck, lint, test over the branch diff)
|
|
801
|
-
│ └─ If FAIL: Code agent
|
|
774
|
+
│ └─ If FAIL: Code-fix agent loop (max 2 retries) → re-validate at the new HEAD
|
|
802
775
|
│ └─ If PASS: record VALIDATED_HEAD, gate:validate claim → evidence file
|
|
803
776
|
│
|
|
804
777
|
├─ Phase 7: QA Testing
|
|
805
778
|
│ └─ Test agent (scenario-based acceptance tests, TEST_PLAN) → one claim per TP row → evidence file
|
|
806
|
-
│ └─ If FAIL: Code agent
|
|
779
|
+
│ └─ If FAIL: Code-fix agent loop (max 2 retries) → re-test
|
|
807
780
|
│
|
|
808
781
|
├─ Phase 8: Re-Validate (only if a qa-fix committed)
|
|
809
782
|
│ └─ Validate agent (changed-only over VALIDATED_HEAD..HEAD) → gate:validate claim
|
|
810
783
|
│
|
|
811
|
-
├─ Phase 9:
|
|
812
|
-
│ └─
|
|
784
|
+
├─ Phase 9: Open PR (every strategy, outside the strategy branches)
|
|
785
|
+
│ └─ 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
|
|
813
786
|
│
|
|
814
|
-
├─ Phase 10:
|
|
815
|
-
│ └─
|
|
816
|
-
│ └─ SEQUENTIAL: already created by the last Phase 2 Code agent
|
|
817
|
-
│ └─ PARALLEL: Code agent (pr-create) creates unified PR
|
|
787
|
+
├─ Phase 10: CI Status Gate (every strategy)
|
|
788
|
+
│ └─ Push the branch, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code-fix agent on FAILING (3 waits + 2 fixes)
|
|
818
789
|
│
|
|
819
|
-
├─ Phase
|
|
790
|
+
├─ Phase 11: Evidence (every strategy, once the PR exists)
|
|
820
791
|
│ └─ Push the branch (never force; a failure is DEGRADED, not a stop)
|
|
821
792
|
│ └─ Git agent (update-pr-evidence) - test-plan block + evidence comment; never blocks
|
|
822
793
|
│
|
|
823
|
-
├─ Phase
|
|
794
|
+
├─ Phase 12: Report
|
|
824
795
|
│
|
|
825
796
|
└─ Feature Knowledge Write-Back (Conditional)
|
|
826
797
|
└─ Knowledge agent (if documented area changed AND knowledge enabled)
|
|
@@ -828,7 +799,7 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
828
799
|
|
|
829
800
|
## Principles
|
|
830
801
|
|
|
831
|
-
1. **Orchestration only** - Command spawns agents, never does work itself; the inline calls are the bounded plumbing the charter allows: the Phase
|
|
802
|
+
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
|
|
832
803
|
2. **Plan-first** - Plan documents from `/plan` skip exploration/planning overhead entirely
|
|
833
804
|
3. **Coherence-first** - Single Code agent produces more consistent code (default ~80% of tasks)
|
|
834
805
|
4. **Agent ownership** - Each agent owns its output completely
|
|
@@ -837,9 +808,9 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
837
808
|
7. **Simplification pass** - Code refined for clarity before PR
|
|
838
809
|
8. **Strict delegation** - Never perform agent work in main session. "Spawn X" means call Agent tool with X, not do X's work yourself
|
|
839
810
|
9. **Validate agent owns validation** - Never run `npm test`, `npm run build`, or similar in main session; always delegate to Validate agent
|
|
840
|
-
10. **Code agent owns fixes** - Never implement fixes in main session; spawn Code agent for validation failures and alignment fixes
|
|
811
|
+
10. **Code-fix agent owns fixes** - Never implement fixes in main session; spawn Code-fix agent for validation failures and alignment fixes
|
|
841
812
|
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
|
|
842
|
-
12. **CI awareness** - CI status is checked before merge
|
|
813
|
+
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
|
|
843
814
|
|
|
844
815
|
## Error Handling
|
|
845
816
|
|