dev-loops 0.6.0 → 0.7.2
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 +8 -7
- package/.claude/agents/fixer.md +1 -0
- package/.claude/agents/refiner.md +2 -2
- package/.claude/agents/review.md +4 -3
- package/.claude/commands/{auto.md → loop-auto.md} +1 -1
- package/.claude/commands/loop-continue.md +15 -0
- package/.claude/commands/loop-enqueue.md +22 -0
- package/.claude/commands/loop-grill.md +17 -0
- package/.claude/commands/{info.md → loop-info.md} +2 -2
- package/.claude/commands/loop-queue-status.md +24 -0
- package/.claude/commands/{start-spike.md → loop-start-spike.md} +2 -2
- package/.claude/commands/{start.md → loop-start.md} +1 -1
- package/.claude/commands/{status.md → loop-status.md} +1 -1
- package/.claude/hooks/_bash-command-classify.mjs +333 -29
- package/.claude/hooks/_hook-decisions.mjs +138 -15
- package/.claude/hooks/pre-tool-use-bash-gate.mjs +36 -15
- package/.claude/skills/copilot-pr-followup/SKILL.md +60 -34
- package/.claude/skills/dev-loop/SKILL.md +16 -12
- package/.claude/skills/docs/acceptance-criteria-verification.md +8 -3
- package/.claude/skills/docs/anti-patterns.md +5 -3
- package/.claude/skills/docs/artifact-authority-contract.md +30 -11
- package/.claude/skills/docs/confirmation-rules.md +1 -0
- package/.claude/skills/docs/contract-style-guide.md +37 -0
- package/.claude/skills/docs/copilot-loop-operations.md +19 -15
- package/.claude/skills/docs/cross-harness-regression-contract.md +60 -0
- package/.claude/skills/docs/debt-remediation-contract.md +1 -1
- package/.claude/skills/docs/epic-tree-refinement-procedure.md +25 -22
- package/.claude/skills/docs/issue-intake-procedure.md +26 -19
- package/.claude/skills/docs/local-planning-flow.md +1 -1
- package/.claude/skills/docs/local-planning-worked-example.md +1 -1
- package/.claude/skills/docs/merge-preconditions.md +30 -12
- package/.claude/skills/docs/plan-file-contract.md +1 -1
- package/.claude/skills/docs/pr-lifecycle-contract.md +44 -35
- package/.claude/skills/docs/public-dev-loop-contract.md +60 -44
- package/.claude/skills/docs/retrospective-checkpoint-contract.md +106 -79
- package/.claude/skills/docs/spike-mode-contract.md +14 -7
- package/.claude/skills/docs/stop-conditions.md +30 -15
- package/.claude/skills/docs/tracker-first-loop-state.md +13 -8
- package/.claude/skills/docs/ui-e2e-scoping-step.md +32 -0
- package/.claude/skills/docs/validation-policy.md +4 -5
- package/.claude/skills/docs/workflow-handoff-contract.md +39 -0
- package/.claude/skills/local-implementation/SKILL.md +62 -145
- package/.claude/skills/loop-grill/SKILL.md +163 -0
- package/AGENTS.md +1 -0
- package/CHANGELOG.md +101 -0
- package/README.md +9 -9
- package/agents/dev-loop.agent.md +11 -10
- package/agents/developer.agent.md +1 -1
- package/agents/docs.agent.md +1 -1
- package/agents/fixer.agent.md +2 -1
- package/agents/quality.agent.md +1 -1
- package/agents/refiner.agent.md +3 -3
- package/agents/review.agent.md +5 -4
- package/cli/index.mjs +35 -42
- package/extension/README.md +4 -4
- package/extension/checks.ts +1 -5
- package/extension/harness-types.ts +1 -0
- package/extension/index.ts +6 -0
- package/extension/pi-extension-adapter.ts +2 -0
- package/extension/presentation.ts +7 -19
- package/package.json +12 -12
- package/scripts/_core-helpers.mjs +2 -0
- package/scripts/claude/headless-dev-loop.mjs +1 -1
- package/scripts/docs/validate-rule-ownership.mjs +442 -0
- package/scripts/docs/validate-state-machine-conformance.mjs +1092 -0
- package/scripts/github/_review-thread-mutations.mjs +5 -2
- package/scripts/github/capture-review-threads.mjs +2 -9
- package/scripts/github/comment-issue.mjs +2 -9
- package/scripts/github/create-label.mjs +133 -0
- package/scripts/github/create-pr.mjs +119 -10
- package/scripts/github/detect-checkpoint-evidence.mjs +259 -18
- package/scripts/github/detect-linked-issue-pr.mjs +22 -6
- package/scripts/github/edit-pr.mjs +259 -0
- package/scripts/github/fetch-ci-logs.mjs +2 -9
- package/scripts/github/list-issues.mjs +2 -9
- package/scripts/github/list-review-threads.mjs +277 -0
- package/scripts/github/manage-sub-issues.mjs +46 -10
- package/scripts/github/offer-human-handoff.mjs +8 -5
- package/scripts/github/post-gate-findings.mjs +20 -5
- package/scripts/github/probe-ci-status.mjs +8 -2
- package/scripts/github/probe-copilot-review.mjs +21 -14
- package/scripts/github/ready-for-review.mjs +26 -8
- package/scripts/github/reconcile-draft-gate.mjs +7 -3
- package/scripts/github/reply-resolve-review-thread.mjs +16 -5
- package/scripts/github/reply-resolve-review-threads.mjs +69 -7
- package/scripts/github/request-copilot-review.mjs +98 -26
- package/scripts/github/resolve-handoff-candidates.mjs +7 -3
- package/scripts/github/resolve-tracker-local-spec.mjs +9 -3
- package/scripts/github/stage-reviewer-draft.mjs +10 -2
- package/scripts/github/tick-verified-checkboxes.mjs +202 -0
- package/scripts/github/upsert-checkpoint-verdict.mjs +105 -15
- package/scripts/github/verify-briefing-prefixes.mjs +191 -0
- package/scripts/github/verify-fresh-review-context.mjs +226 -32
- package/scripts/github/view-pr.mjs +150 -0
- package/scripts/github/wait-pr-checks.mjs +171 -0
- package/scripts/github/write-gate-context.mjs +458 -65
- package/scripts/github/write-gate-findings-log.mjs +128 -2
- package/scripts/lib/jq-output.mjs +18 -0
- package/scripts/loop/_post-convergence-change.mjs +211 -0
- package/scripts/loop/_pr-runner-coordination.mjs +70 -0
- package/scripts/loop/_repo-root-resolver.mjs +47 -0
- package/scripts/loop/build-handoff-envelope.mjs +14 -4
- package/scripts/loop/check-retro-tooling.mjs +14 -3
- package/scripts/loop/checkpoint-contract.mjs +7 -4
- package/scripts/loop/cleanup-worktree.mjs +12 -3
- package/scripts/loop/conductor-monitor.mjs +12 -18
- package/scripts/loop/copilot-pr-handoff.mjs +162 -14
- package/scripts/loop/debt-remediate.mjs +24 -12
- package/scripts/loop/detect-change-scope.mjs +38 -9
- package/scripts/loop/detect-copilot-loop-state.mjs +34 -8
- package/scripts/loop/detect-copilot-session-activity.mjs +7 -3
- package/scripts/loop/detect-initial-copilot-pr-state.mjs +7 -3
- package/scripts/loop/detect-internal-only-pr.mjs +8 -2
- package/scripts/loop/detect-issue-refinement-artifact.mjs +6 -3
- package/scripts/loop/detect-pr-gate-coordination-state.mjs +184 -69
- package/scripts/loop/detect-reviewer-loop-state.mjs +12 -2
- package/scripts/loop/detect-tracker-first-loop-state.mjs +9 -1
- package/scripts/loop/detect-tracker-pr-state.mjs +10 -3
- package/scripts/loop/ensure-worktree.mjs +8 -3
- package/scripts/loop/info.mjs +12 -4
- package/scripts/loop/inspect-run-viewer/constants.mjs +4 -18
- package/scripts/loop/inspect-run-viewer/vendor/mermaid.min.js +3405 -0
- package/scripts/loop/inspect-run-viewer-ci-changes.mjs +18 -6
- package/scripts/loop/inspect-run-viewer.mjs +67 -4
- package/scripts/loop/inspect-run.mjs +8 -2
- package/scripts/loop/outer-loop.mjs +8 -4
- package/scripts/loop/pr-runner-coordination.mjs +2 -9
- package/scripts/loop/pre-commit-branch-guard.mjs +16 -10
- package/scripts/loop/pre-flight-gate.mjs +9 -9
- package/scripts/loop/pre-pr-ready-gate.mjs +8 -4
- package/scripts/loop/pre-write-remote-freshness-guard.mjs +13 -4
- package/scripts/loop/provision-worktree.mjs +74 -3
- package/scripts/loop/resolve-dev-loop-startup.mjs +216 -10
- package/scripts/loop/resolve-gate-dispatch.mjs +134 -0
- package/scripts/loop/resolve-pr-conflicts.mjs +14 -7
- package/scripts/loop/run-conductor-cycle.mjs +8 -2
- package/scripts/loop/run-queue.mjs +18 -9
- package/scripts/loop/run-refinement-audit.mjs +8 -9
- package/scripts/loop/run-watch-cycle.mjs +2 -9
- package/scripts/loop/sanctioned-commands.mjs +106 -0
- package/scripts/loop/steer-loop.mjs +29 -16
- package/scripts/loop/validate-pr-body-spec.mjs +223 -0
- package/scripts/loop/watch-initial-copilot-pr.mjs +8 -3
- package/scripts/pages/build-site.mjs +59 -8
- package/scripts/pages/build-state-atlas.mjs +443 -0
- package/scripts/projects/_resolve-project.mjs +1 -0
- package/scripts/projects/add-queue-item.mjs +60 -54
- package/scripts/projects/archive-done-items.mjs +49 -84
- package/scripts/projects/ensure-queue-board.mjs +10 -36
- package/scripts/projects/list-queue-items.mjs +59 -382
- package/scripts/projects/move-queue-item.mjs +21 -449
- package/scripts/projects/reconcile-queue.mjs +253 -0
- package/scripts/projects/reorder-queue-item.mjs +43 -68
- package/scripts/projects/resolve-active-board-item.mjs +108 -46
- package/scripts/projects/sync-item-status.mjs +15 -10
- package/scripts/refine/_refine-helpers.mjs +21 -5
- package/scripts/refine/exit-spike.mjs +18 -8
- package/scripts/refine/promote-plan.mjs +22 -16
- package/scripts/refine/prose-linkage-detector.mjs +1 -1
- package/scripts/refine/refine-plan-file.mjs +13 -4
- package/scripts/refine/refinement-completeness-checker.mjs +1 -1
- package/scripts/refine/scaffold-spike-file.mjs +4 -8
- package/scripts/refine/scope-boundary-cross-checker.mjs +1 -1
- package/scripts/refine/tree-integrity-validator.mjs +1 -1
- package/scripts/refine/validate-plan-file.mjs +1 -1
- package/scripts/refine/validate-spike-file.mjs +1 -1
- package/scripts/refine/verify.mjs +11 -6
- package/scripts/release/assert-core-dependency-version.mjs +123 -0
- package/scripts/release/extract-changelog-section.mjs +16 -2
- package/skills/copilot-pr-followup/SKILL.md +60 -34
- package/skills/dev-loop/SKILL.md +11 -7
- package/skills/docs/acceptance-criteria-verification.md +8 -3
- package/skills/docs/anti-patterns.md +5 -3
- package/skills/docs/artifact-authority-contract.md +30 -11
- package/skills/docs/confirmation-rules.md +1 -0
- package/skills/docs/contract-style-guide.md +37 -0
- package/skills/docs/copilot-loop-operations.md +19 -15
- package/skills/docs/cross-harness-regression-contract.md +60 -0
- package/skills/docs/debt-remediation-contract.md +1 -1
- package/skills/docs/epic-tree-refinement-procedure.md +25 -22
- package/skills/docs/issue-intake-procedure.md +26 -19
- package/skills/docs/local-planning-flow.md +1 -1
- package/skills/docs/local-planning-worked-example.md +1 -1
- package/skills/docs/merge-preconditions.md +30 -12
- package/skills/docs/plan-file-contract.md +1 -1
- package/skills/docs/pr-lifecycle-contract.md +44 -35
- package/skills/docs/public-dev-loop-contract.md +60 -44
- package/skills/docs/required-rules.json +149 -0
- package/skills/docs/retrospective-checkpoint-contract.md +106 -79
- package/skills/docs/spike-mode-contract.md +14 -7
- package/skills/docs/stop-conditions.md +30 -15
- package/skills/docs/tracker-first-loop-state.md +13 -8
- package/skills/docs/ui-e2e-scoping-step.md +32 -0
- package/skills/docs/validation-policy.md +4 -5
- package/skills/docs/workflow-handoff-contract.md +39 -0
- package/skills/local-implementation/SKILL.md +62 -145
- package/skills/loop-grill/SKILL.md +165 -0
- package/.claude/commands/continue.md +0 -15
- package/scripts/docs/validate-no-duplicate-rules.mjs +0 -250
- package/scripts/loop/conductor.mjs +0 -233
- package/scripts/loop/detect-stale-runner.mjs +0 -265
- package/scripts/loop/pre-push-main-guard.mjs +0 -117
|
@@ -39,11 +39,17 @@ Treat missing optional files as normal bootstrap conditions, not errors.
|
|
|
39
39
|
|
|
40
40
|
### Tracker-backed local implementation
|
|
41
41
|
|
|
42
|
-
Local implementation supports two durable spec
|
|
42
|
+
Local implementation supports these spec-of-record inputs. The first two are durable/committed artifacts; the third is a spec-of-record that is NOT a durable committed artifact:
|
|
43
|
+
|
|
44
|
+
Durable/committed spec artifacts:
|
|
43
45
|
|
|
44
46
|
- phase-doc-backed local sessions ([Phase Plan](../../docs/phases/phase-x.md) is canonical)
|
|
45
47
|
- tracker-backed local sessions (the tracker issue is canonical)
|
|
46
48
|
|
|
49
|
+
Non-durable spec-of-record (no committed plan artifact):
|
|
50
|
+
|
|
51
|
+
- lightweight PR-body-as-spec sessions (`--lightweight`; the PR description is the canonical spec-of-record but NOT a durable committed artifact — the resolver output carries `canonicalSpecSource: pr_body` and the derived handoff envelope carries `specSource: pr_body`; no phase/plan doc minted or committed). Same gate sequence as the phase-doc path; only the backing artifact differs. See [Artifact Authority Contract](../docs/artifact-authority-contract.md) "Lightweight (PR-body-as-spec)".
|
|
52
|
+
|
|
47
53
|
Tracker-backed local implementation stays inside the existing `local_implementation` path. For sub-issue tree decomposition, see [Sub-Issue Tree Contract](../../docs/sub-issue-tree-contract.md) (this is a source-repo reference; it is not part of the bundled `../docs/` runtime contract surface for installed skill copies). It does not introduce a new routing mode.
|
|
48
54
|
|
|
49
55
|
When the local spec already lives in a tracker issue:
|
|
@@ -51,47 +57,38 @@ When the local spec already lives in a tracker issue:
|
|
|
51
57
|
- resolve the tracker reference deterministically from a GitHub issue URL or explicit `<owner/name>` + issue number
|
|
52
58
|
- use the bounded GitHub helper `scripts/github/resolve-tracker-local-spec.mjs` when you need a machine-readable spec bundle
|
|
53
59
|
- treat the tracker issue title/body/url/state as the durable local spec bundle
|
|
54
|
-
- do not
|
|
60
|
+
- the no-duplicate-phase-doc rule is owned by `ARTIFACT-TRACKER-FIRST-NO-DUP` in [Artifact Authority Contract](../docs/artifact-authority-contract.md); do not read [Phase Plan](../../docs/phases/phase-x.md) for that same tracker-backed session either
|
|
55
61
|
- sync durable scope / acceptance / status changes back to the tracker issue rather than maintaining a duplicate local phase doc
|
|
56
62
|
- keep `tmp/` as temporary local execution state only; it does not become a second durable spec surface
|
|
57
63
|
- for tracker-backed sessions, the handoff path is always: push the working branch → open a PR → merge via GitHub
|
|
58
|
-
- for tracker-backed sessions,
|
|
59
|
-
-
|
|
64
|
+
- <!-- rule: LOCAL-PR-CREATE-CANONICAL --> for tracker-backed sessions, you MUST open PRs through the canonical `dev-loops pr create` path — always draft and always assigned — self-assigned by default (`--assignee @me` when none is given; honors an explicit `--assignee <login>` / `-a <login>`) — and MUST NOT open them via raw `gh pr create`. The PR body MUST contain `Closes #N` (or `Fixes #N`) for the linked issue so GitHub auto-closes it on merge. When `.devloops` sets `workflow.requireDraftFirst` to true, use `dev-loops pr create --assignee @me ...`; the draft-first requirement itself is owned by [`OPS-DRAFT-FIRST-PR`](../docs/copilot-loop-operations.md).
|
|
65
|
+
- <!-- rule: LOCAL-TRACKER-NO-DIRECT-MERGE --> `LOCAL-TRACKER-NO-DIRECT-MERGE`: for tracker-backed sessions, agents MUST NOT suggest a direct local-main merge and MUST NOT merge the working branch into local `main` at phase completion
|
|
60
66
|
|
|
61
67
|
## Primary execution rules
|
|
62
68
|
|
|
63
69
|
### Step 0: Pre-flight gate (mandatory for local_implementation)
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
<!-- rule: LOCAL-PREFLIGHT-GATE-MANDATORY -->
|
|
72
|
+
For the `local_implementation` strategy, before any planning or implementation mutation, you MUST run the pre-flight gate:
|
|
66
73
|
|
|
67
74
|
```sh
|
|
68
75
|
node scripts/loop/pre-flight-gate.mjs --expected-branch <working-branch> --check-subagents
|
|
69
76
|
```
|
|
70
77
|
|
|
71
|
-
Before creating or reusing a worktree for local implementation, use the canonical lifecycle entrypoint
|
|
78
|
+
Before creating or reusing a worktree for local implementation, use the canonical lifecycle entrypoint (`WORKTREE-CREATE-PROVISION`, see [Worktree usage guidance](../../docs/worktree-guidance.md#create-or-reuse--provision-ensure-worktreemjs)):
|
|
72
79
|
|
|
73
80
|
```sh
|
|
74
81
|
node scripts/loop/ensure-worktree.mjs --repo-root <main> --issue <n>
|
|
75
82
|
```
|
|
76
83
|
|
|
77
|
-
This
|
|
78
|
-
|
|
79
|
-
This validates:
|
|
80
|
-
- Worktree isolation (current directory is under `tmp/worktrees/`)
|
|
81
|
-
- Branch identity (current branch matches the working branch)
|
|
82
|
-
- Subagent availability (subagents should be used for fan-out when available)
|
|
83
|
-
|
|
84
|
-
If the gate fails, **stop and fix the violation** before proceeding. Do not bypass the gate in normal workflow execution.
|
|
84
|
+
This validates worktree isolation (current directory under `tmp/worktrees/`) and branch identity (current branch matches the working branch); `--check-subagents` only reports subagent availability and is advisory (fails-open, does not block the gate). If the gate fails, **stop and fix the violation** before proceeding — do not bypass it in normal workflow execution.
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
This gate does **not** apply to other routed strategies (`copilot_pr_followup`, `external_pr_followup`, `reviewer_fixer`, `wait_watch`, `final_approval`, `issue_intake`). Those strategies have their own execution rules and may edit code from any checkout as needed.
|
|
89
|
-
|
|
90
|
-
Development-only bypass (`DEVLOOPS_PREFLIGHT_BYPASS=1`) exists for testing the gate itself but must not be used in production workflow runs. The bypass variable is a testing convenience, not an operational escape hatch.
|
|
86
|
+
This gate does **not** apply to other routed strategies (`copilot_pr_followup`, `external_pr_followup`, `reviewer_fixer`, `wait_watch`, `final_approval`, `issue_intake`); those strategies have their own execution rules and may edit code from any checkout as needed. The development-only bypass (`DEVLOOPS_PREFLIGHT_BYPASS=1`) exists for testing the gate itself and MUST NOT be used in production workflow runs — it is a testing convenience, not an operational escape hatch.
|
|
91
87
|
|
|
92
88
|
## Narrow failure-triage fast path
|
|
93
89
|
|
|
94
|
-
|
|
90
|
+
<!-- rule: LOCAL-FAILURE-TRIAGE-ORDER -->
|
|
91
|
+
When resuming local implementation with dirty work or an observed failing command, you MUST follow this ordered path before broad discovery:
|
|
95
92
|
|
|
96
93
|
1. run startup once from the relevant worktree/context
|
|
97
94
|
2. inspect current state with `git status` and the changed files
|
|
@@ -105,20 +102,13 @@ Follow [Anti-patterns](../docs/anti-patterns.md) for the general tooling-interna
|
|
|
105
102
|
|
|
106
103
|
### Step 1
|
|
107
104
|
|
|
108
|
-
-
|
|
109
|
-
- Do not refine later phases in detail before the current phase is complete.
|
|
105
|
+
- <!-- rule: LOCAL-PHASE-ONE-AT-A-TIME --> You MUST implement **one phase at a time** and MUST NOT refine later phases in detail before the current phase is complete.
|
|
110
106
|
- Use the `refiner` agent for phase-refinement work when subagents are available; escalate RFC-worthy technical decisions to the parent session / human operator.
|
|
111
|
-
-
|
|
112
|
-
- Maintain **90% coverage** thresholds.
|
|
107
|
+
- <!-- rule: LOCAL-TEST-FIRST-COVERAGE --> You MUST work **test-first** for all non-trivial logic and SHOULD maintain **90% coverage** thresholds (coverage is not enforced by the shipped verify config; treat it as the working target).
|
|
113
108
|
- Log detailed iteration artifacts under `tmp/` using the required structure below.
|
|
114
|
-
-
|
|
115
|
-
- Treat `tmp/` as temporary local execution state. Do not rely on it as durable repo history and do not force-add it to git unless the user explicitly wants checked-in examples or fixtures.
|
|
109
|
+
- Spec-of-record split (phase-doc-backed vs. tracker-backed vs. lightweight): see [Tracker-backed local implementation](#tracker-backed-local-implementation) above.
|
|
116
110
|
- When a phase changes durable product truth in ways `PLAN.md` should express (for example command surface, accepted product decisions, resolved open questions, or scope changes), update [Project Plan](../../PLAN.md) before closing the phase.
|
|
117
|
-
-
|
|
118
|
-
- If the repo has no commits yet, still create the working branch first so the first commits land off `main`; only move `main` forward after review and validation.
|
|
119
|
-
- Use small atomic local commits as progress checkpoints whenever a coherent slice is green and reviewable.
|
|
120
|
-
- Before a branch is considered review-complete, approval-ready, merge-ready, or ready for final handoff, run the default pre-approval gate as a full review / fix loop with the review angles resolved from config (`resolveGateAngles(config, "preApproval")`), then apply accepted fixes and rerun validation. Shipped defaults include the `deep` angle.
|
|
121
|
-
- A phase is only fully complete when its scoped work, required support files, artifacts, validation, review/fix pass, commit(s), and finalization (merge into local `main` for phase-doc-backed sessions; PR merge for tracker-backed sessions) are done, or when the only remaining step is an explicitly noted authorization-gated finalization action.
|
|
111
|
+
- Branch, commit, pre-approval-gate, and finalization mechanics: see [Branch / review / merge policy](#branch--review--merge-policy), [Commit policy](#commit-policy), and [Implementation loop for the phase](#implementation-loop-for-the-phase) below.
|
|
122
112
|
- When subagents are used, log what each subagent was asked to do and what it concluded.
|
|
123
113
|
- If [Project Plan](../../PLAN.md) is too rough or ambiguous to safely start the current phase, do not guess: run a clarification/interview step with the user first.
|
|
124
114
|
|
|
@@ -126,34 +116,16 @@ Follow [Anti-patterns](../docs/anti-patterns.md) for the general tooling-interna
|
|
|
126
116
|
|
|
127
117
|
Apply [Structural Quality](../docs/structural-quality.md) from the `deep` review angle.
|
|
128
118
|
|
|
129
|
-
## Light mode (small changes)
|
|
119
|
+
## Light mode (small changes)
|
|
130
120
|
|
|
131
|
-
|
|
121
|
+
<!-- rule: LOCAL-LIGHT-MODE-CONFIG-SURFACE -->
|
|
122
|
+
`localImplementation.lightMode` (`.devloops` field; this repo sets `maxLines: 20`, `maxFiles: 2`) is this skill's config surface for light-mode gate dispatch. Gate-collapse mechanics, escalation, and dispatch resolution (`resolveGateDispatchMode`, `scripts/loop/resolve-gate-dispatch.mjs`) are owned by [Light-mode inline acceptance](../../docs/gate-review-sub-loop-contract.md#light-mode-inline-acceptance-under-threshold-micro-prs); this skill MUST NOT redefine them.
|
|
132
123
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
Use `scripts/loop/detect-change-scope.mjs` to determine eligibility:
|
|
124
|
+
Use `scripts/loop/detect-change-scope.mjs` to determine scope:
|
|
136
125
|
```sh
|
|
137
126
|
node scripts/loop/detect-change-scope.mjs
|
|
138
127
|
```
|
|
139
128
|
|
|
140
|
-
**Planned light mode path (not yet wired):**
|
|
141
|
-
1. Validation (`npm run verify`)
|
|
142
|
-
2. Single review pass (not multi-angle fan-out)
|
|
143
|
-
3. Pre-approval gate
|
|
144
|
-
4. Finalization
|
|
145
|
-
|
|
146
|
-
**Override threshold:**
|
|
147
|
-
```yaml
|
|
148
|
-
localImplementation:
|
|
149
|
-
lightMode:
|
|
150
|
-
enabled: true
|
|
151
|
-
maxFiles: 5
|
|
152
|
-
maxLines: 300
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Disabled by default (opt-in). Scope above threshold falls back to full fan-out/fan-in path.
|
|
156
|
-
|
|
157
129
|
## Deterministic logging structure
|
|
158
130
|
|
|
159
131
|
Treat the workflow as three layers:
|
|
@@ -260,6 +232,10 @@ For the **current phase only**, run this loop before implementation.
|
|
|
260
232
|
|
|
261
233
|
### 1. Create or update the durable phase doc and tmp scaffold
|
|
262
234
|
|
|
235
|
+
**Lightweight (PR-body-as-spec) exception:** when the session is lightweight — the resolver output carries `canonicalSpecSource: pr_body` and the derived handoff envelope carries `specSource: pr_body` (started via `resolve-dev-loop-startup.mjs --issue <n> --lightweight`) — SKIP the durable phase-doc mint entirely. The PR description is the spec-of-record; do NOT create or commit any `docs/phases/*.md` for this session. The ephemeral `tmp/phases/` scaffold may still be used for local execution state. All other steps (read prior learning, plan, implement) proceed unchanged, and the gate sequence (draft → pre-approval fanout → detect-evidence → human merge) is identical. See [Artifact Authority Contract](../docs/artifact-authority-contract.md) "Lightweight (PR-body-as-spec)".
|
|
236
|
+
|
|
237
|
+
Otherwise (default phase-doc path), create or update the durable phase doc.
|
|
238
|
+
|
|
263
239
|
Use paths like:
|
|
264
240
|
- `docs/phases/phase-0.md`
|
|
265
241
|
- `tmp/phases/phase-0/`
|
|
@@ -395,7 +371,8 @@ If the review finds real issues, revise the merged plan and briefly update the r
|
|
|
395
371
|
|
|
396
372
|
### 6. Only then start implementation
|
|
397
373
|
|
|
398
|
-
|
|
374
|
+
<!-- rule: LOCAL-PLAN-REVIEW-GATE -->
|
|
375
|
+
You MUST NOT begin coding before the merged phase plan has passed review.
|
|
399
376
|
Update `manifest.json` to show that phase implementation has started.
|
|
400
377
|
|
|
401
378
|
## Task breakdown & delegation
|
|
@@ -414,7 +391,8 @@ into parallel executable tasks and dispatch them to the right specialist subagen
|
|
|
414
391
|
|
|
415
392
|
### Delegation contract
|
|
416
393
|
|
|
417
|
-
|
|
394
|
+
<!-- rule: LOCAL-DELEGATION-TABLE -->
|
|
395
|
+
Implementation tasks MUST be dispatched to dedicated specialist agents per this table:
|
|
418
396
|
|
|
419
397
|
| Task type | Delegate to |
|
|
420
398
|
|---|---|
|
|
@@ -514,7 +492,7 @@ After the phase plan passes review:
|
|
|
514
492
|
5. Run the default pre-approval gate as a full review / fix loop on the branch before calling it review-complete, approval-ready, merge-ready, or ready for final handoff:
|
|
515
493
|
- resolve review angles from config: `resolveGateAngles(config, "preApproval")` from `@dev-loops/core/config` (shipped defaults enable all 11 pre-approval gate angle families; consumer repos may opt out individual angles via `excludeAngles`); run via the chain prescription below
|
|
516
494
|
- run the resolved angle-focused passes in parallel with fresh context when practical
|
|
517
|
-
-
|
|
495
|
+
- the sequential-fallback rule is owned by `GATE-EXEC-FANOUT-SEQUENTIAL-FALLBACK` in [Gate Review Sub-Loop Contract](../../docs/gate-review-sub-loop-contract.md); when it applies, record the fallback in `Phase Review` (`tmp/phases/phase-x/review.md`) (or the equivalent merged review artifact)
|
|
518
496
|
- for each angle, resolve its persona and prompt via `resolveReviewerRole(config, angle)` — start each reviewer in fresh context with a concise briefing including the angle-specific prompt, the branch/phase, intended behavior, acceptance criteria, relevant files or artifacts, and current validation status
|
|
519
497
|
- run the mandatory chain defined in [Gate Review Sub-Loop Contract](../../docs/gate-review-sub-loop-contract.md). Retry rule: in subsequent cycles, only re-run reviewers that produced findings in the previous pass. Do not fork the parent session for parallel reviewers; write a compact handoff artifact under `tmp/` and point the reviewer at it.
|
|
520
498
|
- when reviewer subagents stumble on raw source-tree reads (for example unresolved build artifacts or import assumptions), generate a deterministic diff/review artifact under `tmp/` and have reviewers inspect that artifact instead of the raw file set
|
|
@@ -528,8 +506,8 @@ After the phase plan passes review:
|
|
|
528
506
|
9. Write `Retrospective` (`tmp/phases/phase-x/retrospective.md`) using [Retrospective Template](../dev-loop/templates/retrospective.md).
|
|
529
507
|
10. Update `tmp/phases/phase-x/manifest.json` and `tmp/phases/index.json`.
|
|
530
508
|
11. Update [Implementation State](../../docs/IMPLEMENTATION_STATE.md).
|
|
531
|
-
12. **Exit validation gate — no uncommitted changes.** Before the subagent session terminates, run `git status --porcelain` and verify the output is empty. If uncommitted changes exist, first determine whether they are intended implementation changes or unintended/post-validation deltas. Revert any unintended or speculative changes. For intended changes, rerun the narrowest justified validation (`npm run verify` or equivalent) before staging and committing with an appropriate message; for tracker-backed sessions, also push the branch. A subagent session that exits with uncommitted changes in the worktree is a workflow defect and
|
|
532
|
-
13. For tracker-backed sessions, create the PR from the working branch
|
|
509
|
+
12. <!-- rule: LOCAL-COMMIT-BEFORE-EXIT --> **Exit validation gate — no uncommitted changes.** Before the subagent session terminates, run `git status --porcelain` and verify the output is empty. If uncommitted changes exist, first determine whether they are intended implementation changes or unintended/post-validation deltas. Revert any unintended or speculative changes. For intended changes, rerun the narrowest justified validation (`npm run verify` or equivalent) before staging and committing with an appropriate message; for tracker-backed sessions, also push the branch. A subagent session that exits with uncommitted changes in the worktree is a workflow defect and MUST NOT be treated as a clean completion. After committing, verify `git status --porcelain` is empty before declaring phase completion.
|
|
510
|
+
13. For tracker-backed sessions, create the PR from the working branch: `dev-loops pr create --assignee @me --repo <owner/name> --base main --head <branch> --title "..." --body-file <body-file>` (fallback when the CLI helper is unavailable: `node <resolved-skill-scripts>/github/create-pr.mjs --repo <owner/name> --assignee @me --base main --head <branch> --title "..." --body-file <body-file>`); never raw `gh pr create`. Draft/assignment/`Closes #N` policy: [LOCAL-PR-CREATE-CANONICAL](#tracker-backed-local-implementation) above.
|
|
533
511
|
14. If authorized, merge the fully reviewed, locally validated phase branch back into local `main` (phase-doc-backed sessions) or proceed through the PR gate pipeline (tracker-backed sessions).
|
|
534
512
|
15. If authorization for PR creation or merge is still pending (commit authorization is already enforced by the exit validation gate in step 12), mark the phase as `awaiting-finalization` rather than `completed`, and record exactly which finalization step is pending.
|
|
535
513
|
|
|
@@ -542,85 +520,32 @@ The retrospective must capture:
|
|
|
542
520
|
- what should change in the skill or workflow next time
|
|
543
521
|
- what a fresh session should know before the next phase
|
|
544
522
|
|
|
545
|
-
|
|
523
|
+
<!-- rule: LOCAL-RETROSPECTIVE-REQUIRED -->
|
|
524
|
+
This is the infrastructure for self-improvement; you MUST NOT skip it.
|
|
546
525
|
|
|
547
526
|
## Dev mode
|
|
548
527
|
|
|
549
|
-
Dev mode
|
|
550
|
-
|
|
551
|
-
A repository may also declare a formal-dev-mode default through `.devloops` field `workflow.devModeDefault`. Treat that config as the policy source of truth when present, but explicit user opt-in or opt-out for the current run still wins. Runtime consumption of that config may be staged separately from this documentation update.
|
|
552
|
-
|
|
553
|
-
Trigger it when the user explicitly asks for dev mode, self-improvement mode, or says they want the skill to refine itself as it goes.
|
|
554
|
-
|
|
555
|
-
In dev mode, after the normal phase summary and retrospective are written, run one extra bounded self-improvement pass before moving on:
|
|
556
|
-
|
|
557
|
-
1. collect a deterministic context bundle for the phase using:
|
|
558
|
-
- `../dev-loop/scripts/dev-mode-context.mjs`
|
|
559
|
-
- output to `tmp/phases/phase-x/dev-mode-context.json`
|
|
560
|
-
2. review the phase artifacts and logs with emphasis on the workflow itself:
|
|
561
|
-
- planning quality
|
|
562
|
-
- review quality
|
|
563
|
-
- validation friction
|
|
564
|
-
- bash exit-code-1 patterns
|
|
565
|
-
- places where skill or agent prompts should be tightened
|
|
566
|
-
- places where deterministic tooling should replace ad hoc work
|
|
567
|
-
3. write `Dev Mode Retrospective` (`tmp/phases/phase-x/dev-mode-retrospective.md`)
|
|
568
|
-
- this is the required dev-mode retrospective artifact
|
|
569
|
-
- it should name the highest-value prompt/workflow follow-ups revealed by the phase
|
|
570
|
-
4. optionally write `Dev Mode Review` (`tmp/phases/phase-x/dev-mode-review.md`) when separate analytical notes help support the retrospective
|
|
571
|
-
5. apply at least one bounded follow-up update to a relevant skill and/or agent prompt
|
|
572
|
-
- deterministic tooling, docs, templates, or tests may accompany that change
|
|
573
|
-
- but they do not replace the required prompt update
|
|
574
|
-
- keep the change phase-bounded and tied directly to the retrospective findings
|
|
575
|
-
6. write `Dev Mode Skill Changes` (`tmp/phases/phase-x/dev-mode-skill-changes.md`)
|
|
576
|
-
- record which skill and/or agent prompts changed
|
|
577
|
-
- record any supporting tooling/docs/template changes that accompanied them
|
|
578
|
-
- if no prompt update can be justified safely, stop and report that dev-mode exit criteria were not met
|
|
579
|
-
7. if skill scripts or deterministic tooling changed, rerun the skill-local tests
|
|
580
|
-
8. stop after this bounded self-improvement pass; do not recurse into endless self-editing loops
|
|
581
|
-
|
|
582
|
-
Dev mode is still phase-bounded. It improves the loop around the completed phase; it does not authorize work on the next product phase.
|
|
528
|
+
Dev mode improves the local implementation loop itself while using it. A repo may declare a default via `.devloops` field `workflow.devModeDefault`; explicit user opt-in/opt-out for the current run still wins over that default. Trigger it when the user explicitly asks for dev mode, self-improvement mode, or says they want the skill to refine itself as it goes.
|
|
583
529
|
|
|
584
|
-
|
|
530
|
+
After the normal phase summary and retrospective, run one extra bounded self-improvement pass:
|
|
585
531
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
- `summary.md`
|
|
595
|
-
- `retrospective.md`
|
|
596
|
-
- optional `Variant C` (`tmp/phases/phase-x/variant-c.md`) when a third variant was actually useful
|
|
597
|
-
- `bash-exit-1.jsonl` when any bash call during the phase exited with code `1`
|
|
598
|
-
- `clarification.md` when a plan-sufficiency interview or auto-clarification step was needed
|
|
599
|
-
- subagent summaries when subagents were used
|
|
600
|
-
- raw subagent outputs only when they were saved separately on purpose
|
|
601
|
-
- in dev mode: `dev-mode-context.json`, `dev-mode-retrospective.md`, and `dev-mode-skill-changes.md`
|
|
602
|
-
- optional in dev mode: `dev-mode-review.md` when separate analytical notes were useful
|
|
603
|
-
|
|
604
|
-
These `tmp/` artifacts are normally temporary and do not need to be checked into git.
|
|
605
|
-
|
|
606
|
-
Also log validation output summaries and notable decisions if they help evaluate the local dev loop later.
|
|
607
|
-
|
|
608
|
-
Additionally, append every bash call that exits with code `1` to:
|
|
609
|
-
- `tmp/phases/phase-x/bash-exit-1.jsonl`
|
|
532
|
+
1. Collect a deterministic context bundle: `../dev-loop/scripts/dev-mode-context.mjs` → `tmp/phases/phase-x/dev-mode-context.json`.
|
|
533
|
+
2. Review the phase artifacts/logs for planning quality, review quality, validation friction, bash exit-code-1 patterns, and places where prompts or deterministic tooling should improve.
|
|
534
|
+
3. Write `Dev Mode Retrospective` (`tmp/phases/phase-x/dev-mode-retrospective.md`) — required; name the highest-value prompt/workflow follow-ups revealed by the phase.
|
|
535
|
+
4. Optionally write `Dev Mode Review` (`tmp/phases/phase-x/dev-mode-review.md`) when separate analytical notes help.
|
|
536
|
+
5. Apply at least one bounded follow-up update to a relevant skill and/or agent prompt (supporting tooling/docs/template changes may accompany it but do not replace the prompt update), kept phase-bounded and tied directly to the retrospective findings.
|
|
537
|
+
6. Write `Dev Mode Skill Changes` (`tmp/phases/phase-x/dev-mode-skill-changes.md`) recording which prompts and supporting changes landed; if no prompt update can be justified safely, stop and report that dev-mode exit criteria were not met.
|
|
538
|
+
7. If skill scripts or deterministic tooling changed, rerun the skill-local tests.
|
|
539
|
+
8. Stop after this bounded pass — do not recurse into endless self-editing loops.
|
|
610
540
|
|
|
611
|
-
|
|
612
|
-
|
|
541
|
+
Dev mode is still phase-bounded: it improves the loop around the completed phase and does not authorize work on the next product phase.
|
|
542
|
+
|
|
543
|
+
## tmp/ logging requirements
|
|
613
544
|
|
|
614
|
-
|
|
615
|
-
- `
|
|
616
|
-
- `phase`
|
|
617
|
-
- `cwd`
|
|
618
|
-
- `command`
|
|
619
|
-
- `exitCode`
|
|
620
|
-
- `purpose`
|
|
621
|
-
- `summary`
|
|
545
|
+
<!-- rule: LOCAL-TMP-EPHEMERAL-STATE -->
|
|
546
|
+
The required durable-doc + `tmp/` artifact set for a phase is defined once in [Deterministic logging structure](#deterministic-logging-structure); this section MUST NOT duplicate that list. Those artifacts are normally temporary and do not need to be checked into git; do not force-add them unless the user explicitly wants checked-in examples or fixtures. Also log validation output summaries and notable decisions if they help evaluate the local dev loop later.
|
|
622
547
|
|
|
623
|
-
|
|
548
|
+
Additionally, append every bash call that exits with code `1` to `tmp/phases/phase-x/bash-exit-1.jsonl` using the deterministic helper `../dev-loop/scripts/log-bash-exit-1.mjs`. Each line is one JSON object with at least `timestamp`, `phase`, `cwd`, `command`, `exitCode`, `purpose`, `summary` (optionally truncated `stdout`/`stderr` or a path to a larger saved artifact). This log improves the local dev loop itself, so do not skip it just because the command was exploratory.
|
|
624
549
|
|
|
625
550
|
## Stop conditions
|
|
626
551
|
|
|
@@ -628,28 +553,20 @@ See [Stop Conditions](../docs/stop-conditions.md). Local-specific stops: phase c
|
|
|
628
553
|
|
|
629
554
|
## Branch / review / merge policy
|
|
630
555
|
|
|
631
|
-
-
|
|
632
|
-
-
|
|
633
|
-
-
|
|
634
|
-
-
|
|
635
|
-
-
|
|
636
|
-
- Rerun validation after review-driven fixes.
|
|
637
|
-
- A phase is not operationally closed until its branch state is captured in commit history and the reviewed branch has been finalized according to session type (merged into local `main` for phase-doc-backed sessions; merged via GitHub PR for tracker-backed sessions), unless authorization for that finalization is still pending.
|
|
638
|
-
- For tracker-backed sessions, the handoff path is always: push the working branch → open a PR → merge via GitHub; never merge the working branch into local `main`.
|
|
639
|
-
- PR creation always goes through `dev-loops pr create`, which is ALWAYS draft and always assigned — self-assigned by default (`--assignee @me` when none is given; honors an explicit `--assignee <login>` / `-a <login>`), never via raw `gh pr create`, and the PR body must contain `Closes #N` (or `Fixes #N`) for the linked issue so GitHub auto-closes it on merge. When `.devloops` sets `workflow.requireDraftFirst` to true, use `dev-loops pr create --assignee @me ...`. Do not create a fresh PR directly in ready-for-review state unless the user explicitly overrides that policy for the current PR scope. The draft gate inspection is a real workflow boundary, so a new PR must exist in draft before `gh pr ready` is eligible.
|
|
640
|
-
- When authorization is pending, record the phase as `awaiting-finalization` and describe the exact missing step.
|
|
556
|
+
- Implement on a dedicated local working branch, never directly on `main`, switching to it before the first mutating step; if the repo is unborn (no commits yet), still create the working branch first and make the initial atomic commits there.
|
|
557
|
+
- Use atomic local commits to log progress, but only for coherent reviewable slices — [Commit policy](#commit-policy) below governs commit timing/authorization.
|
|
558
|
+
- Before merging, run a full parallel review / fix loop and resolve accepted findings on the same branch; rerun validation after review-driven fixes.
|
|
559
|
+
- A phase is not operationally closed until its branch state is captured in commit history and the reviewed branch has been finalized according to session type (merged into local `main` for phase-doc-backed sessions; merged via GitHub PR for tracker-backed sessions); when authorization for that finalization is still pending, record the phase as `awaiting-finalization` and describe the exact missing step.
|
|
560
|
+
- For tracker-backed sessions, the handoff path is always: push the working branch → open a PR → merge via GitHub; never merge the working branch into local `main`. PR creation follows [LOCAL-PR-CREATE-CANONICAL](#tracker-backed-local-implementation) above; a new PR must exist in draft before `gh pr ready` is eligible.
|
|
641
561
|
- For phase-doc-backed sessions, merge the fully reviewed, locally validated branch back into local `main` when authorized.
|
|
562
|
+
- Behind-branch integration before merge (for example a sibling PR merged first and both touch shared files): prefer a merge commit (`git merge origin/main`) over rebase + force-push. Since dev-loop PRs are squash-merged, intermediate branch history is discarded at merge time, so a merge commit lands an identical result on `main` while avoiding a non-fast-forward push to the remote. Force-push (`--force-with-lease` only, never bare `--force`) remains acceptable only for a branch the loop solely owns and where no integration alternative exists (rare); document that carve-out rather than leaving it implicit. After any integration that changes the head SHA, re-verify gate evidence at the new head (existing behavior — see [Merge Preconditions](../docs/merge-preconditions.md#required-before-merge)).
|
|
642
563
|
|
|
643
564
|
## Commit policy
|
|
644
565
|
|
|
645
|
-
- Do not commit speculative work.
|
|
646
|
-
- Do not commit before the relevant validation for that slice passes.
|
|
566
|
+
- Do not commit speculative work or before the relevant validation for that slice passes.
|
|
647
567
|
- Immediately before every `git add && git commit` sequence, assert branch identity with `git branch --show-current` and stop if it does not match the intended local working branch.
|
|
648
|
-
-
|
|
649
|
-
- Do not leave completed phase work stranded off `main`; once the reviewed branch is ready and authorized, finalize it according to session type (merge into local `main` for phase-doc-backed sessions; complete via PR merge for tracker-backed sessions).
|
|
650
|
-
- Commit only when the coordination/main agent has decided the slice or phase is ready. **Exception:** in non-interactive subagent sessions, commit authorization is implicit — the subagent was dispatched to implement and must commit before exiting (see the commit sub-bullet under implementation loop step 3 and the exit validation gate in step 12).
|
|
568
|
+
- Commit only when the coordination/main agent has decided the slice or phase is ready. **Exception:** in non-interactive subagent sessions, commit authorization is implicit — the subagent was dispatched to implement and must commit before exiting, enforced by [LOCAL-COMMIT-BEFORE-EXIT](#implementation-loop-for-the-phase) (implementation loop step 12; `git status --porcelain` must be empty before the session terminates).
|
|
651
569
|
- If commit/merge authorization has not yet been given, do not call the phase `completed`; call it `awaiting-finalization` instead.
|
|
652
|
-
- **Subagent exit contract:** before a subagent session terminates, the exit validation gate (implementation loop step 12) must pass — `git status --porcelain` must be empty. A subagent that exits with uncommitted changes in the worktree has not completed its task, regardless of what was implemented.
|
|
653
570
|
|
|
654
571
|
## Anti-patterns
|
|
655
572
|
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "loop-grill"
|
|
3
|
+
description: "Standalone pre-loop Socratic Q&A grill for issues (tracker-first) or local plan files (local-planning). Detects spec gaps, asks clarifying questions (interactive) or self-answers them from codebase context (--auto), then writes a ## Grill findings section back to the source artifact."
|
|
4
|
+
allowed-tools: Read Bash Edit Write
|
|
5
|
+
user-invocable: false
|
|
6
|
+
---
|
|
7
|
+
<!-- GENERATED from skills/loop-grill/SKILL.md by scripts/claude/generate-claude-assets.mjs — do not edit; edit the source and regenerate. -->
|
|
8
|
+
|
|
9
|
+
# Loop-grill skill
|
|
10
|
+
|
|
11
|
+
A standalone, on-demand pre-loop grilling skill. Run it against an issue or a local plan file **before** the dev loop starts to surface underspecified acceptance criteria, fuzzy scope boundaries, unresolved primary actors, and undocumented hard-to-reverse decisions.
|
|
12
|
+
|
|
13
|
+
It is entirely separate from the in-loop docs-grill (`docs/docs-grill-step.md`), which audits code/doc drift while the loop runs. This skill operates on the *spec* before any implementation begins.
|
|
14
|
+
|
|
15
|
+
## Interface
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
/loop-grill <issue-number> # tracker-first, interactive
|
|
19
|
+
/loop-grill <issue-number> --auto # tracker-first, auto-answer
|
|
20
|
+
/loop-grill <path/to/plan.md> # local-planning, interactive
|
|
21
|
+
/loop-grill <path/to/plan.md> --auto # local-planning, auto-answer
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Argument validation (fail-closed)
|
|
25
|
+
|
|
26
|
+
Before doing anything else:
|
|
27
|
+
|
|
28
|
+
1. Confirm exactly one positional argument is present (issue number or path). No argument → error, stop.
|
|
29
|
+
2. Confirm the only optional flag is `--auto`. Any other flag → error, stop.
|
|
30
|
+
3. **Tracker-first:** verify the issue exists. Non-existent issue → `Error: issue #<n> not found.`, stop.
|
|
31
|
+
4. **Local-planning:** verify the file exists. Missing file → `Error: plan file not found: <path>`, stop.
|
|
32
|
+
5. Never mutate any artifact when argument validation fails.
|
|
33
|
+
|
|
34
|
+
## Step 1 — Load the target
|
|
35
|
+
|
|
36
|
+
- **Tracker-first:** fetch the issue body (title + description + any existing `## Grill findings` section).
|
|
37
|
+
- **Local-planning:** read the plan file from disk.
|
|
38
|
+
|
|
39
|
+
## Step 1b — Surface external resources
|
|
40
|
+
|
|
41
|
+
Before detecting gaps, scan the loaded content for external resource references: links, other repo URLs, API endpoints, doc URLs, screenshots, or Playwright navigation descriptors.
|
|
42
|
+
|
|
43
|
+
- **Interactive mode:** if external resources are present, ask the operator to confirm they are accessible or to provide them before the Q&A starts.
|
|
44
|
+
- **`--auto` mode:** attempt to fetch each resource using bounded wrapper commands (e.g. `gh`, API wrapper scripts under `scripts/`). Do not fetch resources inline with raw `curl` or token-heavy calls. Flag any inaccessible resource as `unresolved` in the findings rather than silently skipping it.
|
|
45
|
+
- When no external resources are present, skip this step silently.
|
|
46
|
+
|
|
47
|
+
## Step 2 — Detect gaps
|
|
48
|
+
|
|
49
|
+
Scan the loaded content and identify each gap. The minimum required gap detectors are:
|
|
50
|
+
|
|
51
|
+
| Gap kind | Detection signal |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Missing acceptance criteria | No `## Acceptance criteria` section, or section is empty / stub |
|
|
54
|
+
| Missing scope boundary | No explicit in-scope / out-of-scope statement or non-goals section |
|
|
55
|
+
| Unresolved primary actor | No named user, system, or role that is the main beneficiary of the feature |
|
|
56
|
+
| Undocumented hard-to-reverse decision | Destructive or irreversible operations described without a rationale or rollback note |
|
|
57
|
+
|
|
58
|
+
Additional gaps discovered through semantic reading of the spec are also recorded.
|
|
59
|
+
|
|
60
|
+
For each gap, classify it as either:
|
|
61
|
+
- **Bounded choice** — the answer is one of a small discrete set (e.g. yes/no, A/B/C).
|
|
62
|
+
- **Open-ended** — the answer requires free-form elaboration.
|
|
63
|
+
|
|
64
|
+
## Step 3 — Fill gaps
|
|
65
|
+
|
|
66
|
+
### Interactive mode (default)
|
|
67
|
+
|
|
68
|
+
For each gap, in order:
|
|
69
|
+
|
|
70
|
+
- **Bounded choice gap:** use `AskUserQuestion` with the question text and the choice options, plus an "Other / free text" option. Block until the user answers.
|
|
71
|
+
- **Open-ended gap:** present the question as a plain text turn. Block until the user answers.
|
|
72
|
+
|
|
73
|
+
Record each answer with its source: `human`.
|
|
74
|
+
|
|
75
|
+
> `AskUserQuestion` is a Claude Code–native construct. If you are running outside Claude Code, use `--auto` mode instead.
|
|
76
|
+
|
|
77
|
+
### Auto mode (`--auto`)
|
|
78
|
+
|
|
79
|
+
Answer every grilling question yourself without prompting the user. Source answers from (in priority order):
|
|
80
|
+
|
|
81
|
+
1. **`codebase`** — inspectable source files, tests, scripts, config in the repository.
|
|
82
|
+
2. **`docs`** — markdown files under `docs/`, `skills/docs/`, and adjacent contract docs.
|
|
83
|
+
3. **`context`** — `CONTEXT.md` at the repo root, if present. When absent, skip silently — do not crash, no warning required.
|
|
84
|
+
4. **`inferred`** — reasoning from the issue/plan text alone, with no external citation.
|
|
85
|
+
|
|
86
|
+
Record the evidence source for every answer. Flag a question as **`unresolved`** when:
|
|
87
|
+
- The only available source is `inferred`, **and**
|
|
88
|
+
- No codebase path, doc section, or issue/plan text can be cited as the basis for the answer.
|
|
89
|
+
|
|
90
|
+
Do not silently guess an `inferred` answer when no evidence can be cited — flag it `unresolved` instead.
|
|
91
|
+
|
|
92
|
+
## Step 4 — Write back (replace-section semantics)
|
|
93
|
+
|
|
94
|
+
Write a `## Grill findings` section back to the source artifact using **replace-section** semantics:
|
|
95
|
+
|
|
96
|
+
- **Find** the existing `## Grill findings` section: the range from the `## Grill findings` heading through the next `##`-level heading (exclusive) or end of file.
|
|
97
|
+
- **Replace** that range in place with the new section content.
|
|
98
|
+
- If no `## Grill findings` section exists, **append** it.
|
|
99
|
+
- This makes re-runs idempotent — no accumulated noise, no duplicate sections.
|
|
100
|
+
- If parsing the section boundary fails, **abort with an error** rather than silently truncating.
|
|
101
|
+
|
|
102
|
+
**Tracker-first write-back:** update the GitHub issue body using:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
gh issue edit <n> --repo <owner/repo> --body-file <tmp-path>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The `## Grill findings` section lives in the issue body, not as a comment. Do not use `comment-issue.mjs` here — that creates a comment, not a body update.
|
|
109
|
+
|
|
110
|
+
**GitHub body size guard:** issue bodies are capped at 65,536 characters. Before writing back, check whether the updated body would exceed this limit. If so, warn: `Warning: updated body would exceed GitHub's 65,536-character limit — write-back skipped. Truncate the findings or the issue body manually.` Do not silently truncate.
|
|
111
|
+
|
|
112
|
+
**Local-planning write-back:** update the plan file in place using the edit tool.
|
|
113
|
+
|
|
114
|
+
## Output artifact format
|
|
115
|
+
|
|
116
|
+
The `## Grill findings` section written to the artifact:
|
|
117
|
+
|
|
118
|
+
```markdown
|
|
119
|
+
## Grill findings
|
|
120
|
+
|
|
121
|
+
<!-- loop-grill: <timestamp> mode:<interactive|auto> -->
|
|
122
|
+
|
|
123
|
+
### Resolved gaps
|
|
124
|
+
|
|
125
|
+
| # | Gap | Question | Answer | Source |
|
|
126
|
+
|---|-----|----------|--------|--------|
|
|
127
|
+
| 1 | Missing AC | <question text> | <answer text> | codebase \| docs \| context \| inferred \| human |
|
|
128
|
+
|
|
129
|
+
### Unresolved gaps
|
|
130
|
+
|
|
131
|
+
| # | Gap | Question | Reason unresolved |
|
|
132
|
+
|---|-----|----------|-------------------|
|
|
133
|
+
| 1 | Unresolved primary actor | <question text> | No citable evidence found |
|
|
134
|
+
|
|
135
|
+
### Verdict
|
|
136
|
+
|
|
137
|
+
grill-clean
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Replace `grill-clean` with `N unresolved items` when unresolved gaps remain.
|
|
141
|
+
|
|
142
|
+
## Step 5 — Emit verdict
|
|
143
|
+
|
|
144
|
+
After write-back, emit the verdict line to stdout:
|
|
145
|
+
|
|
146
|
+
- `grill-clean` when no unresolved gaps remain.
|
|
147
|
+
- `N unresolved items` (e.g. `3 unresolved items`) when gaps remain after all questions are answered.
|
|
148
|
+
|
|
149
|
+
## CONTEXT.md degradation rule
|
|
150
|
+
|
|
151
|
+
When `CONTEXT.md` is absent from the repo root, skip the context-source check silently. Do not crash. Do not emit a warning. The grill continues with the remaining sources (`codebase`, `docs`, `inferred`).
|
|
152
|
+
|
|
153
|
+
## Idempotency guarantee
|
|
154
|
+
|
|
155
|
+
Running `/loop-grill` twice on the same target must produce a single `## Grill findings` section, not two. The replace-section logic handles the already-present-section case. On the second run, if the gap set is identical to the first run, the section content is replaced with an equivalent section (same questions, same answers, updated timestamp).
|
|
156
|
+
|
|
157
|
+
## Non-goals
|
|
158
|
+
|
|
159
|
+
- Auto-triggering from `issue_intake` — this is on-demand only.
|
|
160
|
+
- Replacing or modifying the in-loop docs-grill (`docs/docs-grill-step.md`, `scripts/loop/docs-grill-contract.mjs`) — different concern, different firing surface.
|
|
161
|
+
- Full DDD `CONTEXT.md` management.
|
|
162
|
+
- Scheduling or storing grill runs — stateless and on-demand.
|
|
163
|
+
- Any CI/CD integration.
|
package/AGENTS.md
CHANGED
|
@@ -23,3 +23,4 @@
|
|
|
23
23
|
- Keep workflow procedure out of AGENTS; put shared contracts under `skills/docs/`. Brief, high-signal main-agent dispatch contracts (e.g., sequential dispatch) are the narrow exception — they stay in AGENTS.md because AGENTS.md is the canonical main-agent instruction surface.
|
|
24
24
|
- No PR scope has gate exemptions (#579): see skills/dev-loop/SKILL.md "No gate exemptions" section.
|
|
25
25
|
- **Sequential dispatch contract (#693):** When the user says "sequential", "one at a time", "serially", or "in order" with multiple `dev-loop` targets, the main agent must dispatch `dev-loop` async subagents one at a time — each blocking on prior completion before the next starts. This is deterministic: the keyword must always produce serial execution, never concurrent. The main agent is the sequencer; do not dispatch all targets at once.
|
|
26
|
+
- **Harness-agnostic non-regression (#1086):** dev-loops is harness-agnostic (Pi + Claude Code). Any harness-specific change MUST NOT regress other harnesses — add/keep cross-harness regression coverage. Canonical procedure: [Cross-Harness Regression Contract](skills/docs/cross-harness-regression-contract.md).
|