--- description: Run Local CI (post-landing slow and formal checks on next), check status, rerun, manage its Mac launchd job, and run the persistent operator session that dispatches fix, beta release, and zbot or agent friction workers. Use for /operator, /local-ci, "is next green", "Local CI status", "rerun Local CI", "keep watching", "release a beta now", or a red local-ci task. argument-hint: '[watch | release | status | rerun | install | uninstall]' --- # Operator and Local CI Owns Local CI (`tooling/scripts/local-ci.mjs`, post-landing checks on `origin/next`) and the persistent `operator` session. Let `
` be the main checkout. ## How Local CI runs `pnpm check --affected` runs `land` steps; Local CI runs all other non-opt-in steps on `origin/next` (`--deep`, daily fresh `--build --browser --reads` after 04:00 on main). Heavy baseline-pinned sweeps are opt-in via `pnpm check --audit` or by name. - Launchd (`dev.plate.local-ci`) runs `local-ci.mjs run` every 20m in `
/.claude/worktrees/local-ci`. Main CI checks all steps and pushes `refs/pstack/local-ci-green`; teammates check `--steps` in `config.json`. - State, events, lock, config: `/plate-local-ci/`; logs: `docs/plans/artifacts/local-ci//`. - Failures rerun failing test files (or the step) to separate flakes from reds, then bisect within 1h (`PLITE_BROWSER_KEEP_GOING=1`). Flakes stay defects until timing/load dependence is gone. - Each red/flake offers a P0 `local-ci` task (`refs/pstack/ledger`) and wakes `operator` for the 3-step green-convergence loop (never cut Yjs tests, park, retry, raise limits, or freeze on a P0 `decide` chip). - Three starts of one failure in 7d offer a P3 `red-recurrence` task (`red-recurrence.mjs`) to add an earlier guard via `/pstack:correct`. - `beta-release.mjs wake` emits `release` after green when a daily beta is due. Nothing here posts to Discord. Run from `
` (`.claude/worktrees/local-ci/tooling/scripts/local-ci.mjs` for CI; `
/tooling/scripts/local-ci.mjs` for `friction`). `$ARGUMENTS`: none/`supervise` -> **Keep watching**; `release` -> **Release brief** (skip due check); `status`, `rerun`, `install`, `uninstall` -> below. ## status Run `node .claude/worktrees/local-ci/tooling/scripts/local-ci.mjs status`. Report launchd state, steps, author email, last run/green, newest events (step, culprit/range, log), `red now:`, and 14d time-to-green. ## rerun 1. Run `node .claude/worktrees/local-ci/tooling/scripts/local-ci.mjs run --force` in background (`run --full` for daily fresh). 2. For another commit without side effects: `run --ref --green [--step ] --dry`. 3. Run `status` on exit and report. ## install and uninstall Run `node .claude/worktrees/local-ci/tooling/scripts/local-ci.mjs install` (or `node tooling/scripts/local-ci.mjs install` first) for `dev.plate.local-ci`, `uninstall` to remove. Main CI (zbeyens) omits `--steps`; teammates pass `--steps ` (needs `git config user.email`). Confirm: `launchctl print gui/$(id -u)/dev.plate.local-ci`. ## Keep watching Keep one pinned `operator` T3 Code thread (own worktree, commands prefixed `cd
&& `). Prompt: `"Read
/.claude/worktrees/local-ci/.agents/skills/operator/SKILL.md in full and run watch mode. Prefix every
shell call with cd
&& ."` 1. If this thread is already titled `operator`, run `watch` here. 2. Search for an unarchived `operator` thread (or legacy `Local CI`, renaming it to `operator` via `t3_thread_update`). If it is mid-turn, stop; if idle, send the prompt via `t3_thread_send` and stop. 3. Otherwise launch a fresh worktree thread titled `operator` with `t3_thread_launch`, send the prompt, and pin it via `t3_thread_organize(action: "pin")`. ## watch Never edit or land directly. Caps: 3 fix agents (max 1 heavy: `plite-browser` or any `check.mjs` step with `light`), 1 release, 1 friction judge. Spawn workers via `invoke_subagent` (or `delegate_task` for an isolated thread) in the background, inheriting the lead's model and effort (escalate a failed 1st fix attempt once to Neon `@xhigh`). Let `` = `node .claude/worktrees/local-ci/tooling/scripts/local-ci.mjs` and `` = `node tooling/scripts/local-ci.mjs friction`. 1. First loop: note ISO time, run step 3, then start ` wait --after ` in background. 2. Handle each waking JSON event, then run step 3: - `green` (main CI, tip `T` = `event.tip`): scan unarchived, non-pinned, non-running T3 threads titled `⏳ ...` or `🔴 ...` (including settled ones). For each thread whose landed commit (from its `Session:` trailer in `git log` or last landed SHA) is an ancestor of `T` (`git merge-base --is-ancestor `) with no newer unverified commit after `T`, strip the `⏳`/`🔴` prefix via `t3_thread_update` (`action: "rename"`) and call `t3_thread_organize(action: "archive")`. Never touch pinned threads (`pinned: true` or `📌`) or running threads. - `red`/`flake` (`wake: true`): keep 1 queued event per step; drop if `startedIn` is active (`lastActivityAt` < 2h); prioritize big reds (`failures.length >= 3` with bisected `culprit`). On `red` with bisected `culprit` and `event.session`, call `t3_thread_organize(action: "unsettle")` (in case the landed `⏳` thread self-settled), `t3_thread_organize(action: "unarchive")` and `t3_thread_organize(action: "mark_unread")` if needed, rename `event.session` to `🔴 ` via `t3_thread_update` (skipping pinned threads), and wake it via `t3_thread_send` per the 3-step green-convergence loop. Track attempts per streak: 1st runs normal fix; if still red with no clean revert, escalate 2nd once to Neon `@xhigh`. Never freeze on `decide`. - `passed`: drop from queue and message any running fix on that step to recheck and close. - `dry: true`: spawn **Dry brief**. - `broken`: check `output` and `plate-local-ci/launchd.log`; if install broke, run `pnpm install --frozen-lockfile` in `.claude/worktrees/local-ci`, else report without Discord. - `release`: main CI only (drop if `config.json` exists or release runs); spawn **Release brief**. - `friction`: continue to step 3. - **Agent friction (`FRICTION [tooling|skill|pstack|t3]`):** handle incoming worker reports alongside the `local-ci` friction loop. Deduplicate by failure signature (file/command/error): if a fix for that signature is already running, append any new `blocking: yes` reporter `threadId` to its wakeup list instead of spawning a duplicate worker. For fixable `plate` or `ustack` friction, dispatch an **Agent friction fix brief** subagent (never edit directly in `operator`), land on `origin/next` (or push `ustack` `main`), and wake every paused `blocking: yes` reporter via `t3_thread_send` (`"Fixed in , pull origin/next and resume"`). For external T3 app bugs that `operator` cannot fix in `plate` or `ustack`, record once in `
/docs/plans/artifacts/local-ci//t3-friction.md` for the owner instead of looping, and immediately reply via `t3_thread_send` to any `blocking: yes` reporter with a fallback or clean stop. 3. Dispatch: - Fill up to 3 fix agents from the red queue (1 per step, max 1 heavy) using **Fix brief**. - If 0 fixes run and red queue is empty, run ` next`; if `item`, run ` start --item ` and spawn **Friction fix brief**. - If no judge runs and ` next` shows `unjudged`/`stuck` (first loop, after `friction`, or after ` failed`), spawn **Friction brief**. 4. Repeat from step 1 with newest handled event's `at`. Save reports to `
/docs/plans/artifacts/local-ci//` (`fix-.md`, `fix-friction--.md`, `release-.md`, `friction-.md`), run ` failed --item ` after friction fixes, run step 3, and reply with 1 line per finished agent plus active steps and queued reds. ### Fix brief > Local CI found `` failing on `next`. Event: ``. Work from `
`; read `AGENTS.md` and `operator` first. > 1. Load `chips`, start `` (or open `local-ci` task for ``), and cut a fresh worktree from `origin/next`. For `red`, run `pnpm check `; if green, dismiss `` as `dismissed done` and stop. For `flake`, remove timing/load dependence and prove with 5 warm retry-free runs. > 2. Follow the 3-step green-convergence loop (never cut Yjs tests, park, retry, or raise limits): > - **Big red (`failures.length >= 3` with bisected `culprit`):** try clean code-only `git revert ` (+ `Lands-With:` companion, skipping `docs/plans/` and `.decisions.tsv` conflicts). If clean and `typecheck` + `pnpm check ` pass, land via `land.mjs` and message `event.session` (`t3_thread_send` if active/idle, else log a follow-up chip naming the reverted commit) with failure log and revert SHA to pivot and re-land. > - **Small red (1 to 2 failures), unknown `culprit`, or tangled revert (real code/type conflict with later commits):** abort conflicting revert. If `event.session` is live/idle and owns `culprit`, message via `t3_thread_send` with failure log; else run `.agents/playbooks/bug-fix.md` for the best reversible fix (fix forward, update stale test, or cut bad test) and land via `land.mjs`. > - **Failed 1st fix attempt (still red with no clean revert):** escalate once to Neon `@xhigh` to fix root cause, pivot, or cleanly revert. Never silently freeze the release lane on a P0 `decide` chip; alert owner in-thread only if a genuinely irreversible product decision blocks green. > 3. Send no team message. End with 1 line: step and commit (or woken session), or why still open. ### Dry brief > Local CI dry proof for ``: ``. Read event and log; reply in 1 paragraph with step, culprit/range, log, and first fix. Edit, land, and message nothing. ### Release brief > Operator woke for a beta: ``. Work from `
`; read `AGENTS.md`, `release-lanes`, `changeset`. > 1. Cut worktree from `origin/next`, run `node tooling/scripts/beta-release.mjs due` (stop if not due). > 2. Run `beta-release.mjs pending`, condense changesets per `changeset`; if changed, land `chore(release): condense changesets` via `land.mjs`. > 3. Run `node tooling/scripts/beta-release.mjs ship --force` in background (`release.yml` closes fixed public issues; `ship` runs `close-released-issues.mjs` fallback; retry on exit 75). > 4. Send no team message. End with 1 line: beta and closed issues, or why none shipped. ### Friction brief > Judge zbot friction via `node
/tooling/scripts/local-ci.mjs friction`. Work from `
`; edit no files, land nothing, send no messages. > 1. Run `friction list` and `git -C
fetch --quiet origin next`; read files via `git show origin/next:`. > 2. Classify each `unjudged` line (`-`): `fixed` (`same`/`commit`/`fix`), `chip` (product bug, zbot/zstack, owner call), or `dropped` (`reason`). > 3. Offer each `chip` via `chips` (`via: hook`, `session: none`, dedupe against `suggested-tasks.decisions.tsv`; never card). > 4. Submit all verdicts in one `friction judged` stdin JSON call (`{"verdicts":[...]}`). > 5. Offer any `stuck` item as a chip and run `friction done --item --task `. > 6. End with 1 line per judged line and stuck item. ### Friction fix brief > Fix queued zbot friction `` via `node
/tooling/scripts/local-ci.mjs friction`. > 1. Cut worktree from `origin/next` (or owning repo's main). If fixed, run `friction done --item --commit ` and stop. > 2. If `after` is set and persists, run `/pstack:correct` on its class; else fix the skill/rule/script/helper. > 3. Land via `land.mjs` (or owning repo rules), then run `friction done --item --commit ` (if unlandable, offer chip `via: hook`, `session: none` and run `friction done --item --task `). > 4. Send no team message. End with 1 line: commit or task, and why. ### Agent friction fix brief > Fix agent-reported friction `` (signature ``). Work from `
`; read `AGENTS.md` and `operator` first. > 1. If the failure is an external T3 app bug outside `plate` and `ustack`, edit nothing and reply `external-t3: `. > 2. Otherwise cut a fresh worktree from `origin/next` (or edit `ustack` in place on `main` per `ustack/AGENTS.md` and sync `plate` via `sync-pstack.mjs apply`). Fix the root cause with a focused test and verify all affected checks. > 3. Land via `land.mjs` (or push `ustack` `main`). Send no team message. End with 1 line: `fixed: ` (plus synced `plate` SHA if applicable) or `blocked: `.