--- 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, friction, and opt-in auto-start 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 failure. argument-hint: '[watch | release | status | rerun | install | uninstall]' name: operator metadata: skiller: source: .agents/rules/operator.mdc --- # 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, `` = `node .claude/worktrees/local-ci/tooling/scripts/local-ci.mjs`, and `` = `node tooling/scripts/local-ci.mjs friction`. ## 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//`. - Non-app `.md`-only commits (with zero reds) skip `--deep` and emit `green` (`skipped: "md-only"`). `.agents/**` or `content/docs/**`-only changes run `pnpm check --affected --base `. - 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 wakes `operator` for the 3-step green-convergence loop (never cut Yjs tests, park, retry, or raise limits). - Three starts of one failure in 7d record a `recurrence` event (`red-recurrence.mjs`) for a `/pstack:correct` guard. - `beta-release.mjs wake` runs after every non-dry main run to dispatch `release.yml` (`mode=auto` when `> 24h` since last auto beta, excluding manual betas, with changesets on `refs/pstack/local-ci-green`; else `mode=sync` if PR lags) with `wake: false`. Briefs keep `Send no team message.`; `operator` may post via `notify` for team/workflow changes. Run from `
` (`` for CI; `` for friction). `$ARGUMENTS`: none/`supervise` -> **Keep watching**; `release` -> **Release brief** (skip due check); `status`, `rerun`, `install`, `uninstall` -> below. ## status Run ` 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 ` 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 ` 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. `operator` runs at `medium` (`thought_level: "medium"`). Caps: 3 fix agents (max 1 heavy: `plite-browser` or any `light` step), 1 release, 1 friction judge; subagents (`invoke_subagent`/`delegate_task`) unlimited. Spawn via `invoke_subagent` (`delegate_task` for isolation/effort): routine fixers `medium` (`thought_level: "medium"`), complex bugs `high`, escalate failed 1st fix once to Neon `@xhigh`. Read effective `maxAutoStart` from `readProjectConfig()` in `.agents/pstack/lead.mjs` (merges `.agents/pstack.json` with main checkout's gitignored `.agents/pstack.local.json`, default `0`). 1. Start, restart, compaction, or resume after quota swap: run the **Settle sweep** below against `state.json.tip`, run step 3, then arm ` wait --after ` in background (`` = last handled event `at`, or `lastRunAt` from `settle-check`, or now if null). 2. Handle each waking JSON event, then run step 3: - `green`, `passed`, or completed run (`state.tip` advance on main CI): run the **Settle sweep**: pipe unarchived, non-pinned (`📌`), non-running `⚪`/`🔴` threads (settled included) as JSON `[{threadId, title, settled, status}]` to ` settle-check`. For each `eligible` thread, read its latest reply: if an owner question or optional go/stop call remains, rename to `🟠 ` and `unsettle` if settled; else strip `⚪`/`🔴` (`t3_thread_update`, plain ``) and `settle` (`t3_thread_organize`, never auto-archive). For each `demoteToPending` thread (`🔴` fix landed after `tip`), rename to `⚪ `. - `red`/`flake` (`wake: true`): queue 1 event per step; prioritize big reds (`failures.length >= 3` with bisected `culprit`). On `red` with bisected `culprit` and `event.session`, `unsettle`/`unarchive`/`mark_unread` if needed, rename to `🔴 ` (skip pinned), and wake via `t3_thread_send` per the 3-step loop. Track attempts per streak: 1st normal fix; escalate 2nd once to Neon `@xhigh` if still red without clean revert. - `passed`: drop from queue and tell 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` (`wake: true` only): main CI only (drop if `config.json` exists or release runs); spawn **Release brief** (daily betas run via `release.yml`). - `friction`: continue to step 3. - **Agent friction (`FRICTION [tooling|skill|pstack|t3]`):** deduplicate by signature (file/command/error); if a fix runs, append new `blocking: yes` `threadId`s to its wakeup list. For `plate`/`ustack` fixes, spawn **Agent friction fix brief**, land on `origin/next` (or push `ustack` `main`), and wake paused reporters via `t3_thread_send` (`"Fixed in , pull origin/next and resume"`). For external T3 bugs, log once in `
/docs/plans/artifacts/local-ci//t3-friction.md` and reply to `blocking: yes` reporters with a fallback or clean stop. - **`SLOT_FREE`:** immediately check active non-pinned Plate threads against `maxAutoStart` and fill open slots via step 3 (Local CI events remain the crash/missed-ping fallback). 3. Dispatch: - **P0 Local CI reds (exempt from `maxAutoStart`):** fill up to 3 fix agents from the red queue (1 per step, max 1 heavy) using **Fix brief**. - **Friction:** 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`, spawn **Friction brief**. - **Opt-in auto-start (`maxAutoStart > 0` only):** skip when `maxAutoStart === 0`. Pause P1 to P3 only when (a) a foundational gate (`typecheck`, `www-build`, `plite-app-typecheck`, or `broken` install) is red on `origin/next` without a fix after the red tip, or (b) `>= 3` steps are red with no fix landed and no fixer running (localized test/lint or fixed reds do not pause). While active non-pinned top-level `🥔` threads `< maxAutoStart` and unpaused, launch via `t3_thread_launch` (`workspaceStrategy: { type: "worktree", baseRef: "origin/next", startFromOrigin: true }`) at `medium` (`thought_level: "medium"`) for routine docs/sync/simple-triage and `gemini-4-neon @high` for complex work, in priority order: 1. **P1 Team sweep (`plate-private`/Beta):** run `pnpm triage claim --next --repo plate-private` first (atomic claim; skips claimed work), then launch `triage fix `. 2. **P2 Active roadmaps:** manual `/start` threads by the owner (counted in `active`). 3. **P3 Background fill:** check live T3 threads to avoid duplicates, then pick: `node tooling/scripts/relapse.mjs` (`card` scopes) -> `
/docs/plans/artifacts/queue.tsv` (P0 then P1, <=14d old; group matching-scope rows) -> `node tooling/scripts/review-ledger.mjs due` (max 2 concurrent verdicts; brief requires First-Principles HHF per `verdict.md` and forbids shrinking a cut/redesign to dodge `api-plan` or `🟠`; multi-phase roadmaps and breaking API calls stop at `🟠` with the HHF verdict/plan ready). 4. Arm ` wait --after ` in background and repeat from step 2. 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. Cut a fresh worktree from `origin/next`. For `red`, run `pnpm check `; if green, stop and report green. 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) 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; 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 > Manual beta: ``. Work from `
`; read `AGENTS.md`, `release-lanes`, `changeset`. > 1. Cut worktree from `origin/next`; check `beta-release.mjs due` and `pending` on `refs/pstack/local-ci-green`. > 2. Run `node tooling/scripts/beta-release.mjs ship --force` in background (`manual` beta, does not reset `> 24h` auto clock; retry on exit 75). > 3. 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` (queued in `
/docs/plans/artifacts/queue.tsv` with id `q_` for product bug, zbot/zstack, or owner call), or `dropped` (`reason`). > 3. Submit all verdicts in one `friction judged` stdin JSON call (`{"verdicts":[...]}`). > 4. For any `stuck` item, append a row to `
/docs/plans/artifacts/queue.tsv` and run `friction done --item --task `. > 5. 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, append a row to `
/docs/plans/artifacts/queue.tsv` and run `friction done --item --task `). > 4. Send no team message. End with 1 line: commit or queue id, 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: `.