devflow-kit 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +4 -4
  3. package/dist/agents/{diagnose.md → debug.md} +4 -4
  4. package/dist/agents/{code-fix.md → fix.md} +2 -2
  5. package/dist/agents/{scrutinize.md → harden.md} +6 -6
  6. package/dist/agents/{code-edit.md → refactor.md} +3 -3
  7. package/dist/cli/agents-view/render.js +1 -1
  8. package/dist/cli/commands/init.js +3 -3
  9. package/dist/cli/commands/learning.js +12 -12
  10. package/dist/cli/commands/legacy-hooks.js +1 -1
  11. package/dist/cli/commands/uninstall.js +111 -5
  12. package/dist/commands/bug-analysis.md +19 -15
  13. package/dist/commands/code-review.md +13 -22
  14. package/dist/commands/debug.md +15 -15
  15. package/dist/commands/dynamic-build.md +51 -55
  16. package/dist/commands/dynamic-plan.md +11 -9
  17. package/dist/commands/dynamic-profile.md +7 -5
  18. package/dist/commands/dynamic-tickets.md +11 -9
  19. package/dist/commands/explore.md +13 -13
  20. package/dist/commands/implement.md +58 -127
  21. package/dist/commands/plan.md +19 -41
  22. package/dist/commands/release.md +9 -5
  23. package/dist/commands/research.md +12 -8
  24. package/dist/commands/resolve.md +42 -86
  25. package/dist/commands/self-review.md +42 -42
  26. package/dist/core/agent-models.js +47 -11
  27. package/dist/core/{learning-tuning-config.js → curate-tuning-config.js} +14 -14
  28. package/dist/core/learning-queue-cleanup.js +1 -1
  29. package/dist/core/migrations.js +63 -44
  30. package/dist/core/plugins.js +14 -12
  31. package/dist/core/project-paths.js +3 -3
  32. package/dist/hud/codex-usage.js +247 -0
  33. package/dist/hud/components/codex-quota.js +37 -0
  34. package/dist/hud/components/usage-quota.js +1 -1
  35. package/dist/hud/config.js +1 -0
  36. package/dist/hud/index.js +16 -3
  37. package/dist/hud/render.js +3 -1
  38. package/dist/learning-off/agents/{diagnose.md → debug.md} +4 -4
  39. package/dist/learning-off/agents/{code-fix.md → fix.md} +2 -2
  40. package/dist/learning-off/agents/{scrutinize.md → harden.md} +6 -6
  41. package/dist/learning-off/agents/{code-edit.md → refactor.md} +3 -3
  42. package/dist/learning-off/commands/bug-analysis.md +9 -9
  43. package/dist/learning-off/commands/code-review.md +2 -15
  44. package/dist/learning-off/commands/debug.md +4 -8
  45. package/dist/learning-off/commands/dynamic-build.md +45 -51
  46. package/dist/learning-off/commands/dynamic-plan.md +5 -5
  47. package/dist/learning-off/commands/dynamic-profile.md +1 -1
  48. package/dist/learning-off/commands/dynamic-tickets.md +5 -5
  49. package/dist/learning-off/commands/explore.md +2 -6
  50. package/dist/learning-off/commands/implement.md +46 -119
  51. package/dist/learning-off/commands/plan.md +8 -33
  52. package/dist/learning-off/commands/release.md +4 -2
  53. package/dist/learning-off/commands/research.md +2 -2
  54. package/dist/learning-off/commands/resolve.md +31 -79
  55. package/dist/learning-off/commands/self-review.md +30 -34
  56. package/dist/skills/git/references/pr/check-merge-readiness.md +2 -0
  57. package/dist/skills/git/references/pr/update-pr-evidence.md +4 -6
  58. package/dist/targets/claude-code/installer.js +117 -84
  59. package/dist/targets/claude-code/tracker-servers.js +1 -1
  60. package/package.json +1 -1
  61. package/src/assets/agents/_partials/_code.mds +2 -2
  62. package/src/assets/agents/code.mds +2 -2
  63. package/src/assets/agents/{learning.md → curate.md} +4 -4
  64. package/src/assets/agents/{diagnose.mds → debug.mds} +4 -4
  65. package/src/assets/agents/evaluate.md +4 -4
  66. package/src/assets/agents/{code-fix.mds → fix.mds} +5 -5
  67. package/src/assets/agents/{scrutinize.mds → harden.mds} +6 -6
  68. package/src/assets/agents/{simplify.md → polish.md} +4 -4
  69. package/src/assets/agents/{code-edit.mds → refactor.mds} +6 -6
  70. package/src/assets/agents/test.md +2 -2
  71. package/src/assets/commands/_partials/_compliance.mds +1 -1
  72. package/src/assets/commands/_partials/_decisions.mds +26 -6
  73. package/src/assets/commands/_partials/_engine.mds +15 -15
  74. package/src/assets/commands/_partials/_evidence_policy.mds +0 -17
  75. package/src/assets/commands/_partials/_knowledge.mds +14 -9
  76. package/src/assets/commands/_partials/_preamble.mds +4 -2
  77. package/src/assets/commands/_partials/_roster.mds +4 -4
  78. package/src/assets/commands/bug-analysis.mds +7 -7
  79. package/src/assets/commands/code-review.mds +1 -14
  80. package/src/assets/commands/debug.mds +2 -2
  81. package/src/assets/commands/dynamic-build.mds +26 -32
  82. package/src/assets/commands/implement.mds +45 -102
  83. package/src/assets/commands/plan.mds +7 -37
  84. package/src/assets/commands/release.mds +5 -1
  85. package/src/assets/commands/resolve.mds +28 -76
  86. package/src/assets/commands/self-review.mds +27 -27
  87. package/src/assets/mds/git/_pr.mds +6 -6
  88. package/src/assets/scripts/hooks/assets/orchestrator-charter.md +4 -3
  89. package/src/assets/scripts/hooks/capture-prompt +1 -1
  90. package/src/assets/scripts/hooks/capture-question +1 -1
  91. package/src/assets/scripts/hooks/capture-turn +1 -1
  92. package/src/assets/scripts/hooks/json-helper.cjs +2 -2
  93. package/src/assets/scripts/hooks/lib/learning-store.cjs +1 -1
  94. package/src/assets/scripts/hooks/lib/project-paths.cjs +4 -4
  95. package/src/assets/scripts/hooks/preamble +1 -1
  96. package/src/assets/scripts/hooks/session-start-context +58 -45
  97. package/src/assets/scripts/verify-evidence.cjs +726 -9
  98. package/src/assets/skills/agent-references/SKILL.md +9 -5
  99. package/src/assets/skills/agent-references/references/commands/implement-evidence-asks.md +35 -0
  100. package/src/assets/skills/agent-references/references/commands/implement-revalidate.md +15 -0
  101. package/src/assets/skills/agent-references/references/synthesize/bug-analysis.md +1 -1
  102. package/src/assets/skills/apply-decisions/SKILL.md +6 -4
  103. package/src/assets/skills/docs-framework/SKILL.md +3 -3
  104. package/src/assets/skills/qa/SKILL.md +1 -1
  105. package/src/assets/skills/quality-gates/SKILL.md +7 -7
  106. package/src/assets/skills/quality-gates/references/report-template.md +7 -7
  107. /package/src/assets/skills/agent-references/references/{learning → curate}/maintain.md +0 -0
