mandrel 1.90.0 → 1.92.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 (115) hide show
  1. package/.agents/README.md +5 -5
  2. package/.agents/docs/SDLC.md +75 -107
  3. package/.agents/docs/configuration.md +1 -1
  4. package/.agents/docs/quality-gates.md +8 -7
  5. package/.agents/docs/workflows.md +4 -10
  6. package/.agents/instructions.md +2 -2
  7. package/.agents/schemas/agentrc.schema.json +1 -1
  8. package/.agents/schemas/lifecycle/README.md +2 -1
  9. package/.agents/schemas/lifecycle/ledger-record.schema.json +1 -1
  10. package/.agents/schemas/risk-verdict.schema.json +14 -1
  11. package/.agents/scripts/README.md +0 -46
  12. package/.agents/scripts/analyze-execution.js +76 -1
  13. package/.agents/scripts/check-doc-links.js +3 -0
  14. package/.agents/scripts/check-workflow-cli-lint.js +208 -0
  15. package/.agents/scripts/epic-audit-recheck.js +1 -1
  16. package/.agents/scripts/epic-deliver-preflight.js +37 -1
  17. package/.agents/scripts/epic-plan-clarity.js +16 -6
  18. package/.agents/scripts/epic-plan-decompose.js +37 -59
  19. package/.agents/scripts/epic-plan-healthcheck.js +39 -6
  20. package/.agents/scripts/epic-plan-spec.js +41 -168
  21. package/.agents/scripts/epic-reconcile.js +7 -1
  22. package/.agents/scripts/lib/Logger.js +4 -4
  23. package/.agents/scripts/lib/audit-suite/index.js +4 -5
  24. package/.agents/scripts/lib/audit-suite/runner.js +6 -4
  25. package/.agents/scripts/lib/audit-suite/selector.js +2 -3
  26. package/.agents/scripts/lib/bdd-runner-detect.js +1 -1
  27. package/.agents/scripts/lib/command-header.js +20 -0
  28. package/.agents/scripts/lib/config/github.js +1 -3
  29. package/.agents/scripts/lib/config-settings-schema.js +4 -3
  30. package/.agents/scripts/lib/degraded-mode.js +1 -1
  31. package/.agents/scripts/lib/label-constants.js +18 -3
  32. package/.agents/scripts/lib/label-taxonomy.js +14 -3
  33. package/.agents/scripts/lib/mutation/baseline-snapshot.js +7 -6
  34. package/.agents/scripts/lib/orchestration/consolidation-precondition.js +18 -8
  35. package/.agents/scripts/lib/orchestration/context-hydration-engine.js +3 -4
  36. package/.agents/scripts/lib/orchestration/docs-digest.js +2 -2
  37. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist-helpers.js +4 -0
  38. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist.js +22 -12
  39. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/authoring-context.js +6 -1
  40. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-diff.js +18 -2
  41. package/.agents/scripts/{lifecycle-diff.js → lib/orchestration/lifecycle/ledger-diff.js} +10 -76
  42. package/.agents/scripts/lib/orchestration/lifecycle/listeners/acceptance-reconciler.js +1 -1
  43. package/.agents/scripts/lib/orchestration/lifecycle/listeners/finalizer.js +32 -0
  44. package/.agents/scripts/lib/orchestration/plan-context.js +510 -0
  45. package/.agents/scripts/lib/orchestration/plan-critic-conditions.js +177 -0
  46. package/.agents/scripts/lib/orchestration/plan-metrics.js +445 -0
  47. package/.agents/scripts/lib/orchestration/plan-persist/amend.js +359 -0
  48. package/.agents/scripts/lib/orchestration/plan-persist/delivery-mode.js +127 -0
  49. package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +978 -0
  50. package/.agents/scripts/lib/orchestration/plan-persist/summary.js +191 -0
  51. package/.agents/scripts/lib/orchestration/plan-reachability.js +160 -0
  52. package/.agents/scripts/lib/orchestration/plan-runner/worktree-sweep.js +3 -3
  53. package/.agents/scripts/lib/orchestration/planning-risk.js +1 -1
  54. package/.agents/scripts/lib/orchestration/remote-verifier.js +165 -0
  55. package/.agents/scripts/lib/orchestration/single-story-close/phases/push.js +10 -0
  56. package/.agents/scripts/lib/orchestration/spec-freshness.js +1 -1
  57. package/.agents/scripts/lib/orchestration/ticketing/bulk.js +1 -1
  58. package/.agents/scripts/lib/orchestration/ticketing/reads.js +11 -2
  59. package/.agents/scripts/lib/plan-phase-cleanup.js +16 -0
  60. package/.agents/scripts/lib/presentation/manifest-persistence.js +2 -3
  61. package/.agents/scripts/lib/templates/spec-author-prompts.js +74 -0
  62. package/.agents/scripts/plan-context.js +186 -0
  63. package/.agents/scripts/plan-critics.js +227 -0
  64. package/.agents/scripts/plan-persist.js +383 -0
  65. package/.agents/scripts/pr-watch-with-update.js +8 -7
  66. package/.agents/scripts/run-lint.js +10 -11
  67. package/.agents/scripts/single-story-init.js +22 -0
  68. package/.agents/scripts/story-plan.js +19 -7
  69. package/.agents/scripts/sync-claude-commands.js +10 -5
  70. package/.agents/skills/core/knowledge-transfer/SKILL.md +11 -7
  71. package/.agents/workflows/audit-documentation.md +5 -7
  72. package/.agents/workflows/audit-lighthouse.md +1 -0
  73. package/.agents/workflows/audit-security.md +1 -0
  74. package/.agents/workflows/audit-to-stories.md +16 -5
  75. package/.agents/workflows/deliver.md +8 -0
  76. package/.agents/workflows/git-deliver.md +76 -243
  77. package/.agents/workflows/helpers/_merge-conflict-template.md +1 -1
  78. package/.agents/workflows/helpers/code-review.md +7 -6
  79. package/.agents/workflows/helpers/deliver-epic.md +16 -4
  80. package/.agents/workflows/helpers/plan-epic-reference.md +109 -96
  81. package/.agents/workflows/helpers/plan-epic.md +246 -999
  82. package/.agents/workflows/helpers/plan-story.md +14 -14
  83. package/.agents/workflows/helpers/scope-triage-gate.md +6 -4
  84. package/.agents/workflows/helpers/single-story-deliver.md +13 -4
  85. package/.agents/workflows/helpers/worktree-lifecycle.md +9 -7
  86. package/.agents/workflows/mandrel-update.md +144 -466
  87. package/.agents/workflows/plan.md +73 -143
  88. package/docs/CHANGELOG.md +20 -0
  89. package/lib/cli/registry.js +21 -3
  90. package/package.json +1 -1
  91. package/.agents/schemas/loop-unit.schema.json +0 -70
  92. package/.agents/scripts/assert-branch.js +0 -81
  93. package/.agents/scripts/check-loop-units.js +0 -204
  94. package/.agents/scripts/detect-merges.js +0 -111
  95. package/.agents/scripts/git-pr-quality-gate.js +0 -205
  96. package/.agents/scripts/git-rebase-and-resolve.js +0 -234
  97. package/.agents/scripts/hierarchy-gate.js +0 -192
  98. package/.agents/scripts/hydrate-context.js +0 -179
  99. package/.agents/scripts/lib/loop-units/validate-loop-unit.js +0 -197
  100. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/cli.js +0 -167
  101. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/cli-args.js +0 -69
  102. package/.agents/scripts/lib/orchestration/plan-runner/plan-router.js +0 -86
  103. package/.agents/scripts/loc-delta.js +0 -205
  104. package/.agents/scripts/render-manifest.js +0 -143
  105. package/.agents/scripts/run-audit-suite.js +0 -97
  106. package/.agents/scripts/select-audits.js +0 -155
  107. package/.agents/scripts/update-mutation-baseline.js +0 -189
  108. package/.agents/workflows/explain.md +0 -118
  109. package/.agents/workflows/git-merge-pr.md +0 -377
  110. package/.agents/workflows/helpers/epic-plan-decompose.md +0 -22
  111. package/.agents/workflows/helpers/epic-plan-spec.md +0 -22
  112. package/.agents/workflows/loops/README.md +0 -65
  113. package/.agents/workflows/loops/fix-failing-tests.md +0 -74
  114. package/.agents/workflows/loops/nightly-audit.md +0 -81
  115. package/.agents/workflows/loops/watch-ci.md +0 -68
