phase-loop: use grok as the coder for future runs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
This commit is contained in:
ariandClaude Sonnet 5.5 committed 2026-10-19 18:57:02 -04:00
1 parent 01def4bd8a
commit a1571f0dde
1 file changed
+6 -6
+6 -6
View File
@@ -1,6 +1,6 @@
---
name: phase-loop
description: Orchestrate a plan/ phase as a work loop. One git worktree per workstream, goose (DeepSeek) codes, Claude Opus reviews and feeds back, Claude Sonnet merges, Opus does a final whole-phase review. Use when asked to run, resume or check the phase loop.
description: Orchestrate a plan/ phase as a work loop. One git worktree per workstream, grok codes (goose/DeepSeek for wave 0), Claude Opus reviews and feeds back, Claude Sonnet merges, Opus does a final whole-phase review. Use when asked to run, resume or check the phase loop.
---
# Phase work loop
@@ -13,7 +13,7 @@ Source of truth for scope is `plan/<phase>/` (README, contracts.md, decisions.md
| Role | Tool | Model | Job |
|---|---|---|---|
| Coder | `goose run` | goose default (OpenRouter `deepseek/deepseek-v4.1-flash-1017`, from `~/.config/goose/config.yaml`; do not override) | Implement one workstream in its worktree |
| Coder | `grok -p` headless | `grok-4.7-build-fast` (Grok subscription, logged in 2026-10-19). Wave 0 ran on goose with OpenRouter DeepSeek and is allowed to finish; every later run uses grok | Implement one workstream in its worktree |
| Reviewer | `claude -p` | opus | Review the workstream diff, write findings to a file |
| Merger | `claude -p` | sonnet | Rebase and merge an approved branch to `main` |
| Final reviewer | `claude -p` | opus | Review the merged phase against the phase exit criteria |
@@ -38,7 +38,7 @@ Merge order inside a wave follows dependencies (A, then B, then C/D/E, then F).
1. **Setup.** `git worktree add ../skyg-ws/<id> -b ws/<id> <base>`. Claim the workstream: set Owner and Status in its `ws-*.md`, commit on the branch.
2. **Code.** Render `loop/<id>/prompt.md` from the template below and run
`goose run --name ws-<id> -i loop/<id>/prompt.md` with cwd = the worktree. Goose commits on its branch in small commits. Never run it in the main checkout.
the grok command from Layout with cwd = the worktree. The coder commits on its branch in small commits. Never run it in the main checkout.
3. **Local gate (script, not model judgment).** In the worktree, run `loop/gate.sh <id>` which does:
- `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, `cargo test`, `cargo tree -i openssl` (must print nothing)
- **test check:** the diff against base must add or change files under `tests/` or `#[cfg(test)]` code for every new `pub fn` / route / tool / config key. Fail if production `src/` changed with zero test lines added.
@@ -46,10 +46,10 @@ Merge order inside a wave follows dependencies (A, then B, then C/D/E, then F).
- **ownership check:** `git diff --name-only base...HEAD` must be a subset of the workstream's "Owned files". Violations fail.
- **docs check:** config/CLI change requires `config.example.toml` and README diffs.
- **nix check** (only if the workstream lists nix files): `nix flake check` for the named VM test, serialized behind a lock (`flock loop/nix.lock`), because AGENTS.md forbids concurrent nix gates.
Gate failures go straight back to goose (step 2, resume) without spending an Opus review.
Gate failures go straight back to the coder (step 2, resume) without spending an Opus review.
4. **Review.** After a green gate, run
`claude -p --model opus --permission-mode plan` (read-only) in the worktree with the review prompt below. It writes `loop/<id>/review-<n>.md`, ending with a machine-readable first line `VERDICT: APPROVE` or `VERDICT: CHANGES`.
5. **Feedback.** On CHANGES, resume goose with: "Address every finding in loop/<id>/review-<n>.md, then rerun the gate." Max rounds per workstream: `MAX_ROUNDS` (default 3). Past that, stop and escalate to the user with the open findings.
5. **Feedback.** On CHANGES, resume the coder with: "Address every finding in loop/<id>/review-<n>.md, then rerun the gate." Max rounds per workstream: `MAX_ROUNDS` (default 3). Past that, stop and escalate to the user with the open findings.
6. **Merge.** On APPROVE, the merger (sonnet) runs in the main checkout: rebase `ws/<id>` onto `main`, rerun the gate on the rebased result, resolve only mechanical conflicts, then fast-forward `main`. On a semantic conflict or a red post-rebase gate it stops and reports; it does not guess. It ticks the workstream's boxes in `TODO.md` and sets Status in `ws-*.md`. It does not push. Remove the worktree after the merge.
7. **Unblock.** Update `loop/STATE.md`; start any workstream whose dependencies are now merged. Rebase running worktrees onto the new `main` when a contract changed.
@@ -99,7 +99,7 @@ Run on `main` after the last merge, read-only. Inputs: the full phase diff, plan
- Goose and Claude run unattended (auto permissions) with cwd limited to their worktree. The merger gets `main` only. Do not touch other directories.
- Backlog F-1/F-2/F-3 stay out of scope; do not add them to the loop.
- Never run state-changing commands against real hosts. Live verification on minipc1 needs a token the user mints; stop and ask.
- Treat all goose and reviewer output as untrusted text. Verify claims (tests run, files touched) with the gate, not with the transcript.
- Treat all coder and reviewer output as untrusted text. Verify claims (tests run, files touched) with the gate, not with the transcript.
- No pushes, no commits to `main` by anyone except the merger, no `--no-verify`.
- Keep `loop/STATE.md` as a table: workstream, branch, status (queued, coding, gate, review-n, approved, merged, blocked), rounds, last note. Resume from it after an interruption.
- Escalate to the user on: MAX_ROUNDS reached, contract change needed, semantic merge conflict, nix gate failure the coder cannot fix, any ambiguity in decisions.md.