@@ -120,7 +120,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
120
120
 
121
121
  **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
122
122
 
123
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters). The frontmatter fields `name`, `description`, and `directories` are the authoritative relevance surface — `index.md` is only a cache.
123
+ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
124
124
 
125
125
  **Step 3 — Pick relevant KBs:**
126
126
 
@@ -151,7 +151,7 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
151
151
 
152
152
  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)`.
153
153
 
154
- **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.
154
+ **One git call, then direct reads — no `.cjs` script.**
155
155
 
156
156
  Pass `FEATURE_KNOWLEDGE` to the Triage agent in Phase 2.
157
157
 
@@ -177,7 +177,7 @@ Resolve this per worktree — unlike the evidence policy above, the settings lin
177
177
 
178
178
  > 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.
179
179
 
180
- Set it per worktree, from that worktree's lens, and pass that worktree's `COMPLIANCE_DIRECTIVE` to each of its Code and Code-fix spawns, on a line of its own.
180
+ 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.
181
181
 
182
182
  **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.
183
183
 
@@ -308,7 +308,7 @@ Collect from each Code agent:
308
308
  **Produces:** RESOLUTION_FILE (early write for compaction safety)
309
309
  **Requires:** TRIAGE_RESULTS, CODE_AGENT_RESULTS, TARGET_DIR, TARGET_DIR_REL, BRANCH_INFO, RESOLUTION_TS
310
310
 
311
- **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 (Simplify, Verification Gate, CI gate, Tech Debt) trigger context compaction.
311
+ **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.
312
312
 
313
313
  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).
314
314
 
@@ -316,19 +316,19 @@ DUPLICATE issues are listed **only** in `## Duplicates` — never in `## Fixed I
316
316
 
317
317
  Use the template from the Output Artifact section below.
318
318
 
319
- ### Phase 6: Simplify
319
+ ### Phase 6: Polish
320
320
 
321
- **Produces:** SIMPLIFICATION_RESULT
321
+ **Produces:** POLISH_RESULT
322
322
  **Requires:** CODE_AGENT_RESULTS
323
323
 
324
- If any fixes were made, spawn Simplify agent to refine the changed code:
324
+ If any fixes were made, spawn Polish agent to refine the changed code:
325
325
 