@@ -120,7 +120,7 @@ Ask:
120
120
  > - **Single Epic via `/plan`** **[Recommended]** — opens one Epic,
121
121
  > then chains into `/plan --idea` so the standard spec-and-WBS
122
122
  > authoring handles decomposition. Grouped Stories become the
123
- > seed for Phase 7 decomposition.
123
+ > seed for the authoring step's decomposition.
124
124
  > - **Individual standalone Stories** — opens one GitHub Issue per
125
125
  > group directly, no Epic wrapper.
126
126
 
@@ -138,8 +138,8 @@ node .agents/scripts/audit-to-stories.js --emit-epic-seed \
138
138
 
139
139
  The seed renders the canonical one-pager sections — Problem Statement,
140
140
  Recommended Direction, Key Assumptions (with links to every source
141
- report), MVP Scope (the M proposed Stories), Key Files (so `/plan`
142
- Phase 7 decompose has concrete anchors), Not Doing.
141
+ report), MVP Scope (the M proposed Stories), Key Files (so `/plan`'s
142
+ authoring step has concrete anchors), Not Doing.
143
143
 
144
144
  Chain into the existing planning entrypoint:
145
145
 
@@ -147,8 +147,8 @@ Chain into the existing planning entrypoint:
147
147
  /plan --idea "<path-to-seed>"
