mandrel 1.91.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.
- package/.agents/README.md +5 -5
- package/.agents/docs/SDLC.md +75 -107
- package/.agents/docs/configuration.md +1 -1
- package/.agents/docs/quality-gates.md +8 -7
- package/.agents/docs/workflows.md +4 -10
- package/.agents/instructions.md +2 -2
- package/.agents/schemas/agentrc.schema.json +1 -1
- package/.agents/schemas/lifecycle/README.md +2 -1
- package/.agents/schemas/lifecycle/ledger-record.schema.json +1 -1
- package/.agents/schemas/risk-verdict.schema.json +14 -1
- package/.agents/scripts/README.md +0 -46
- package/.agents/scripts/analyze-execution.js +76 -1
- package/.agents/scripts/check-doc-links.js +3 -0
- package/.agents/scripts/check-workflow-cli-lint.js +208 -0
- package/.agents/scripts/epic-audit-recheck.js +1 -1
- package/.agents/scripts/epic-plan-clarity.js +16 -6
- package/.agents/scripts/epic-plan-decompose.js +37 -59
- package/.agents/scripts/epic-plan-healthcheck.js +39 -6
- package/.agents/scripts/epic-plan-spec.js +41 -168
- package/.agents/scripts/epic-reconcile.js +7 -1
- package/.agents/scripts/lib/Logger.js +4 -4
- package/.agents/scripts/lib/audit-suite/index.js +4 -5
- package/.agents/scripts/lib/audit-suite/runner.js +6 -4
- package/.agents/scripts/lib/audit-suite/selector.js +2 -3
- package/.agents/scripts/lib/bdd-runner-detect.js +1 -1
- package/.agents/scripts/lib/command-header.js +20 -0
- package/.agents/scripts/lib/config/github.js +1 -3
- package/.agents/scripts/lib/config-settings-schema.js +4 -3
- package/.agents/scripts/lib/degraded-mode.js +1 -1
- package/.agents/scripts/lib/label-constants.js +18 -3
- package/.agents/scripts/lib/label-taxonomy.js +14 -3
- package/.agents/scripts/lib/mutation/baseline-snapshot.js +7 -6
- package/.agents/scripts/lib/orchestration/consolidation-precondition.js +18 -8
- package/.agents/scripts/lib/orchestration/context-hydration-engine.js +3 -4
- package/.agents/scripts/lib/orchestration/docs-digest.js +2 -2
- package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist-helpers.js +4 -0
- package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist.js +22 -12
- package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/authoring-context.js +6 -1
- package/.agents/scripts/lib/orchestration/epic-spec-reconciler-diff.js +18 -2
- package/.agents/scripts/{lifecycle-diff.js → lib/orchestration/lifecycle/ledger-diff.js} +10 -76
- package/.agents/scripts/lib/orchestration/lifecycle/listeners/acceptance-reconciler.js +1 -1
- package/.agents/scripts/lib/orchestration/plan-context.js +510 -0
- package/.agents/scripts/lib/orchestration/plan-critic-conditions.js +177 -0
- package/.agents/scripts/lib/orchestration/plan-metrics.js +445 -0
- package/.agents/scripts/lib/orchestration/plan-persist/amend.js +359 -0
- package/.agents/scripts/lib/orchestration/plan-persist/delivery-mode.js +127 -0
- package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +978 -0
- package/.agents/scripts/lib/orchestration/plan-persist/summary.js +191 -0
- package/.agents/scripts/lib/orchestration/plan-reachability.js +160 -0
- package/.agents/scripts/lib/orchestration/plan-runner/worktree-sweep.js +3 -3
- package/.agents/scripts/lib/orchestration/planning-risk.js +1 -1
- package/.agents/scripts/lib/orchestration/spec-freshness.js +1 -1
- package/.agents/scripts/lib/orchestration/ticketing/bulk.js +1 -1
- package/.agents/scripts/lib/orchestration/ticketing/reads.js +11 -2
- package/.agents/scripts/lib/plan-phase-cleanup.js +16 -0
- package/.agents/scripts/lib/presentation/manifest-persistence.js +2 -3
- package/.agents/scripts/lib/templates/spec-author-prompts.js +74 -0
- package/.agents/scripts/plan-context.js +186 -0
- package/.agents/scripts/plan-critics.js +227 -0
- package/.agents/scripts/plan-persist.js +383 -0
- package/.agents/scripts/pr-watch-with-update.js +8 -7
- package/.agents/scripts/run-lint.js +10 -11
- package/.agents/scripts/story-plan.js +19 -7
- package/.agents/scripts/sync-claude-commands.js +10 -5
- package/.agents/skills/core/knowledge-transfer/SKILL.md +11 -7
- package/.agents/workflows/audit-documentation.md +5 -7
- package/.agents/workflows/audit-lighthouse.md +1 -0
- package/.agents/workflows/audit-security.md +1 -0
- package/.agents/workflows/audit-to-stories.md +16 -5
- package/.agents/workflows/git-deliver.md +76 -243
- package/.agents/workflows/helpers/_merge-conflict-template.md +1 -1
- package/.agents/workflows/helpers/code-review.md +7 -6
- package/.agents/workflows/helpers/deliver-epic.md +5 -4
- package/.agents/workflows/helpers/plan-epic-reference.md +109 -96
- package/.agents/workflows/helpers/plan-epic.md +246 -999
- package/.agents/workflows/helpers/plan-story.md +14 -14
- package/.agents/workflows/helpers/scope-triage-gate.md +6 -4
- package/.agents/workflows/helpers/single-story-deliver.md +5 -4
- package/.agents/workflows/helpers/worktree-lifecycle.md +9 -7
- package/.agents/workflows/mandrel-update.md +144 -466
- package/.agents/workflows/plan.md +73 -143
- package/docs/CHANGELOG.md +13 -0
- package/lib/cli/registry.js +21 -3
- package/package.json +1 -1
- package/.agents/schemas/loop-unit.schema.json +0 -70
- package/.agents/scripts/assert-branch.js +0 -81
- package/.agents/scripts/check-loop-units.js +0 -204
- package/.agents/scripts/detect-merges.js +0 -111
- package/.agents/scripts/git-pr-quality-gate.js +0 -205
- package/.agents/scripts/git-rebase-and-resolve.js +0 -234
- package/.agents/scripts/hierarchy-gate.js +0 -192
- package/.agents/scripts/hydrate-context.js +0 -179
- package/.agents/scripts/lib/loop-units/validate-loop-unit.js +0 -197
- package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/cli.js +0 -167
- package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/cli-args.js +0 -69
- package/.agents/scripts/lib/orchestration/plan-runner/plan-router.js +0 -86
- package/.agents/scripts/loc-delta.js +0 -205
- package/.agents/scripts/render-manifest.js +0 -143
- package/.agents/scripts/run-audit-suite.js +0 -97
- package/.agents/scripts/select-audits.js +0 -155
- package/.agents/scripts/update-mutation-baseline.js +0 -189
- package/.agents/workflows/explain.md +0 -118
- package/.agents/workflows/git-merge-pr.md +0 -377
- package/.agents/workflows/helpers/epic-plan-decompose.md +0 -22
- package/.agents/workflows/helpers/epic-plan-spec.md +0 -22
- package/.agents/workflows/loops/README.md +0 -65
- package/.agents/workflows/loops/fix-failing-tests.md +0 -74
- package/.agents/workflows/loops/nightly-audit.md +0 -81
- package/.agents/workflows/loops/watch-ci.md +0 -68
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
description: >-
|
|
3
3
|
Reference companion to plan-epic.md — the recovery procedures, --resume
|
|
4
4
|
mechanics, troubleshooting, and background rationale blocks moved out of the
|
|
5
|
-
runtime core so every /plan run ingests only the
|
|
5
|
+
runtime core so every /plan run ingests only the step flow. Read on demand
|
|
6
6
|
from the trigger-point pointers in plan-epic.md.
|
|
7
7
|
caller: plan-epic.md
|
|
8
8
|
---
|
|
@@ -11,126 +11,139 @@ caller: plan-epic.md
|
|
|
11
11
|
|
|
12
12
|
> **Not a slash command.** This file lives in `helpers/` and is a
|
|
13
13
|
> path-included reference module (not projected into the plugin command
|
|
14
|
-
> tree). [`plan-epic.md`](plan-epic.md) is the runtime core — the
|
|
15
|
-
> flow, commands, and gate contracts. This file holds the secondary
|
|
16
|
-
>
|
|
17
|
-
>
|
|
18
|
-
> Each section below is reached from a one-line pointer at its trigger
|
|
19
|
-
> point in the core.
|
|
14
|
+
> tree). [`plan-epic.md`](plan-epic.md) is the runtime core — the 3-step
|
|
15
|
+
> flow, commands, and gate contracts. This file holds the secondary material
|
|
16
|
+
> a run needs only when it hits an edge (a recovery path, a troubleshooting
|
|
17
|
+
> symptom) or wants the design rationale behind a persist guard.
|
|
20
18
|
|
|
21
|
-
##
|
|
19
|
+
## Persist guards — background rationale
|
|
22
20
|
|
|
23
|
-
The
|
|
24
|
-
|
|
25
|
-
sections lives here.
|
|
21
|
+
The persist step's core carries only the commands and the ordered gate list.
|
|
22
|
+
The design rationale for its guards and managed sections lives here.
|
|
26
23
|
|
|
27
24
|
### Epic-lease preflight (workflow guard)
|
|
28
25
|
|
|
29
|
-
Before any
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Epic
|
|
33
|
-
|
|
34
|
-
**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
held by this operator**, is taken (or re-affirmed) silently. The lease is
|
|
42
|
-
**released after Phase 8** (decompose) completes.
|
|
26
|
+
Before any mutation, `plan-persist.js` acquires the Epic-lease via the
|
|
27
|
+
assignee-as-lease primitive (`lib/orchestration/ticket-lease.js`). The lease
|
|
28
|
+
rides the Epic's single assignee: the operator (`github.operatorHandle` in
|
|
29
|
+
`.agentrc.json`) claims the Epic for the duration of the persist. The guard
|
|
30
|
+
**fails closed**: `/plan` emits no `story.heartbeat` during its run, so any
|
|
31
|
+
**foreign assignee** is treated as a live claim — the persist exits non-zero
|
|
32
|
+
and names the current owner, so two `/plan` runs cannot drive the same Epic
|
|
33
|
+
concurrently. Pass **`--steal`** to forcibly transfer a foreign claim once
|
|
34
|
+
you have confirmed the other run is dead. An **unassigned** Epic, or one
|
|
35
|
+
**already held by this operator**, is taken (or re-affirmed) silently. The
|
|
36
|
+
lease is released on every exit path — success, gate failure, and throw
|
|
37
|
+
alike.
|
|
43
38
|
|
|
44
39
|
### Idempotent managed sections
|
|
45
40
|
|
|
46
|
-
The persist
|
|
41
|
+
The persist is section-scoped and keyed on the Epic body: a re-run that
|
|
47
42
|
finds the requested sections already present
|
|
48
43
|
(`<!-- mandrel:tech-spec:start/end -->` /
|
|
49
44
|
`<!-- mandrel:acceptance-table:start/end -->`) short-circuits as
|
|
50
|
-
`already-planned` instead of duplicating content. Pass `--force` to
|
|
51
|
-
the managed sections in place (same Epic issue, refreshed section
|
|
45
|
+
`already-planned` instead of duplicating content. Pass `--force` to
|
|
46
|
+
overwrite the managed sections in place (same Epic issue, refreshed section
|
|
47
|
+
bodies, one regeneration audit comment).
|
|
52
48
|
|
|
53
49
|
### One planning document
|
|
54
50
|
|
|
55
51
|
A `/plan` Epic run creates exactly **one** issue — the Epic. The planning
|
|
56
|
-
artifacts land as marker-delimited managed sections of the Epic body: the
|
|
57
|
-
Spec (opening with `## Delivery Slicing`) inside
|
|
58
|
-
`<!-- mandrel:tech-spec:start/end -->`, and the Acceptance Spec's AC-ID
|
|
59
|
-
(headed `## Acceptance Table`) inside
|
|
60
|
-
`<!-- mandrel:acceptance-table:start/end -->`. The
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
label to the Epic ticket — when present, the `epic-plan-spec-author` skill
|
|
69
|
-
skips the Acceptance Table output and the runtime gates (start gate, finalize
|
|
70
|
-
reconciler) honour the waiver — the section need not be authored when the
|
|
71
|
-
waiver is set. See [SDLC § Acceptance Table — the second folded planning
|
|
72
|
-
section](../../docs/SDLC.md#acceptance-table--the-second-folded-planning-section)
|
|
52
|
+
artifacts land as marker-delimited managed sections of the Epic body: the
|
|
53
|
+
Tech Spec (opening with `## Delivery Slicing`) inside
|
|
54
|
+
`<!-- mandrel:tech-spec:start/end -->`, and the Acceptance Spec's AC-ID
|
|
55
|
+
table (headed `## Acceptance Table`) inside
|
|
56
|
+
`<!-- mandrel:acceptance-table:start/end -->`. The `## Acceptance Table`
|
|
57
|
+
section captures the stable-ID acceptance criteria table
|
|
58
|
+
(`| AC ID | Outcome | Feature File | Scenario | Disposition |`) that drives
|
|
59
|
+
close-time reconciliation during `/deliver`. Operators may opt out for
|
|
60
|
+
refactor-only or docs-only Epics by applying the `acceptance::n-a` label to
|
|
61
|
+
the Epic — the authoring skill then skips the Acceptance Table and the
|
|
62
|
+
runtime gates honour the waiver. See
|
|
63
|
+
[SDLC § Acceptance Table — the second folded planning section](../../docs/SDLC.md#acceptance-table--the-second-folded-planning-section)
|
|
73
64
|
for the full lifecycle.
|
|
74
65
|
|
|
75
66
|
### Parallel-safe file naming (per-Epic tree)
|
|
76
67
|
|
|
77
|
-
Multiple Epics may be planned
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
`temp/epic-[Epic_ID]/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
`temp/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
them.
|
|
94
|
-
|
|
95
|
-
## Phase 8 — `--resume` recovery (secondary rate limit)
|
|
96
|
-
|
|
97
|
-
The Phase 8 (Work Breakdown Decomposition) core carries the normal-path and
|
|
98
|
-
`--force` persist commands. The `--resume` recovery path — reached when a
|
|
99
|
-
large decomposition aborts mid-persist — lives here.
|
|
68
|
+
Multiple Epics may be planned concurrently. Every temp file written in the
|
|
69
|
+
workflow lives under the per-Epic tree (`temp/epic-[Epic_ID]/<artifact>`) —
|
|
70
|
+
e.g. `temp/epic-[Epic_ID]/plan-context.json`,
|
|
71
|
+
`temp/epic-[Epic_ID]/techspec.md`, `temp/epic-[Epic_ID]/tickets.json`. The
|
|
72
|
+
directory namespace is the isolation boundary; basenames inside it are
|
|
73
|
+
stable. (The ideation entry, which has no Epic id yet, namespaces under
|
|
74
|
+
`temp/plan-ideation/<slug>/` instead.) Do **not** reuse bare flat names like
|
|
75
|
+
`temp/techspec.md`.
|
|
76
|
+
|
|
77
|
+
**Durability.** The per-Epic tree is durable across runs: `plan-persist.js`
|
|
78
|
+
cleans its temp files **only at terminal success**
|
|
79
|
+
([`lib/plan-phase-cleanup.js`](../../scripts/lib/plan-phase-cleanup.js)), so
|
|
80
|
+
a failed persist leaves every authored artifact in place for `--force` /
|
|
81
|
+
`--resume` reuse. Nothing else garbage-collects the tree.
|
|
82
|
+
|
|
83
|
+
## Persist — `--resume` recovery (secondary rate limit)
|
|
100
84
|
|
|
101
85
|
**Secondary rate limit on large Epics.** For backlogs over ~60 tickets,
|
|
102
|
-
GitHub's secondary rate limit (HTTP 403, body contains "secondary rate
|
|
103
|
-
can trip mid-
|
|
104
|
-
automatically with a 30–120s backoff
|
|
105
|
-
|
|
106
|
-
|
|
86
|
+
GitHub's secondary rate limit (HTTP 403, body contains "secondary rate
|
|
87
|
+
limit") can trip mid-persist after ~80 issue creations. The http-client
|
|
88
|
+
retries automatically with a 30–120s backoff. If the run still aborts
|
|
89
|
+
(network drop, exhausted retries, etc.), resume from the partial backlog
|
|
90
|
+
with:
|
|
107
91
|
|
|
108
92
|
```bash
|
|
109
|
-
node .agents/scripts/
|
|
110
|
-
--tickets temp/epic-[Epic_ID]/tickets.json --resume
|
|
93
|
+
node .agents/scripts/plan-persist.js --epic [Epic_ID] --resume
|
|
111
94
|
```
|
|
112
95
|
|
|
113
|
-
`--resume` is idempotent: the
|
|
114
|
-
`
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
96
|
+
`--resume` is idempotent: the managed sections short-circuit
|
|
97
|
+
`already-planned`, and the reconciler recovers the slug→issue map from its
|
|
98
|
+
per-slug state ledger (`temp/epic-[Epic_ID]/[Epic_ID].state.json`) —
|
|
99
|
+
reseeding from live GitHub state when the file is missing — so only the
|
|
100
|
+
genuinely-missing children are created; the existing tree is never
|
|
101
|
+
duplicated.
|
|
102
|
+
|
|
103
|
+
## Measurement — the G2 acceptance gate (Epic #4474)
|
|
104
|
+
|
|
105
|
+
The 3-step collapse is **measured, not asserted**. The acceptance bar the
|
|
106
|
+
next benchmark cohort reads as the gate:
|
|
107
|
+
|
|
108
|
+
- **Turns-per-plan ≤ ~15** at the epic rung (from the 55–72-turn 12-phase
|
|
109
|
+
baseline). The turns proxy is the plan-metrics invocation ledger
|
|
110
|
+
(`temp/epic-<id>/plan-metrics.json`) plus the host session's turn
|
|
111
|
+
accounting — ledger records count CLI invocations from the parent
|
|
112
|
+
session's perspective, not sub-agent turns.
|
|
113
|
+
- **Plan tokens ≤ ~1.5M** at the epic rung (from 7.3–8.9M) — owned by the
|
|
114
|
+
host's session accounting (mandrel-bench `modelUsage`), not by any
|
|
115
|
+
in-repo counter.
|
|
116
|
+
- **Unchanged validator coverage** — every deterministic gate of the
|
|
117
|
+
retired pipeline still fires on the persist path: section gate, ticket
|
|
118
|
+
validator, file-assumption, DAG, budget, draft reachability, inline
|
|
119
|
+
healthcheck, mode-coherence. The enumerated receipt is
|
|
120
|
+
`tests/contract/planning/plan-persist-validator-coverage.test.js`.
|
|
121
|
+
|
|
122
|
+
Where to read the measurement:
|
|
123
|
+
|
|
124
|
+
- The `plan-summary` structured comment on the Epic carries the
|
|
125
|
+
plan-metrics roll-up line (invocations, per-CLI counts, span, critic
|
|
126
|
+
skips) — no runner-disk access needed.
|
|
127
|
+
- `node .agents/scripts/analyze-execution.js --epic <id> --plan-metrics-json`
|
|
128
|
+
prints the compact machine-readable envelope
|
|
129
|
+
(`{ epicId, planMetrics, summaryLine }`) — local read-only, stdout-pure.
|
|
121
130
|
|
|
122
131
|
## Troubleshooting
|
|
123
132
|
|
|
124
|
-
- If `
|
|
125
|
-
|
|
126
|
-
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
`
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
- If `plan-context.js` fails, confirm the Epic exists and has a body with
|
|
134
|
+
enough initial context (epic mode), or that the one-pager file is
|
|
135
|
+
non-empty (ideation mode).
|
|
136
|
+
- If `plan-persist.js` rejects the tickets file, re-read the validator's
|
|
137
|
+
error message — the most common causes are a ticket whose `type` is not
|
|
138
|
+
`story`, a Story missing its inline `acceptance[]` / `verify[]` contract,
|
|
139
|
+
a file-assumption declaration that contradicts the base branch, or a
|
|
140
|
+
dependency cycle in the Story `depends_on` graph.
|
|
141
|
+
- If `plan-persist.js` refuses with a mode-coherence error, the risk
|
|
142
|
+
verdict's `deliveryShape` contradicts the tickets payload — a `"single"`
|
|
143
|
+
verdict with a `tickets.json` on disk (delete or re-shape it), or a
|
|
144
|
+
fan-out verdict with no tickets authored.
|
|
145
|
+
- If the persist completed but the Epic is not on `agent::ready`, the
|
|
146
|
+
inline healthcheck refused the flip — read the failing check's `reason`
|
|
147
|
+
in the persist output, resolve it (or apply
|
|
148
|
+
`planning::healthcheck-waived` for a triaged environmental failure), and
|
|
149
|
+
re-run the persist.
|