326
326
  ```
327
- Agent(subagent_type="Simplify", run_in_background=false):
327
+ Agent(subagent_type="Polish", run_in_background=false):
328
328
  "TASK_DESCRIPTION: Issue resolution fixes
329
329
  WORKTREE_PATH: {worktree_path} (omit if cwd)
330
330
  FILES_CHANGED: {list of files modified by Code agents}
331
- Simplify and refine the fixes for clarity and consistency
331
+ Polish and refine the fixes for clarity and consistency
332
332
  Commit any improvements with a conventional-commit message."
333
333
  ```
334
334
 
@@ -354,9 +354,9 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
354
354
  1. Extract failure details from Validate agent output
355
355
  2. Increment `validation_retry_count`
356
356
  3. If `validation_retry_count <= 2`:
357
- - Spawn Code-fix agent with fix context:
357
+ - Spawn Fix agent with fix context:
358
358
  ```
359
- Agent(subagent_type="Code-fix"):
359
+ Agent(subagent_type="Fix"):
360
360
  "OPERATION: validation-fix
361
361
  TASK_ID: resolve-{batch-id}-valfix-{count}
362
362
  VALIDATION_FAILURES: {parsed failures from Validate agent}
@@ -373,7 +373,7 @@ Run build, typecheck, lint, test. Report pass/fail with failure details."
373
373
  Record `## Verification` outcome in resolution-summary.md (runs unconditionally after the validation loop exits):
374
374
  - Rewrite the `## Verification` section with | Command | Result | table + `Final gate: PASS | FAILED after N attempts`
375
375
 
376
- Push all commits to remote once (Code and Code-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):
376
+ 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):
377
377
  ```bash
378
378
  git -C {worktree} push
379
379
  ```
@@ -411,7 +411,7 @@ Phase 7 has pushed already, so this is a no-op unless the head moved since. `exi
411
411
  3. **If NO_PR or NO_CI** → skip: "No PR/CI configured, skipping CI validation." Proceed to next phase.
412
412
  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.
413
413
  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.
414
- 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` 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.
414
+ 6. **If FAILING** and fewer than 2 fixes have run → report the failing checks from the line. Spawn `Agent(subagent_type="Fix")` whose prompt opens with `OPERATION: ci-fix`, with `COMPLIANCE_DIRECTIVE` (when it is not empty), `CI_FAILURES` and `PUSH: false`; `CI_FAILURES` holds the failing-check names from the line and nothing else, because the Fix agent fetches the full names and reads the logs itself and this command reads none. After a fix, push with the command above and, if a wait remains, wait again (step 1); a failed push records `TRACEABILITY: DEGRADED (ci push failed)`, reports "CI status unknown — verify manually before merging" and stops waiting. After the second fix still FAILING → report the failing checks and proceed.
415
415
  7. **Budget**: at most 3 waits and 2 fixes in all, per worktree. When one is spent, report the current status and proceed.
416
416
  <!-- /PATTERN: ci-status-gate -->
417
417
 
@@ -521,19 +521,13 @@ Capture the Git agent's `**Publication**:` and `**Status**:` lines as `PR_COMMEN
521
521
 
522
522
  **Step 9b-3: Refresh the test-plan evidence**
523
523
 
524
- 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})`. Spawn Git agent:
524
+ 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`:
525
525
 
526
- ```
527
- Agent(subagent_type="Git"):
528
- "OPERATION: update-pr-evidence
529
- PR_NUMBER: {pr_number}
530
- EVIDENCE_FILE: {TARGET_DIR_REL}/evidence.md
531
- REVIEW_PUBLICATION: {9b-2's publication mode}
532
- WORKTREE_PATH: {worktree_path} (omit if cwd)
533
- Refresh the PR's test-plan block and post its evidence comment."
526
+ ```bash
527
+ 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=$?"
534
528
  ```
535
529
 
536
- Omit the `EVIDENCE_FILE` line when Step 9b-0 appended no claim. `REVIEW_PUBLICATION` 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 `EVIDENCE` line and its `**Body**:` / `**Comment**:` line, or its `TRACEABILITY: DEGRADED ({reason})` line, as `EVIDENCE_REFRESH`. It never blocks.
530
+ 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.
537
531
 
538
532
  ### Phase 9c: Merge Readiness (Report-only)
539
533
 
@@ -542,19 +536,17 @@ Omit the `EVIDENCE_FILE` line when Step 9b-0 appended no claim. `REVIEW_PUBLICAT
542
536
 
543
537
  Run this phase only when `REQUIRE_NON_AUTHOR_APPROVAL` is `true`; otherwise skip it and report it as SKIPPED.
544
538
 
545
- Spawn Git agent:
539
+ Run the script inline — it is the whole `check-merge-readiness` operation, with no Git agent spawn — through the Bash tool with `timeout: 180000`:
546
540
 
541
+ ```bash
542
+ cd {worktree} && node "$HOME/.devflow/scripts/verify-evidence.cjs" readiness --pr {pr_number} --require-non-author-approval true; echo "exit=$?"
547
543
  ```