148
148
  ```
149
149
 
150
- `/plan` then runs ideation → duplicate-searchrender Epic body
151
- → open Epic → Phase 7 / 8 decompose, as documented in its workflow.
150
+ `/plan` then runs its 3-step Epic path (interrogate author
151
+ persist), as documented in its workflow.
152
152
  Each Story it spawns from the seed carries `context::audit:
153
153
  <reportLink>` and `audit-fingerprint: <sha>` in its body so future
154
154
  Phase 6 idempotency works on the next run.
@@ -248,6 +248,17 @@ opened. When the Standalone-Stories path ran, list every Issue URL.
248
248
  creation; fall back to `gh issue create` when the MCP tool is
249
249
  unavailable.
250
250
 
251
+ ## Scheduling a nightly sweep
252
+
253
+ To run an unattended maintenance sweep, `/schedule` a nightly (or weekly)
254
+ job that (1) runs the relevant `audit-*` lens workflows full-scope — no
255
+ `--paths`, no change-set filter, so the whole target-set union is audited —
256
+ writing their `temp/audits/audit-*-results.md` reports, then (2) invokes
257
+ `/audit-to-stories` over those results to dedupe and route the findings.
258
+ The host scheduler owns the cadence; this workflow owns the routing. (This
259
+ paragraph folds in the `loops/nightly-audit.md` starter unit retired in
260
+ issue 4482.)
261
+
251
262
  ## See also
252
263
 
253
264
  - [`/plan`](helpers/plan-epic.md) — the planning pipeline `/audit-to-stories`
@@ -131,6 +131,14 @@ the standalone segment; segments themselves remain strictly sequential.
131
131
 
132
132
  ## Constraints
133
133
 
134
+ - **Land or block — never a silent local build (issue #4483).** The
135
+ helpers' orchestration path (worktrees, `story-<id>`/`epic/<id>` branches,
136
+ close-validation, PR) is the ONLY sanctioned delivery mechanism.
137
+ Executing story slices inline in this session and/or committing the
138
+ delivery to local `main` is expressly forbidden, regardless of how the
139
+ environment looks. Each path surfaces verified remote evidence
140
+ (`remoteVerified`) at entry; on `false`, transition the ticket to
141
+ `agent::blocked` quoting `remoteProbe.detail` and halt.
134
142
  - `/deliver` requires planned tickets: Epics at `agent::ready` (the
135
143
  Epic helper's preflight enforces this, per segment) or well-formed
136
144
  standalone Stories. Planning happens in [`/plan`](plan.md); the
@@ -9,18 +9,15 @@ description: >-
9
9
 
10
10
  # /git-deliver [Message] [--no-push] [--pr] [--draft] [--no-auto-merge] [--branch <name>] [--base <branch>]
11
11
 
12
- This workflow is the **single source of truth** for getting outstanding
13
- working-tree changes out the door when they do not belong to a planned Epic
14
- (typo fixes, file deletions, doc tweaks, dependency bumps, operator
15
- housekeeping). It is the ad-hoc counterpart to the heavyweight `/deliver`
16
- pipeline.
17
-
18
- It replaces the retired `/git-commit-all`, `/git-push`, and `/git-pr-all`
19
- commands: instead of choosing a command by how far you want to go, you run
20
- one command and it **detects the git setup** and escalates to the correct
21
- terminal step. Flags pin any level explicitly; the interactive choice prompt
22
- fires **only** when the detected state is genuinely ambiguous, so the common
23
- path stays non-interactive and scriptable.
12
+ The **single source of truth** for getting outstanding working-tree changes
13
+ out the door when they do not belong to a planned Epic (typo fixes, doc
14
+ tweaks, dependency bumps, operator housekeeping, benchmark result commits
15
+ from mandrel-bench's `/benchmark` Step 4). It is the ad-hoc counterpart to
16
+ the heavyweight `/deliver` pipeline: one command that **detects the git
17
+ setup** and escalates to the correct terminal step. Flags pin any level
18
+ explicitly; the interactive choice prompt fires **only** when the detected
19
+ state is genuinely ambiguous, so the common path stays non-interactive and
20
+ scriptable.
24
21
 
25
22
  > **Persona**: `devops-engineer` · **Skills**:
26
23
  > `core/git-workflow-and-versioning`
@@ -47,35 +44,30 @@ it is about to run** before it acts.
47
44
  /git-deliver [Message] [--no-push] [--pr] [--draft] [--no-auto-merge] [--branch <name>] [--base <branch>]
48
45
  ```
