feat(loop): optional spec/plan gate — reviewable plan artifact before implementation (issue #100) - #148
Merged
Merged
Conversation
Adds gates.json's `plan.gate` knob (off default | label | always) so the loop can post a reviewable plan comment (marked <!-- plan-gate:plan -->) and wait for owner approval (plan-review -> plan-approved) before an issue is implemented, instead of always going straight to code. loop-census.sh derives each candidate's plan state from its labels and skips awaiting-owner candidates like a "Blocked by" edge; loop-tick.sh threads the resulting advance_mode through as telemetry; loop-event.sh builds a PLAN-ONLY driver prompt, an implement prompt with the approved plan injected as authoritative scope, or today's unchanged ungated prompt. gate=off leaves census output byte-identical to pre-#100 behavior. reviewer.md/orchestrator.md gain a short note on honoring an approved plan's scope; docs/USAGE.md documents the label lifecycle. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Collaborator
Author
|
feat(loop): optional spec/plan gate — reviewable plan artifact before implementation (issue #100) (not yet reviewed) |
robercano
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #100 — an optional, per-issue spec/plan gate: a reviewable plan artifact (a structured issue comment) that the owner approves before the loop writes any code. Opt-in and off by default, so cheap issues pay zero overhead and this repo's own dogfooding behavior is unchanged.
What was implemented
plan.gatein both.claude/gates.json(placeholder, schema-documented) and.claude/self/gates.json(set tooff): modesoff(default, today's single-pass behavior, byte-identical) |label(gate only issues carryingplan-first) |always(gate every planned issue).loop-census.shderives a per-candidate plan state from labels (precedenceplan-approved>plan-review>plan-first), emitsadvance_mode=plan|implement-gated|implementnext to the chosenadvance_ready, and excludesawaiting-owner(plan-review, not yet approved) issues from bothadvance_readyandfallback_ready(reported asplan_wait=N). Emits nothing new whenplan.gate=off.loop-tick.shthreadsadvance_modethrough, re-echoing it only on genuineaction=advancedispatch and always before the final verdict line (issue Harden PR-loop tick: deterministic loop-tick.sh with single verdict, in-flight detection, spawn lock #81 byte-identical-verdict contract preserved).loop-event.shselects one of three ADVANCE prompt variants: plan-only (scope, post a<!-- plan-gate:plan -->marked plan comment via bot-gh, applyplan-review+needs-human(Loop/cockpit: needs-human signal — label + push notification when the loop blocks on the owner #99 signal), write no code/branch/PR), implement-gated (fetch the approved plan comment and inject it into the implementer AND every reviewer prompt, with "diff exceeds approved plan scope" as a valid correctness reject reason), and ungated (unchanged). Readsadvance_modevia grep, nevertail -1; missing/broken value safely defaults toimplement.reviewer.md/orchestrator.md: durable notes so an approved plan is forwarded verbatim as authoritative scope and scope-creep is a valid correctness reject.plan-gate.test.sh(new, auto-discovered bychecks.sh): 33 checks driving the realloop-census.shandloop-event.shacross all six mode/label combinations, including the gate=off byte-identical guarantee and the awaiting-owner skip.docs/USAGE.md: documents theplan-first→plan-review→plan-approvedlabel lifecycle next to the existingbacklog/plannedworkflow.Decision points resolved
off/label/always) implemented, per the acceptance criteria.plan-approved, documented with the same non-enforceable caveat as the existingplannedlabel (the loop checks label presence, not GitHub identity).Gates & review
build,lint,testall green viaGATES_FILE=.claude/self/gates.json(test includes the newplan-gate.test.sh(33/33), all pre-existing*.test.sh— loop-census 29, loop-tick 71, loop-event 29 — andsmoke-fanout.sh; no regressions).Closes #100
🤖 Generated with Claude Code