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
package/dist/commands/resolve.md
CHANGED
|
@@ -94,27 +94,27 @@ Set `TARGET_DIR` to the selected review or bug-analysis directory path, and `TAR
|
|
|
94
94
|
node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
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.
|
|
97
|
+
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> GATE_LEVEL=<full|standard|lean>` — 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 GATE_LEVEL=full` instead.
|
|
98
98
|
|
|
99
|
-
The accepted line is the only source of these values
|
|
99
|
+
The accepted line is the only source of these values.
|
|
100
100
|
|
|
101
101
|
### Load DECISIONS_CONTEXT
|
|
102
102
|
|
|
103
103
|
When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
|
|
104
104
|
|
|
105
|
-
The decisions ledger belongs to the repository, not to one checkout:
|
|
105
|
+
The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy, a subdirectory session the repository root's. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
|
|
106
106
|
|
|
107
107
|
```bash
|
|
108
108
|
git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
Line 1 is the checkout's toplevel, line 2 the
|
|
111
|
+
Line 1 is the checkout's toplevel, line 2 the common git directory. A git older than 2.31 echoes `--path-format=absolute` back as a line of its own first. `{ledger}` is the first that applies:
|
|
112
112
|
|
|
113
113
|
1. **The main worktree** — line 2 without its trailing `/.git`, when the output is exactly two lines each beginning with `/`, line 2 ends in `/.git`, and the directory left once it is removed is not your home directory and contains a `.devflow/` directory.
|
|
114
114
|
2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
|
|
115
115
|
3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
|
|
116
116
|
|
|
117
|
-
This is the rule the learning hooks apply
|
|
117
|
+
This is the rule the learning hooks apply, so you read the index the Curate agent writes.
|
|
118
118
|
|
|
119
119
|
**Step 1 — Read the pre-rendered index:**
|
|
120
120
|
|
|
@@ -123,11 +123,15 @@ Attempt to read `{ledger}/.devflow/learning/index.md`.
|
|
|
123
123
|
- If the file exists and contains non-empty content: use that content as `DECISIONS_CONTEXT`.
|
|
124
124
|
- If the file is absent or empty: set `DECISIONS_CONTEXT` to `(none)`.
|
|
125
125
|
|
|
126
|
-
The index is one direct file read, written at render time by `render-decisions.cjs`
|
|
126
|
+
The index is one direct file read, written at render time by `render-decisions.cjs` — no `.cjs` script runs here.
|
|
127
127
|
|
|
128
|
-
**Step 2 —
|
|
128
|
+
**Step 2 — Slice the index, then hand it on:**
|
|
129
129
|
|
|
130
|
-
When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it.
|
|
130
|
+
When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it.
|
|
131
|
+
|
|
132
|
+
Hand each agent that takes `DECISIONS_CONTEXT` a slice, not the whole index: the index lines whose title, scope or area touch the files and task it works on, verbatim, led by `(slice: N of M entries — full index: <absolute index path>)` and closed by the index footer. When unsure, include the line. Siblings over one diff share ONE slice.
|
|
133
|
+
|
|
134
|
+
Those agents follow `devflow:apply-decisions`. A host that uses the index in its own thread says so in its own step.
|
|
131
135
|
|
|
132
136
|
This produces a compact index of active ADR/PF entries written at render time — Deprecated/Superseded entries are already stripped. Pass `DECISIONS_CONTEXT` to the Triage agent in Phase 2 and to Code agents in Phase 4.
|
|
133
137
|
|
|
@@ -153,7 +157,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
|
|
|
153
157
|
|
|
154
158
|
**Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
|
|
155
159
|
|
|
156
|
-
Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
|
|
160
|
+
Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
|
|
157
161
|
|
|
158
162
|
**Step 3 — Pick relevant KBs:**
|
|
159
163
|
|
|
@@ -184,7 +188,7 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
|
|
|
184
188
|
|
|
185
189
|
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)`.
|
|
186
190
|
|
|
187
|
-
**One git call, then direct reads — no `.cjs` script.**
|
|
191
|
+
**One git call, then direct reads — no `.cjs` script.**
|
|
188
192
|
|
|
189
193
|
Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
|
|
190
194
|
|
|
@@ -210,7 +214,7 @@ Resolve this per worktree — unlike the evidence policy above, the settings lin
|
|
|
210
214
|
|
|
211
215
|
> 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.
|
|
212
216
|
|
|
213
|
-
Set it per worktree, from that worktree's lens, and pass that worktree's `COMPLIANCE_DIRECTIVE` to each of its Code and
|
|
217
|
+
Set it per worktree, from that worktree's lens, and pass that worktree's `COMPLIANCE_DIRECTIVE` to each of its Code and Fix spawns, on a line of its own.
|
|
214
218
|
|
|
215
219
|
**Mint `RESOLUTION_TS` once per run:** `date -u +%Y-%m-%dT%H:%M:%SZ`. Every worktree reuses it — the resolution comment's dedup marker is searched per PR, so one run key keeps a retry of this run deduplicated while the next /resolve on the same PR posts. Phase 5 writes it as the summary's `**Date**:` and Phase 9b-2 passes it, so the local file and the posted marker agree.
|
|
216
220
|
|
|
@@ -346,7 +350,7 @@ Collect from each Code agent:
|
|
|
346
350
|
**Produces:** RESOLUTION_FILE (early write for compaction safety)
|
|
347
351
|
**Requires:** TRIAGE_RESULTS, CODE_AGENT_RESULTS, TARGET_DIR, TARGET_DIR_REL, BRANCH_INFO, RESOLUTION_TS
|
|
348
352
|
|
|
349
|
-
**Immediately write `resolution-summary.md`** to `{TARGET_DIR}` using the Write tool. Do this now — not in Phase 9 — while results are fresh in context. This ensures the record is persisted even if later phases (
|
|
353
|
+
**Immediately write `resolution-summary.md`** to `{TARGET_DIR}` using the Write tool. Do this now — not in Phase 9 — while results are fresh in context. This ensures the record is persisted even if later phases (Polish, Verification Gate, CI gate, Tech Debt) trigger context compaction.
|
|
350
354
|
|
|
351
355
|
Set `Tracked` for FIX_SEPARATE and TECH_DEBT items to `(pending)` — to be backfilled after Phase 9 manage-debt (or `TRACEABILITY: DEGRADED ({reason})` if manage-debt degrades).
|
|
352
356
|
|
|
@@ -354,19 +358,19 @@ DUPLICATE issues are listed **only** in `## Duplicates` — never in `## Fixed I
|
|
|
354
358
|
|
|
355
359
|
Use the template from the Output Artifact section below.
|
|
356
360
|
|
|
357
|
-
### Phase 6:
|
|
361
|
+
### Phase 6: Polish
|
|
358
362
|
|
|
359
|
-
**Produces:**
|
|
363
|
+
**Produces:** POLISH_RESULT
|
|
360
364
|
**Requires:** CODE_AGENT_RESULTS
|
|
361
365
|
|
|
362
|
-
If any fixes were made, spawn
|
|
366
|
+
If any fixes were made, spawn Polish agent to refine the changed code:
|
|
363
367
|
|
|
364
368
|
```
|
|
365
|
-
Agent(subagent_type="
|
|
369
|
+
Agent(subagent_type="Polish", run_in_background=false):
|
|
366
370
|
"TASK_DESCRIPTION: Issue resolution fixes
|
|
367
371
|
WORKTREE_PATH: {worktree_path} (omit if cwd)
|
|
368
372
|
FILES_CHANGED: {list of files modified by Code agents}
|
|
369
|
-
|
|
373
|
+
Polish and refine the fixes for clarity and consistency
|
|
370
374
|
Commit any improvements with a conventional-commit message."
|
|
371
375
|
```
|
|
372
376
|
|
|
@@ -392,9 +396,9 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
|
|
|
392
396
|
1. Extract failure details from Validate agent output
|
|
393
397
|
2. Increment `validation_retry_count`
|
|
394
398
|
3. If `validation_retry_count <= 2`:
|
|
395
|
-
- Spawn
|
|
399
|
+
- Spawn Fix agent with fix context:
|
|
396
400
|
```
|
|
397
|
-
Agent(subagent_type="
|
|
401
|
+
Agent(subagent_type="Fix"):
|
|
398
402
|
"OPERATION: validation-fix
|
|
399
403
|
TASK_ID: resolve-{batch-id}-valfix-{count}
|
|
400
404
|
VALIDATION_FAILURES: {parsed failures from Validate agent}
|
|
@@ -412,7 +416,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
|
|
|
412
416
|
Record `## Verification` outcome in resolution-summary.md (runs unconditionally after the validation loop exits):
|
|
413
417
|
- Rewrite the `## Verification` section with | Command | Result | table + `Final gate: PASS | FAILED after N attempts`
|
|
414
418
|
|
|
415
|
-
Push all commits to remote once (Code and
|
|
419
|
+
Push all commits to remote once (Code and Fix agents ran with PUSH: false — runs whether the gate PASSED or FAILED, so the branch is always visible before Phase 9 or CI runs):
|
|
416
420
|
```bash
|
|
417
421
|
git -C {worktree} push
|
|
418
422
|
```
|
|
@@ -450,7 +454,7 @@ Phase 7 has pushed already, so this is a no-op unless the head moved since. `exi
|
|
|
450
454
|
3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to next phase.
|
|
451
455
|
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.
|
|
452
456
|
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.
|
|
453
|
-
6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="
|
|
457
|
+
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.
|
|
454
458
|
7. **Budget**: at most 3 waits and 2 fixes in all, per worktree. When one is spent, report the current status and proceed.
|
|
455
459
|
<!-- /PATTERN: ci-status-gate -->
|
|
456
460
|
|
|
@@ -560,19 +564,13 @@ Capture the Git agent's `**Publication**:` and `**Status**:` lines as `PR_COMMEN
|
|
|
560
564
|
|
|
561
565
|
**Step 9b-3: Refresh the test-plan evidence**
|
|
562
566
|
|
|
563
|
-
Run this step only when Step 9b-0 ran — the head moved — and its `EVIDENCE` line did not read `total:0` with `exceptions:none` (nothing to record); otherwise record `EVIDENCE_REFRESH` as `SKIPPED ({reason})`.
|
|
567
|
+
Run this step only when Step 9b-0 ran — the head moved — and its `EVIDENCE` line did not read `total:0` with `exceptions:none` (nothing to record); otherwise record `EVIDENCE_REFRESH` as `SKIPPED ({reason})`. Run the script inline — it is the whole `update-pr-evidence` operation, with no Git agent spawn — through the Bash tool with `timeout: 180000`:
|
|
564
568
|
|
|
565
|
-
```
|
|
566
|
-
|
|
567
|
-
"OPERATION: update-pr-evidence
|
|
568
|
-
PR_NUMBER: {pr_number}
|
|
569
|
-
EVIDENCE_FILE: {TARGET_DIR_REL}/evidence.md
|
|
570
|
-
REVIEW_PUBLICATION: {9b-2's publication mode}
|
|
571
|
-
WORKTREE_PATH: {worktree_path} (omit if cwd)
|
|
572
|
-
Refresh the PR's test-plan block and post its evidence comment."
|
|
569
|
+
```bash
|
|
570
|
+
cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" publish --pr {pr_number} --evidence "{TARGET_DIR_REL}/evidence.md" --publication {9b-2's publication mode}; echo "exit=$?"
|
|
573
571
|
```
|
|
574
572
|
|
|
575
|
-
|
|
573
|
+
Drop the `--evidence` pair when Step 9b-0 appended no claim. Run it only when `TARGET_DIR_REL` matches `^[A-Za-z0-9._/-]+$` — it carries the branch name, which a fork author picks — and `{pr_number}` is digits only; treat any other value as a failed run. The publication value is the mode 9b-2 reported on its `**Publication**:` line — `FULL…` → `full`, `STUB…` → `stub`, `OFF…` → `off` — else `{REVIEW_PUBLICATION}` as resolved in Step 0d. Capture its stdout as `EVIDENCE_REFRESH`: the `## PR Evidence` block's `EVIDENCE` line and its `**Body**:` / `**Comment**:` line, with any `TRACEABILITY: DEGRADED ({reason})` lines after them (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.
|
|
576
574
|
|
|
577
575
|
### Phase 9c: Merge Readiness (Report-only)
|
|
578
576
|
|
|
@@ -581,19 +579,17 @@ Omit the `EVIDENCE_FILE` line when Step 9b-0 appended no claim. `REVIEW_PUBLICAT
|
|
|
581
579
|
|
|
582
580
|
Run this phase only when `REQUIRE_NON_AUTHOR_APPROVAL` is `true`; otherwise skip it and report it as SKIPPED.
|
|
583
581
|
|
|
584
|
-
|
|
582
|
+
Run the script inline — it is the whole `check-merge-readiness` operation, with no Git agent spawn — through the Bash tool with `timeout: 180000`:
|
|
585
583
|
|
|
584
|
+
```bash
|
|
585
|
+
cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" readiness --pr {pr_number} --require-non-author-approval true; echo "exit=$?"
|
|
586
586
|
```
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
PR_NUMBER: {pr_number}
|
|
590
|
-
REQUIRE_NON_AUTHOR_APPROVAL: {REQUIRE_NON_AUTHOR_APPROVAL}
|
|
591
|
-
WORKTREE_PATH: {worktree_path} (omit if cwd)"
|
|
592
|
-
```
|
|
587
|
+
|
|
588
|
+
Pass `--require-non-author-approval true`: `REQUIRE_NON_AUTHOR_APPROVAL` is `true` here, or this phase would not run. `{pr_number}` is digits only. Its stdout is the `## Merge Readiness` block (exit 0), or the same block with `**Status**: DEGRADED ({reason})` and a `TRACEABILITY: DEGRADED ({reason})` line after it (exit 2); empty stdout or any other exit is `TRACEABILITY: DEGRADED (readiness unavailable)`.
|
|
593
589
|
|
|
594
590
|
Include merge readiness verdict (READY / NOT_READY / DEGRADED) and its `- Test plan:` detail line in Phase 10 report. Never block on this result — report-only.
|
|
595
591
|
|
|
596
|
-
If
|
|
592
|
+
If the script prints a `TRACEABILITY: DEGRADED` line: warn, proceed to Phase 10.
|
|
597
593
|
|
|
598
594
|
### Phase 10: Report
|
|
599
595
|
|
|
@@ -682,21 +678,17 @@ FEATURE_SLUG: {slug derived from primary changed directory, kebab-case}
|
|
|
682
678
|
FEATURE_NAME: {human-readable name}
|
|
683
679
|
DIRECTORIES: {list of primary directories touched by this workflow}
|
|
684
680
|
FILES_CHANGED: {list of files changed}
|
|
685
|
-
DECISIONS_CONTEXT: {
|
|
681
|
+
DECISIONS_CONTEXT: {the slice for these directories, else (none)}
|
|
686
682
|
|
|
687
683
|
Write the knowledge base to:
|
|
688
684
|
{worktree}/.devflow/features/{slug}/KNOWLEDGE.md
|
|
689
685
|
|
|
690
|
-
Then update the index cache
|
|
686
|
+
Then update the index cache:
|
|
691
687
|
{worktree}/.devflow/features/index.md
|
|
692
688
|
|
|
693
689
|
Index line format: `- **{slug}** — {areas} — {Use-when description}` — at most 300 characters, the description at most 220; reword a longer one, never cut it.
|
|
694
690
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
The frontmatter in KNOWLEDGE.md is the source of truth — index.md is only a cache. Write the two files directly — no intermediate result JSON files, no external scripts.
|
|
698
|
-
|
|
699
|
-
After writing, commit the two files to the current worktree branch yourself by running git via your Bash tool (do not use a script). Stage ONLY .devflow/features/index.md and .devflow/features/{slug}/KNOWLEDGE.md, then commit just those paths with a docs(knowledge): message. Do NOT push, do NOT force, do NOT stage anything else. Follow your Commit Protocol — it is non-blocking, so if any git step fails, report KB_COMMIT and finish normally."
|
|
691
|
+
Then commit the two files as your Commit Protocol directs."
|
|
700
692
|
```
|
|
701
693
|
|
|
702
694
|
**Step 4 — Surface an uncommitted knowledge base:**
|
|
@@ -711,44 +703,24 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
711
703
|
/resolve (orchestrator - spawns agents only)
|
|
712
704
|
│
|
|
713
705
|
├─ Phase 0: Worktree Discovery & Pre-flight
|
|
714
|
-
│ ├─ Step 0a: git worktree list → filter resolvable
|
|
715
|
-
│ ├─ Step 0b: Git agent (validate-branch) per worktree [parallel] ← + DIFF_FILES
|
|
716
|
-
│ ├─ Step 0c: Target latest review directory per worktree
|
|
717
|
-
│ └─ Step 0d: Load project decisions → DECISIONS_CONTEXT + EVIDENCE_POLICY + REVIEW_PUBLICATION
|
|
718
|
-
│
|
|
719
706
|
├─ Phase 1: Parse issues from TARGET_DIR + extract confidence %
|
|
720
|
-
│
|
|
721
707
|
├─ Phase 1b: Fetch external threads (evidence policy required)
|
|
722
|
-
│ └─ Git agent (fetch-review-threads) → THREAD_MAP
|
|
723
|
-
│
|
|
724
708
|
├─ Phase 2: Global Triage [Triage agent, opus, single agent]
|
|
725
|
-
│ └─ ALL issues → verdict ledger by disposition (incl. DUPLICATE with duplicate_of)
|
|
726
|
-
│
|
|
727
709
|
├─ Phase 3: Batch FIX_NOW issues (skip if empty; DUPLICATE issues never dispatched)
|
|
728
|
-
│ └─ same-file sequential, distinct-file parallel, max 5/batch
|
|
729
|
-
│
|
|
730
710
|
├─ Phase 4: Fix [Code agent × N, OPERATION: issue-fix, PUSH: false]
|
|
731
|
-
│ └─ Returns Verification block per batch
|
|
732
|
-
│
|
|
733
711
|
├─ Phase 5: Write resolution-summary.md (compaction safety; Tracked = "(pending)" or "(pending — TRACEABILITY: DEGRADED)" if manage-debt degrades)
|
|
734
|
-
|
|
735
|
-
├─ Phase
|
|
736
|
-
│
|
|
737
|
-
├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Code-fix agent validation-fix loop ≤2
|
|
738
|
-
│
|
|
712
|
+
├─ Phase 6: Polish [Polish agent]
|
|
713
|
+
├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Fix agent validation-fix loop ≤2
|
|
739
714
|
├─ Phase 8: CI Status Gate (conditional — skipped if no fixes or verification FAILED)
|
|
740
|
-
│ └─ push, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code-fix agent on FAILING (3 waits + 2 fixes per worktree)
|
|
741
|
-
│
|
|
742
715
|
├─ Phase 9: Git agent (manage-debt) — FIX_SEPARATE + TECH_DEBT → backfill Tracked={ISSUE_REF} (or TRACEABILITY: DEGRADED on failure)
|
|
743
|
-
│ SEQUENTIAL across worktrees
|
|
744
716
|
│
|
|
745
717
|
├─ Phase 9b: Thread resolution + resolution comment
|
|
746
718
|
│ ├─ Step 9b-0: verify-evidence.cjs --stale-out → ≤1 Test agent on the stale TPs (wrapped) — only after this run's push
|
|
747
719
|
│ ├─ Step 9b-1: Git agent (resolve-review-threads) — evidence policy required
|
|
748
720
|
│ ├─ Step 9b-2: Git agent (post-resolution-summary, REVIEW_PUBLICATION) — always-on
|
|
749
|
-
│ └─ Step 9b-3:
|
|
721
|
+
│ └─ Step 9b-3: verify-evidence.cjs publish (inline, no Git spawn) — only when the head moved
|
|
750
722
|
│
|
|
751
|
-
├─ Phase 9c:
|
|
723
|
+
├─ Phase 9c: verify-evidence.cjs readiness (inline, no Git spawn) — non-author approval required, report-only
|
|
752
724
|
│
|
|
753
725
|
└─ Phase 10: Display results (resolution-summary.md written in Phase 5)
|
|
754
726
|
```
|
|
@@ -762,21 +734,11 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
762
734
|
| Fix attempt fails | Revert changes, mark BLOCKED, continue others |
|
|
763
735
|
| Issue dependencies | Sequential chain, skip dependents if predecessor blocked |
|
|
764
736
|
| No actionable issues | Report "No issues to resolve" |
|
|
765
|
-
| Incomplete review directory (no review-summary.md) | Skip — resolve only targets complete reviews |
|
|
766
737
|
| Latest review already resolved | Check bug-analysis fallback (Step 0c-5b); if also absent, skip worktree and suggest `/code-review` or `/bug-analysis` |
|
|
767
|
-
| Legacy flat layout (no subdirectories) | Read flat *.md files directly (backwards compatible) |
|
|
768
738
|
| `--review {timestamp}` in multi-worktree mode | Not supported — use `--path` + `--review` to target specific worktree + review |
|
|
769
|
-
| Worktree pre-flight fails | Report failure, continue with other worktrees |
|
|
770
|
-
| Empty FIX_NOW list | Skip Phases 3-4/6-8; still write full summary + run manage-debt if FIX_SEPARATE/TECH_DEBT exist |
|
|
771
|
-
| ESCALATED security issues | Surfaced in ## Escalations + display callout; never routed to manage-debt |
|
|
772
|
-
| DUPLICATE verdict without duplicate_of, or chained to another DUPLICATE | Treated as Triage failure — same retry-then-abort as a vanished id |
|
|
773
|
-
| DUPLICATE issues in THREAD_MAP | Map ext-{N} to primary's verdict/verification status for thread reply |
|
|
774
|
-
| Verification Gate FAILED after 2 attempts | Recorded as FAILED in ## Verification + blocking callout; CI gate skipped; proceed to Phase 9 (manage-debt) then Phase 10 (display) |
|
|
775
739
|
| gh/GitHub absent | manage-debt degrades (`TRACEABILITY: DEGRADED ({reason})`); Tracked stays `(pending — TRACEABILITY: DEGRADED ({reason}))` — recorded, not dropped |
|
|
776
740
|
| `EVIDENCE_POLICY` is `standard` | Phases 1b and 9b-step-1 are skipped; post-resolution-summary (Phase 9b step 2) still runs if a PR is known |
|
|
777
741
|
| `REQUIRE_NON_AUTHOR_APPROVAL` is `false` | Phase 9c is skipped and reported as SKIPPED |
|
|
778
|
-
| THREAD_MAP empty or DEGRADED | Phase 9b-1 skipped; resolution comment (Phase 9b-2) still posted if PR known |
|
|
779
|
-
| No PR exists for post-resolution-summary | Git agent returns TRACEABILITY: DEGRADED; resolution-summary.md already on disk — not a blocker |
|
|
780
742
|
| Public repo (`auto` mode) | Git agent probes visibility, posts counts-only STUB comment; full resolution report stays local |
|
|
781
743
|
| `reviewPublication: off` | Git agent skips posting the resolution comment (OFF) — except that, only when `EVIDENCE_POLICY` is `required`, Step 0d passes `stub` and a counts-only STUB comment posts |
|
|
782
744
|
| Fork PR this run cannot push to (no maintainer edits, no push access of its own) | validate-branch emits `TRACEABILITY: DEGRADED (cannot push to fork)` → `fork_no_push`: Phase 7 skips the push, Phase 8 is skipped, 9b-1 records FIXED threads as DEGRADED instead of citing unpushed commits; 9b-2 still posts the resolution comment; the head did not move, so 9b-0 and 9b-3 are skipped |
|
|
@@ -787,14 +749,8 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
787
749
|
|
|
788
750
|
1. **Orchestration only** - Command spawns agents, doesn't do git/resolve work itself
|
|
789
751
|
2. **No agent grades its own homework** - Triage agent validates, Code agents fix, Validate agent verifies
|
|
790
|
-
3. **
|
|
791
|
-
4. **
|
|
792
|
-
5. **Parallel execution** - Distinct-file Code agent batches run in parallel; same-file batches sequential
|
|
793
|
-
6. **Honest reporting** - Verification failure is recorded and displayed, never silenced
|
|
794
|
-
7. **Complete tracking** - Every issue gets exactly one verdict in the ledger
|
|
795
|
-
8. **Latest review by default** - Only process the most recent complete review
|
|
796
|
-
9. **Auto-discover worktrees** - One command handles all resolvable branches
|
|
797
|
-
10. **Traceability-aware** - Policy-gated ops (thread fetch/resolve, merge readiness) are skipped cleanly when the evidence policy does not ask for them; resolution comment (Phase 9b-2) is always-on; test-plan evidence is re-verified (≤1 Test agent) and refreshed only when this run moved the head (Steps 9b-0, 9b-3)
|
|
752
|
+
3. **Git agent for git work** - All git operations go through Git agent; the CI wait, the evidence refresh and the merge-readiness check are inline scripts (plumbing, no model work)
|
|
753
|
+
4. **Traceability-aware** - Policy-gated ops (thread fetch/resolve, merge readiness) are skipped cleanly when the evidence policy does not ask for them; resolution comment (Phase 9b-2) is always-on; test-plan evidence is re-verified (≤1 Test agent) and refreshed only when this run moved the head (Steps 9b-0, 9b-3)
|
|
798
754
|
|
|
799
755
|
## Output Artifact
|
|
800
756
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Self-review workflow -
|
|
2
|
+
description: Self-review workflow - Polish agent (code clarity) then Harden agent (9-pillar quality gate)
|
|
3
3
|
---
|
|
4
4
|
# Self-Review Command
|
|
5
5
|
|
|
6
|
-
Run
|
|
6
|
+
Run Polish agent and Harden agent sequentially on changed files for post-implementation quality refinement.
|
|
7
7
|
|
|
8
8
|
## Usage
|
|
9
9
|
|
|
@@ -22,7 +22,7 @@ Detect changed files and build context:
|
|
|
22
22
|
2. Else run `git diff --name-only HEAD` + `git diff --name-only --cached` to get staged + unstaged
|
|
23
23
|
3. If no changes found, report "No changes to review" and exit
|
|
24
24
|
4. Build TASK_DESCRIPTION from recent commit messages or branch name
|
|
25
|
-
5. Record `HEAD_BEFORE` (`git rev-parse HEAD`) now, before
|
|
25
|
+
5. Record `HEAD_BEFORE` (`git rev-parse HEAD`) now, before Polish runs — Phase 3 compares against it
|
|
26
26
|
|
|
27
27
|
**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:
|
|
28
28
|
|
|
@@ -30,27 +30,27 @@ Detect changed files and build context:
|
|
|
30
30
|
node "$HOME/.devflow/scripts/resolve-settings.cjs" "{root}" 2>/dev/null; echo "exit=$?"
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
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.
|
|
33
|
+
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> GATE_LEVEL=<full|standard|lean>` — 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 GATE_LEVEL=full` instead.
|
|
34
34
|
|
|
35
|
-
The accepted line is the only source of these values
|
|
35
|
+
The accepted line is the only source of these values.
|
|
36
36
|
|
|
37
37
|
### Load DECISIONS_CONTEXT
|
|
38
38
|
|
|
39
39
|
When the settings line says `LEARNING=off`, set `DECISIONS_CONTEXT` to `(none)` and skip this step, locating no ledger and reading no index.
|
|
40
40
|
|
|
41
|
-
The decisions ledger belongs to the repository, not to one checkout:
|
|
41
|
+
The decisions ledger belongs to the repository, not to one checkout: a linked worktree reads the main worktree's copy, a subdirectory session the repository root's. Locate it with ONE git call, run from the start directory — `WORKTREE_PATH` if provided, otherwise cwd (`devflow:worktree-support`):
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
44
|
git -C "{start}" rev-parse --path-format=absolute --show-toplevel --git-common-dir
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
Line 1 is the checkout's toplevel, line 2 the
|
|
47
|
+
Line 1 is the checkout's toplevel, line 2 the common git directory. A git older than 2.31 echoes `--path-format=absolute` back as a line of its own first. `{ledger}` is the first that applies:
|
|
48
48
|
|
|
49
49
|
1. **The main worktree** — line 2 without its trailing `/.git`, when the output is exactly two lines each beginning with `/`, line 2 ends in `/.git`, and the directory left once it is removed is not your home directory and contains a `.devflow/` directory.
|
|
50
50
|
2. **The toplevel** — line 1, or on an older git the line after the echoed flag.
|
|
51
51
|
3. **The start directory itself** — when the command failed or printed no absolute toplevel (outside a git repository).
|
|
52
52
|
|
|
53
|
-
This is the rule the learning hooks apply
|
|
53
|
+
This is the rule the learning hooks apply, so you read the index the Curate agent writes.
|
|
54
54
|
|
|
55
55
|
**Step 1 — Read the pre-rendered index:**
|
|
56
56
|
|
|
@@ -59,13 +59,17 @@ Attempt to read `{ledger}/.devflow/learning/index.md`.
|
|
|
59
59
|
- If the file exists and contains non-empty content: use that content as `DECISIONS_CONTEXT`.
|
|
60
60
|
- If the file is absent or empty: set `DECISIONS_CONTEXT` to `(none)`.
|
|
61
61
|
|
|
62
|
-
The index is one direct file read, written at render time by `render-decisions.cjs`
|
|
62
|
+
The index is one direct file read, written at render time by `render-decisions.cjs` — no `.cjs` script runs here.
|
|
63
63
|
|
|
64
|
-
**Step 2 —
|
|
64
|
+
**Step 2 — Slice the index, then hand it on:**
|
|
65
65
|
|
|
66
|
-
When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it.
|
|
66
|
+
When `DECISIONS_CONTEXT` is not `(none)`, hand it only to the agents whose contract declares it.
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
Hand each agent that takes `DECISIONS_CONTEXT` a slice, not the whole index: the index lines whose title, scope or area touch the files and task it works on, verbatim, led by `(slice: N of M entries — full index: <absolute index path>)` and closed by the index footer. When unsure, include the line. Siblings over one diff share ONE slice.
|
|
69
|
+
|
|
70
|
+
Those agents follow `devflow:apply-decisions`. A host that uses the index in its own thread says so in its own step.
|
|
71
|
+
|
|
72
|
+
Pass `DECISIONS_CONTEXT` to Harden agent — the compact index lists active ADR/PF entries; Harden agent uses `devflow:apply-decisions` to Read full entry bodies on demand. Known pitfalls help identify reintroduced issues, prior decisions help validate architectural consistency. (Polish agent does not consume decisions — it operates at code-shape level and Harden agent runs after to catch any architectural drift.)
|
|
69
73
|
|
|
70
74
|
### Load Feature Knowledge
|
|
71
75
|
|
|
@@ -89,7 +93,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
|
|
|
89
93
|
|
|
90
94
|
**Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
|
|
91
95
|
|
|
92
|
-
Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
|
|
96
|
+
Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
|
|
93
97
|
|
|
94
98
|
**Step 3 — Pick relevant KBs:**
|
|
95
99
|
|
|
@@ -120,35 +124,35 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
|
|
|
120
124
|
|
|
121
125
|
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)`.
|
|
122
126
|
|
|
123
|
-
**One git call, then direct reads — no `.cjs` script.**
|
|
127
|
+
**One git call, then direct reads — no `.cjs` script.**
|
|
124
128
|
|
|
125
|
-
Pass `FEATURE_KNOWLEDGE_RULES` to
|
|
129
|
+
Pass `FEATURE_KNOWLEDGE_RULES` to Harden agent.
|
|
126
130
|
|
|
127
131
|
**Extract:** FILES_CHANGED (list), TASK_DESCRIPTION (string), DECISIONS_CONTEXT (string, optional), FEATURE_KNOWLEDGE (string, optional), FEATURE_KNOWLEDGE_RULES (string, optional), HEAD_BEFORE (40-hex SHA)
|
|
128
132
|
|
|
129
|
-
### Phase 1:
|
|
133
|
+
### Phase 1: Polish agent (Code Refinement)
|
|
130
134
|
|
|
131
|
-
**Produces:**
|
|
135
|
+
**Produces:** POLISH_COMMITS
|
|
132
136
|
**Requires:** FILES_CHANGED, TASK_DESCRIPTION
|
|
133
137
|
|
|
134
|
-
Spawn
|
|
138
|
+
Spawn Polish agent to refine code for clarity and consistency:
|
|
135
139
|
|
|
136
|
-
Agent(subagent_type="
|
|
140
|
+
Agent(subagent_type="Polish", run_in_background=false):
|
|
137
141
|
"TASK_DESCRIPTION: {task_description}
|
|
138
142
|
FILES_CHANGED: {files_changed}
|
|
139
|
-
|
|
143
|
+
Polish and refine the code for clarity and consistency while preserving functionality.
|
|
140
144
|
Commit any improvements with a conventional-commit message."
|
|
141
145
|
|
|
142
|
-
**Wait for completion.**
|
|
146
|
+
**Wait for completion.** Polish agent commits changes directly.
|
|
143
147
|
|
|
144
|
-
### Phase 2:
|
|
148
|
+
### Phase 2: Harden agent (9-Pillar Quality Gate)
|
|
145
149
|
|
|
146
|
-
**Produces:**
|
|
150
|
+
**Produces:** HARDEN_STATUS
|
|
147
151
|
**Requires:** FILES_CHANGED, TASK_DESCRIPTION, DECISIONS_CONTEXT
|
|
148
152
|
|
|
149
|
-
Spawn
|
|
153
|
+
Spawn Harden agent for quality evaluation and fixing:
|
|
150
154
|
|
|
151
|
-
Agent(subagent_type="
|
|
155
|
+
Agent(subagent_type="Harden", run_in_background=false):
|
|
152
156
|
"TASK_DESCRIPTION: {task_description}
|
|
153
157
|
FILES_CHANGED: {files_changed}
|
|
154
158
|
DECISIONS_CONTEXT: {decisions_context}
|
|
@@ -162,11 +166,11 @@ Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE. Skip if (none)."
|
|
|
162
166
|
### Phase 3: Conditional Validation
|
|
163
167
|
|
|
164
168
|
**Produces:** VALIDATION_RESULT
|
|
165
|
-
**Requires:** HEAD_BEFORE,
|
|
169
|
+
**Requires:** HEAD_BEFORE, HARDEN_STATUS
|
|
166
170
|
|
|
167
171
|
If STATUS is BLOCKED, skip this phase: the report (Phase 4) names the blocker.
|
|
168
172
|
|
|
169
|
-
Run this phase only if HEAD moved — `git rev-parse HEAD` differs from `HEAD_BEFORE`, meaning
|
|
173
|
+
Run this phase only if HEAD moved — `git rev-parse HEAD` differs from `HEAD_BEFORE`, meaning Polish or Harden committed (Polish alone counts, whatever Harden's STATUS is). Otherwise skip it. Its scope is changed-only over what the two agents changed:
|
|
170
174
|
|
|
171
175
|
Agent(subagent_type="Validate", run_in_background=false):
|
|
172
176
|
"FILES_CHANGED: {output of `git diff --name-only HEAD_BEFORE..HEAD`}
|
|
@@ -178,7 +182,7 @@ Run build, typecheck, lint, test on modified files"
|
|
|
178
182
|
|
|
179
183
|
### Phase 4: Report
|
|
180
184
|
|
|
181
|
-
**Requires:**
|
|
185
|
+
**Requires:** HARDEN_STATUS, VALIDATION_RESULT
|
|
182
186
|
|
|
183
187
|
Display summary:
|
|
184
188
|
|
|
@@ -187,10 +191,10 @@ Display summary:
|
|
|
187
191
|
**Files Reviewed**: {n}
|
|
188
192
|
**Status**: {PASS|FIXED|BLOCKED}
|
|
189
193
|
|
|
190
|
-
###
|
|
194
|
+
### Polish agent
|
|
191
195
|
- {n} files refined for clarity
|
|
192
196
|
|
|
193
|
-
###
|
|
197
|
+
### Harden agent (9-Pillar Evaluation)
|
|
194
198
|
| Pillar | Status |
|
|
195
199
|
|--------|--------|
|
|
196
200
|
| Design | {status} |
|
|
@@ -240,21 +244,17 @@ FEATURE_SLUG: {slug derived from primary changed directory, kebab-case}
|
|
|
240
244
|
FEATURE_NAME: {human-readable name}
|
|
241
245
|
DIRECTORIES: {list of primary directories touched by this workflow}
|
|
242
246
|
FILES_CHANGED: {list of files changed}
|
|
243
|
-
DECISIONS_CONTEXT: {
|
|
247
|
+
DECISIONS_CONTEXT: {the slice for these directories, else (none)}
|
|
244
248
|
|
|
245
249
|
Write the knowledge base to:
|
|
246
250
|
{worktree}/.devflow/features/{slug}/KNOWLEDGE.md
|
|
247
251
|
|
|
248
|
-
Then update the index cache
|
|
252
|
+
Then update the index cache:
|
|
249
253
|
{worktree}/.devflow/features/index.md
|
|
250
254
|
|
|
251
255
|
Index line format: `- **{slug}** — {areas} — {Use-when description}` — at most 300 characters, the description at most 220; reword a longer one, never cut it.
|
|
252
256
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
The frontmatter in KNOWLEDGE.md is the source of truth — index.md is only a cache. Write the two files directly — no intermediate result JSON files, no external scripts.
|
|
256
|
-
|
|
257
|
-
After writing, commit the two files to the current worktree branch yourself by running git via your Bash tool (do not use a script). Stage ONLY .devflow/features/index.md and .devflow/features/{slug}/KNOWLEDGE.md, then commit just those paths with a docs(knowledge): message. Do NOT push, do NOT force, do NOT stage anything else. Follow your Commit Protocol — it is non-blocking, so if any git step fails, report KB_COMMIT and finish normally."
|
|
257
|
+
Then commit the two files as your Commit Protocol directs."
|
|
258
258
|
```
|
|
259
259
|
|
|
260
260
|
**Step 4 — Surface an uncommitted knowledge base:**
|
|
@@ -272,14 +272,14 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
272
272
|
│ ├─ Record HEAD_BEFORE
|
|
273
273
|
│ └─ Read index.md → DECISIONS_CONTEXT
|
|
274
274
|
│
|
|
275
|
-
├─ Phase 1:
|
|
275
|
+
├─ Phase 1: Polish agent
|
|
276
276
|
│ └─ Code refinement (commits directly)
|
|
277
277
|
│
|
|
278
|
-
├─ Phase 2:
|
|
278
|
+
├─ Phase 2: Harden agent
|
|
279
279
|
│ └─ 9-pillar quality gate (may fix and commit)
|
|
280
280
|
│
|
|
281
281
|
├─ Phase 3: Validate agent (conditional)
|
|
282
|
-
│ └─ If HEAD moved since HEAD_BEFORE (
|
|
282
|
+
│ └─ If HEAD moved since HEAD_BEFORE (Polish or Harden committed), changed-only Validate over HEAD_BEFORE..HEAD
|
|
283
283
|
│
|
|
284
284
|
└─ Phase 4: Report
|
|
285
285
|
└─ Display summary with pillar status
|
|
@@ -289,15 +289,15 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
|
|
|
289
289
|
| Case | Handling |
|
|
290
290
|
|------|----------|
|
|
291
291
|
| No changes | Report "No changes to review" and exit |
|
|
292
|
-
|
|
|
293
|
-
|
|
|
292
|
+
| Polish agent finds nothing | Normal, continue to Harden agent |
|
|
293
|
+
| Harden agent BLOCKED | Report blocking issue, halt workflow |
|
|
294
294
|
| Validation fails | Report failures, halt (don't create broken state) |
|
|
295
295
|
| Not in git repo | Report error, suggest running in git repo |
|
|
296
296
|
|
|
297
297
|
## Principles
|
|
298
298
|
|
|
299
299
|
1. **Orchestration only** - Command spawns agents, doesn't do the work
|
|
300
|
-
2. **Sequential execution** -
|
|
301
|
-
3. **Validation gate** - If
|
|
300
|
+
2. **Sequential execution** - Polish agent must complete before Harden agent
|
|
301
|
+
3. **Validation gate** - If Polish agent or Harden agent committed, the changes must pass validation
|
|
302
302
|
4. **Honest reporting** - Display actual agent outputs
|
|
303
303
|
5. **Fail fast** - Stop on BLOCKED or validation failure
|