49
46
 
50
- - `Message` — the commit subject. First line becomes the commit subject (and,
51
- at the **pr** level, the PR title); if the message contains a blank line,
52
- everything after it becomes the commit/PR body. When omitted, a timestamped
53
- fallback (`chore: ad-hoc changes <ISO 8601>`) is used so the commit is never
47
+ - `Message` — commit subject (and, at the **pr** level, the PR title); text
48
+ after the first blank line becomes the commit/PR body. When omitted, fall
49
+ back to `chore: ad-hoc changes <ISO 8601>` so the commit is never
54
50
  unmessageable.
55
- - `--no-push` — force the **commit** level: stage and commit only, no push.
56
- Useful when chaining several commits or deferring the push.
57
- - `--pr` — force the **pr** level even from a feature branch where a plain
58
- push would otherwise be the default.
51
+ - `--no-push` — force the **commit** level.
52
+ - `--pr` force the **pr** level even from a feature branch.
59
53
  - `--draft` — (pr level) open the PR in draft state and skip arming
60
- auto-merge. Useful when you want CI to run before flipping to
61
- ready-for-review.
62
- - `--no-auto-merge` (pr level) open a normal (non-draft) PR but do not enable
63
- GitHub's native auto-merge queue. The operator merges through the UI.
64
- Default at the pr level is `gh pr merge --auto --squash --delete-branch`.
54
+ auto-merge.
55
+ - `--no-auto-merge` — (pr level) open a normal PR but do not enable native
56
+ auto-merge; the operator merges through the UI.
65
57
  - `--branch <name>` — (pr level) override the auto-generated feature branch
66
- name. When omitted, the branch is slugged from the commit subject (Step 3).
67
- - `--base <branch>` — override the base branch used for detection and as the PR
68
- merge target. When omitted, reads `project.baseBranch` from `.agentrc.json`
69
- (default `main`).
58
+ name.
59
+ - `--base <branch>` — override the base branch used for detection and as the
60
+ PR merge target. Default: `project.baseBranch` from `.agentrc.json`
61
+ (fallback `main`).
70
62
 
71
63
  ---
72
64
 
73
65
  ## Boot sweep
74
66
 
75
- Before detecting the git setup, run the **protected boot sweep** so
76
- `/git-deliver` starts from a tidy local checkout — a feature branch this
77
- command opened and pushed on a prior run, once its PR has merged, is reaped
78
- here rather than left to accumulate:
67
+ Before detecting the git setup, run the **protected boot sweep** so the run
68
+ starts from a tidy local checkout — a feature branch this command opened on a
69
+ prior run, once its PR has merged, is reaped here rather than left to
70
+ accumulate:
79
71
 
80
72
  ```bash
81
73
  node .agents/scripts/boot-sweep.js \
@@ -84,240 +76,81 @@ node .agents/scripts/boot-sweep.js \
84
76
  --current "$(git rev-parse --abbrev-ref HEAD)"
85
77
  ```
86
78
 
87
- This is the **safe subset** of the `/git-cleanup` phases: it fast-forwards the
88
- base branch (`main`), prunes stale remote-tracking refs, and reaps every local
89
- branch whose PR is **merged** and whose HEAD matches the merged `headRefOid`.
90
- It **never** touches the stash stack, and its `evaluateProtection` partition
91
- skips (never reaps) any candidate with unpushed work, a dirty worktree, or a
92
- still-open parent ticket; `--current` always excludes the branch you are on.
93
- The sweep is **silent on a no-op** — nothing merged, `main` already current →
94
- one summary line (`[boot-sweep] reaped 0 local + 0 remote; protected 0.`). Its
95
- exit code is always `0`; a failed sweep is reported in that summary, never
96
- allowed to fail the delivery run.
79
+ The safe subset of the `/git-cleanup` phases: fast-forwards the base branch,
80
+ prunes stale remote-tracking refs, and reaps merged branches. It never
81
+ touches the stash, never reaps a candidate with unpushed work / dirty
82
+ worktree / open parent ticket, and always exits `0` — a failed sweep is
83
+ reported in its summary line, never allowed to fail the delivery run.
97
84
 
98
85
  ---
99
86
 
100
87
  ## Step 0 — Detect Git Setup & Resolve Level
