Repository navigation
Design: MCP lab server for agents (shaped by this week's incidents) - #131
Conversation
… lab channel Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…r last Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Map each 2026-11-07..13 incident to a resource, tool or event; add read-only console state/save and run resources, leases and events, validated tools with declared preconditions, enforcement, and a PR plan that retires lab scripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
|
Codex design-review handoff:
The revision makes the proposed contract implementable: versioned state.json with explicit unknowns and frame identity, SQLite-backed leases/events/idempotency, fresh-frame screenshot semantics, typed static contracts plus side-effect-free dynamic preflight, and an eight-slice rollout with acceptance criteria. It defers arbitrary game switching and separates console control from build/CI/worktree operations. Validation: git diff --check passes; documentation-only change. |
Review of 8cf5938 against the lab scripts and the user's console rules. Says where the daemon and the app slices live (agents lab/server, branches from lab/tooling), how leases coexist with lablock and the channel owner token until Slice 7, that no hook guards the app binary today, which AGENTS.md hard rules the app slices must keep, the legacy program.state values, which scripts each slice retires, and which decisions are the user's rules versus proposals awaiting the user's confirmation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
|
Questions from the implementation review of current head 7a2da8f:
Two factual corrections from the review note: the current legacy file is Lab/state with seq, state, program, controller, owner, and error; commit 7c44e72 does not yet modify LabChannel or tag transitions. |
…s, hook done) Fork-only for now for the app seams and the mGBA work, kept small enough to upstream later. Preconditions are a list of named check objects declared with the program (prechecks()/run_prechecks(), generalizing FRLG RNG's run_precheck from upstream PokemonAutomation#1881); they land in Slice 4 and the server first refuses runs on them in Slice 5. The require-profile PreToolUse hook is done, so Enforcement describes it instead of planning it. The open questions are listed with a recommended answer each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…lice 1) "snapshot LABEL [TIMEOUT_MS]" waits for the first frame of the selected console's video that arrives after the line starts, saves it as <request>_<LABEL>.png and prints its instance id, frame_seq and capture time, the same numbers Lab/state.json uses. It reads only: no owner token, and no program state or controller check, so it works on a stopped panel with no controller. No newer frame in time fails the line with "snapshot timeout ..."; no video, a panel change, app shutdown or a failed save fail it with "snapshot unavailable ... reason=...". LabFrames takes over the frame counting from LabChannel's listener and keeps a frame only while a snapshot waits for one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Moves the seven open questions to settled with their recommended answers, writes the nine answers from the 2026-11-14 implementation review into the resources, lease, tool and slice text, corrects the legacy Lab/state fields and what 7c44e72 does, and records Slices 0-3 as built (#478, #481, #482, #483) and Slice 4 as approved on PokemonAutomation#1881's branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
|
Answers to the implementation review (09:11Z), all written into the doc at 5c32c74; the list is also under "Decisions and open questions".
Both corrections are in: the legacy |
lab/server: Slice 0 contracts and fixtures for the lab server (#131)
lab/server: Slice 2 attach-only read server (#131)
lab/server: Slice 3 durable control plane (#131)
Lab channel: write Lab/state.json for the lab server (#131 Slice 1)
Depends on #107
This week agents lost time on console B to stale screenshots, a start on the HOME screen, setup errors found only after a full reset, the app run without its profile, and answers that took several log greps. This design proposes one local MCP daemon that owns console B: read-only resources for console state (versioned
Lab/state.jsonwith an app instance id, frame sequence and capture time), the save it holds as a fact with provenance, and structured run results; a SQLite control plane with leases, idempotent requests and a durable event cursor, so a Start or Stop clicked in the app window hands the console to the user until they release it; and typed tools whose options and program preconditions are checked by a side-effect-free preflight before anything starts.switch_gameand the heavy build/test work are deliberately out, pending their own designs. A table maps each incident to the piece that prevents it; the work plan is nine slices (fixtures and the read-only app seam first, supervised app launch last), each with acceptance criteria and the lab scripts it retires, and the doc says how the daemon coexists withlablock.shand the channel owner token until then. Documentation only; checked against the lab scripts and the user's console rules on 2026-11-14.Update 2026-11-14: the user's decisions from the grilling session are recorded. Fork-only for now, for the app seams and the mGBA controller/video work, with the seams kept small enough to upstream later (Lab/Developer boundary, no scheduler or clock change, one connection/controller/source). Preconditions are a list of named check objects declared with the program (
prechecks()/run_prechecks(), generalizing FRLG RNG'srun_precheck()from upstream PokemonAutomation#1881); they land in Slice 4, the server first refuses runs on them in Slice 5, and nothing changes in that PR now. The PreToolUse hook that refuses the bare SerialPrograms binary is already done (~/.claude/hooks/require-profile.py), so Enforcement describes it instead of planning it; the user-lease rule is confirmed. Seven questions stay open, each with a recommended answer at the end of the doc.🤖 Generated with Claude Code
https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss