dev-loops 0.4.0 → 0.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.
- package/.claude/.claude-plugin/plugin.json +1 -1
- package/.claude/agents/dev-loop.md +1 -1
- package/.claude/agents/refiner.md +1 -0
- package/.claude/commands/auto.md +7 -0
- package/.claude/commands/continue.md +15 -0
- package/.claude/commands/info.md +7 -0
- package/.claude/commands/start-spike.md +16 -0
- package/.claude/commands/start.md +7 -0
- package/.claude/commands/status.md +6 -0
- package/.claude/hooks/_run-context.mjs +11 -4
- package/.claude/skills/dev-loop/SKILL.md +21 -6
- package/.claude/skills/dev-loop/templates/slides-story-review.md +54 -0
- package/.claude/skills/docs/artifact-authority-contract.md +86 -31
- package/.claude/skills/docs/local-planning-flow.md +63 -0
- package/.claude/skills/docs/local-planning-worked-example.md +139 -0
- package/.claude/skills/docs/merge-preconditions.md +35 -0
- package/.claude/skills/docs/plan-file-contract.md +37 -0
- package/.claude/skills/docs/release-runbook.md +45 -0
- package/.claude/skills/docs/retrospective-checkpoint-contract.md +55 -7
- package/.claude/skills/docs/spike-mode-contract.md +237 -0
- package/.claude/skills/docs/ui-e2e-scoping-step.md +102 -0
- package/.claude/skills/local-implementation/SKILL.md +1 -1
- package/CHANGELOG.md +73 -0
- package/README.md +21 -1
- package/agents/dev-loop.agent.md +8 -1
- package/agents/refiner.agent.md +1 -0
- package/cli/index.mjs +2 -0
- package/extension/index.ts +10 -1
- package/extension/presentation.ts +15 -0
- package/lib/dev-loops-core.mjs +141 -0
- package/package.json +8 -3
- package/scripts/claude/generate-claude-assets.mjs +15 -1
- package/scripts/github/capture-review-threads.mjs +20 -2
- package/scripts/github/comment-issue.mjs +181 -0
- package/scripts/github/fetch-ci-logs.mjs +215 -0
- package/scripts/github/list-issues.mjs +191 -0
- package/scripts/github/probe-copilot-review.mjs +69 -3
- package/scripts/github/upsert-checkpoint-verdict.mjs +18 -3
- package/scripts/lib/jq-output.mjs +297 -0
- package/scripts/loop/_handoff-contract.mjs +1 -0
- package/scripts/loop/check-retro-tooling.mjs +246 -0
- package/scripts/loop/copilot-pr-handoff.mjs +21 -3
- package/scripts/loop/detect-pr-gate-coordination-state.mjs +65 -2
- package/scripts/loop/docs-grill-contract.mjs +70 -0
- package/scripts/loop/info.mjs +21 -2
- package/scripts/loop/pr-runner-coordination.mjs +20 -4
- package/scripts/loop/resolve-dev-loop-startup.mjs +176 -5
- package/scripts/loop/resolve-pr-conflicts.mjs +357 -0
- package/scripts/loop/run-conductor-cycle.mjs +5 -0
- package/scripts/loop/run-watch-cycle.mjs +77 -3
- package/scripts/loop/slides-story-review-contract.mjs +123 -0
- package/scripts/pages/build-site.mjs +136 -0
- package/scripts/projects/add-queue-item.mjs +12 -2
- package/scripts/projects/list-queue-items.mjs +12 -2
- package/scripts/projects/move-queue-item.mjs +12 -2
- package/scripts/projects/resolve-active-board-item.mjs +193 -0
- package/scripts/refine/_refine-helpers.mjs +20 -0
- package/scripts/refine/exit-spike.mjs +186 -0
- package/scripts/refine/promote-plan.mjs +387 -0
- package/scripts/refine/refine-plan-file.mjs +165 -0
- package/scripts/refine/scaffold-spike-file.mjs +183 -0
- package/scripts/refine/validate-plan-file.mjs +64 -0
- package/scripts/refine/validate-spike-file.mjs +87 -0
- package/scripts/release/extract-changelog-section.mjs +111 -0
- package/skills/dev-loop/SKILL.md +24 -2
- package/skills/dev-loop/templates/slides-story-review.md +54 -0
- package/skills/docs/artifact-authority-contract.md +86 -31
- package/skills/docs/local-planning-flow.md +63 -0
- package/skills/docs/local-planning-worked-example.md +139 -0
- package/skills/docs/merge-preconditions.md +35 -0
- package/skills/docs/plan-file-contract.md +37 -0
- package/skills/docs/release-runbook.md +45 -0
- package/skills/docs/retrospective-checkpoint-contract.md +55 -7
- package/skills/docs/spike-mode-contract.md +237 -0
- package/skills/docs/ui-e2e-scoping-step.md +102 -0
- package/skills/local-implementation/SKILL.md +1 -1
|
@@ -22,7 +22,7 @@ The envelope is the primary handoff artifact — it is derived from resolver out
|
|
|
22
22
|
|
|
23
23
|
**Construction sequence:**
|
|
24
24
|
|
|
25
|
-
1. Run the deterministic startup resolver to produce the authoritative state bundle: `npx dev-loops@0.
|
|
25
|
+
1. Run the deterministic startup resolver to produce the authoritative state bundle: `npx dev-loops@0.6.0 loop startup --issue <n>` for issues, or `npx dev-loops@0.6.0 loop startup --pr <n>` for PRs.
|
|
26
26
|
2. Pass the resolver output, resolved settings (merged from `.devloops` and `.pi/dev-loop/defaults.yaml`), and current gate state to `buildDevLoopHandoffEnvelope()`.
|
|
27
27
|
3. **Validate the envelope** with `validateHandoffEnvelope()` before consuming any field. If validation returns `ok: false`, reject the handoff with the structured error — do not load requiredReads, do not execute nextAction, do not delegate.
|
|
28
28
|
4. Read the envelope as the first artifact.
|
|
@@ -44,6 +44,7 @@ For the active phase, require and produce:
|
|
|
44
44
|
- Do not invent audit findings when no audit artifact was provided
|
|
45
45
|
- when the phase includes watcher or predicate-driven behavior: explicit timeout semantics and negative-case expectations for non-target identities/events
|
|
46
46
|
- when the phase relies on package-first shared helpers inside a source-loaded workspace: explicit integration expectations about whether local callers use published package imports or a thin source/workspace adapter during development
|
|
47
|
+
- cross-check the phase's claims against the contracts and docs they reference (the autonomous docs-grill step, see ../docs/docs-grill-step.md): surface code-vs-doc drift, stale references, and contract-surface inaccuracies as refinement findings while the claims are still being verified
|
|
47
48
|
|
|
48
49
|
## Working style
|
|
49
50
|
- Prefer parallel fresh-context fan-out/fan-in when it improves refinement quality or surfaces materially different variants.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Run an autonomous dev loop on a GitHub issue until the human approval checkpoint."
|
|
3
|
+
argument-hint: "<issue>"
|
|
4
|
+
---
|
|
5
|
+
<!-- GENERATED from commands/auto.command.md by scripts/claude/generate-claude-assets.mjs — do not edit; edit the source and regenerate. -->
|
|
6
|
+
|
|
7
|
+
Run the `dev-loop` skill with the public intent `auto dev loop on issue $ARGUMENTS`. Resolve authoritative state first, then continue autonomously through the routed loop until a stop condition or the human approval checkpoint. Do not pick an internal strategy name yourself.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Continue the dev loop — the current in-progress board item, or a given issue/PR."
|
|
3
|
+
argument-hint: "[issue|pr]"
|
|
4
|
+
---
|
|
5
|
+
<!-- GENERATED from commands/continue.command.md by scripts/claude/generate-claude-assets.mjs — do not edit; edit the source and regenerate. -->
|
|
6
|
+
|
|
7
|
+
Continue a dev loop. Two forms, both handed to the `dev-loop` skill — do NOT pick an internal strategy yourself.
|
|
8
|
+
|
|
9
|
+
- With an argument (`$ARGUMENTS` is an issue or PR — `123`, `#123`, or a GitHub URL): run the `dev-loop` skill with the public intent `continue dev loop on $ARGUMENTS`. Resolve that artifact's authoritative state first, then route; ignore board position.
|
|
10
|
+
|
|
11
|
+
- Bare (no `$ARGUMENTS`): pick up the single in-progress board item. Resolve the board's repo and project the same way the queue commands do, then run `node scripts/projects/resolve-active-board-item.mjs --repo <owner/name> --project <number>`.
|
|
12
|
+
- It returns `{ ok: true, target: { kind, number } }` for exactly one in-progress item → run the `dev-loop` skill with the public intent `continue dev loop on #<number>` (the resolved `target.number`), so the intent carries the concrete target instead of re-resolving board state.
|
|
13
|
+
- It returns `{ ok: false, reason }` when there are zero or more than one in-progress items → FAIL CLOSED: print the reason verbatim (it lists the items) and instruct the user to run `/continue #N` explicitly. Do NOT guess.
|
|
14
|
+
|
|
15
|
+
Resolve authoritative state before routing. All paths terminate in the dev-loop skill's `loop startup` → build-envelope → route, stopping at the human-approval checkpoint as usual. No new routing logic here.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Show the read-only dev-loop state summary for an issue or PR."
|
|
3
|
+
argument-hint: "<issue|pr>"
|
|
4
|
+
---
|
|
5
|
+
<!-- GENERATED from commands/info.command.md by scripts/claude/generate-claude-assets.mjs — do not edit; edit the source and regenerate. -->
|
|
6
|
+
|
|
7
|
+
Resolve the read-only dev-loop state for `$ARGUMENTS` via the `loop info` shortcut — no full dev-loop run. If `$ARGUMENTS` is an issue number, run `npx dev-loops@0.6.0 loop info --issue $ARGUMENTS`; if it is a PR number, run `npx dev-loops@0.6.0 loop info --pr $ARGUMENTS`. Report the strategy, route, linked PR / branch, CI, and next action. Do not start implementation.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Start a time-boxed dev-loop spike from a question (or a pre-authored findings file)."
|
|
3
|
+
argument-hint: "<question> | --file <path>"
|
|
4
|
+
---
|
|
5
|
+
<!-- GENERATED from commands/start-spike.command.md by scripts/claude/generate-claude-assets.mjs — do not edit; edit the source and regenerate. -->
|
|
6
|
+
|
|
7
|
+
Start a spike — a time-boxed exploration whose deliverable is a findings document. Two forms; both end in `loop startup --spike <path>` and hand the bundle to the `dev-loop` skill. Do NOT pick an internal strategy yourself, and do NOT invent new spike behavior — this wraps the shipped `--spike` intake (see `skills/docs/spike-mode-contract.md`).
|
|
8
|
+
|
|
9
|
+
- Inline question (`$ARGUMENTS` is free text, not `--file ...`): scaffold a startable findings artifact, then enter spike mode.
|
|
10
|
+
- Pick a local spike path (e.g. `docs/spikes/<slug>.md` derived from the question; do not overwrite an existing file).
|
|
11
|
+
- Run `node scripts/refine/scaffold-spike-file.mjs --question "$ARGUMENTS" --out <path> --json`. It writes `## Question` (from the arg) plus stubbed `## Approach`/`## Findings` so the exploration scaffold passes `validateSpikeExplorationSections`; `## Recommendation` is left for the spike to fill in. It returns `{ ok: true, path, question }`.
|
|
12
|
+
- Then run `node scripts/loop/resolve-dev-loop-startup.mjs --spike <path>` and route the resulting bundle through the `dev-loop` skill.
|
|
13
|
+
|
|
14
|
+
- Pre-authored file (`$ARGUMENTS` begins with `--file <path>`): skip scaffolding and run `node scripts/loop/resolve-dev-loop-startup.mjs --spike <path>` directly, then route. The file must already carry the exploration scaffold (Question/Approach/Findings).
|
|
15
|
+
|
|
16
|
+
The spike runs under the relaxed `gates.spike` profile. When the exploration reaches a `## Recommendation`, conclude it with `node scripts/refine/exit-spike.mjs --spike-file <path> --disposition <discard|graduate> [--plan-file <path>]` per the spike-mode contract — discard leaves nothing behind, graduate emits a plan file into the local-planning flow. No new routing logic here.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Start a dev loop on a GitHub issue."
|
|
3
|
+
argument-hint: "<issue>"
|
|
4
|
+
---
|
|
5
|
+
<!-- GENERATED from commands/start.command.md by scripts/claude/generate-claude-assets.mjs — do not edit; edit the source and regenerate. -->
|
|
6
|
+
|
|
7
|
+
Run the `dev-loop` skill with the public intent `start dev loop on issue $ARGUMENTS`. Resolve authoritative state first, then route through the deterministic internal strategy. Do not pick an internal strategy name yourself.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Report dev-loop readiness (gh auth, git repo, subagent availability)."
|
|
3
|
+
---
|
|
4
|
+
<!-- GENERATED from commands/status.command.md by scripts/claude/generate-claude-assets.mjs — do not edit; edit the source and regenerate. -->
|
|
5
|
+
|
|
6
|
+
Report dev-loop readiness for this environment. Check, in one pass: `gh` is installed (`command -v gh`), `gh` is authenticated (`gh auth status`), the working directory is inside a git repo (`git rev-parse --is-inside-work-tree`), and the `subagent`/`Agent` capability is available. Summarize which checks passed and the suggested next step. Read-only — do not start implementation.
|
|
@@ -5,8 +5,14 @@
|
|
|
5
5
|
* The dev-loop async path keys off the harness-neutral `DEVLOOPS_RUN_ID` env var to
|
|
6
6
|
* identify an inspectable per-subagent run (runner ownership, async-start enforcement,
|
|
7
7
|
* human-comment gating), and provides a mint-and-propagate path for harnesses (e.g. Claude
|
|
8
|
-
* Code) that inject no native per-subagent run id.
|
|
9
|
-
* dispatching an async subagent.
|
|
8
|
+
* Code) that inject no native per-subagent run id. For those harnesses dev-loops itself mints
|
|
9
|
+
* and sets `DEVLOOPS_RUN_ID` when dispatching an async subagent.
|
|
10
|
+
*
|
|
11
|
+
* Other harnesses may already inject their own run-id var: the Pi runtime injects
|
|
12
|
+
* `PI_SUBAGENT_RUN_ID` (not `DEVLOOPS_RUN_ID`) into each async subagent's child env, so that
|
|
13
|
+
* name is honored as a recognized run-id alias (precedence after the neutral primary). It is
|
|
14
|
+
* an externally-injected Pi-runtime contract var, not a dev-loops-owned var — dev-loops still
|
|
15
|
+
* mints/propagates only the neutral `DEVLOOPS_RUN_ID`.
|
|
10
16
|
*
|
|
11
17
|
* This module is pure except for the explicit file/IO helpers (writeRunContext/readRunContext),
|
|
12
18
|
* which take an injectable `fs` and `root` for testability.
|
|
@@ -18,9 +24,10 @@ import path from "node:path";
|
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
26
|
* Env var names that carry the async-context run id, in resolution precedence order.
|
|
21
|
-
* The neutral `DEVLOOPS_RUN_ID` is the
|
|
27
|
+
* The neutral `DEVLOOPS_RUN_ID` is primary; `PI_SUBAGENT_RUN_ID` is the alias the Pi
|
|
28
|
+
* runtime injects into async-subagent child envs (the only run-id marker present under Pi).
|
|
22
29
|
*/
|
|
23
|
-
export const RUN_ID_MARKERS = Object.freeze(["DEVLOOPS_RUN_ID"]);
|
|
30
|
+
export const RUN_ID_MARKERS = Object.freeze(["DEVLOOPS_RUN_ID", "PI_SUBAGENT_RUN_ID"]);
|
|
24
31
|
|
|
25
32
|
/** Neutral env var name used when minting/propagating a run id. */
|
|
26
33
|
export const NEUTRAL_RUN_ID_VAR = "DEVLOOPS_RUN_ID";
|
|
@@ -25,7 +25,7 @@ Required installed runtime contract docs are shared bundled copies under `../doc
|
|
|
25
25
|
|
|
26
26
|
> Under the Claude Code harness the dev-loop runs as a single agent: run these steps directly — no read-only boundary and no separate async-subagent dispatch. See [Main Agent Contract](../docs/main-agent-contract.md).
|
|
27
27
|
|
|
28
|
-
Resolve authoritative state via the startup resolver (`npx dev-loops@0.
|
|
28
|
+
Resolve authoritative state via the startup resolver (`npx dev-loops@0.6.0 loop startup --issue <n>` for issues, `npx dev-loops@0.6.0 loop startup --pr <n>` for PRs), then immediately build the handoff envelope via `npx dev-loops@0.6.0 loop build-envelope --input <resolver-output.json>`. The envelope determines `requiredReads`, `nextAction`, `stopRules`, and `acceptance` — load only those files, execute only that bounded task. It is the first handoff artifact consumed before loading any route pack. See [Workflow Handoff Contract](../docs/workflow-handoff-contract.md) for the derivation contract.
|
|
29
29
|
|
|
30
30
|
**Retrospective checkpoint gate:** the resolver reads `.pi/dev-loop-retrospective-checkpoint.json` and injects the state. When the checkpoint is `missing` and the repo config `workflow.requireRetrospective` (set via `.devloops` at repo root) is `true`, the resolver returns `needs_reconcile`. Complete or explicitly skip the retrospective before starting.
|
|
31
31
|
|
|
@@ -99,10 +99,25 @@ When `@dev-loops/core` is available again, switch back to the full helper. The f
|
|
|
99
99
|
|
|
100
100
|
## Read-only info shortcut
|
|
101
101
|
|
|
102
|
-
Info/handoff requests can be served directly via `npx dev-loops@0.
|
|
103
|
-
- `npx dev-loops@0.
|
|
104
|
-
- `npx dev-loops@0.
|
|
105
|
-
- `npx dev-loops@0.
|
|
102
|
+
Info/handoff requests can be served directly via `npx dev-loops@0.6.0 loop info` (read-only; no full dev-loop run required):
|
|
103
|
+
- `npx dev-loops@0.6.0 loop info --issue <n>` — human-readable issue state summary (strategy, route, linked PR, next action)
|
|
104
|
+
- `npx dev-loops@0.6.0 loop info --pr <n>` — human-readable PR state summary (branch, CI, threads, rounds, action)
|
|
105
|
+
- `npx dev-loops@0.6.0 loop info --issue <n> --json` — machine-readable JSON output
|
|
106
|
+
|
|
107
|
+
## Reading tool output (token-economical convention)
|
|
108
|
+
|
|
109
|
+
When you need a fact from a dev-loops JSON-emitting script, climb this ladder and stop at the first rung that answers the question — never read more output than you need:
|
|
110
|
+
|
|
111
|
+
1. **Prefer the dev-loops subcommand / concise mode.** Use `loop info` or a script's `--concise`/`--summary` mode (e.g. `run-watch-cycle.mjs --concise`, `probe-copilot-review.mjs --concise`) for a human-readable digest. The concise modes surface loop state, Copilot round count, unresolved/actionable thread counts, round-cap-clean eligibility, CI status, next action, and the current round's new Copilot comment bodies.
|
|
112
|
+
2. **`--silent` / `-s` for a yes/no check.** Reads ZERO output: `… --jq '<predicate>' --silent; echo $?` exits `0` for true / `1` for false. Without `--jq`, `--silent` maps the script's success (`ok:true`) to exit `0`, failure to `1`. Example: `probe-copilot-review.mjs --repo o/r --pr N --jq '.status=="idle"' -s`.
|
|
113
|
+
3. **`--jq <filter>` to extract a single field.** The `--jq`-wired scripts (`probe-copilot-review.mjs`, `capture-review-threads.mjs`, `upsert-checkpoint-verdict.mjs`, the `scripts/projects/*` queue scripts) accept a gh-style `--jq` filter (jq subset: field access, `.[]`/`.[N]`, `|`, `select(...)`, `==`/`!=`/`<`/`<=`/`>`/`>=`, `length`, `keys`). It prints only the filtered value. An invalid filter fails closed (stderr + exit `2`), distinct from a clean predicate-false (silent exit `1`).
|
|
114
|
+
4. **Use a dev-loops wrapper for `gh` reads — never an agent-level raw `gh`.** With `workflow.requireRetrospectiveInternalTooling: true`, a raw `gh` call is a recorded retro violation (fail-closed). If no script covers the read you need, treat it as a tooling gap: file/build a thin wrapper (reuse `scripts/lib/jq-output.mjs`, like the three below), don't shell out. The reads that already have wrappers:
|
|
115
|
+
- CI run-log tail (a failing PR's job log) → `scripts/github/fetch-ci-logs.mjs --repo <o/r> --pr <n> [--failed-only] [--tail <n>]`, **never raw `gh run view --log`/`--log-failed`**. (`probe-ci-status.mjs` names the failed checks; this returns the LOG.)
|
|
116
|
+
- Issue list/filter → `scripts/github/list-issues.mjs --repo <o/r> [--state <open|closed|all>] [--label <l>] [--limit <n>]`, **never raw `gh issue list`**. (The queue tool lists the project board; this is for arbitrary issue queries.)
|
|
117
|
+
- Issue comment → `scripts/github/comment-issue.mjs --repo <o/r> --issue <n> (--body <text> | --body-file <path>)`, **never raw `gh issue comment`**. Returns `{ ok, commentUrl }`.
|
|
118
|
+
|
|
119
|
+
All three accept the same `--jq`/`--silent` output flags as the other JSON-emitting scripts.
|
|
120
|
+
5. **NEVER `| python3` or `node -e`** to parse tool JSON. If a field you need is missing from a script's output, add it to the script (or its concise mode), not an inline parser.
|
|
106
121
|
|
|
107
122
|
## Guard rules
|
|
108
123
|
|
|
@@ -114,7 +129,7 @@ Info/handoff requests can be served directly via `npx dev-loops@0.4.0 loop info`
|
|
|
114
129
|
|
|
115
130
|
**Bounded async task contract:** Break work into discrete tasks with clear inputs, explicit outputs, bounded scope. No shell polling — use `run-watch-cycle.mjs` or `gh run watch`.
|
|
116
131
|
|
|
117
|
-
**Round-cap budget check (enforced):** After every watch cycle, fix pass, or reply-resolve, check whether completed Copilot review rounds have reached the maximum (default: 5). Stop re-requesting Copilot review when the limit is reached — never re-request after the cap.
|
|
132
|
+
**Round-cap budget check (enforced):** After every watch cycle, fix pass, or reply-resolve, check whether completed Copilot review rounds have reached the maximum (default: 5). Stop re-requesting Copilot review when the limit is reached — never re-request after the cap. Read these gate-cadence facts via the token-economical convention above (`run-watch-cycle.mjs --concise`, or `--jq`/`--silent` for a single field/predicate) — never `| python3` or `node -e`.
|
|
118
133
|
|
|
119
134
|
## Shorthand issue-based auto trigger contract
|
|
120
135
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Slides content & storytelling review prompt template
|
|
2
|
+
|
|
3
|
+
Use this template when running the bounded slides-story reviewer mode behind `dev-loop`.
|
|
4
|
+
|
|
5
|
+
You are a public-audience storytelling reviewer judging a deck's **narrative**, not its pixels. The visual designer/vision loop owns layout, spacing, and contrast; you own arc, message, sequencing, and audience fit.
|
|
6
|
+
|
|
7
|
+
## Inputs
|
|
8
|
+
|
|
9
|
+
- `acceptanceCriteria`: required list of slice-level acceptance criteria the review is judging
|
|
10
|
+
- `storytellingBrief`: required short focus brief (audience, intended takeaway, what to watch for)
|
|
11
|
+
- `deckBundle.deckSourcePath`: required path to the deck source (e.g. the Slidev `.md`)
|
|
12
|
+
- `deckBundle.slideScreenshots[]`: optional captured slides from the UI smoke harness
|
|
13
|
+
- `slideId`
|
|
14
|
+
- `screenshotPath`
|
|
15
|
+
|
|
16
|
+
## Review lens (public audience)
|
|
17
|
+
|
|
18
|
+
1. **Arc**: hook → tension → resolution. Does slide 1 make a stranger care?
|
|
19
|
+
2. **One message per slide**: each slide has a single takeaway; titles state the claim, not the topic.
|
|
20
|
+
3. **Sequencing**: order builds understanding; no forward references; jargon introduced before it is used.
|
|
21
|
+
4. **Audience calibration**: a public/non-insider reader can follow it — internal enum names, state-machine identifiers, and pills are translated or earn their keep, not dumped raw.
|
|
22
|
+
5. **Cut / merge / reorder**: explicit recommendations — which slides to drop, combine, or move.
|
|
23
|
+
6. **Close**: a memorable takeaway, not a feature list.
|
|
24
|
+
|
|
25
|
+
## Review policy
|
|
26
|
+
|
|
27
|
+
1. Fail closed on any missing, ambiguous, or unreadable required input — do not guess the narrative.
|
|
28
|
+
2. Ground every finding in a specific `slideId` (and a `screenshotPath` when available).
|
|
29
|
+
3. Return only deterministic findings tied to the brief and acceptance criteria; do not invent content.
|
|
30
|
+
|
|
31
|
+
## Required output format
|
|
32
|
+
|
|
33
|
+
Allowed enum values:
|
|
34
|
+
- `outcome`: `"story_review_satisfied"` | `"needs_iteration"`
|
|
35
|
+
- `severity`: `"high"` | `"medium"` | `"low"`
|
|
36
|
+
|
|
37
|
+
Return strict JSON with this shape (example uses concrete values):
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"outcome": "needs_iteration",
|
|
42
|
+
"summary": "short overall verdict on whether the deck lands",
|
|
43
|
+
"findings": [
|
|
44
|
+
{
|
|
45
|
+
"severity": "high",
|
|
46
|
+
"slideId": "hero",
|
|
47
|
+
"problem": "what is wrong with the narrative on this slide and why it fails the public audience",
|
|
48
|
+
"correctiveAction": "what to change next (cut/merge/reorder/reword)"
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
When `outcome` is `"needs_iteration"`, `findings` must be non-empty.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Artifact authority contract
|
|
2
2
|
|
|
3
|
-
This document is the canonical authority for the artifact-selection model:
|
|
3
|
+
This document is the canonical authority for the artifact-selection model: whether a work item originates from a GitHub issue (tracker-first) or from a persisted markdown plan file (local-planning).
|
|
4
4
|
|
|
5
5
|
This canonical owner lives in the shipped `skills/docs/` surface because installed skill/runtime consumers reliably own the skills subtree. In installed layouts, read the same contract via [Artifact Authority Contract](../docs/artifact-authority-contract.md) from the installed skill directory.
|
|
6
6
|
|
|
@@ -8,9 +8,11 @@ Other repo docs may summarize or link this contract, but they should not redefin
|
|
|
8
8
|
|
|
9
9
|
## Two-tier model
|
|
10
10
|
|
|
11
|
-
dev-loops supports two mutually exclusive artifact authority modes. Every work item
|
|
11
|
+
dev-loops supports two mutually exclusive artifact authority modes. Every work item originates from exactly one authoritative artifact: a GitHub issue or a persisted markdown plan file. Work originates from a PR or a direct local change only when explicitly requested.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The shipped extension default selects local-planning; see [Shipped default posture](#shipped-default-posture) below. The mode names that follow describe the two tiers; "default" in their headings refers to the github-first code-level fallback in `BUILT_IN_DEFAULTS`, which the shipped extension layer overrides to local-first.
|
|
14
|
+
|
|
15
|
+
### Tracker-first
|
|
14
16
|
|
|
15
17
|
**GitHub issues are the authoritative artifact store.** Work originates from a GitHub issue. A linked PR is the execution artifact. GitHub is the canonical source of truth for issue identity, acceptance criteria, scope, and lifecycle state.
|
|
16
18
|
|
|
@@ -25,12 +27,12 @@ Key contract:
|
|
|
25
27
|
- When an open linked PR exists, reuse it rather than opening another
|
|
26
28
|
- Implementation may proceed through either the GitHub-first routed path or the local implementation strategy (see [Public Dev Loop Contract](public-dev-loop-contract.md) `targetPreference`)
|
|
27
29
|
|
|
28
|
-
### Local-planning
|
|
30
|
+
### Local-planning
|
|
29
31
|
|
|
30
|
-
**Persisted markdown plan files are the authoritative artifact store.** Work originates from a markdown plan file
|
|
32
|
+
**Persisted markdown plan files are the authoritative artifact store.** Work originates from a local markdown plan file in the repo working tree, and no GitHub issue is required. The plan file stays uncommitted through authoring, refinement, and local review; promotion is the step that commits it (the helper sequence commits it as part of opening the PR). GitHub PRs carry review and merge while the plan file stays the canonical spec.
|
|
31
33
|
|
|
32
34
|
Artifacts:
|
|
33
|
-
- **Planning artifact:** Persisted markdown plan file (e.g., `docs/phases/phase-<n>.md`)
|
|
35
|
+
- **Planning artifact:** Persisted markdown plan file (e.g., `docs/phases/phase-<n>.md`); its format and required base sections are defined in the [Plan-file Contract](plan-file-contract.md)
|
|
34
36
|
- **Execution artifact:** Local branch and associated GitHub PR (created during implementation)
|
|
35
37
|
- **No GitHub issue:** The plan file replaces the issue as the canonical spec
|
|
36
38
|
|
|
@@ -41,10 +43,10 @@ Key contract:
|
|
|
41
43
|
|
|
42
44
|
### Mode selection table
|
|
43
45
|
|
|
44
|
-
| Mode | Canonical artifact | GitHub issue required | Settings
|
|
46
|
+
| Mode | Canonical artifact | GitHub issue required | Settings value |
|
|
45
47
|
|---|---|---|---|
|
|
46
|
-
| Tracker-first
|
|
47
|
-
| Local-planning (
|
|
48
|
+
| Tracker-first | GitHub issue | Yes | `strategy.default: github-first` |
|
|
49
|
+
| Local-planning (shipped default) | Markdown plan file | No | `strategy.default: local-first` |
|
|
48
50
|
|
|
49
51
|
`inputSource.default` further disambiguates local-first startup:
|
|
50
52
|
| inputSource | Meaning |
|
|
@@ -54,62 +56,115 @@ Key contract:
|
|
|
54
56
|
|
|
55
57
|
## Settings mechanism
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
The repo's default artifact-authority posture is declared by `strategy.default`, set in `.devloops` at repo root and resolved against the layered config defaults:
|
|
58
60
|
|
|
59
61
|
```yaml
|
|
60
62
|
# .devloops
|
|
61
63
|
strategy:
|
|
62
|
-
default:
|
|
63
|
-
# default:
|
|
64
|
+
default: local-first # local-planning (markdown plan file)
|
|
65
|
+
# default: github-first # tracker-first (GitHub issue required)
|
|
64
66
|
inputSource:
|
|
65
67
|
default: tracker # spec source for local-first: tracker (issue body) or phase-docs
|
|
66
68
|
```
|
|
67
69
|
|
|
68
|
-
The `strategy.default` key
|
|
69
|
-
1. It
|
|
70
|
-
2. It sets the
|
|
70
|
+
The `strategy.default` key carries two jobs:
|
|
71
|
+
1. It declares the repo's default artifact-authority posture (local-planning under `local-first`, tracker-first under `github-first`).
|
|
72
|
+
2. It sets the routing preference (`targetPreference`) in dev-loop startup — `prefer_local` under `local-first`, `prefer_github_first` under `github-first`.
|
|
73
|
+
|
|
74
|
+
The authoritative artifact for a given run is selected by the explicit startup input. `scripts/loop/resolve-dev-loop-startup.mjs` takes `--issue` / `--pr` / `--input` / `--plan-file` (mutually exclusive), and `strategy.default` supplies the default routing preference; it does not force the artifact per invocation.
|
|
71
75
|
|
|
72
76
|
The `inputSource.default` key disambiguates local-first startup:
|
|
73
|
-
- `tracker` (default): local agent implements from the GitHub issue body; the issue is canonical spec
|
|
74
|
-
- `phase-docs`: local agent implements from persisted phase docs; no tracker issue required
|
|
77
|
+
- `tracker` (default): the local agent implements from the GitHub issue body; the issue is the canonical spec
|
|
78
|
+
- `phase-docs`: the local agent implements from persisted phase docs; no tracker issue required
|
|
79
|
+
|
|
80
|
+
### Shipped default posture
|
|
75
81
|
|
|
76
|
-
|
|
82
|
+
The effective default for a consumer comes from the config-merge layering in `packages/core/src/config/config.mjs`. Precedence, low to high:
|
|
77
83
|
|
|
78
|
-
|
|
84
|
+
1. `BUILT_IN_DEFAULTS` (frozen in `config.mjs`) — `strategy.default: github-first`. This is the code-level fallback when no other layer sets the key.
|
|
85
|
+
2. Extension-packaged defaults (`packages/core/src/config/extension-defaults.yaml`, loaded as the `extensionDefaults` layer) — `strategy.default: local-first`. This is the opinion the package ships and the layer that wins over the built-in fallback.
|
|
86
|
+
3. Repo-local `.pi/dev-loop/defaults.*` (legacy) — applied when present.
|
|
87
|
+
4. Repo `.devloops` at repo root — the per-repo override, highest precedence. When `.devloops` is absent, the legacy `.pi/dev-loop/settings.*` / `overrides.*` apply at this position instead.
|
|
79
88
|
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
With nothing but the shipped package in place, the extension layer resolves `strategy.default` to `local-first`, so the shipped default posture is local-planning (epic #947, decision #7). A repo opts back into tracker-first by setting `strategy.default: github-first` in its own `.devloops`.
|
|
90
|
+
|
|
91
|
+
Two legacy repo-local layers also exist under `.pi/dev-loop/` (the package no longer ships a `.pi/dev-loop/defaults.yaml`). They differ in how they load: `.pi/dev-loop/defaults.*` is always applied when present, between the extension defaults and `.devloops`; `.pi/dev-loop/settings.*` (and the older `overrides.*`) load only when no `.devloops` is present — when `.devloops` exists it is authoritative and those files are ignored (with a deprecation warning). The full precedence, low to high, is: `BUILT_IN_DEFAULTS` < extension defaults < `.pi/dev-loop/defaults.*` < repo `.devloops` (or, when `.devloops` is absent, `.pi/dev-loop/settings.*` / `overrides.*`).
|
|
82
92
|
|
|
83
93
|
### Explicit non-knobs
|
|
84
94
|
|
|
85
95
|
These are not valid artifact authority mode selectors:
|
|
86
|
-
- `strategy.default: copilot` — not a valid mode;
|
|
96
|
+
- `strategy.default: copilot` — not a valid mode; the enum accepts only `github-first` or `local-first` (`packages/core/src/config/config.mjs`)
|
|
87
97
|
- Free-form string values — fail closed
|
|
88
|
-
- Omitting `strategy.default`
|
|
98
|
+
- Omitting `strategy.default` from every layer — resolves to `github-first` from `BUILT_IN_DEFAULTS`; with the shipped extension layer present it resolves to `local-first`
|
|
99
|
+
|
|
100
|
+
## Local-first plan-file flow end to end
|
|
101
|
+
|
|
102
|
+
Under local-planning, one plan file moves through four stages. Each stage has a shipped helper script; the start, refine, and promote stages also expose their pure logic as an `@dev-loops/core` contract, while the validate stage's `validatePlanFile` lives in its helper script (`scripts/refine/validate-plan-file.mjs`). The [Local-Planning Flow](local-planning-flow.md) skill doc walks the same sequence as operator steps, and the [Local-Planning Worked Example](local-planning-worked-example.md) shows one plan file evolving through every stage.
|
|
103
|
+
|
|
104
|
+
### P1 — Plan-file artifact + config (#949)
|
|
105
|
+
|
|
106
|
+
The plan file is a phase-doc-format markdown document. Its directory is `localPlanning.plansDir`, which defaults to `docs/phases/` (built-in default in `config.mjs`, mirrored in `extension-defaults.yaml`; `resolvePlansDir(config)` resolves it). Its required base authoring sections — `## Status`, `## Objective`, `## In scope`, `## Explicit non-goals` — and the validator `scripts/refine/validate-plan-file.mjs` (`validatePlanFile`, distinct `missing_*` codes per absent or empty section) are defined in the [Plan-file Contract](plan-file-contract.md).
|
|
107
|
+
|
|
108
|
+
### P2 — Intake (#950)
|
|
109
|
+
|
|
110
|
+
`scripts/loop/resolve-dev-loop-startup.mjs` accepts `--plan-file <path>` (mutually exclusive with `--issue`, `--pr`, `--input`). It validates the plan and threads an intake state onto its output. The pure contract `@dev-loops/core/loop/plan-file-intake-contract` (`packages/core/src/loop/plan-file-intake-contract.mjs`) defines `evaluatePlanFileIntakeState` and the three `PLAN_FILE_INTAKE_STATE` values:
|
|
111
|
+
|
|
112
|
+
| State | Meaning |
|
|
113
|
+
|---|---|
|
|
114
|
+
| `new_plan_needs_refinement` | Base sections valid; the refinement sections are not yet present |
|
|
115
|
+
| `plan_refined_ready_for_promotion` | Base sections valid and both `PLAN_FILE_REFINEMENT_SECTIONS` (`Acceptance criteria`, `Definition of done`) present |
|
|
116
|
+
| `ambiguous_fail_closed` | Base sections invalid, or only one refinement section present — the resolver does not route the plan forward |
|
|
117
|
+
|
|
118
|
+
In the CLI, a base-valid plan carrying only one refinement section is reported as `ambiguous_fail_closed` with exit 0 (the operator completes the missing section before refine/promote); a missing/unreadable plan, or one that fails the base-section validator, makes startup exit 1 with no readiness bundle.
|
|
119
|
+
|
|
120
|
+
### P3 — Local refine + review checkpoint (#951)
|
|
121
|
+
|
|
122
|
+
`scripts/refine/refine-plan-file.mjs` drives the refine step; the pure contract `@dev-loops/core/loop/plan-file-refine-contract` (`packages/core/src/loop/plan-file-refine-contract.mjs`) exports `refinePlanFileInPlace`, which writes the refiner payload back into the single canonical plan file in place — the `Acceptance criteria` and `Definition of done` sections, a `Coverage matrix` section (`COVERAGE_MATRIX_HEADING`), and a `Docs-grill findings` section (`DOCS_GRILL_FINDINGS_HEADING`) — then stops at the `local_human_review` checkpoint (`PLAN_FILE_REFINE_STOP.LOCAL_HUMAN_REVIEW`) with the intake state advanced to `plan_refined_ready_for_promotion`. The module performs no GitHub mutation, no network calls, and no filesystem I/O; the caller reads and writes the plan file. The docs-grill runs as a step within refinement: the CLI classifies each finding with `classifyDocsGrillFinding` (`scripts/loop/docs-grill-contract.mjs`) and the contract records the dispositions. See the [Docs-Grill Step](../../docs/docs-grill-step.md).
|
|
123
|
+
|
|
124
|
+
### P4 — Promotion + authority transfer (#952)
|
|
125
|
+
|
|
126
|
+
`scripts/refine/promote-plan.mjs` promotes a refined plan; the pure contract `@dev-loops/core/loop/plan-file-promote-contract` (`packages/core/src/loop/plan-file-promote-contract.mjs`) exports `evaluatePromoteEligibility` and `buildPromotionPrBody`. Promotion is PR-first: it commits the plan doc and opens exactly one draft PR via the canonical PR wrapper, and mints no GitHub issue. The plan↔PR link is bidirectional — the PR body carries the committed plan-doc path (the spec-of-record) and the plan front-matter carries `prNumber:` (`PLAN_FILE_PR_FRONT_MATTER_KEY`). Promotion is idempotent: a plan that already carries `prNumber` resolves to `already_promoted` (`PLAN_FILE_PROMOTE_ACTION.ALREADY_PROMOTED`) and opens nothing. The optional `prNumber` front-matter and its parser/serializer are described in the [Plan-file Contract](plan-file-contract.md).
|
|
127
|
+
|
|
128
|
+
### P5 — Local-first noise profile (#953)
|
|
129
|
+
|
|
130
|
+
The shipped extension layer pairs local-first with a low-noise posture, in `packages/core/src/config/extension-defaults.yaml`:
|
|
131
|
+
|
|
132
|
+
| Key | Shipped value | Why |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| `strategy.default` | `local-first` | The shipped default posture (decision #7) |
|
|
135
|
+
| `autonomy.humanMergeOnly` | `true` | Local-first never auto-merges; a human always merges |
|
|
136
|
+
| `queue.maxAutoFiledIssues` | `1` | Local-first is PR-first, so auto-filing issues is near-zero; a low cap keeps tracker noise minimal |
|
|
137
|
+
| `gates.postFindingsComments` | `true` | Gate findings live on the PR (the spec-of-record and human-review surface) as evidence |
|
|
138
|
+
|
|
139
|
+
These values come from the existing config-merge layering, so no new resolver is involved: `BUILT_IN_DEFAULTS` keeps the github-first posture (`humanMergeOnly: false`, `maxAutoFiledIssues: 10`), and the extension layer sets the local-first values above. A repo `.devloops` can override any of them.
|
|
89
140
|
|
|
90
141
|
## dev-loops own mode
|
|
91
142
|
|
|
92
|
-
dev-loops
|
|
143
|
+
dev-loops runs **local-planning**, set in its repo-root `.devloops`.
|
|
93
144
|
|
|
94
|
-
- **Mode:**
|
|
95
|
-
- **Settings:** `.
|
|
96
|
-
- **Artifact authority:**
|
|
97
|
-
- **
|
|
98
|
-
- **Why
|
|
145
|
+
- **Mode:** Local-planning
|
|
146
|
+
- **Settings:** repo-root `.devloops` sets `strategy.default: local-first` and `inputSource.default: tracker`
|
|
147
|
+
- **Artifact authority:** the canonical spec for a work item is its plan artifact; the repo dogfoods the same local-first posture the package ships as default
|
|
148
|
+
- **Per-run input:** with `inputSource.default: tracker`, a local-first session can still implement from a GitHub issue body when one is supplied (the issue is the spec source for that run); `phase-docs` switches the source to a committed plan file
|
|
149
|
+
- **Why local-planning:** the repo runs the local-first plan-file flow (plan-file → refine → review → promote) on its own work so the shipped default posture is exercised end to end.
|
|
99
150
|
|
|
100
151
|
## Relationship to other docs
|
|
101
152
|
|
|
102
153
|
| Doc | Relationship |
|
|
103
154
|
|---|---|
|
|
104
155
|
| [Public Dev Loop Contract](public-dev-loop-contract.md) | This contract is the canonical entrypoint; artifact authority contract defines the artifact model it assumes |
|
|
105
|
-
| [
|
|
156
|
+
| [Plan-file Contract](plan-file-contract.md) | Defines the plan-file format (phase-doc format) and its required base sections for local-planning mode |
|
|
157
|
+
| [Local-Planning Flow](local-planning-flow.md) | Operator sequence for the local-first flow: validate → start → refine → promote, naming the shipped helper scripts |
|
|
158
|
+
| [Local-Planning Worked Example](local-planning-worked-example.md) | One plan file shown through every stage, with the file content evolving |
|
|
159
|
+
| [Spike-mode Contract](spike-mode-contract.md) | Time-boxed exploratory runs; a graduated spike emits a plan file that enters this local-planning tier |
|
|
160
|
+
| [Tracker-First Loop State](tracker-first-loop-state.md) | Defines the PR-level state machine for tracker-first PR workflows; that is execution state, separate from artifact authority |
|
|
106
161
|
| [Main Agent Contract](main-agent-contract.md) | Defines the delegation boundary; artifact authority defines which artifacts govern work |
|
|
107
162
|
| AGENTS.md | Repo constitution; cites the work-origin rule and points to this contract |
|
|
108
163
|
| [Dev Loop Skill](../dev-loop/SKILL.md) | Public entrypoint skill; cites the work-origin rule and points to this contract |
|
|
109
164
|
|
|
110
165
|
### Distinction: artifact authority vs tracker-first PR workflow
|
|
111
166
|
|
|
112
|
-
`tracker-first-loop-state.md` defines a state machine for PR lifecycle management when a tracker item (e.g., Shortcut story) drives a GitHub PR.
|
|
167
|
+
`tracker-first-loop-state.md` defines a state machine for PR lifecycle management when a tracker item (e.g., Shortcut story) drives a GitHub PR. It is a **PR-level workflow contract**. The term "tracker-first" there refers to tracker-driven PR state transitions, a separate concern from the artifact authority model this doc defines.
|
|
113
168
|
|
|
114
169
|
## Non-goals
|
|
115
170
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Local-planning flow
|
|
2
|
+
|
|
3
|
+
The operator sequence for the local-first plan-file flow. The [Artifact Authority Contract](artifact-authority-contract.md) owns the model and the per-phase contract details; this doc names the shipped helper scripts in the order they run for one plan file. The [Local-Planning Worked Example](local-planning-worked-example.md) shows a single plan file evolving through these steps.
|
|
4
|
+
|
|
5
|
+
The flow applies under local-planning mode (`strategy.default: local-first`, the shipped default — see the contract's [Shipped default posture](artifact-authority-contract.md#shipped-default-posture)). The plan file lives under `localPlanning.plansDir`, which defaults to `docs/phases/`.
|
|
6
|
+
|
|
7
|
+
## Stages
|
|
8
|
+
|
|
9
|
+
| Stage | Helper script | Pure logic |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| Validate | `scripts/refine/validate-plan-file.mjs` | `validatePlanFile` (in the helper script; not a `@dev-loops/core` export) |
|
|
12
|
+
| Start | `scripts/loop/resolve-dev-loop-startup.mjs --plan-file <path>` | `evaluatePlanFileIntakeState` (`@dev-loops/core/loop/plan-file-intake-contract`) |
|
|
13
|
+
| Refine | `scripts/refine/refine-plan-file.mjs` | `refinePlanFileInPlace` (`@dev-loops/core/loop/plan-file-refine-contract`) |
|
|
14
|
+
| Promote | `scripts/refine/promote-plan.mjs` | `evaluatePromoteEligibility` / `buildPromotionPrBody` (`@dev-loops/core/loop/plan-file-promote-contract`) |
|
|
15
|
+
|
|
16
|
+
## 1. Author and validate the plan
|
|
17
|
+
|
|
18
|
+
Author a phase-doc-format plan under `docs/phases/` with the four base sections `## Status`, `## Objective`, `## In scope`, `## Explicit non-goals`. Check it against the base-section contract:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
node scripts/refine/validate-plan-file.mjs --input docs/phases/phase-<n>.md --json
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The JSON payload reports `{ checker: "validate-plan-file", ok, errors }`. Each absent or empty-body base section contributes one entry with a distinct `missing_*` code; `ok` is `true` when every base section is present with a non-empty body.
|
|
25
|
+
|
|
26
|
+
## 2. Start the local-planning session
|
|
27
|
+
|
|
28
|
+
Hand the plan to startup with `--plan-file` (mutually exclusive with `--issue`, `--pr`, and `--input`):
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
node scripts/loop/resolve-dev-loop-startup.mjs --plan-file docs/phases/phase-<n>.md
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Startup validates the plan and threads an intake state onto its output. A plan with valid base sections and no refinement sections is `new_plan_needs_refinement`; the same plan once it also carries `Acceptance criteria` and `Definition of done` is `plan_refined_ready_for_promotion`. A base-valid plan that carries only one of the two refinement sections is reported as `ambiguous_fail_closed` with exit 0 and is not routed forward — the operator completes the missing section first. A plan that is missing/unreadable or fails the base validator makes startup fail closed (exit 1, no readiness bundle).
|
|
35
|
+
|
|
36
|
+
## 3. Refine in place and stop at the local human-review checkpoint
|
|
37
|
+
|
|
38
|
+
The refine step writes the refiner output back into the same plan file:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
node scripts/refine/refine-plan-file.mjs --plan-file docs/phases/phase-<n>.md --payload <payload.json>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`refinePlanFileInPlace` appends the `Acceptance criteria` and `Definition of done` sections, a `Coverage matrix` section, and a `Docs-grill findings` section, then advances the intake state to `plan_refined_ready_for_promotion` and stops at the `local_human_review` checkpoint. The docs-grill runs as a step within refinement: each finding is classified with `classifyDocsGrillFinding` (see the [Docs-Grill Step](../../docs/docs-grill-step.md)) and the dispositions are recorded into the plan. The step makes no GitHub or network call; the human reviews the refined plan before anything is promoted.
|
|
45
|
+
|
|
46
|
+
## 4. Promote to a single draft PR
|
|
47
|
+
|
|
48
|
+
Once the human approves the refined plan, promote it:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
node scripts/refine/promote-plan.mjs --plan-file docs/phases/phase-<n>.md
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Promotion is PR-first: it commits the plan doc and opens exactly one draft PR via the canonical PR wrapper, and mints no GitHub issue. It records the plan↔PR link bidirectionally — the PR body references the committed plan-doc path, and the plan's front-matter gains a `prNumber:` entry. The committed plan doc is the spec-of-record; the draft PR enters the standard draft → pre-approval → human-merge flow. Promotion is idempotent: re-running on a plan that already carries `prNumber` resolves to `already_promoted` and opens nothing.
|
|
55
|
+
|
|
56
|
+
## Relationship to other docs
|
|
57
|
+
|
|
58
|
+
| Doc | Relationship |
|
|
59
|
+
|---|---|
|
|
60
|
+
| [Artifact Authority Contract](artifact-authority-contract.md) | Canonical model and per-phase contract details for the local-first flow |
|
|
61
|
+
| [Plan-file Contract](plan-file-contract.md) | Plan-file format, base sections, validator, and the optional `prNumber` front-matter |
|
|
62
|
+
| [Local-Planning Worked Example](local-planning-worked-example.md) | One plan file shown through every stage of this sequence |
|
|
63
|
+
| [Docs-Grill Step](../../docs/docs-grill-step.md) | The in-loop grill that runs as a step within refinement |
|