101
88
 
102
- 1. Resolve `[BASE_BRANCH]` from `--base` or `.agentrc.json` →
103
- `project.baseBranch` (default `main`).
104
- 2. Read the current branch: `git rev-parse --abbrev-ref HEAD`.
105
- 3. Verify the working tree has outstanding changes with
106
- `git status --porcelain`. If the output is empty: **STOP** and tell the
107
- operator there is nothing to deliver.
108
- 4. Detect whether a remote is configured: `git remote`.
109
- 5. Resolve the **terminal level** from flags + state:
89
+ 1. Resolve `[BASE_BRANCH]` (`--base` `.agentrc.json` → `main`).
90
+ 2. Read the current branch; verify `git status --porcelain` shows outstanding
91
+ changes if empty, **STOP**: nothing to deliver.
92
+ 3. Resolve the **terminal level** from flags + state:
110
93
  - `--no-push` set → **commit**.
111
94
  - No remote configured → **commit** (warn there is nowhere to push).
112
95
  - `--pr` set → **pr**.
113
96
  - Current branch equals `[BASE_BRANCH]` → **pr** (a direct push to the
114
- protected base would be rejected, so the PR flow is the only safe path).
115
- - Otherwise (a feature branch with a remote) → **push**.
116
- 6. **Ambiguity gate.** Surface an interactive choice **only** when the state is
117
- genuinely under-determined — for example a **detached HEAD**, or a feature
118
- branch with a remote but no upstream tracking ref where pushing would need
119
- `-u`. Present the operator the candidate levels (e.g. "push to a new
120
- upstream" vs. "open a PR") and proceed with their pick. In every
121
- non-ambiguous case, do **not** prompt — announce the detected level and
122
- continue.
123
- 7. Echo a one-line plan to the operator before acting, e.g.
97
+ protected base would be rejected).
98
+ - Otherwise (feature branch with a remote) → **push**.
99
+ 4. **Ambiguity gate.** Prompt the operator **only** when state is genuinely
100
+ under-determined — e.g. a detached HEAD, or a feature branch with a remote
101
+ but no upstream tracking ref (push `-u` vs. open a PR). In every
102
+ non-ambiguous case, do **not** prompt.
103
+ 5. Echo a one-line plan before acting, e.g.
124
104
  `detected: on feature branch 'fix/foo' with upstream → level: push`.
125
105
 
126
106
  ---
127
107
 
128
- ## Step 1 — Compose Commit Message
129
-
130
- If the operator passed `[Message]`, use it verbatim. Otherwise fall back to
131
- `chore: ad-hoc changes <ISO 8601 timestamp>`.
132
-
133
- Split the message on the first blank line:
134
-
135
- - **Subject** — the first line; commit subject and (pr level) PR title.
136
- - **Body** — everything after the first blank line; commit body and (pr level)
137
- PR body. May be empty.
138
-
139
- ---
140
-
141
- ## Step 2 — Stage + Commit (all levels)
142
-
143
- Stage all outstanding changes:
144
-
145
- ```powershell
146
- git add -A
147
- ```
148
-
149
- Commit:
150
-
151
- ```powershell
152
- git commit -m "<subject>" -m "<body>"
153
- ```
154
-
155
- If the body is empty, omit the second `-m`. If the pre-commit hook fails:
156
-
157
- 1. Read the failure output.
158
- 2. Fix the issue (run `npm run format`, fix lint errors, etc.).
159
- 3. `git add -A` again.
160
- 4. Re-run `git commit` — do **not** pass `--no-verify`.
161
-
162
- **If the level is `commit`, stop here** and print the commit summary.
163
-
164
- ---
165
-
166
- ## Step 3 — Cut Feature Branch (pr level, from-base only)
167
-
168
- Only when the level is **pr** *and* the current branch equals `[BASE_BRANCH]`.
169
- Skip when already on a feature branch.
170
-
171
- When `--branch <name>` is set, use it verbatim. Otherwise generate a branch
172
- slug from the commit subject:
173
-
174
- 1. Detect the Conventional Commit type prefix (`<type>(<scope>): …`). If
175
- matched, use `<type>` as the branch namespace. Allowed types: `feat`,
176
- `fix`, `chore`, `docs`, `refactor`, `test`, `build`, `ci`, `perf`,
177
- `style`. Anything else (or no prefix) → `chore`.
178
- 2. Strip the type prefix and any leading punctuation from the subject.
179
- 3. Lowercase, replace non-alphanumeric runs with `-`, collapse repeated
180
- hyphens, trim leading/trailing hyphens.
181
- 4. Truncate to 50 chars on a word boundary.
182
- 5. Combine: `<type>/<slug>`. Example: `"Delete unused files"` →
183
- `chore/delete-unused-files`.
184
-
185
- Cut and check out the branch **before committing** — that is, when this step
186
- applies, run it ahead of Step 2's commit so the commit lands on the feature
187
- branch, never on the base branch:
188
-
189
- ```powershell
190
- git checkout -b <branch-name>
191
- ```
192
-
193
- If a local branch with that name already exists, append `-2` (then `-3`, …)
194
- until `git rev-parse --verify` returns non-zero, and check that out instead.
195
-
196
- ---
197
-
198
- ## Step 4 — Push (push and pr levels)
199
-
200
- Push the current branch. At the **push** level, push to the existing upstream:
201
-
202
- ```powershell
203
- git push
204
- ```
108
+ ## Steps 1–6Deliver at the resolved level
205
109
 