548
- Agent(subagent_type="Git"):
549
- "OPERATION: check-merge-readiness
550
- PR_NUMBER: {pr_number}
551
- REQUIRE_NON_AUTHOR_APPROVAL: {REQUIRE_NON_AUTHOR_APPROVAL}
552
- WORKTREE_PATH: {worktree_path} (omit if cwd)"
553
- ```
544
+
545
+ 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)`.
554
546
 
555
547
  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.
556
548
 
557
- If Git agent returns `TRACEABILITY: DEGRADED`: warn, proceed to Phase 10.
549
+ If the script prints a `TRACEABILITY: DEGRADED` line: warn, proceed to Phase 10.
558
550
 
559
551
  ### Phase 10: Report
560
552
 
@@ -647,16 +639,12 @@ FILES_CHANGED: {list of files changed}
647
639
  Write the knowledge base to:
648
640
  {worktree}/.devflow/features/{slug}/KNOWLEDGE.md
649
641
 
650
- Then update the index cache by performing a read-modify-write on:
642
+ Then update the index cache:
651
643
  {worktree}/.devflow/features/index.md
652
644
 
653
645
  Index line format: `- **{slug}** — {areas} — {Use-when description}` — at most 300 characters, the description at most 220; reword a longer one, never cut it.
654
646
 
655
- 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.
656
-
657
- 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.
658
-
659
- 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."
647
+ Then commit the two files as your Commit Protocol directs."
660
648
  ```
661
649
 
662
650
  **Step 4 — Surface an uncommitted knowledge base:**
@@ -671,44 +659,24 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
671
659
  /resolve (orchestrator - spawns agents only)
672
660
  │
673
661
  ├─ Phase 0: Worktree Discovery & Pre-flight
674
- │ ├─ Step 0a: git worktree list → filter resolvable
675
- │ ├─ Step 0b: Git agent (validate-branch) per worktree [parallel] ← + DIFF_FILES
676
- │ ├─ Step 0c: Target latest review directory per worktree
677
- │ └─ Step 0d: Load project context → EVIDENCE_POLICY + REVIEW_PUBLICATION
678
- │
679
662
  ├─ Phase 1: Parse issues from TARGET_DIR + extract confidence %
680
- │
681
663
  ├─ Phase 1b: Fetch external threads (evidence policy required)
682
- │ └─ Git agent (fetch-review-threads) → THREAD_MAP
683
- │
684
664
  ├─ Phase 2: Global Triage [Triage agent, opus, single agent]
685
- │ └─ ALL issues → verdict ledger by disposition (incl. DUPLICATE with duplicate_of)
686
- │
687
665
  ├─ Phase 3: Batch FIX_NOW issues (skip if empty; DUPLICATE issues never dispatched)
688
- │ └─ same-file sequential, distinct-file parallel, max 5/batch
689
- │
690
666
  ├─ Phase 4: Fix [Code agent × N, OPERATION: issue-fix, PUSH: false]
691
- │ └─ Returns Verification block per batch
692
- │
693
667
  ├─ Phase 5: Write resolution-summary.md (compaction safety; Tracked = "(pending)" or "(pending — TRACEABILITY: DEGRADED)" if manage-debt degrades)
694
- │
695
- ├─ Phase 6: Simplify [Simplify agent]
696
- │
697
- ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Code-fix agent validation-fix loop ≤2
698
- │
668
+ ├─ Phase 6: Polish [Polish agent]
669
+ ├─ Phase 7: Verification Gate [Validate agent, haiku] + push + Fix agent validation-fix loop ≤2
699
670
  ├─ Phase 8: CI Status Gate (conditional — skipped if no fixes or verification FAILED)
700
- │ └─ push, then ci-wait.cjs (inline, one wait ≤ 570 s) → Code-fix agent on FAILING (3 waits + 2 fixes per worktree)
701
- │
702
671
  ├─ Phase 9: Git agent (manage-debt) — FIX_SEPARATE + TECH_DEBT → backfill Tracked={ISSUE_REF} (or TRACEABILITY: DEGRADED on failure)
703
- │ SEQUENTIAL across worktrees
704
672
  │
705
673
  ├─ Phase 9b: Thread resolution + resolution comment
706
674
  │ ├─ Step 9b-0: verify-evidence.cjs --stale-out → ≤1 Test agent on the stale TPs (wrapped) — only after this run's push
707
675
  │ ├─ Step 9b-1: Git agent (resolve-review-threads) — evidence policy required
708
676
  │ ├─ Step 9b-2: Git agent (post-resolution-summary, REVIEW_PUBLICATION) — always-on
709
- │ └─ Step 9b-3: Git agent (update-pr-evidence) — only when the head moved
677
+ │ └─ Step 9b-3: verify-evidence.cjs publish (inline, no Git spawn) — only when the head moved
710
678
  │
711
- ├─ Phase 9c: Git agent (check-merge-readiness) — non-author approval required, report-only
679
+ ├─ Phase 9c: verify-evidence.cjs readiness (inline, no Git spawn) — non-author approval required, report-only
712
680
  │
713
681
  └─ Phase 10: Display results (resolution-summary.md written in Phase 5)
714
682
  ```
@@ -722,21 +690,11 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
722
690
  | Fix attempt fails | Revert changes, mark BLOCKED, continue others |
723
691
  | Issue dependencies | Sequential chain, skip dependents if predecessor blocked |
724
692
  | No actionable issues | Report "No issues to resolve" |
725
- | Incomplete review directory (no review-summary.md) | Skip — resolve only targets complete reviews |
726
693
  | Latest review already resolved | Check bug-analysis fallback (Step 0c-5b); if also absent, skip worktree and suggest `/code-review` or `/bug-analysis` |
727
- | Legacy flat layout (no subdirectories) | Read flat *.md files directly (backwards compatible) |
728
694
  | `--review {timestamp}` in multi-worktree mode | Not supported — use `--path` + `--review` to target specific worktree + review |
729
- | Worktree pre-flight fails | Report failure, continue with other worktrees |
730
- | Empty FIX_NOW list | Skip Phases 3-4/6-8; still write full summary + run manage-debt if FIX_SEPARATE/TECH_DEBT exist |
731
- | ESCALATED security issues | Surfaced in ## Escalations + display callout; never routed to manage-debt |
732
- | DUPLICATE verdict without duplicate_of, or chained to another DUPLICATE | Treated as Triage failure — same retry-then-abort as a vanished id |
733
- | DUPLICATE issues in THREAD_MAP | Map ext-{N} to primary's verdict/verification status for thread reply |
734
- | 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) |
735
695
  | gh/GitHub absent | manage-debt degrades (`TRACEABILITY: DEGRADED ({reason})`); Tracked stays `(pending — TRACEABILITY: DEGRADED ({reason}))` — recorded, not dropped |
736
696
  | `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 |
737
697
  | `REQUIRE_NON_AUTHOR_APPROVAL` is `false` | Phase 9c is skipped and reported as SKIPPED |
738
- | THREAD_MAP empty or DEGRADED | Phase 9b-1 skipped; resolution comment (Phase 9b-2) still posted if PR known |
739
- | No PR exists for post-resolution-summary | Git agent returns TRACEABILITY: DEGRADED; resolution-summary.md already on disk — not a blocker |
740
698
  | Public repo (`auto` mode) | Git agent probes visibility, posts counts-only STUB comment; full resolution report stays local |
741
699
  | `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 |
742
700
  | 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 |
@@ -747,14 +705,8 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
747
705
 
748
706
  1. **Orchestration only** - Command spawns agents, doesn't do git/resolve work itself
749
707
  2. **No agent grades its own homework** - Triage agent validates, Code agents fix, Validate agent verifies
750
- 3. **Global triage first** - Single Triage agent sees all issues for cross-issue consistency; no issue may vanish
751
- 4. **Git agent for git work** - All git operations go through Git agent
752
- 5. **Parallel execution** - Distinct-file Code agent batches run in parallel; same-file batches sequential
753
- 6. **Honest reporting** - Verification failure is recorded and displayed, never silenced
754
- 7. **Complete tracking** - Every issue gets exactly one verdict in the ledger
755
- 8. **Latest review by default** - Only process the most recent complete review
756
- 9. **Auto-discover worktrees** - One command handles all resolvable branches
757
- 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)
708
+ 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)
709
+ 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)
758
710
 
759
711
  ## Output Artifact
760
712
 
@@ -1,9 +1,9 @@
1
1
  ---
2
- description: Self-review workflow - Simplify agent (code clarity) then Scrutinize agent (9-pillar quality gate)
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 Simplify agent and Scrutinize agent sequentially on changed files for post-implementation quality refinement.
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 Simplify runs — Phase 3 compares against it
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
 
@@ -56,7 +56,7 @@ If `index.md` exists and contains at least one entry line, use it for relevance
56
56
 
57
57
  **Step 2 — Fallback: glob frontmatter (if `index.md` is absent or empty):**
58
58
 
59
- Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters). The frontmatter fields `name`, `description`, and `directories` are the authoritative relevance surface — `index.md` is only a cache.
59
+ Glob `{worktree}/.devflow/features/*/KNOWLEDGE.md`. For each file found, read only its YAML frontmatter block (between the opening and closing `---` delimiters).
60
60
 
61
61
  **Step 3 — Pick relevant KBs:**
62
62
 
@@ -87,35 +87,35 @@ Headings: L5 Rules · L40 Overview · L62 Anti-Patterns · L118 Key Files
87
87
 