206
- At the **pr** level (or any branch lacking an upstream), set the upstream:
110
+ Commit, push, and PR mechanics are host-native git/`gh` competency; run them
111
+ directly, honoring these contracts:
207
112
 
208
- ```powershell
209
- git push -u origin <branch-name>
210
- ```
211
-
212
- If the pre-push hook fails:
213
-
214
- 1. Read the failure output.
215
- 2. Fix the offending baseline / test / lint issue in the working tree.
216
- 3. `git add -A`, then create a **new follow-up commit** (do not amend a commit
217
- that has already been pushed; amending an unpushed commit is fine).
218
- 4. Re-run the push. Never bypass the hook with `--no-verify`.
219
-
220
- If the push is rejected because the remote has work you do not have locally,
221
- `git pull --rebase`, resolve conflicts, and push again.
222
-
223
- **If the level is `push`, stop here** and print the push summary.
224
-
225
- ---
226
-
227
- ## Step 5 — Open PR (pr level)
228
-
229
- ```powershell
230
- gh pr create --base <BASE_BRANCH> --head <branch-name> \
231
- --title "<subject>" --body "<body-or-default>"
232
- ```
233
-
234
- When the body would otherwise be empty, fall back to a single line:
235
- `Opened via /git-deliver`. Pass `--draft` to `gh pr create` when the operator
236
- set `--draft`. Capture the PR URL from stdout for the summary.
237
-
238
- ---
239
-
240
- ## Step 6 — Arm Auto-Merge (pr level, default)
241
-
242
- Skip when `--draft` or `--no-auto-merge` is set.
243
-
244
- ```powershell
245
- gh pr merge <PR_NUMBER> --auto --squash --delete-branch
246
- ```
247
-
248
- This queues the PR to merge as soon as required checks turn green and schedules
249
- head-branch deletion on merge. Auto-merge requires `allow_auto_merge: true` on
250
- the repo. If `gh pr merge --auto` fails (missing repo feature, insufficient
251
- token scope), log the failure and surface it — the PR stays open and mergeable
252
- through the GitHub UI.
253
-
254
- ---
255
-
256
- ## Step 7 — Summary
257
-
258
- Print a single block matched to the level that ran:
259
-
260
- ```text
261
- # commit level
262
- ✅ Committed on <branch>: <subject>
263
-
264
- # push level
265
- ✅ Committed + pushed <branch> → origin: <subject>
266
-
267
- # pr level
268
- ✅ Opened PR #<PR_NUMBER>: <subject>
269
- <PR_URL>
270
- branch: <branch-name> → <BASE_BRANCH>
271
- auto-merge: <enabled | draft | disabled>
272
- ```
273
-
274
- Do **not** poll CI. That is the `/deliver` Phase 7 job and is overkill for
275
- ad-hoc changes. The operator (or GitHub's email notification) is the next
276
- watcher.
277
-
278
- > **Local ref left behind — reaped at the next boot.** At the **pr** level
279
- > this command leaves a local feature branch behind after the PR merges; it
280
- > does **not** reap it inline (the merge happens later, out of band). You do
281
- > not need to run `/git-cleanup` by hand: the next time `/git-deliver` (or
282
- > `/plan`) runs, its **Boot sweep** step reaps that merged ad-hoc branch and
283
- > fast-forwards `main` automatically. The delivering flow owns tidying its own
284
- > refs on the next boot — see
285
- > [`.agents/rules/git-conventions.md` § Local checkout hygiene](../rules/git-conventions.md).
286
-
287
- ---
113
+ - **Branch cut (pr level, from-base only).** Cut the feature branch **before
114
+ committing** so the commit never lands on the base branch. Branch name:
115
+ `--branch` verbatim, else `<type>/<slug>` — Conventional Commit type from
116
+ the subject (unrecognized/absent → `chore`), subject slugged to lowercase
117
+ hyphenated ≤50 chars. Name collision → append `-2`/`-3`/….
118
+ - **Stage + commit.** `git add -A`, then commit with the composed
119
+ subject/body.
120
+ - **Push.** `git push` (existing upstream) or `git push -u origin <branch>`.
121
+ Rejected because the remote is ahead `git pull --rebase`, resolve, push
122
+ again.
123
+ - **Hook failures (commit or push).** Read the output, fix the underlying
124
+ issue, re-stage, and (for an already-pushed commit) add a **new follow-up
125
+ commit** rather than amending. **Never** `--no-verify`.
126
+ - **PR + auto-merge (pr level).** `gh pr create --base [BASE_BRANCH]`
127
+ with the subject/body (empty body → `Opened via /git-deliver`; pass
128
+ `--draft` through). Then, unless `--draft`/`--no-auto-merge`:
129
+ `gh pr merge --auto --squash --delete-branch`. If arming fails (repo
130
+ feature missing, token scope), log and surface it — the PR stays open and
131
+ mergeable through the UI.
288
132
 
289
- ## Troubleshooting
133
+ Stop at the resolved level and print a one-block summary naming the branch,
134
+ subject, and (pr level) PR URL + auto-merge state.
290
135
 
291
- - **Hook failures**: Read the output, fix the underlying issue, never
292
- `--no-verify`. The pre-push hook (lint + format + maintainability + audit +
293
- coverage + CRAP) is the same gate every PR has to pass eventually; failing
294
- here lets you fix it before opening the PR rather than after CI fails.
295
- - **Branch already exists locally**: appended `-2`/`-3` per Step 3; pass
296
- `--branch <name>` for a specific name.
297
- - **`gh pr create` fails with "no commits between branches"**: the push did not
298
- move the branch (e.g. it was already at the same SHA as `[BASE_BRANCH]`).
299
- Verify `git log <BASE_BRANCH>..HEAD` shows commits before re-running.
300
- - **PR template wins over `--body`**: if `.github/pull_request_template.md`
301
- exists, `gh pr create --body` overrides it. For ad-hoc PRs the explicit body
302
- is the right default.
303
- - **Auto-merge does not fire after CI green**: confirm the PR's required checks
304
- match the auto-merge requirements. The framework's quality gate
305
- (`Validate and Test`) is the canonical required check.
136
+ Do **not** poll CI that is the `/deliver` Phase 7 job and is overkill for
137
+ ad-hoc changes. The local feature branch left behind at the pr level is
138
+ reaped by the next run's Boot sweep see
139
+ [`.agents/rules/git-conventions.md` § Local checkout hygiene](../rules/git-conventions.md).
306
140
 
307
141
  ---
308
142
 
309
143
  ## Constraint
310
144
 
311
- - **Never** push directly to `[BASE_BRANCH]`. At the pr level Step 3's branch
312
- cut is mandatory in from-base mode; remove it and the workflow becomes a
313
- silent bypass of the PR-required policy.
314
- - **Never** pass `--no-verify` to `git commit` or `git push` to bypass the
315
- quality gate. Fix the failure at the source.
145
+ - **Never** push directly to `[BASE_BRANCH]`. The from-base branch cut is
146
+ mandatory; remove it and the workflow becomes a silent bypass of the
147
+ PR-required policy.
148
+ - **Never** pass `--no-verify` to `git commit` or `git push`. Fix the failure
149
+ at the source.
316
150
  - **Never** force-push from `/git-deliver`. This workflow opens new PRs, it
317
- does not rewrite history. Force-pushes belong to `/git-merge-pr` (with
318
- `--force-with-lease` after a rebase) and `/deliver` Phase 7.
151
+ does not rewrite history.
319
152
  - **Always** prefer `--auto --squash --delete-branch` at the pr level unless
320
- the operator opts out, so `main`'s commit history stays uniform across the
153
+ the operator opts out, so `main`'s history stays uniform across the
321
154
  `/git-deliver` and `/deliver` surfaces.
322
155
 
323
156
  ---
@@ -1,7 +1,7 @@
1
1
  # Merge Conflict Resolution — Shared Procedure
2
2
 
3
3
  Canonical, workflow-agnostic procedure for resolving merge / rebase conflicts.
4
- Referenced by `git-merge-pr.md`, `deliver-stories.md`, and `deliver-epic.md`.
4
+ Referenced by `deliver-stories.md` and `deliver-epic.md`.
5
5
 
6
6
  ## Procedure
7
7
 
@@ -427,8 +427,8 @@ in-place.
427
427
  1. **Apply a focused fix on `[HEAD_REF]`.** Permitted only when the
428
428
  finding is unambiguously *fixable* (clean remediation, no scope
429
429
  creep, no spec deviation, no secret exposure):
430
- - Call [`assert-branch.js`](../../scripts/assert-branch.js) with
431
- `--expected [HEAD_REF]` before touching the working tree.
430
+ - Confirm `git branch --show-current` reports `[HEAD_REF]` before
431
+ touching the working tree; if it does not, STOP and re-checkout.
432
432
  - Stage explicit paths only (never `git add .`).
433
433
  - Make one focused conventional commit per finding
434
434
  (`fix(<scope>): <description> (review finding)`).
@@ -461,9 +461,9 @@ ceremony above:
461
461
  1. Group the fixable Mediums by owning lens (the pillar or audit family
462
462
  that produced them). A Medium is fixable on the same terms as a 🟠; a
463
463
  Medium in any escalation class stays on the comment exactly like a 🟠.
464
- 2. For each lens, call `assert-branch.js --expected [HEAD_REF]`, stage
465
- explicit paths only, and make **one focused conventional commit per
466
- lens** (`fix(<scope>): <description> (review findings batch)`).
464
+ 2. For each lens, confirm `git branch --show-current` reports
465
+ `[HEAD_REF]`, stage explicit paths only, and make **one focused
466
+ conventional commit per lens** (`fix(<scope>): <description> (review findings batch)`).
467
467
  3. Bounded-attempt semantics extend to the batch: each finding gets **at
468
468
  most one** attempt, and a lens's batch commit that would exceed
469
469
  `delivery.codeReview.maxFixScopeFiles` routes that lens's findings to
@@ -549,7 +549,8 @@ If the operator instructs you to fix any findings:
549
549
 
550
550
  ```powershell
551
551
  # Guard: confirm we're on the correct branch before committing.
552
- node .agents/scripts/assert-branch.js --expected [HEAD_REF]
552
+ # ([HEAD_REF] mismatch -> STOP and re-checkout before any commit.)
553
+ git branch --show-current
553
554
 
554
555
  # Stage explicit paths — never `git add .` on a shared tree.
555
556
  git add <path/one> <path/two>
@@ -181,6 +181,17 @@ Threshold defaults live in `delivery.preflight.*` in `.agentrc.json`
181
181
  (all keys default to "no cap" — the gate is opt-in until an operator
182
182
  configures `maxStories` etc.).
183
183
 
184
+ **Remote evidence — land or block (issue #4483).** The envelope also
185
+ carries `remoteVerified` + `remoteProbe` (deterministic probes:
186
+ `git remote get-url origin`, bounded `git ls-remote origin HEAD`). When
187
+ `remoteVerified` is `false`, flip the Epic to `agent::blocked`, post a
188
+ friction comment quoting `remoteProbe.detail`, and halt — the same
189
+ explicit-block shape as #4425/#4480. NEVER fall back to executing Stories
190
+ inline in this session or committing the delivery to local `main`; the
191
+ worktree/branch/PR path below is the only sanctioned mechanism. Phase 7's
192
+ finalize additionally refuses with a `delivery-branch-missing-on-origin`
193
+ blocker when `epic/<epicId>` never reached origin.
194
+
184
195
  ### Phase 1 main — Seed the wave plan
185
196
 
186
197
  ```bash
@@ -758,14 +769,15 @@ run. Passing `--epic <epicId>` scopes the red-path failure digest to
758
769
  `gh run view --log-failed` tail, coarse classification) and surfaces
759
770
  the fix-loop handoff. Remediate on `epic/<epicId>` and re-run the
760
771
  helper (auto-merge stays armed across retries). If the same failure
761
- class recurs, hand the convergence off to the host loop:
762
- `/loop /loops:fix-failing-tests`.
772
+ class recurs, hand the convergence off to a self-paced host loop
773
+ (`/loop`) that re-runs the failing check and applies the smallest fix
774
+ until it exits green.
763
775
  - **Exit 2** — **still-running** (slow CI, not red): the poll cap fired
764
776
  with checks still pending and the watcher exhausted its
765
777
  `delivery.ci.watch.maxResumes` re-arm budget with nothing red. This is
766
778
  **never** a failure and **never** `timed_out`. Hand the wait off to the
767
- host's interval loop rather than blocking the delivery turn:
768
- `/loop 5m /loops:watch-ci`.
779
+ host's interval loop rather than blocking the delivery turn: `/loop 5m`
780
+ polling `gh pr checks` until the checks settle.
769
781
 
770
782
  > **Triage authority.** How to classify and remediate a red (or repeatedly
771
783
  > slow) check — the root-cause-only decision tree for infra/transient and