88
88
  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)`.
89
89
 
90
- **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.
90
+ **One git call, then direct reads — no `.cjs` script.**
91
91
 
92
- Pass `FEATURE_KNOWLEDGE_RULES` to Scrutinize agent.
92
+ Pass `FEATURE_KNOWLEDGE_RULES` to Harden agent.
93
93
 
94
94
  **Extract:** FILES_CHANGED (list), TASK_DESCRIPTION (string), FEATURE_KNOWLEDGE (string, optional), FEATURE_KNOWLEDGE_RULES (string, optional), HEAD_BEFORE (40-hex SHA)
95
95
 
96
- ### Phase 1: Simplify agent (Code Refinement)
96
+ ### Phase 1: Polish agent (Code Refinement)
97
97
 
98
- **Produces:** SIMPLIFY_COMMITS
98
+ **Produces:** POLISH_COMMITS
99
99
  **Requires:** FILES_CHANGED, TASK_DESCRIPTION
100
100
 
101
- Spawn Simplify agent to refine code for clarity and consistency:
101
+ Spawn Polish agent to refine code for clarity and consistency:
102
102
 
103
- Agent(subagent_type="Simplify", run_in_background=false):
103
+ Agent(subagent_type="Polish", run_in_background=false):
104
104
  "TASK_DESCRIPTION: {task_description}
105
105
  FILES_CHANGED: {files_changed}
106
- Simplify and refine the code for clarity and consistency while preserving functionality.
106
+ Polish and refine the code for clarity and consistency while preserving functionality.
107
107
  Commit any improvements with a conventional-commit message."
108
108
 
109
- **Wait for completion.** Simplify agent commits changes directly.
109
+ **Wait for completion.** Polish agent commits changes directly.
110
110
 
111
- ### Phase 2: Scrutinize agent (9-Pillar Quality Gate)
111
+ ### Phase 2: Harden agent (9-Pillar Quality Gate)
112
112
 
113
- **Produces:** SCRUTINIZE_STATUS
113
+ **Produces:** HARDEN_STATUS
114
114
  **Requires:** FILES_CHANGED, TASK_DESCRIPTION
115
115
 
116
- Spawn Scrutinize agent for quality evaluation and fixing:
116
+ Spawn Harden agent for quality evaluation and fixing:
117
117
 
118
- Agent(subagent_type="Scrutinize", run_in_background=false):
118
+ Agent(subagent_type="Harden", run_in_background=false):
119
119
  "TASK_DESCRIPTION: {task_description}
120
120
  FILES_CHANGED: {files_changed}
121
121
  FEATURE_KNOWLEDGE: {feature_knowledge_rules}
@@ -127,11 +127,11 @@ Follow devflow:apply-feature-knowledge for FEATURE_KNOWLEDGE. Skip if (none)."
127
127
  ### Phase 3: Conditional Validation
128
128
 
129
129
  **Produces:** VALIDATION_RESULT
130
- **Requires:** HEAD_BEFORE, SCRUTINIZE_STATUS
130
+ **Requires:** HEAD_BEFORE, HARDEN_STATUS
131
131
 
132
132
  If STATUS is BLOCKED, skip this phase: the report (Phase 4) names the blocker.
133
133
 
134
- Run this phase only if HEAD moved — `git rev-parse HEAD` differs from `HEAD_BEFORE`, meaning Simplify or Scrutinize committed (Simplify alone counts, whatever Scrutinize's STATUS is). Otherwise skip it. Its scope is changed-only over what the two agents changed:
134
+ 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:
135
135
 
136
136
  Agent(subagent_type="Validate", run_in_background=false):
137
137
  "FILES_CHANGED: {output of `git diff --name-only HEAD_BEFORE..HEAD`}
@@ -143,7 +143,7 @@ Run build, typecheck, lint, test on modified files"
143
143
 
144
144
  ### Phase 4: Report
145
145
 
146
- **Requires:** SCRUTINIZE_STATUS, VALIDATION_RESULT
146
+ **Requires:** HARDEN_STATUS, VALIDATION_RESULT
147
147
 
148
148
  Display summary:
149
149
 
@@ -152,10 +152,10 @@ Display summary:
152
152
  **Files Reviewed**: {n}
153
153
  **Status**: {PASS|FIXED|BLOCKED}
154
154
 
155
- ### Simplify agent
155
+ ### Polish agent
156
156
  - {n} files refined for clarity
157
157
 
158
- ### Scrutinize agent (9-Pillar Evaluation)
158
+ ### Harden agent (9-Pillar Evaluation)
159
159
  | Pillar | Status |
160
160
  |--------|--------|
161
161
  | Design | {status} |
@@ -209,16 +209,12 @@ FILES_CHANGED: {list of files changed}
209
209
  Write the knowledge base to:
210
210
  {worktree}/.devflow/features/{slug}/KNOWLEDGE.md
211
211
 
212
- Then update the index cache by performing a read-modify-write on:
212
+ Then update the index cache:
213
213
  {worktree}/.devflow/features/index.md
214
214
 
215
215
  Index line format: `- **{slug}** — {areas} — {Use-when description}` — at most 300 characters, the description at most 220; reword a longer one, never cut it.
216
216
 
217
- 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.
218
-
219
- 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.
220
-
221
- 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."
217
+ Then commit the two files as your Commit Protocol directs."
222
218
  ```
223
219
 
224
220
  **Step 4 — Surface an uncommitted knowledge base:**
@@ -235,14 +231,14 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
235
231
  │ ├─ Git diff for changed files
236
232
  │ └─ Record HEAD_BEFORE
237
233
  │
238
- ├─ Phase 1: Simplify agent
234
+ ├─ Phase 1: Polish agent
239
235
  │ └─ Code refinement (commits directly)
240
236
  │
241
- ├─ Phase 2: Scrutinize agent
237
+ ├─ Phase 2: Harden agent
242
238
  │ └─ 9-pillar quality gate (may fix and commit)
243
239
  │
244
240
  ├─ Phase 3: Validate agent (conditional)
245
- │ └─ If HEAD moved since HEAD_BEFORE (Simplify or Scrutinize committed), changed-only Validate over HEAD_BEFORE..HEAD
241
+ │ └─ If HEAD moved since HEAD_BEFORE (Polish or Harden committed), changed-only Validate over HEAD_BEFORE..HEAD
246
242
  │
247
243
  └─ Phase 4: Report
248
244
  └─ Display summary with pillar status
@@ -252,15 +248,15 @@ When the Knowledge agent reports `KB_COMMIT: skipped (detached HEAD)`, the files
252
248
  | Case | Handling |
253
249
  |------|----------|
254
250
  | No changes | Report "No changes to review" and exit |
255
- | Simplify agent finds nothing | Normal, continue to Scrutinize agent |
256
- | Scrutinize agent BLOCKED | Report blocking issue, halt workflow |
251
+ | Polish agent finds nothing | Normal, continue to Harden agent |
252
+ | Harden agent BLOCKED | Report blocking issue, halt workflow |
257
253
  | Validation fails | Report failures, halt (don't create broken state) |
258
254
  | Not in git repo | Report error, suggest running in git repo |
259
255
 
260
256
  ## Principles
261
257
 
262
258
  1. **Orchestration only** - Command spawns agents, doesn't do the work
263
- 2. **Sequential execution** - Simplify agent must complete before Scrutinize agent
264
- 3. **Validation gate** - If Simplify agent or Scrutinize agent committed, the changes must pass validation
259
+ 2. **Sequential execution** - Polish agent must complete before Harden agent
260
+ 3. **Validation gate** - If Polish agent or Harden agent committed, the changes must pass validation
265
261
  4. **Honest reporting** - Display actual agent outputs
266
262
  5. **Fail fast** - Stop on BLOCKED or validation failure
@@ -25,6 +25,8 @@ Load for `check-merge-readiness` under every tracker provider.
25
25
 
26
26
  ### Process
27
27
 
28
+ Run the script from `WORKTREE_PATH` (else cwd) and print its stdout, nothing else: `node "$HOME/.devflow/scripts/verify-evidence.cjs" readiness --pr {PR_NUMBER}; echo "exit=$?"`, adding `--require-non-author-approval {REQUIRE_NON_AUTHOR_APPROVAL}` only when that is `true` or `false`, with the Bash `timeout` at 180000. On exit 0 or 2 its stdout is the `## Merge Readiness` block (exit 2: `DEGRADED`, closed by a `TRACEABILITY: DEGRADED ({reason})` line); any other exit, or empty stdout, is `TRACEABILITY: DEGRADED (readiness unavailable)`. The script makes the reads and applies the ladder below, so the steps are its specification: run none of them yourself.
29
+
28
30
  1. Fetch unresolved review threads via GraphQL: `reviewThreads(first: 100) { nodes { isResolved } totalCount }`. Count unresolved from nodes (`isResolved == false`). If `totalCount > 100`, report the unresolved count as approximate: prefix with `>` and note `(count approximate — PR has more than 100 threads)`.
29
31
  2. Fetch PR review decision: `gh pr view {PR_NUMBER} --json reviewDecision --jq '.reviewDecision'`
30
32
  - Values: `APPROVED`, `CHANGES_REQUESTED`, `REVIEW_REQUIRED`, or null
@@ -15,13 +15,11 @@ Update the PR's test-plan block and evidence comment.
15
15
 
16
16
  Load for `update-pr-evidence` under every tracker provider.
17
17
 
18
- **PR mechanics held here:** the evidence script run, the compare-and-swap body edit and the append-only evidence comment. The script owns every marker, grammar and state rule; nothing here restates one.
18
+ **PR mechanics held here:** the one script run. `verify-evidence.cjs publish` owns every step, marker, grammar and state rule, and scrubs (D11) each body before it posts one; nothing here restates any of them.
19
19
 
20
20
  ### Process
21
21
 
22
- Run steps 1–4 as ONE Bash invocation from `WORKTREE_PATH` (else cwd) — the trap removes `$S` and the temp files when it exits — with `V="$HOME/.devflow/scripts"`.
22
+ 1. From `WORKTREE_PATH` (else cwd), run `node "$HOME/.devflow/scripts/verify-evidence.cjs" publish --pr {PR_NUMBER}; echo "exit=$?"`, adding `--publication {REVIEW_PUBLICATION}` only when that is `auto`, `full`, `off` or `stub`, and `--evidence "{EVIDENCE_FILE}"` when given — only a value matching `^[A-Za-z0-9._/-]{1,255}$` reaches the shell; any other is a failed run. Set the Bash `timeout` to 180000.
23
+ 2. Print the script's stdout and nothing else. On exit 0 it is the `## PR Evidence` block: the heading, the line `EVIDENCE pr:<n> head:<sha> total:<n> VERIFIED-CI:<n> ATTESTED-LOCAL:<n> UNVERIFIED:<n> STALE:<n> FAILED:<n> INDETERMINATE:<n> stale:<ids|none> exceptions:<kinds|none> approval:<yes|no|unchecked> key:<hex> posted:<yes|no|n/a> body:<same|changed>`, and the `**Body**:` / `**Comment**:` line, then one `TRACEABILITY: DEGRADED ({reason})` line for each part that degraded, such as `DEGRADED (concurrent edit)` (the body edit then reads `SKIPPED`), `DEGRADED (body read-back mismatch)` or `DEGRADED (redaction unavailable)`: a body the script cannot scrub is never posted. On exit 2 it is `TRACEABILITY: DEGRADED (evidence unavailable)`. Any other exit, or empty stdout, is a failed run: emit that same line.
23
24
 
24
- 1. **Verify.** Set `S=`, arm the D11 trap with `[ -n "$S" ] && { rm -- "$S/base" "$S/base.sha256"; rmdir -- "$S"; } 2>/dev/null` added before its `exit`, then the four `mktemp`s and `S="$(mktemp -d)"`. Run `node "$V/verify-evidence.cjs" verify --pr {PR_NUMBER} --state "$S" --block-out "$DEVFLOW_NOTES_RAW" --comment-out "$DEVFLOW_BODY_RAW"`, adding `--publication {REVIEW_PUBLICATION}` only when that is `auto`, `full`, `off` or `stub`, and `--evidence "{EVIDENCE_FILE}"` when given — only a value matching `^[A-Za-z0-9._/-]{1,255}$` reaches the shell; any other is a failed run. Continue only on exit 0 with stdout exactly one line, `EVIDENCE pr:<n> head:<sha> total:<n> VERIFIED-CI:<n> ATTESTED-LOCAL:<n> UNVERIFIED:<n> STALE:<n> FAILED:<n> INDETERMINATE:<n> stale:<ids|none> exceptions:<kinds|none> approval:<yes|no|unchecked> key:<hex> posted:<yes|no|n/a> body:<same|changed>`; otherwise emit `TRACEABILITY: DEGRADED (evidence unavailable)` and stop. The script makes this op's one `gh pr view` read and prints nothing it read from the PR; never read the PR another way.
25
- 2. **Body**, only on `body:changed` (else `UNCHANGED`): `node "$V/redact-secrets.cjs" "$DEVFLOW_NOTES_RAW" "$DEVFLOW_NOTES" && node "$V/verify-evidence.cjs" splice --pr {PR_NUMBER} --state "$S" --block "$DEVFLOW_NOTES" --out "$DEVFLOW_BODY" && gh pr edit {PR_NUMBER} --body-file "$DEVFLOW_BODY"`. Only the composed block is scrubbed (D11); every byte outside its markers is the PR's own and stays identical. `splice` re-reads the body: unchanged since step 1 → it writes; changed → it splices once onto the fresh body and re-reads; changed again → `SPLICE conflict`: `SKIPPED` and `TRACEABILITY: DEGRADED (concurrent edit)`. Any other non-zero → `DEGRADED ({reason})`, naming a printed `SPLICE` token. No edit either way; go to step 4.
26
- 3. **Read back** after an edit: `node "$V/verify-evidence.cjs" readback --pr {PR_NUMBER} --expect "$DEVFLOW_BODY"`; anything but `READBACK ok` → `TRACEABILITY: DEGRADED (body read-back mismatch)`, else `EDITED`. GitHub has no conditional body edit: a human edit landing between the last re-read and `gh pr edit` is overwritten (it stays in the PR's edit history), and the read-back proves only that these bytes landed.
27
- 4. **Comment.** `posted:yes` → `SKIPPED`; `posted:n/a` → `OFF`. Otherwise apply the Comment-sink scrub (D11): `node "$V/redact-secrets.cjs" "$DEVFLOW_BODY_RAW" "$DEVFLOW_BODY" && gh pr comment {PR_NUMBER} --body-file "$DEVFLOW_BODY"` → `POSTED`. Never edit or delete an evidence comment. On 5xx retry once; still 5xx → `DEGRADED ({reason})`.
25
+ Run nothing else: the script makes the one PR read, the compare-and-swap body edit, its read-back and the append-only comment itself, and posts nothing it could not scrub.