<!-- Markdown rendering of fleet-guide.html for AI agents.
     The HTML page is the same content with diagrams and styling;
     this view exists so an agent spends its context on the instructions. -->
# Fleet work guide

Use a Dev instance (devbox) for durable work, and a fleet when several instances need to implement and independently review one job. The toolkit is `tools/devbox-fleet/`; its CLI is `bin/fleet`, installed with the `pitchstation-remote-work` skill.

[Dev instances](/devboxes.html) · [Dev instance guide](/devbox-guide.html) · [Markdown for agents](/fleet-guide.md)

## 1. One instance or a fleet?

One instance is enough for independent trusted commands in a durable local queue. The single-instance supervisor bounds concurrency and keeps process and result evidence. Choose a fleet for work packages, dependencies, independent authors and checkers, review/fix rounds and integration of exact commits.

A fleet needs at least two instances. More instances help only when work can proceed independently. Keep one heavy job per instance at a time; review and report jobs have separate concurrency groups. A local queue is not a dependency graph.

Inspect the repository’s `tools/devbox-fleet/README.md` and `docs/single-box.md` inside that toolkit before choosing local mode. This tutorial exercises the fleet build recipe.

## 2. Prepare every instance

- **Runtime and tools:** Python 3.9+, POSIX shell, Git, Node with compatible native module ABI, corepack/pnpm, tmux, timeout, and the project’s test tools. Add scope-specific system tools, such as `pdftoppm` for PDF rasterization.
- **Complete dependencies:** use the target base’s package manifest and lockfile. Setup can reuse matching modules or install from the frozen pnpm lockfile. A directory named `node_modules` alone does not prove required modules load.
- **Browser and fonts:** provide Chromium/Chrome for browser acceptance and the pinned font sources under `vendor/font-sources/` for website-family work. The repository browser helper shares two Chrome slots. Preflight finding any font or a browser version does not prove the full font catalog or a passing browser test.
- **Agent login:** Codex must be installed and authenticated on each instance. Record the requested model/effort and inspect observed evidence. A successful process exit alone does not prove acceptance.
- **GitHub access:** each agent instance needs its own working repository credentials and access to the base and namespace branches. Agent instances exchange work through GitHub; they do not SSH into one another.
- **Coordinator:** when publishing, install the existing share client there, with the intended account and audience. `FLEET_SHARE_CLIENT` can select its path. Remove both the plan’s `share` and `alerts` blocks to disable status/report and owner-alert publication. `new` creates a `share` block, so explicitly set `--team @owner/your-team` and inspect it.

Install or refresh from the repository with `npm run skills:install`. The installed toolkit is under `~/.claude/skills/pitchstation-remote-work/` and `~/.codex/skills/pitchstation-remote-work/`. The checkout CLI also works directly.

Not verified in this release: readiness on real remote instances, SSH setup, real agent authentication and share delivery. The scratch tutorial uses fixture tools.

## 3. How work moves

Choose a unique namespace and immutable full base commit. `<namespace>/plan` contains the frozen `cr/` bundle: plan, engine, briefs and boot script. Each instance owns one `<namespace>/out-<BOX>` branch with `cr/out/<BOX>/results/` records and `status.json` heartbeats. Implementation, integration and merge branches also stay in that namespace.

The operator uses approved SSH paths for initial setup and diagnostics. Each boot loop fetches the whole plan bundle once a minute, finishes existing work, starts ready tasks, and publishes its own Git records. Reviewers consume recorded commit IDs. Integration consumes those exact IDs. Namespace hooks restrict worker pushes; main is landed separately.

Starting instances, executing workers, namespace commits/pushes, changing a plan, publishing reports or owner alerts, landing main and deploying each need authorization covering that action. A person or supervising session with the relevant approval handles these boundaries. A configured audience or a successful check supplies no such approval.

**Environment files:** the runner drops `.env*` from package commits and refuses integrations introducing them. Treat a reported drop as omitted work to review, never as a committed configuration change. The task result’s `dropped_env_files`, final Markdown and build lifecycle summaries name omitted environment files.

## 4. Build and code-review recipes

| Recipe | Work and rounds |
| --- | --- |
| `build` | Define concrete requirements, acceptance and allowed paths per area. `reviewer` is the implementer; `verifier` is the independent reviewer. Records are `fix` → `recheck` → optional `fix2` → `recheck2`, then integrate and report. There are two implementation/review rounds only. |
| `code-review` | Review → independent verification and optional carried-over leads → aggregate → report, then up to two fix/recheck rounds and integration. The follow-up tracked-item cycle is not included. |

The second round runs when the first recheck fails with unresolved high or medium findings. Skipped unnecessary rounds are distinct from passes. Published reports require the configured share client. Merge-main can be added after integration; an integration branch is not main.

An optional `after` starts a package from its predecessor’s final recorded commit. Independence also applies across dependency edges: the instance reviewing a predecessor must not build its dependent successor, or vice versa. Keep role assignments consistent along that chain or add another independent instance.

`check` rejects that dependency-role collision and names the conflicting tasks, instances and rule. CLI and HTML status show “waiting for independent author/checker assignments” for blocked idle tasks. Check and status apply saved coordinator `moves.json` assignments before explicit plan reassignments; they do not propose new moves.

## 5. Read the status and evidence

The CLI status fetches output branches without SSH and prints task totals, running/failed/skipped counts, heartbeat ages and the status URL. The HTML status adds phases, health, preflight freshness, model provenance and publisher health. A fresh heartbeat or report timestamp does not establish passing tests.

With authorized sharing configured, the coordinator replaces the same account-access status URL silently. Separate task success from publication success. With no `share` block, “not published yet” is expected.

Opt-in `"alerts": {"to":"owner"}` publishes owner-only alerts without a team for events such as completion, exhausted failure, silence, disk pressure or expired login; events are deduplicated for six hours. After publication, the toolkit requests `notify ... --to owner` and records `notification.status` as `pending`, `requested` or `failed`. A notification failure leaves successful page publication intact and is not retried within the event throttle; deduplicated alerts send no new request. If the share client cannot notify, alerts do not send mail. Not verified in this release: notification delivery. A requested notification means client acceptance, not proof that email arrived.

Use the private handoff artifact to retain source and patch hashes, evidence references, hosts, unresolved acceptance, report URL, permissions and next action. Inspect skipped records: in the scratch run, handoff lists expected skips as open items even after landing.

## P6. Tests as jobs

Opt in with `plan.test_jobs.enabled: true`: add `"test_jobs": {"enabled": true}` to the trusted plan. The coordinator runs jobs outside agent sessions, with the requested commit’s repository profile and one box-wide lock under `~/.fleet/slots/`. Without this setting, the existing workflow stays in place; a tree without a profile retains its legacy test command. P17 supplies pool transport separately.

Commit the source first, then use `fleet test request --files …` inside the task checkout. It queues that commit and prints the future record path without starting a worker or waiting. The remaining commands below are for the coordinator or an authorized standalone runner; `REPO` is the checkout and `STATE` its private I6 state directory. `run` executes outside an agent session. All commands accept `--help`.

```
fleet test request --files test/example.test.js
fleet test status --repo REPO --records-root STATE
fleet test run --repo REPO --records-root STATE
fleet test validate RECORD
fleet test convert SOURCE --commit COMMIT --tree TREE --provenance SOURCE_BRANCH:SOURCE_PATH --out CONVERTED
fleet test split --repo REPO --records-root STATE --commit COMMIT --base BASE --parts 2
fleet test join --repo REPO --records-root STATE --commit COMMIT --base BASE --parts 2
```

The local default is the run root’s `test-jobs/`; optional `test_jobs.records_root` selects a private absolute directory. A task queues requests in `output/cr-scratch/fleet-test-requests/` for delivery through its output branch. Requests, records and logs are retained on the coordination branch `<namespace>-sup/state` under `suite-records/<commit>/<selection>/`, with `record.json` binding the commit, tree, profile, box/CPUs, times, pass totals, failures, reruns and logs. These private records reach the package’s next review task.

The engine files a merge check after each fix, using package tests and the merged profile’s `test.join` probes; integration still needs the complete profile gate. Failing files are rerun alone and compared with the base, with observations and verdicts in the record; reviewers retain severity and closure decisions. `split` fixes a file manifest and uses stable path hashes until durations are available. `join` reruns missing parts and proves from observed file results that every selected file ran once. A joined record has a separate selection and never satisfies the complete profile gate. Deployment runs its own coordinator gate.

**Not verified in this run:** real test-box execution, splitting or interruption/recovery on two real boxes, or rerunning the expensive historical suites. Local fixtures establish code behavior; the local historical-branch replay uses recorded command playback. The exact owner proof commands and remaining checks are in `docs/platform/devbox-fleet-build/p6.md`; the complete command contract is in `tools/devbox-fleet/docs/test-jobs.md`.

Before real pool use, the owner first configures the actual account CPU limit for P17, then the allowed pool and repository profile. After merge, use requires the platform deploy containing the test price class, `npm run skills:install` on the laptop, and the owner’s one-way grant from the coordinator pair to test boxes holding no login, key or token. Agent boxes stay on. P6 itself creates, stops, resizes or removes no box.

## 6. A worked tutorial: plan to landing

Run in the scratch run: two local instance roots, a local bare Git origin, two trivial packages, independent fixture review, real engine commits and merges, and a real fast-forward to that bare origin’s main. The model worker is a deterministic stub. No share block is used.

The reproducible driver and trimmed command/results evidence live in the repository at `docs/platform/devbox-docs-2026-11-11/tutorial-run/`. From this project’s root, use a fresh scratch name:

```
python3 docs/platform/devbox-docs-2026-11-11/tutorial-run/run.py --scratch tutorial-check
```

The driver creates only `output/cr-scratch/fleet-guide/tutorial-check/`, uses a file-only Git transport, refuses an existing scratch name and runs the commands below. `REPO_DIR` means the fixture clone, `RUN` its plan bundle, `BASE` its full base ID, and `AUTHOR`/`CHECKER` stand for its two synthetic instance roles. The recorded fixture aliases are lowercase. Hosts, repository and team below are placeholders.

### Step A — scaffold and edit the plan

Run in the scratch run: new, plan/brief edits.

```
tools/devbox-fleet/bin/fleet new --namespace dev/tutorial/fleet-guide \
  --repo OWNER/REPO --boxes AUTHOR CHECKER --base "$BASE" \
  --recipe build --model fixture-stub --effort low --team @owner/your-team --out "$RUN"
```

Edit `$RUN/cr/plan.json`: remove `share`; set `control` to `pause` and `paused` to `true`; replace the example area with the two entries below. The driver also sets completion grace to zero and shortens polling through fixture-only PATH wrappers. Replace the copied `cr/briefs/common.md` with fixture-specific rules. A real project needs its own acceptance briefs and tests.

```
"areas": [
  {"id":"alpha", "title":"Alpha", "reviewer":"AUTHOR", "verifier":"CHECKER",
   "paths":["alpha.txt"], "requirements":[{"id":"alpha-1", "title":"Write alpha",
   "detail":"Create alpha.txt with one line alpha", "acceptance":"The fixture assertion passes", "severity":"high"}]},
  {"id":"beta", "title":"Beta", "reviewer":"AUTHOR", "verifier":"CHECKER",
   "paths":["beta.txt"], "requirements":[{"id":"beta-1", "title":"Write beta",
   "detail":"Create beta.txt with one line beta", "acceptance":"The fixture assertion passes", "severity":"high"}]}
]
```

### Step B — check every prompt before launch

Run in the scratch run: an empty-record dry run, 11 decisions and 10 rendered prompts.

```
mkdir -p "$RUN/empty-records"
tools/devbox-fleet/bin/fleet check --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --records "$RUN/empty-records" --out "$RUN/check"
tools/devbox-fleet/bin/fleet status --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --records "$RUN/empty-records"
```

Read `$RUN/check/status.html` and the rendered prompts. Check does not launch workers or publish. Later prompts can use synthetic dependencies when real results do not yet exist; actual decisions still use the supplied records.

### Step C — publish the plan and start the local loops

Run in the scratch run: launch pushes only to the fixture origin; the unchanged bundled boot script starts in separate local roots.

```
tools/devbox-fleet/bin/fleet launch --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --records "$RUN/empty-records" --out "$RUN/launch-check"
sh "$RUN/cr/cr-boot.sh" AUTHOR dev/tutorial/fleet-guide "$SCRATCH/AUTHOR" &
sh "$RUN/cr/cr-boot.sh" CHECKER dev/tutorial/fleet-guide "$SCRATCH/CHECKER" &
```

The driver prepares each root’s clone and `box.json`, supplies a stub instead of Codex and verifies both loops saw the pause. This does not exercise real setup.

Not verified in this release: use of real hosts over SSH. After setup and namespace-write approval, the real-host variant is:

```
tools/devbox-fleet/bin/fleet launch --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" --setup \
  --host AUTHOR=ubuntu@AUTHOR_HOST --host CHECKER=ubuntu@CHECKER_HOST \
  --root /RUN_ROOT --session FLEET_SESSION
```

### Step D — steer, watch and hand off

Run in the scratch run: all five steering actions, status and JSON handoff. Pause/stop/rerun/reassign were exercised before work; reassign preserved the existing author. Resume then allowed both packages to finish.

```
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" pause
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" stop
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" reassign fix:alpha=AUTHOR
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" rerun fix:alpha \
  --reason 'Fixture before first attempt'
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" pause
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" resume
tools/devbox-fleet/bin/fleet status --plan "$RUN/cr/plan.json" --repo "$REPO_DIR"
tools/devbox-fleet/bin/fleet handoff --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" --json
```

Not verified in this release: moving active work to a different real instance, a completed-result rerun and real model review quality.

### Step E — review exact integration and request its merge

Run in the scratch run: the fixture reviewer checks each recorded package commit; integration runs two assertions. After it finishes, the driver reads the exact integration record and adds this merge request to the local plan:

```
"merge_main": {"main":"FULL_MAIN_COMMIT", "fixes":"FULL_INTEGRATION_COMMIT",
               "message":"Land tutorial [skip ci]"}
```

```
tools/devbox-fleet/bin/fleet check --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" --out "$RUN/merge-check"
tools/devbox-fleet/bin/fleet launch --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" --out "$RUN/merge-launch-check"
```

The driver restarts the same local boot loops to run the newly requested merge, waits for its completed record, and verifies its parents. Copy that record privately as `MERGE_RECORD`; use its actual branch as `MERGE_BRANCH`.

### Step F — validate and land the fixture

Run in the scratch run: land without push, inspect its output, then land with push to the local bare origin only.

```
tools/devbox-fleet/bin/fleet land --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --branch "$MERGE_BRANCH" --record "$MERGE_RECORD" --attestation "$SCRATCH/land-attestation.json"
tools/devbox-fleet/bin/fleet land --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --branch "$MERGE_BRANCH" --record "$MERGE_RECORD" --attestation "$SCRATCH/land-attestation.json" --push
tools/devbox-fleet/bin/fleet status --plan "$RUN/cr/plan.json" --repo "$REPO_DIR"
tools/devbox-fleet/bin/fleet handoff --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" --json
```

Observed result: 12 terminal records, seven done, five expected skips (four unnecessary second-round tasks and unconfigured publication), zero failed. Both landed-file assertions passed. Boot processes exited successfully. The evidence includes commands, plan, runtime records and the source-bound landing attestation.

Not verified in this release: landing a real repository, publishing status/alerts, production deployment, real-agent execution or reboot/disconnect recovery.

## 7. Steering a running job

### P0: keep a runner open

Read in code (`fleet/engine.py:709`, `bin/fleet_cli.py:302`): set optional `"keep_open": true` in the plan to keep polling after tasks finish, then use `fleet steer --plan PLAN --repo REPO close`. Active work and required publication finish first. Omitting the setting preserves the completion grace.

Read in code (`bin/fleet_check.py:20`, `fleet/recipes/build.py:139`, `bin/fleet_land.py:57`): check rejects package/requirement paths the runner never commits, including `.env.example`; build prompts include optional package focus. Land reads the coordinator's output-branch merge record by default; `--record FILE` overrides it.

Read in code (`scripts/deploy-gate.sh:84`, `briefs/build/implement.md:19`, `box/box-setup.sh:191`): workers run affected tests with one test file at a time for every two CPUs, at least one, leaving the complete repository suite to integration. The gate uses that default, honors `GATE_CONCURRENCY`, and includes toolkit unittests. Setup completes partial clones; the login-independent resume hook logs checks at 30 and 60 seconds. Not verified: real reboot or laptop-disconnect recovery.

### P0 round 2: validation and completion

Read in code (`bin/fleet_check.py:20`, `bin/fleet_land.py:300`): requirement paths preserve literal underscores, including `_data/settings.json`; excluded files with line ranges, such as `docs/service.key:12-18`, are refused. Landing uses the freshly fetched remote branch when present despite a stale local branch.

Read in code (`box/box-setup.sh:191`, `fleet/records.py:173`): partial-clone completion includes retained tag history. A completed `control: close` run bypasses routine publication throttling for its final status page; active work, publication ownership, retries and terminal publication guards still apply.

### P0 final repair: shell paths and portable tests

Read in code (`bin/fleet_check.py:23,105,146`): check refuses `curl -odata/settings.json`, Bash `$'data/settings.json'` quotes and `/usr/bin/curl --output=data/settings.json` in package or requirement fields. Quote a whole filename containing spaces; `_data/settings.json` and `fixture.env.example` stay allowed. Read in code (`tests/test_box_scripts.py:52,193`, `tests/test_p0_box_restart.py:340`): tests use scratch homes and stand-ins without Codex or Claude, and private tmux sockets with an explicit missing-tool skip; they never contact the invoking user's systemd manager. Not verified: the complete merged gate on the separate test box or a real reboot. Commands and evidence: `docs/platform/devbox-fleet-build/p0.md`.

### P0 further round 1: path spellings and restart checks

Read in code (`bin/fleet_check.py:20`, `box/box-setup.sh:79`): check refuses excluded paths in quotes, commands and option assignments, including `--output=data/settings.json`, `--config=.env.example` and `--identity=id_ed25519`, with space-separated arguments or line ranges too; `_data/settings.json` stays allowed. Restart checks use an exact tmux pane target with a trailing colon and log liveness at 30 and 60 seconds. Not verified: real reboot acceptance. The repository handoff `docs/platform/devbox-fleet-build/p0.md` records local real-tmux tests and the supervisor-provided nine-file offline history evidence.

### P0-r4: literal paths and static limits

Read in code (`bin/fleet_check.py:36`, `bin/fleet_check.py:85`): check removes literal Bash quoting; ANSI-C octal values wrap modulo 256, so `$'\544ata/settings.json'` names `data/settings.json`. Hex, Unicode and control escapes are decoded too. Read in code (`bin/fleet_check.py:172`, `bin/fleet_check.py:230`, `bin/fleet_check.py:293`): it checks the whole word, every value after `=` or `:`, and every suffix after the first character of a word starting with a single `-`, for any program and full executable paths such as `/usr/bin/curl`, without a curl flag whitelist. It refuses `-sSRodata/settings.json`, `-4odata/settings.json` and `-#odata/settings.json`. Conservative refusal can flag `-o_data/settings.json`; bare `_data/settings.json` and `--output=_data/settings.json` remain allowed. Quote an entire spaced filename, such as `"data backup/settings.json"`, to keep it one word.

Read in code (`bin/fleet_check.py:187`, `bin/fleet_check.py:220`): literal shell command operands use one shared parser in package paths, inline code, structured requirements and prose. It recursively checks `/bin/bash -c ':>data/settings.json'` without requiring whitespace in the script, and handles `-ce`, `-ec` and `+ce`. Interposed flags, named `-o`/`-O` options, `--` and redirections before the script do not hide its literal paths. Ordinary quoted arguments stay whole. Command-option recognition remains conservative and has no executable whitelist; the checker never executes plan text.

Read in code (`bin/fleet_check.py:85`, `fleet/records.py:224`, `fleet/records.py:340`): paths built only at runtime through a variable, glob, brace expansion, command substitution or a change of directory (`cd`) are outside this static check. The commit-time unstaging guard remains and names omitted paths in `unstaged_secrets`.

Read in code (`test/devbox-fleet-p0-toolkit.test.js:11`, `test/devbox-fleet-p0-toolkit.test.js:17`, `test/devbox-fleet-p0-toolkit.test.js:24`, `test/devbox-fleet-p0-toolkit.test.js:20`, `test/devbox-fleet-p0-toolkit.test.js:27`): the toolkit bridge runs only the quick set, with 300 s limits for Python and its Node test, retaining elapsed-time reporting and original toolkit failure output. **Not verified:** the complete real merged gate. Supplied timings and the timeout rule: `docs/platform/devbox-fleet-build/p0.md`.

### P0-r5: recursive literal checks supersede script selection

Read in code (`bin/fleet_check.py:123`): the literal word decoder joins an unquoted backslash-newline before recognizing ANSI-C or dollar-double quotes, including a continuation between `$` and its quote. It removes literal quoting and decodes ANSI-C octal modulo 256, hex, Unicode and control escapes without executing plan text; locale translation is a runtime operation.

Read in code (`bin/fleet_check.py:255`): every decoded word is checked again as shell text, recursively to depth 16, with repeated text deduplicated at fixed points. This supersedes the earlier script selector and quoted-caption policy: no program, option, argument position or redirection selects which word to reparse. Thus `/bin/bash -c - ':>data/settings.json'`, `-ce`, `+`, `--` and `{fd}` redirections cannot hide a literal script. Conservative recursion can refuse the ordinary quoted caption `'notes data/settings.json'`; quoting alone does not keep captions or spaced filenames opaque. The safe-root spaced path `'_data/settings with spaces.json'` remains allowed.

Read in code (`bin/fleet_check.py:22`, `bin/fleet_check.py:255`): uncertain text, including text remaining at the depth bound, fails closed when removing quotes, backslashes, dollar signs and backticks exposes an excluded candidate. Literal underscores remain intact. The same traversal covers package paths, inline code, structured requirements and prose (`bin/fleet_check.py:277`).

Read in code (`fleet/engine.py:64`, `fleet/records.py:15`, `fleet/records.py:224`, `fleet/records.py:368`): the engine's `SECRET_PATHS` exclusions and commit-time unstaging guard remain authoritative; omitted files are named in `unstaged_secrets`. Paths built only at runtime through a variable, glob, brace expansion, command substitution or a change of directory (`cd`) are outside this static check (`bin/fleet_check.py:123`). Not verified: arbitrary runtime path construction or real external-service/reboot behavior.

Read in code (`bin/fleet_check.py:221`, `bin/fleet_check.py:277`): only an explicit `Read` sentence containing a list of whole raw background hyperlinks (optionally followed by `for background`) is exempt; Markdown labels are still checked. All other URL-shaped text is checked, including redirection operands such as `:>"scheme://fixture.invalid/../../data/settings.json"`, quote fragments, nested scripts, links containing shell operators and unmarked positional commands such as `touch URL` or `Run touch URL`. No program or command-introducer guessing selects operands. Read in code (`bin/fleet_check.py:47`): ANSI-C raw SOH/DEL bytes retain Bash's parser markers through control-escape expansion. Not verified: Bash versions other than the tested 5.2.21.

- **Pause / resume:** push a shared plan control. Active children can continue; paused passes do not collect their finished results until resumed.
- **Stop:** suspends this run’s passes. It does not power off the instance or kill already launched agents.
- **Rerun:** name exact task IDs. It invalidates matching results finished before the cutoff. Include completed dependent tasks whose inputs must be regenerated.
- **Reassign:** name `TASK=BOX`. Preserve author/checker independence, including dependency edges. An old child can still be running; inspect it before duplicating work.

Steering changes and pushes the remote plan. Use a current plan snapshot; competing edits are refused instead of force-pushed. The coordinator may reassign a silent instance’s unstarted work to healthy capacity while preserving independence. Inspect the resulting assignments and records.

## 8. Review exact commits and land

Read the independent reviews, unresolved findings and suite evidence for the recorded integration and merge commits. Validate the exact branch tip and completed merge record, rather than a later branch that merely contains an accepted commit.

`land` checks the selected parents, ancestry, automatic merge tree, new conflict markers and `[skip ci]` commit messages. It prints the suite result from the record; it does not run the suite. It writes an attestation bound to the source and record hash. `--push` fast-forwards main only when possible, and records the pushed commit after success.

If main moved beyond the checked ancestry, make a new merge on current main, run the relevant validation and repeat independent acceptance. Source changes need new acceptance. A person or authorized supervising session approves the real main push. Deployment requires its own explicit approval and execution.

## 9. Prompts to give your AI agent

Replace every uppercase placeholder. These prompts state the required decisions; they do not grant remote access, publishing, landing or deployment permission.

### Plan

```
Plan a fleet build for OWNER/REPO at FULL_BASE_COMMIT using the
pitchstation-remote-work toolkit. Compare one Dev instance with a fleet.
Define package paths, concrete acceptance checks, dependencies and independent
AUTHOR/CHECKER assignments, including dependency edges. Create and inspect
the local plan and rendered prompts. Report readiness gaps and every
unverified step. Stop before external actions unless already authorized.
```

### Launch

```
Launch the reviewed plan at PLAN_PATH using the approved instance setup
and worker-execution permissions. Confirm the existing grant covers commits
and pushes under NAMESPACE only. Confirm publication permission separately
for status/reports and owner alerts to @owner/your-team / owner as appropriate.
If publishing is not authorized, remove the share block and disable alerts.
Use ubuntu@AUTHOR_HOST and ubuntu@CHECKER_HOST as the approved SSH paths.
Inspect dependency modules, browser, font sources, system tools, login and
GitHub access on each instance. Do not land main or deploy.
```

### Watch and hand off

```
Watch NAMESPACE through Git records and the approved status page.
Separate passed, failed, skipped and unavailable checks; inspect exact commits
and model evidence. Use only already-authorized plan controls; request a
decision for changes outside that grant. Check old processes before rerunning
or reassigning work. Produce a source-bound handoff with evidence, open items,
publication outcomes, required permissions and the next action. Verify actual
disconnect/restart evidence before promising laptop-off continuity.
```

### Land

```
Review MERGE_RECORD and MERGE_BRANCH for OWNER/REPO. Inspect exact parents,
independent acceptance and suite results, and run the landing validation.
Prepare the concrete result for approval. Push main only when the existing
authorization explicitly covers landing that checked source. Revalidate if
the source or main changed. Deployment is a separate permission and action;
do not deploy without that authorization.
```

## 10. Recovery and the human decisions

Read status and preserved records first. Diagnose disk, memory/load, runner session, credentials, stale state and publication separately. A live PID, tmux session or configuration file alone does not prove acceptance or laptop independence.

Doctor ignores non-task JSON metadata, including list-shaped `state/preflight.json`, while retaining task-state diagnostics. Not verified in this release: real remote diagnostics and departure checks. With approved read access, use:

```
tools/devbox-fleet/bin/fleet doctor --departure --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --host AUTHOR=ubuntu@AUTHOR_HOST --host CHECKER=ubuntu@CHECKER_HOST \
  --root /RUN_ROOT --session FLEET_SESSION
```

For a stopped instance, have an authorized operator restart it through the Dev instance lifecycle tools. Reuse the exact run root and session when repeating setup. Retained disks preserve records and restart hooks; a dead process is recovered as an interrupted attempt. Expired login needs operator authentication. Automatic reboot recovery and laptop-off operation require observed, source-bound recovery/disconnect evidence.

Preserve live locks, namespace hooks and other runs’ files. A fleet stop is different from powering off a whole instance, which can interrupt other projects. Resolve missing credentials, cost approvals, unresolved findings, assignment collisions and unexplained merge edits with the person or supervising session responsible for them. Two exhausted build/review rounds require a new decision; they do not establish acceptance.

## P2. Installed supervising sessions

### P2-r5: indirect reads and uncertain outcomes

Read in code (`tools/devbox-fleet/supervise/permissions.py:25`, `tools/devbox-fleet/supervise/outcomes.py:26`): searches and fetched Git trees check the engine's `SECRET_PATHS` before reading content. A lost HTTP response, nonzero exit, signal or timeout keeps `delivery-unknown` for a person to reconcile; restart, takeover and `--retry-start` never clear uncertainty. Proven pre-send failures remain retryable. See `docs/supervising.md`. Real two-box operation and external delivery remain **Not verified**.

Read in code (`tools/devbox-fleet/supervise/suplib.py:74`, `tools/devbox-fleet/supervise/status_report.py:1557`): cached inputs and handoff copies require regular files without symlinks. Slash-bearing Grep globs require a permitted search tree. `reporter.lock` serializes receipt recovery and delivery, including `--once`; retry resume after a busy reporter saves its receipt. Local validation and DNS failures before connection remain retryable, while earlier request uncertainty is retained. See `docs/supervising.md`. External delivery remains **Not verified**.

### P2-r4 round 2: Git objects and interrupted operations

Read in code (`tools/devbox-fleet/supervise/permissions.py:187`, `tools/devbox-fleet/supervise/notify_owner.py:112`, `tools/devbox-fleet/supervise/manage.py:356`): Git object reads check object types and paths. A signal-terminated notifier leaves `delivery-unknown`; reconcile fallback and takeover mail before resend. Retry an interrupted owner note with the same input: `state/owner-note-pending.json` preserves its operation identity. A different pending note is refused; identical text submitted after completion creates a new note. See `docs/supervising.md`. Real two-box operation and mail delivery remain **Not verified**.

### P2-r4: secret paths and delivery recovery

Read in code (`tools/devbox-fleet/supervise/permissions.py:40`, `tools/devbox-fleet/supervise/supervise_loop.py:583`): the profile uses the engine's `SECRET_PATHS`, including `firebase-service-account.json`, for reads, searches and Git publication. Bundle checks include data files as well as Python modules. A durable `not-attempted` receipt lets the sender recover a delivery claim after a lost push acknowledgement and temporary readback failure. Uncertain sends still require reconciliation. A timed-out deploy start or uncertain first share creation also waits for reconciliation. See `docs/supervising.md`. Real two-box operation and mail delivery remain **Not verified**.

### P2-r3 follow-up: delivery claims and worker paths

Read in code (`tools/devbox-fleet/supervise/permissions.py:374`, `tools/devbox-fleet/supervise/supervise_loop.py:583`, `tools/devbox-fleet/supervise/facts.py:121`): validate the resolved plan's executable bundle even through symlinks. First-fallback mail has a shared delivery claim without expiry; uncertain delivery needs reconciliation before resend. Worker facts default to `~/fleet/` plus the namespace with slashes changed to hyphens. A configured `supervise.run_root` records an existing `fleet launch --setup --root ROOT` choice. See `docs/supervising.md` for recovery limits. Real two-box operation and mail delivery remain **Not verified**.

Read in code (`tools/devbox-fleet/supervise/manage.py:465`, `tools/devbox-fleet/supervise/suplib.py:312`): resume invalidates earlier heartbeat observations; takeover waits for the resumed holder's fresh heartbeat. Uncertain pushes are checked before replaying events. Facts document deployment checks and production evidence. Supervising shell operations use the isolated permission dispatcher; see the toolkit's `docs/supervising.md`.

Read in code (`scripts/install-local-skills.sh:50`): refresh with `scripts/install-local-skills.sh pitchstation-remote-work`. Both agent skills include the supervisor and its templates. Existing runs keep their frozen toolkit copy.

Read in code (`tools/devbox-fleet/bin/fleet_supervise.py:54`): configure this run locally on each existing coordinator with a plain I1 settings JSON dictionary. Use `primary` on the first box and `standby` on the second. The standby starts only after a fresh primary heartbeat. The units contain no environment-file assignment; configuration is in the run's `run.json`.

```
fleet supervise install RUN --plan PLAN --settings SETTINGS_JSON --repo REPO --box BOX --role primary
fleet supervise start RUN
fleet supervise status RUN
fleet note RUN FILE
fleet rounds allow RUN 3
fleet engine set RUN codex
fleet supervise stop RUN
fleet resume RUN
```

Read in code (`tools/devbox-fleet/supervise/facts.py:48`, `tools/devbox-fleet/supervise/timings.py:8`): facts are generated from the plan, settings and version-1 box records; pass prompts list notes oldest first. Never edit those generated files. Resume requires the local lease and no recorded deploy start; a final run needs resume before notes. Defaults are a 60-second cycle, a pass after 12 idle minutes, a 100-minute pass limit, takeover after 20 silent minutes and an alarm after 45 minutes without progress. Optional settings override these values; the generated table is in the toolkit's `docs/supervising.md`.

Read in code (`tools/devbox-fleet/supervise/manage.py:415`, `tools/devbox-fleet/supervise/standby_watch.py:114`): retry interrupted resume with the same command on the lease holder. Takeover restores shared progress before a pass, and heartbeat observations survive watcher restart. Generated facts retain summary, focus and paths. The permission profile checks exact helper arguments, output paths, staged files and recursive searches.

**Not verified:** real logout continuity, two-box execution, signed-in agent permission refusals, external publication, mail delivery and deployment. Read the P2 build note for owner checks before relying on laptop-off continuity.

Read in code (`tools/devbox-fleet/supervise/suplib.py:74`, `tools/devbox-fleet/supervise/outcomes.py:38`): every automatic reader uses the classified regular-file boundary. Sender state is valid, absent (ENOENT only), or unreadable under one sender lock. Unreadable receipts keep `delivery-unknown` and a `*-state-uncertain.json` marker for human reconciliation across restart and takeover. Repair the original state and verify delivery before clearing its marker. See `docs/supervising.md`. Real two-box operation and external delivery remain **Not verified**.

Read in code (`tools/devbox-fleet/supervise/standby_watch.py:133`, `tools/devbox-fleet/supervise/standby_watch.py:139`, `tools/devbox-fleet/supervise/suplib.py:626`): a definitely refused takeover clears `takeover-pending.json`, allowing automatic retry after later silence. If publication cannot be confirmed after a lost acknowledgement, failed readback or failed Git ancestry check, the intent stays for reconciliation.

## P3. Box records and repository profiles

Read in code (`tools/devbox-fleet/bin/fleet_box.py:264`, `tools/devbox-fleet/fleet/boxrecord.py:261`): `fleet box record` refreshes the optional local `~/.fleet/box-record.json`. `fleet boxes` reads capabilities and state from the platform registry without SSH. `fleet boxes --check-logins` checks this box immediately; normal login checks are cached for 24 hours. The setup helper installs a five-minute timer.

Read in code (`tools/devbox-fleet/bin/fleet_box.py:102`, `tools/devbox-fleet/fleet/alerts.py:103`, `tools/devbox-fleet/fleet/status.py:139`): optional `plan.box_requirements` supplies live/submitted run requirements to coordinator alerts and the existing run page. Local refreshes discover `ROOT/cr/plan.json`; optional `config.runs` adds other plans. Use `fleet boxes --plan PLAN_JSON --html LOCAL_PAGE` to render current deficits; repeat `--plan` for more plans. Ordinary inventory reads retain unmet warnings on later renders without sending alerts. Login loss is observed daily or immediately with the local login check.

Read in code (`tools/devbox-fleet/bin/fleet_profile.py:54`): `fleet profile check`, `fleet profile prepare`, `fleet profile brief` and `fleet profile test-job` use the repository's `.fleet/profile.json`. `fleet repo setup REPO` clones, installs and verifies trusted repository code. Review its profile first. Not verified: six real boxes, login revocation, timer/logout recovery, the private second repository and production deployment. Read in code (`tools/devbox-fleet/box/box-setup.sh:196`, `tools/devbox-fleet/briefs/build/integrate.md:17`): setup invokes the optional record helper after PATH is ready; the integration brief uses the merged checkout's profile when present and the legacy isolated command otherwise. External deployment adoption remains not verified; see `docs/platform/devbox-fleet-build/p3.md`.

## P3 further round

### P3 follow-up 2: optional requirements and push limits

Read in code (`bin/fleet_box.py:224`, `fleet/alerts.py:124`, `fleet/alerts.py:375`): omitted or empty capability requirements, including empty agent/class lists or requirements for another box, perform no receipt coordination. Registration overrides follow the same rule; removing requirements retains an existing episode's recovery boundary locally until requirements return. Receipt pushes retain the repository's pre-push hook and use `--no-follow-tags`. Read in code (`bin/fleet_box.py:84`): registry rows use `lastReport.capabilities` independently of their optimistic `version`.

Read in code (`tools/devbox-fleet/fleet/alerts.py:324`, `tools/devbox-fleet/fleet/alerts.py:358`): distributed capability alerts reserve a receipt at the current Git origin on `<namespace>/capability-alert-<key hash>`. Ordinary fast-forward pushes prevent stale worker or coordinator copies from publishing twice; an unavailable origin defers publication. Keep these branches until the run is retired. Recovery rearms a later loss; failed or uncertain publication retains the six-hour retry policy.

Read in code (`tools/devbox-fleet/fleet/profile.py:307`, `tools/devbox-fleet/bin/fleet_box.py:91`): `python3 tools/devbox-fleet/bin/fleet profile test-job --run > suite.tap 2>&1` retains complete test output without description JSON. Inventory rejects another box alias's record, supplies no classes and names the mismatch. Not verified: live remote transport and owner notification delivery.

## P3 queued capability alerts

Read in code (`fleet/alerts.py:435`, `fleet/alerts.py:466`): dispatch rechecks queued capability alerts against the current plan's required box, classes and agents before receipt handling. Omitted or empty requirements, requirements for another box only, empty agent/class lists or removal of the box cancel the queued alert without publication, notification or a new origin receipt. Retained pending entries are checked again each pass. Read in code (`bin/fleet_box.py:254`): local registration overrides supply their effective requirements to the same check. Not verified: real login revocation and remote alert delivery.

## P3 queued capability identity

Read in code (`fleet/alerts.py:470`, `fleet/alerts.py:522`, `bin/fleet_box.py:248`): queued losses retain their original `missing` class/login identities. Removing a missing class or login cancels its alert even when healthy requirements remain. If some missing capabilities remain required, the message lists only those remaining capabilities. The legacy decoder reads the exact generated message format from older queues; unidentifiable losses are canceled before receipt handling.

Read in code (`fleet/engine.py:1066`): P0 integration must remove `cancelled` results from the pending outbox; the exact engine change is in `docs/platform/devbox-fleet-build/p3.md`. Until integration, re-adding the same requirement can revive a retained event. This package leaves the engine unchanged. Not verified: real login revocation and remote notification delivery.

## P3 removed requirements and later loss episodes

Read in code (`fleet/alerts.py:474`, `fleet/alerts.py:556`, `bin/fleet_box.py:279`): removing capability requirements retires known delivery receipts and retry throttles locally, even with an empty coordinator outbox. No origin receipt is written while requirements are absent. Re-adding them reconciles the recovery boundary before a fresh loss; old, equal-time or undated observations cannot erase it. Accepted loss identities stay in the local ledger, so partial removal also closes the episode when only healthy requirements remain. Rejected old observations cannot relabel that loss. Standalone checks also retire the previous episode. Repeated losses still produce one alert per episode.

Read in code (`fleet/alerts.py:33`, `fleet/boxrecord.py:32`, `fleet/health.py:112`, `bin/fleet_box.py:333`): box observations and alert receipts retain available microseconds. Local requirement withdrawal starts from its action time even when the cached record is older. Read in code (`fleet/alerts.py:50`): if that clock ties or predates the known delivery attempt, both writers keep a conservative local ordering marker one microsecond after that attempt; this marker is not a machine observation. Observations at or before the retained recovery marker remain blocked until a fresh later observation arrives. Legacy second-precision timestamps remain valid.

Read in code (`fleet/engine.py:1066`): the required P0 pending-removal integration line in `docs/platform/devbox-fleet-build/p3.md` is unchanged. Not verified: real scratch login revocation, daily timer execution or remote notification delivery.

## P3 alert ordering and interrupted writes

Read in code (`fleet/alerts.py:36`, `fleet/engine.py:999`, `bin/fleet_box.py:340`): alert timestamps use one parsed UTC ordering, including whole seconds, fractions, Z and +00:00; missing or invalid times sort oldest. A delayed healthy observation can retire a delivery receipt only when it is newer than every saved lifecycle boundary, under the same local lock. Recovery tombstones survive a restart. Read in code (`fleet/engine.py:1025`, `fleet/engine.py:1097`): a journal preserves the coordinator snapshot when either local or output-copy writing is interrupted. The required pending-removal condition is now included in P3; it consumes sent, resolved and cancelled events. This supersedes the older instructions to leave that line for P0 integration. Not verified: real scratch login revocation, daily timer execution or remote owner notification delivery.

## M1. Integrated toolkit

Read in code (`supervise/facts.py:16`, `fleet/boxrecord.py:64`, `box/box-setup.sh:196`, `briefs/build/integrate.md:17`): supervising facts share the bounded box-record reader; setup invokes the optional record helper after PATH is ready; build integration uses the merged checkout's repository profile and retains the legacy no-profile path.

Read in code (`test/devbox-fleet-p0-toolkit.test.js:1`, `tools/devbox-fleet/test-plan.json:1`): the deploy check runs only the quick set, with 300 s limits for Python and Node. Run the complete toolkit collection separately before a merge; both modes print totals and elapsed time.

```
python3 tools/devbox-fleet/run_tests.py quick
python3 tools/devbox-fleet/run_tests.py full
```

Not verified: real two-box takeover, reboot/logout continuity, scheduled login loss, external delivery, six-box inventory, the private second repository and external deploy/profile adoption. The package notes retain the owner's commands.

## P1. Submit one request

Read in code (`tools/devbox-fleet/bin/fleet_submit.py:584`, `tools/devbox-fleet/box/box-setup.sh:303`): submission requires a valid version-one `.fleet/profile.json`, its selected lockfile, `package.json` and `pnpm-lock.yaml`. Fresh runner bootstrap uses the fixed command `COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack pnpm@10.10.0 install --frozen-lockfile` in the runner's `deps` directory, with the immutable base's manifest and pnpm lockfile. Existing dependencies are reused only when their manifest matches that base. Missing profiles refuse submission before runner installation. Read in code (`tools/devbox-fleet/bin/fleet_profile.py:23`, `tools/devbox-fleet/fleet/profile.py:204`): separate repository preparation through `fleet profile prepare` or `fleet repo setup REPOSITORY` uses the profile's `install.command`, preparation settings and verification commands. These settings do not replace the runner bootstrap command.

Read in code (`tools/devbox-fleet/fleet/submission_services.py:155`, `tools/devbox-fleet/supervise/manage.py:174`): toolkit files must match the request's exact commit. The resolved `base` commit in the target repository must contain `tools/devbox-fleet/` with exactly these toolkit files. Only `manage.generated_units` from that toolkit generates installed units. Requests, settings and the environment cannot supply unit text or unit commands; refused keys are named before run assets are created. Both preview and actual submission start every exact generated command once before the submission checkpoint or any branch publication or service installation, with `--self-check`, only the unit's `Environment` values (equivalent to `env -i`), a scratch working directory and a 30-second limit. Real startup loads toolkit modules, reads settings and resolves external programs through the unit's `PATH` before state writes or network use. One JSON line reports `"ok": true`, the program, loaded modules and resolved programs. A nonzero exit, timeout or invalid JSON refuses submission and names the unit and reason.

Read in code (`tools/devbox-fleet/supervise/template_validation.py:10`): accepted pass-template names come from the actual `render_prompt` call. Names that renderer fills are accepted; unfilled names are refused before creating run assets.

Read in code (`tools/devbox-fleet/bin/fleet_submit.py:633`): preview and actual submission share deterministic checks before the submission checkpoint, saved toolkit snapshot or run branches are created. Shared validation checks package and pass prompts, the permission profile, immutable base files consumed by runner setup, local Git author and committer identities used for publication, runner setup's required remote refs and a positive setup timeout, and local SSH availability for the default transport.

Read in code (`tools/devbox-fleet/bin/fleet_submit.py:453`, `tools/devbox-fleet/supervise/manage.py:206`): the default runner root is `~/fleet/` plus the namespace with `/` replaced by `-`. An explicit `supervise.run_root` wins. Keep `~/` unexpanded until the command reaches the box.

Read in code (`tools/devbox-fleet/bin/fleet_submit.py:633`, `tools/devbox-fleet/supervise/suplib.py:140`): preview rehearses the bundle and available package prompts, standing brief, facts and unit templates before creating submission state or saving the frozen toolkit. The preview uses temporary toolkit copies and Git fetches local objects; it does not publish run branches or install services. Planning packages are checked after the coordinator writes them. Git sync rejects linked handoff ancestry before notes are read, copied or published.

Read in code (`tools/devbox-fleet/fleet/request.py:186`): `fleet submit` accepts only `"recipe": "build"`. Use the existing plan commands for `code-review` and `merge-main`.

Read in code (`tools/devbox-fleet/fleet/request.py:59`, `tools/devbox-fleet/supervise/manage.py:206`): each role keeps its model and effort. `models.builder` and `models.reviewer` select workers; `models.supervisor` and `models.fallback` select the primary chain. Optional `models.standby` and `models.standby_fallback` select takeover. Omit both standby keys to keep the existing shared chain; set only `models.standby` to retry that model. The supervising model prefix selects Codex or Claude.

Read in code (`tools/devbox-fleet/fleet/request.py:26`, `tools/devbox-fleet/bin/fleet_submit.py:219`, `tools/devbox-fleet/bin/fleet_submit.py:232`): submission rejects symlinks in request, toolkit and run assets, including internal links. Preview finds a valid mixed auto/named coordinator pair and refuses reserved coordination branches (`plan`, `out-*`, `fix-*`, `fixes*`, `main-merge`) and their descendants. Retry refuses changed SSH aliases, repository paths, runner roots or local repository destinations before any setup step.

Read in code (`tools/devbox-fleet/fleet/request.py:384`, `tools/devbox-fleet/templates/request.md:3`): write the goal, deliverables, done checks and exclusions in one Markdown request. Its single JSON fence carries all run settings; unknown or missing keys fail with the key and line. The versioned standing brief supplies the repeated report, supervision, merge, deploy and completion rules.

```
fleet submit REQUEST --repo REPO --inventory INVENTORY_JSON --dry-run
fleet submit REQUEST --repo REPO --inventory INVENTORY_JSON
fleet steer resume --plan PLAN_JSON --repo REPO
```

Read in code (`tools/devbox-fleet/bin/fleet_submit.py:741`): submit from the owner's laptop using a private inventory of existing boxes. Inspect the remote commit, packages or “to be planned”, box roles, models, available estimate and owner actions in the preview. `--dry-run` stops there. `--state-root PATH` selects retained submission state; rerun the same request after interruption. The command starts this run's supervisors, runners and report, then checks departure. Its final output says “you can close the laptop now” or lists what remains. Run dates use UTC; report times use the requested timezone.

Read in code (`tools/devbox-fleet/briefs/plan.md:7`, `tools/devbox-fleet/fleet/request.py:175`): `"packages": "plan"` asks the coordinator to write, check and publish a plan first. Every package, including later additions, needs a one-sentence `summary` of at most 140 characters. Submitted plans fail without it; old plans warn. With `"start": "after-review"`, tasks stay paused until owner release. Before the resume command above, fetch the published plan branch and save its current `cr/plan.json` as `PLAN_JSON`; review that version.

**Not verified:** the three real laptop scratch submissions, two-box execution, external publication and actual departure. Local stand-ins test the code paths; use the owner checks in the P1 build note before relying on continuity.

Read in code (`tools/devbox-fleet/fleet/submission_services.py:66`): an installed toolkit's maintained components must match the documented projection of the resolved `base` commit. Submission freezes the complete repository `tools/devbox-fleet/` tree. Files in the operator's skill root never supply frozen toolkit bytes.

Source: the repository toolkit and its CLI parser. Local tutorial evidence is recorded alongside the contract note. Real deployment and publication are separate release steps.

## P17. Coordinator-directed test pool

The owner reserves T4/T8 with an explicit monthly hours budget, adds `account_cpu_limit` to the laptop inventory, installs the refreshed skills, then gives each coordinator its own `fleet testbox grant COORDINATOR TESTBOX --ledger PRIVATE_LEDGER`. `--dry-run` lists the four steps and each undo; `revoke` removes that pair. The scoped provisioner owns firewall changes.

Test boxes hold no AI login, repository key, production key or token. Their forced SSH dispatcher accepts only test jobs and the test repository push. Setup `box/test-box-setup.sh --check` lists observations without changing anything. Jobs detach, queue under the box lock and use the repository profile. Lost transport retries on the coordinator once and the report says coordinator fallback. An empty test box stops 60 minutes after its last job and last keepalive; agent boxes stay on. The deploy job keeps its coordinator gate.

If the CPU setting or available capacity prevents startup, the published plan keeps all test jobs on the coordinator. Jobs reuse setup's resource paths. A surviving test subprocess keeps the box occupied after its worker leader exits; the next job and idle shutdown wait. Atomic grant receipts preserve interrupted revoke recovery.

**Not verified in this run:** real provisioning, readiness timing, firewall isolation, detached remote execution, idle shutdown/restart and box loss. P6 owns the executor and records; the joining seam and exact owner proofs are in `docs/platform/devbox-fleet-build/p17.md`.

# 多实例协作指南

使用开发实例（Dev instance，工具中称 devbox）持续运行任务；当一个工作需要多个实例实施并独立评审时，使用多实例协作（fleet）。工具包位于 `tools/devbox-fleet/`，命令行为 `bin/fleet`，随 `pitchstation-remote-work` 技能安装。

[开发实例](/devboxes.html) · [开发实例指南](/devbox-guide.html) · [代理阅读的 Markdown](/fleet-guide.md?lang=zh)

## 1. 一个实例还是多个实例？

对独立、可信的命令，一个实例中的持久本地队列就足够。本地监督进程限制并发，并保存进程和结果证据。需要工作包、依赖关系、独立作者与检查者、评审和修复轮次，以及精确提交集成时，选择多实例协作。

至少需要两个实例。只有任务能够独立推进时，增加实例才有帮助。每个实例同时保持一个重任务；评审和报告任务使用单独的并发分组。本地队列不提供依赖图。

选择本地模式前，阅读仓库的 `tools/devbox-fleet/README.md` 以及工具包内的 `docs/single-box.md`。本教程实跑的是多实例构建配方。

## 2. 准备每一个实例

- **运行环境与工具：**Python 3.9+、POSIX shell、Git、与原生模块 ABI 兼容的 Node、corepack/pnpm、tmux、timeout，以及项目测试工具。按任务范围补充系统工具，例如 PDF 栅格化需要 `pdftoppm`。
- **完整依赖：**使用目标基线的包清单和锁文件。设置脚本可复用匹配的模块，或按冻结的 pnpm 锁文件安装。存在 `node_modules` 目录本身不能证明所需模块可加载。
- **浏览器与字体：**浏览器验收需要 Chromium/Chrome；网站样式族任务需要 `vendor/font-sources/` 下固定版本的字体源。仓库浏览器辅助工具共享两个 Chrome 槽位。预检发现任意字体或浏览器版本，并不能证明完整字体目录就绪或浏览器测试通过。
- **代理登录：**每个实例都应安装并登录 Codex。记录请求的模型与推理力度，核查实际观察证据。进程成功退出本身不代表验收通过。
- **GitHub 访问：**每个代理实例需要自己的仓库凭证，并能读取基线与命名空间分支。代理实例通过 GitHub 交换工作，不互相 SSH。
- **协调实例：**发布时，在协调实例上安装已有共享客户端，确认账号和受众。`FLEET_SHARE_CLIENT` 可指定客户端路径。同时删除计划的 `share` 和 `alerts` 块，才能关闭状态／报告及负责人提醒的发布。`new` 默认创建 `share` 块，因此应显式指定 `--team @owner/your-team` 并检查结果。

在仓库中运行 `npm run skills:install` 安装或刷新。安装目录为 `~/.claude/skills/pitchstation-remote-work/` 与 `~/.codex/skills/pitchstation-remote-work/`，也可直接使用检出目录中的命令行。

本版本未验证（Not verified in this release）：真实远程实例的准备条件、SSH 设置、真实代理认证与共享交付。暂存教程使用测试工具。

## 3. 工作如何流转

选择唯一命名空间和不可变的完整基线提交。`<namespace>/plan` 保存冻结的 `cr/` 包：计划、引擎、任务说明和启动脚本。每个实例拥有一个 `<namespace>/out-<BOX>` 输出分支，包含 `cr/out/<BOX>/results/` 结果与 `status.json` 心跳。实施、集成和合并分支也在该命名空间内。

操作人员通过已批准的 SSH 路径执行初始设置和诊断。每个启动循环每分钟获取完整计划包，完成已有工作、启动就绪任务，并发布自己的 Git 记录。评审读取记录中的提交 ID；集成使用这些精确 ID。命名空间钩子限制工作进程推送，主分支单独合入。

启动实例、执行代理、命名空间提交／推送、修改计划、发布报告或负责人提醒、合入主分支，以及部署，都需要覆盖相应操作的授权。具备权限的人或监督会话处理这些边界。配置受众或检查成功不提供授权。

**环境文件：**运行器从工作包提交中剔除 `.env*`，并拒绝引入此类文件的集成。看到剔除提示时，应审查遗漏的工作，不能认为配置已提交。任务结果的 `dropped_env_files`、最终 Markdown 与构建生命周期摘要会列出被排除的环境文件。

## 4. 构建与代码审查配方

| 配方 | 工作与轮次 |
| --- | --- |
| `build` | 为每个区域定义具体需求、验收条件和允许路径。`reviewer` 是实施者，`verifier` 是独立评审者。记录顺序为 `fix` → `recheck` → 可选的 `fix2` → `recheck2`，随后集成并报告。只有两轮实施／评审。 |
| `code-review` | 审查 → 独立核实与可选的遗留线索 → 汇总 → 报告，随后最多两轮修复／复查并集成。不包含后续跟踪事项审查周期。 |

首轮复查失败且仍有高或中严重程度问题时，才运行第二轮。跳过不必要的轮次与通过不同。发布报告需要配置共享客户端。集成后可以追加 merge-main；集成分支不等于主分支。

可选的 `after` 让工作包从前置工作包最终记录的提交开始。独立性也适用于依赖边：评审前置工作包的实例不能构建依赖它的后续工作包，反向也一样。沿依赖链保持角色分配一致，或增加独立实例。

`check` 会拒绝这种依赖角色冲突，并列出冲突任务、实例与规则。命令行及 HTML 状态会为受阻的空闲任务显示 “waiting for independent author/checker assignments”。check 与 status 先应用协调实例已保存的 `moves.json` 分配，再应用计划中的明确重新分配；它们不会提出新的迁移。

## 5. 阅读状态与证据

命令行状态通过 Git 获取输出分支，不使用 SSH，显示任务总数、运行／失败／跳过数量、心跳时间和状态链接。HTML 状态页还展示阶段、健康状况、预检新鲜度、模型来源和发布器健康状况。新的心跳或报告时间不等于测试通过。

配置并授权共享后，协调实例会静默替换同一个需账号访问的状态链接。任务成功与发布成功应分别判断。没有 `share` 块时，“not published yet” 属于预期结果。

通过 `"alerts": {"to":"owner"}` 开启后，完成、失败重试耗尽、无心跳、磁盘压力或登录失效等事件会发布仅负责人可见、无团队受众的提醒；同一事件六小时内去重。发布后，工具包请求 `notify ... --to owner`，并将 `notification.status` 记录为 `pending`、`requested` 或 `failed`。通知失败不会改变页面发布成功的结果，也不会在事件节流期内重试；去重后的提醒不再请求通知。共享客户端不支持通知时，提醒不会发送邮件。本版本未验证：通知交付。requested 只表示客户端接受请求，不能证明邮件送达。

使用私有交接工件保存源提交与补丁哈希、证据引用、实例、未完成验收、报告链接、所需权限和下一步。要检查跳过的记录：暂存实跑即使已合入，handoff 仍将预期跳过列为未完成项。

## P6. 以任务方式运行测试

使用 `plan.test_jobs.enabled: true` 显式启用：在可信计划中添加 `"test_jobs": {"enabled": true}`。协调器在代理会话之外运行测试，读取请求提交中的仓库配置，并使用 `~/.fleet/slots/` 下的实例级独占锁。省略此设置时保留既有流程；没有仓库配置的提交保留原测试命令。P17 单独提供测试池传输。

先提交源码，再在任务检出目录中运行 `fleet test request --files …`。命令为该提交排队并输出未来记录路径，不启动工作进程，也不等待结果。下面其余命令供协调器或已获授权的独立运行器使用；`REPO` 是检出目录，`STATE` 是私有 I6 状态目录。`run` 在代理会话之外执行。所有命令均支持 `--help`。

```
fleet test request --files test/example.test.js
fleet test status --repo REPO --records-root STATE
fleet test run --repo REPO --records-root STATE
fleet test validate RECORD
fleet test convert SOURCE --commit COMMIT --tree TREE --provenance SOURCE_BRANCH:SOURCE_PATH --out CONVERTED
fleet test split --repo REPO --records-root STATE --commit COMMIT --base BASE --parts 2
fleet test join --repo REPO --records-root STATE --commit COMMIT --base BASE --parts 2
```

本地默认目录为运行根目录下的 `test-jobs/`；可选的 `test_jobs.records_root` 可指定私有绝对路径。任务将请求放入 `output/cr-scratch/fleet-test-requests/`，通过自身输出分支交付。请求、记录和日志保存在协调分支 `<namespace>-sup/state` 的 `suite-records/<commit>/<selection>/` 下；`record.json` 绑定提交、目录树、配置、实例／CPU、起止时间、各轮数量、失败、重跑与日志。工作包的下一项评审任务会收到这些私有记录。

每次修复后，引擎使用工作包测试及合并后配置中的 `test.join` 探针提交合并检查；集成仍须完整配置门禁。失败文件会单独重跑并与基线比较，记录保留观察与判定；严重级别及关闭决定仍由评审者负责。`split` 固定文件清单，在尚无耗时记录时按路径的稳定哈希分片。`join` 重跑缺失分片，并根据实际观察到的文件结果证明每个选定文件恰好运行一次。合并记录使用独立选择，不能替代完整配置门禁。部署仍在协调器上运行自身门禁。

**本次运行未验证（Not verified in this run）：**真实测试实例执行、两台真实实例上的分片或中断／恢复，以及重新运行耗时的历史测试套件。本地替身证明代码行为；本地历史分支重放使用已记录命令的回放。所有者须执行的确切证明命令及剩余检查见 `docs/platform/devbox-fleet-build/p6.md`；完整命令契约见 `tools/devbox-fleet/docs/test-jobs.md`。

使用真实测试池前，所有者首先为 P17 配置账户实际 CPU 上限，再配置允许的测试池与仓库配置。合并后还须部署包含测试价格类别的平台版本，在笔记本上运行 `npm run skills:install`，并由所有者授予协调器对不持有登录、密钥或令牌的测试实例的单向访问。代理实例保持运行。P6 自身不创建、停止、调整或删除任何实例。

## 6. 实跑教程：从计划到合入

已在暂存实跑：两个本地实例根目录、本地裸 Git 源、两个简单工作包、独立测试评审、真实引擎提交与合并，以及向该裸源主分支的真实快进。模型工作进程使用确定性的替身。没有 share 块。

可复现驱动脚本及精简命令／结果证据位于仓库的 `docs/platform/devbox-docs-2026-11-11/tutorial-run/`。从项目根目录执行，使用新的暂存名称：

```
python3 docs/platform/devbox-docs-2026-11-11/tutorial-run/run.py --scratch tutorial-check
```

驱动只在 `output/cr-scratch/fleet-guide/tutorial-check/` 内创建文件，Git 仅允许文件传输，拒绝已存在的暂存名称，并执行以下命令。`REPO_DIR` 指测试克隆，`RUN` 指计划包，`BASE` 指完整基线 ID，`AUTHOR`／`CHECKER` 表示两个虚构实例角色。实跑记录使用小写别名。以下主机、仓库与团队均为占位符。

### 步骤 A — 创建并编辑计划

已在暂存实跑：new、计划与说明文件编辑。

```
tools/devbox-fleet/bin/fleet new --namespace dev/tutorial/fleet-guide \
  --repo OWNER/REPO --boxes AUTHOR CHECKER --base "$BASE" \
  --recipe build --model fixture-stub --effort low --team @owner/your-team --out "$RUN"
```

编辑 `$RUN/cr/plan.json`：删除 `share`，将 `control` 设为 `pause`、`paused` 设为 `true`，用以下两项替换示例区域。驱动还将完成等待期设为零，并通过仅用于测试的 PATH 包装器缩短轮询。将复制的 `cr/briefs/common.md` 替换为测试专用规则。真实项目需要自己的验收说明与测试。

```
"areas": [
  {"id":"alpha", "title":"Alpha", "reviewer":"AUTHOR", "verifier":"CHECKER",
   "paths":["alpha.txt"], "requirements":[{"id":"alpha-1", "title":"Write alpha",
   "detail":"Create alpha.txt with one line alpha", "acceptance":"The fixture assertion passes", "severity":"high"}]},
  {"id":"beta", "title":"Beta", "reviewer":"AUTHOR", "verifier":"CHECKER",
   "paths":["beta.txt"], "requirements":[{"id":"beta-1", "title":"Write beta",
   "detail":"Create beta.txt with one line beta", "acceptance":"The fixture assertion passes", "severity":"high"}]}
]
```

### 步骤 B — 启动前检查每份提示词

已在暂存实跑：空记录预演，11 项决策与 10 份已渲染提示词。

```
mkdir -p "$RUN/empty-records"
tools/devbox-fleet/bin/fleet check --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --records "$RUN/empty-records" --out "$RUN/check"
tools/devbox-fleet/bin/fleet status --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --records "$RUN/empty-records"
```

阅读 `$RUN/check/status.html` 与提示词。check 不启动工作进程、不发布内容。真实结果尚未产生时，后续提示词可使用模拟依赖；实际决策仍读取指定记录。

### 步骤 C — 发布计划并启动本地循环

已在暂存实跑：launch 只推送至测试裸源；未修改的打包启动脚本在独立本地根目录中运行。

```
tools/devbox-fleet/bin/fleet launch --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --records "$RUN/empty-records" --out "$RUN/launch-check"
sh "$RUN/cr/cr-boot.sh" AUTHOR dev/tutorial/fleet-guide "$SCRATCH/AUTHOR" &
sh "$RUN/cr/cr-boot.sh" CHECKER dev/tutorial/fleet-guide "$SCRATCH/CHECKER" &
```

驱动准备各根目录的克隆与 `box.json`，用替身代替 Codex，并验证两个循环都看到了暂停状态。这未验证真实设置流程。

本版本未验证（Not verified in this release）：通过 SSH 使用真实主机。具备设置与命名空间写入授权后，真实主机版本为：

```
tools/devbox-fleet/bin/fleet launch --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" --setup \
  --host AUTHOR=ubuntu@AUTHOR_HOST --host CHECKER=ubuntu@CHECKER_HOST \
  --root /RUN_ROOT --session FLEET_SESSION
```

### 步骤 D — 控制、观察与交接

已在暂存实跑：五种控制操作、status 与 JSON handoff。pause／stop／rerun／reassign 在工作前执行；reassign 保留原作者。resume 后两个工作包完成。

```
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" pause
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" stop
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" reassign fix:alpha=AUTHOR
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" rerun fix:alpha \
  --reason 'Fixture before first attempt'
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" pause
tools/devbox-fleet/bin/fleet steer --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" resume
tools/devbox-fleet/bin/fleet status --plan "$RUN/cr/plan.json" --repo "$REPO_DIR"
tools/devbox-fleet/bin/fleet handoff --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" --json
```

本版本未验证：将运行中工作迁往另一真实实例、重新生成已完成的结果、真实模型的评审质量。

### 步骤 E — 审查精确集成并请求合并

已在暂存实跑：测试评审者检查各工作包记录的提交；集成执行两个断言。完成后，驱动读取精确集成记录，并向本地计划追加合并请求：

```
"merge_main": {"main":"FULL_MAIN_COMMIT", "fixes":"FULL_INTEGRATION_COMMIT",
               "message":"Land tutorial [skip ci]"}
```

```
tools/devbox-fleet/bin/fleet check --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" --out "$RUN/merge-check"
tools/devbox-fleet/bin/fleet launch --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" --out "$RUN/merge-launch-check"
```

驱动重新启动相同的本地循环，执行新增合并，等待完成记录并核查父提交。私下复制该记录为 `MERGE_RECORD`，以其实际分支作为 `MERGE_BRANCH`。

### 步骤 F — 验证并合入测试主分支

已在暂存实跑：先不推送运行 land，检查输出，再以 push 合入本地裸源。

```
tools/devbox-fleet/bin/fleet land --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --branch "$MERGE_BRANCH" --record "$MERGE_RECORD" --attestation "$SCRATCH/land-attestation.json"
tools/devbox-fleet/bin/fleet land --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --branch "$MERGE_BRANCH" --record "$MERGE_RECORD" --attestation "$SCRATCH/land-attestation.json" --push
tools/devbox-fleet/bin/fleet status --plan "$RUN/cr/plan.json" --repo "$REPO_DIR"
tools/devbox-fleet/bin/fleet handoff --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" --json
```

实测结果：12 项终态记录，其中七项完成、五项预期跳过（四项不必要的第二轮任务与未配置发布），零失败。合入后两个文件断言通过，启动进程成功退出。证据包含命令、计划、运行记录与绑定源提交的合入证明。

本版本未验证：真实仓库合入、状态／提醒发布、生产部署、真实代理执行，以及重启／断线恢复。

## 7. 控制正在运行的工作

### P0：保持运行器开放

代码已查阅（read in code：`fleet/engine.py:709`、`bin/fleet_cli.py:302`）：在计划中设置可选的 `"keep_open": true`，任务结束后继续轮询；用 `fleet steer --plan PLAN --repo REPO close` 关闭。运行中的任务与必要发布先完成。不设置此项则保留原有完成宽限期。

代码已查阅（read in code：`bin/fleet_check.py:20`、`fleet/recipes/build.py:139`、`bin/fleet_land.py:57`）：check 拒绝运行器不会提交的工作包／需求路径，包括 `.env.example`；构建提示包含可选工作包 focus。land 默认从协调器输出分支读取合并记录，`--record FILE` 可覆盖。

代码已查阅（read in code：`scripts/deploy-gate.sh:84`、`briefs/build/implement.md:19`、`box/box-setup.sh:191`）：工作进程仅运行受影响测试，每两个 CPU 同时运行一个测试文件，至少一个；完整仓库测试交由集成。部署门禁采用相同默认值，遵守 `GATE_CONCURRENCY`，并包含工具包 unittest。安装会补全部分克隆；恢复钩子不依赖登录环境，在 30 秒与 60 秒记录检查结果。尚未验证（not verified）：真实重启或电脑断连恢复。

### P0 第 2 轮：校验与完成

代码已查阅（read in code：`bin/fleet_check.py:20`、`bin/fleet_land.py:300`）：需求路径保留原有下划线，例如 `_data/settings.json`；带行号范围的排除路径（例如 `docs/service.key:12-18`）仍会被拒绝。远端分支存在时，合入以刚获取的远端分支为准，不受过期本地分支影响。

代码已查阅（read in code：`box/box-setup.sh:191`、`fleet/records.py:173`）：补全部分克隆时包含保留标签的历史。已完成且设置 `control: close` 的运行会跳过日常发布间隔，及时发布最终状态页；运行中任务、发布所有权、重试与最终发布校验仍然生效。

### P0 最后修复：Shell 路径与可移植测试

代码已查阅（read in code：`bin/fleet_check.py:23,105,146`）：check 拒绝工作包或需求中的 `curl -odata/settings.json`、Bash `$'data/settings.json'` 引号及 `/usr/bin/curl --output=data/settings.json`。含空格的文件名应整体加引号；`_data/settings.json` 与 `fixture.env.example` 仍可使用。代码已查阅（read in code：`tests/test_box_scripts.py:52,193`、`tests/test_p0_box_restart.py:340`）：测试使用临时主目录与替身，无需 Codex 或 Claude；真实 tmux 使用独立套接字，缺少工具时明确跳过；测试不访问调用者的 systemd 用户管理器。尚未验证（not verified）：独立测试实例的完整合并门禁或真实重启。命令与证据：`docs/platform/devbox-fleet-build/p0.md`。

### P0 后续第 1 轮：路径写法与恢复检查

代码已查阅（read in code：`bin/fleet_check.py:20`、`box/box-setup.sh:79`）：check 拒绝引号、命令及选项赋值中的排除路径，包括 `--output=data/settings.json`、`--config=.env.example`、`--identity=id_ed25519`，也检查空格分隔的参数与行号范围；`_data/settings.json` 仍可使用。恢复检查使用带结尾冒号的精确 tmux 窗格目标，在 30 秒与 60 秒记录存活状态。尚未验证（not verified）：真实重启验收。仓库交接记录 `docs/platform/devbox-fleet-build/p0.md` 包含本地真实 tmux 测试和监督者提供的九文件离线历史验证证据。

### P0-r4：字面路径与静态检查边界

代码已查阅（read in code：`bin/fleet_check.py:36`、`bin/fleet_check.py:85`）：check 先去除 Bash 字面引号；ANSI-C 八进制按模 256（modulo 256）回绕，因此 `$'\544ata/settings.json'` 表示 `data/settings.json`，也解码十六进制、Unicode 与控制转义。代码已查阅（read in code：`bin/fleet_check.py:172`、`bin/fleet_check.py:230`、`bin/fleet_check.py:293`）：检查整个词、每个 `=` 或 `:` 后的值，以及单个 `-` 开头词首字符后的每个后缀；适用于任意程序，包括 `/usr/bin/curl` 这样的完整可执行文件路径，不使用 curl 选项白名单。`-sSRodata/settings.json`、`-4odata/settings.json` 与 `-#odata/settings.json` 均被拒绝。保守拒绝也可能命中 `-o_data/settings.json`；裸路径 `_data/settings.json` 与 `--output=_data/settings.json` 仍可使用。含空格文件名须整体加引号，例如 `"data backup/settings.json"`，使其保持为一个词。

代码已查阅（read in code：`bin/fleet_check.py:187`、`bin/fleet_check.py:220`）：包路径、行内代码、结构化要求和正文共用一个 shell 命令参数解析器。它递归检查 `/bin/bash -c ':>data/settings.json'`，不要求脚本包含空白，也支持 `-ce`、`-ec` 和 `+ce`。脚本前的其他选项、带名称参数的 `-o`/`-O`、`--` 和重定向均不会隐藏字面路径。普通带引号的参数仍作为完整词处理。命令选项识别保持保守且不使用可执行文件白名单；检查器绝不执行计划文本。

代码已查阅（read in code：`bin/fleet_check.py:85`、`fleet/records.py:224`、`fleet/records.py:340`）：仅在运行时由变量（variable）、通配符（glob）、大括号展开（brace expansion）、命令替换（command substitution）或切换目录（`cd`）构造的路径超出静态检查范围。提交时取消暂存的防线仍然生效，并在 `unstaged_secrets` 中列出省略的路径。

代码已查阅（read in code：`test/devbox-fleet-p0-toolkit.test.js:11`、`test/devbox-fleet-p0-toolkit.test.js:17`、`test/devbox-fleet-p0-toolkit.test.js:24`, `test/devbox-fleet-p0-toolkit.test.js:20`, `test/devbox-fleet-p0-toolkit.test.js:27`）：工具包桥接仅运行快速测试集（quick set），Python 与 Node 测试均限时 300 s，保留耗时报告与工具包原始失败输出。**尚未验证（not verified）：**真实完整合并门禁。已提供的计时与限时规则见 `docs/platform/devbox-fleet-build/p0.md`。

### P0-r5：递归字面检查取代脚本选择

代码已查阅（read in code：`bin/fleet_check.py:123`）：字面词解码器先连接未加引号的反斜杠加换行（backslash-newline），再识别 ANSI-C 或美元双引号，包括 `$` 与其引号之间的续行。解码器去除字面引号，按模 256（modulo 256）解码 ANSI-C 八进制，以及十六进制、Unicode 与控制转义，且不执行计划文本；本地化翻译属于运行时操作。

代码已查阅（read in code：`bin/fleet_check.py:255`）：每个解码后的词都会再次作为 shell 文本检查，递归深度上限为 16；重复文本在不动点处去重。本节取代先前的脚本选择器与带引号说明文字策略：不按程序、选项、参数位置或重定向选择要再次解析的词。因此 `/bin/bash -c - ':>data/settings.json'`、`-ce`、`+`、`--` 与 `{fd}` 重定向均不能隐藏字面脚本。保守递归也可能拒绝普通带引号说明文字 `'notes data/settings.json'`；仅加引号不能使说明文字或含空格文件名免于再次解析。安全根目录下的含空格路径 `'_data/settings with spaces.json'` 仍可使用。

代码已查阅（read in code：`bin/fleet_check.py:22`、`bin/fleet_check.py:255`）：不能确定解码的文本，包括达到深度上限后剩余的文本，在去除引号、反斜杠、美元符号和反引号后若暴露排除路径候选，则保守拒绝（fails closed）。字面下划线保持不变。工作包路径、行内代码、结构化要求和正文使用相同遍历（`bin/fleet_check.py:277`）。

代码已查阅（read in code：`fleet/engine.py:64`、`fleet/records.py:15`、`fleet/records.py:224`、`fleet/records.py:368`）：引擎的 `SECRET_PATHS` 排除规则与提交时取消暂存的防线仍为准；被省略的文件在 `unstaged_secrets` 中列出。仅在运行时通过变量（variable）、通配符（glob）、大括号展开（brace expansion）、命令替换（command substitution）或切换目录（`cd`）构造的路径超出静态检查范围（`bin/fleet_check.py:123`）。尚未验证（not verified）：任意运行时路径构造或真实外部服务／重启行为。

代码已查阅（read in code：`bin/fleet_check.py:221`、`bin/fleet_check.py:277`）：只有明确以 `Read` 开头、内容为完整原始正文超链接列表的句子（末尾可加 `for background`）才豁免；Markdown 标签仍会检查。其他形似 URL 的文本全部检查，包括重定向参数，例如 `:>"scheme://fixture.invalid/../../data/settings.json"`、引号片段、嵌套脚本、含 shell 运算符的链接，以及未标记的位置参数命令，例如 `touch URL` 或 `Run touch URL`。不猜测程序或命令引导词来选择参数。代码已查阅（read in code：`bin/fleet_check.py:47`）：ANSI-C 原始 SOH/DEL 字节在控制转义展开过程中保留 Bash 解析器标记。尚未验证（not verified）：已测试的 5.2.21 以外的 Bash 版本。

- **Pause／resume：**推送共享计划控制。已启动的子进程可能继续执行；恢复前，暂停的轮询不会收集已完成结果。
- **Stop：**暂停本次运行的处理轮询，不关闭实例，也不终止已启动代理。
- **Rerun：**指定精确任务 ID，使截止时间之前完成的匹配记录失效。同时列出依赖这些结果、也需重新生成的已完成后续任务。
- **Reassign：**指定 `TASK=BOX`，保持作者／检查者及依赖边独立。旧子进程可能仍在运行，重复工作前先检查。

控制操作修改并推送远程计划。使用最新计划快照；竞争编辑会被拒绝，不会强制推送。协调实例可以将无心跳实例尚未开始的任务迁往健康容量，并保留独立性。检查调整后的分配与记录。

## 8. 审查精确提交并合入

阅读记录中集成与合并提交的独立评审、未解决问题和测试证据。验证精确分支顶端与已完成合并记录，不能用仅包含已接受提交的后续分支代替。

`land` 检查选定父提交、祖先关系、自动合并树、新增冲突标记和 `[skip ci]` 提交信息。它打印记录中的测试结果，不执行测试；并生成绑定源提交与记录哈希的证明。`--push` 仅在能够快进时合入主分支，成功后才记录已推送提交。

主分支若已前进到已核查祖先关系之外，基于当前主分支重新合并、运行相关验证，并重新独立验收。源发生变化即需要重新验收。真实主分支推送由获授权的人或监督会话批准；部署需要单独明确授权与执行。

## 9. 可交给 AI 代理的提示词

替换全部大写占位符。这些提示词说明所需决策，本身不授予远程访问、发布、合入或部署权限。

### 规划

```
使用 pitchstation-remote-work 工具包，为 OWNER/REPO 在
FULL_BASE_COMMIT 规划多实例构建。比较单个开发实例与多实例的适用性。
定义工作包路径、具体验收、依赖关系，以及包含依赖边的独立
AUTHOR／CHECKER 分配。创建并检查本地计划与渲染后的提示词。
报告准备条件缺口及每个未验证步骤。已有授权未覆盖时，在外部操作前停止。
```

### 启动

```
使用已批准的实例设置与代理执行权限，启动 PLAN_PATH 中的已审查计划。
确认已有授权仅覆盖 NAMESPACE 内的提交和推送。分别确认状态／报告
发布及负责人提醒的发布权限；按用途选择 @owner/your-team 或 owner。
未获发布授权时，删除 share 块并关闭 alerts。
使用 ubuntu@AUTHOR_HOST 与 ubuntu@CHECKER_HOST 作为已批准的 SSH 路径。
检查各实例的完整模块、浏览器、字体源、系统工具、登录及 GitHub 访问。
不要合入主分支或部署。
```

### 观察并交接

```
通过 Git 记录与已批准的状态页观察 NAMESPACE。区分通过、失败、
跳过与不可用，核查精确提交和模型证据。只使用已有授权覆盖的计划控制；
超出授权的更改需获得决策。重跑或重新分配前，检查旧进程。
生成绑定源提交的交接记录，包含证据、未完成项、发布结果、所需权限
和下一步。承诺关闭笔记本后持续运行前，核实真实断线／重启证据。
```

### 合入

```
为 OWNER/REPO 审查 MERGE_RECORD 与 MERGE_BRANCH。
核查精确父提交、独立验收及测试结果，并执行合入验证。
准备可供批准的具体结果。只有已有授权明确覆盖该已核查源的合入时，
才推送主分支。源或主分支发生变化时重新验证。
部署是单独权限和操作，没有该授权不得部署。
```

## 10. 恢复与人工决策

先阅读状态与保留记录。分别诊断磁盘、内存／负载、运行会话、凭证、过期状态与发布。存活 PID、tmux 会话或配置文件本身不能证明验收通过或脱离笔记本后仍可运行。

Doctor 会忽略非任务 JSON 元数据，包括列表形式的 `state/preflight.json`，同时保留任务状态诊断。本版本未验证（Not verified in this release）：真实远程诊断与离线前检查。具备读取授权后可使用：

```
tools/devbox-fleet/bin/fleet doctor --departure --plan "$RUN/cr/plan.json" --repo "$REPO_DIR" \
  --host AUTHOR=ubuntu@AUTHOR_HOST --host CHECKER=ubuntu@CHECKER_HOST \
  --root /RUN_ROOT --session FLEET_SESSION
```

实例停止时，请获授权的操作人员通过开发实例生命周期工具重新启动。重复设置时复用精确运行根目录与会话。保留磁盘可保留记录和重启钩子；死亡进程按中断尝试恢复。登录失效需要操作人员认证。自动重启恢复与关闭笔记本后的持续工作，都需要真实观察且绑定源的恢复／断线证据。

保留活动锁、命名空间钩子和其他运行的文件。停止 fleet 与关闭整个实例不同；后者可能中断其他项目。缺少凭证、费用授权、未解决问题、分配冲突或无法解释的合并编辑，应交由负责的人或监督会话决策。两轮构建／评审耗尽需要新的决策，不代表验收通过。

## P2. 工具包内的监督会话

### P2-r5：间接读取与不确定结果

代码阅读（`tools/devbox-fleet/supervise/permissions.py:25`、`tools/devbox-fleet/supervise/outcomes.py:26`）：搜索与获取后的 Git 树在读取内容前，按引擎的 `SECRET_PATHS` 检查路径。HTTP 响应丢失、非零退出、信号或超时均保留 `delivery-unknown`，等待人工核对；重启、接管及 `--retry-start` 不会自动清除不确定状态。已证明发送前失败的操作仍可重试。详情见 `docs/supervising.md`。真实双机运行与外部送达仍未验证（**Not verified**）。

代码阅读（`tools/devbox-fleet/supervise/suplib.py:74`、`tools/devbox-fleet/supervise/status_report.py:1557`）：缓存输入与交接复制只接受常规文件，不跟随符号链接。含斜杠的 Grep 模式要求搜索树内所有路径均获准。`reporter.lock` 串行处理回执恢复和发送，包括 `--once`；报告进程忙碌时，待其保存回执后重试恢复。连接前的本地校验及 DNS 失败仍可重试，之前请求的不确定结果仍保留。详情见 `docs/supervising.md`。外部送达仍未验证（**Not verified**）。

### P2-r4 第 2 轮：Git 对象与中断操作

代码阅读（`tools/devbox-fleet/supervise/permissions.py:187`、`tools/devbox-fleet/supervise/notify_owner.py:112`、`tools/devbox-fleet/supervise/manage.py:356`）：Git 对象读取校验对象类型和路径。通知进程被信号终止后保留 `delivery-unknown`；重发回退或接管邮件前须先核对结果。所有者便笺中断后，以相同内容重试；`state/owner-note-pending.json` 保留同一操作标识。前一便笺仍待处理时拒绝不同内容；完成后再次提交相同文字会创建新便笺。详情见 `docs/supervising.md`。真实双机运行及邮件送达仍未验证（**Not verified**）。

### P2-r4：敏感路径与送信恢复

代码阅读（`tools/devbox-fleet/supervise/permissions.py:40`、`tools/devbox-fleet/supervise/supervise_loop.py:583`）：读取、搜索和 Git 发布使用引擎的 `SECRET_PATHS`，包括 `firebase-service-account.json`。代码包校验同时覆盖数据文件和 Python 模块。持久化的 `not-attempted` 回执让发送方在推送确认丢失且读取暂时失败后恢复同一送信声明。已开始发送但结果不确定时仍须核对。部署启动超时或首次分享创建结果不明时也须先核对再重试。详情见 `docs/supervising.md`。真实双机运行及邮件送达仍未验证（**Not verified**）。

### P2-r3 后续修复：送信声明与工作路径

代码阅读（`tools/devbox-fleet/supervise/permissions.py:374`、`tools/devbox-fleet/supervise/supervise_loop.py:583`、`tools/devbox-fleet/supervise/facts.py:121`）：即使计划路径使用符号链接，也校验解析后计划旁的可执行代码包。首次回退邮件使用不会过期的共享送信声明；送达结果不确定时须先核对再重发。工作路径默认是 `~/fleet/` 加上将斜杠替换为连字符的命名空间。配置的 `supervise.run_root` 记录已有 `fleet launch --setup --root ROOT` 的选择。恢复限制见 `docs/supervising.md`。真实双机运行及邮件送达仍未验证（**Not verified**）。

代码阅读（`tools/devbox-fleet/supervise/manage.py:465`、`tools/devbox-fleet/supervise/suplib.py:312`）：恢复使之前的心跳观察失效；接管等待恢复后的持有者发布新鲜心跳。推送结果不确定时，先核对提交再重放事件。事实文件列明部署条件及生产证据。监督会话的命令通过隔离的权限调度器执行；详见工具包 `docs/supervising.md`。

代码阅读（`scripts/install-local-skills.sh:50`）：运行 `scripts/install-local-skills.sh pitchstation-remote-work` 刷新。两种代理的技能均包含监督器及模板。已有运行继续使用其固定的工具包副本。

代码阅读（`tools/devbox-fleet/bin/fleet_supervise.py:54`）：在每台已有协调实例本地，用普通 I1 设置 JSON 字典配置本次运行；首台使用 `primary`，第二台使用 `standby`。备用监督器只有看到新的主监督器心跳才启动。单元不设置环境文件；配置保存在运行目录的 `run.json`。

```
fleet supervise install RUN --plan PLAN --settings SETTINGS_JSON --repo REPO --box BOX --role primary
fleet supervise start RUN
fleet supervise status RUN
fleet note RUN FILE
fleet rounds allow RUN 3
fleet engine set RUN codex
fleet supervise stop RUN
fleet resume RUN
```

代码阅读（`tools/devbox-fleet/supervise/facts.py:48`、`tools/devbox-fleet/supervise/timings.py:8`）：事实文件由计划、设置与版本 1 实例记录生成；每轮提示自动按时间顺序列出所有者便笺。禁止手工编辑这些生成文件。恢复要求本机持有租约且没有部署启动记录；最终状态运行须先恢复才能接收便笺。默认循环为 60 秒，空闲 12 分钟启动一轮，单轮限制 100 分钟，静默 20 分钟接管，45 分钟无进展告警。可选设置覆盖默认值；从代码生成的完整表格在工具包 `docs/supervising.md`。

代码阅读（`tools/devbox-fleet/supervise/manage.py:415`、`tools/devbox-fleet/supervise/standby_watch.py:114`）：恢复中断后，在租约持有者上重试同一命令。接管先恢复共享进度再启动一轮；心跳观察记录在监视器重启后保留。生成的事实保留摘要、重点与路径。权限配置检查准确的辅助命令参数、输出路径、暂存文件及递归搜索。

**未验证（Not verified）：**真实退出登录后的持续运行、双实例执行、已登录代理的权限拒绝、外部发布、邮件送达及部署。依赖关闭笔记本后的持续工作前，按 P2 构建说明完成所有者检查。

代码阅读（`tools/devbox-fleet/supervise/suplib.py:74`、`tools/devbox-fleet/supervise/outcomes.py:38`）：所有自动读取均通过已分类的常规文件边界。同一发送锁内将状态区分为有效、不存在（仅 ENOENT）或不可读。不可读回执保留 `delivery-unknown` 和 `*-state-uncertain.json` 标记，重启或接管后仍须人工核对。先修复原始状态并核实送达证据，再清理标记。详情见 `docs/supervising.md`。真实双机运行及外部送达仍未验证（**Not verified**）。

代码阅读（Read in code；`tools/devbox-fleet/supervise/standby_watch.py:133`、`tools/devbox-fleet/supervise/standby_watch.py:139`、`tools/devbox-fleet/supervise/suplib.py:626`）：已明确拒绝的接管会清除 `takeover-pending.json`，之后再次持续无心跳时可自动重试。如果推送确认丢失、回读失败或 Git 提交祖先关系检查失败，导致发布结果仍无法确认，则保留接管意图以供核对。

## P3. 实例记录与仓库配置

代码阅读（`tools/devbox-fleet/bin/fleet_box.py:264`、`tools/devbox-fleet/fleet/boxrecord.py:261`）：`fleet box record` 刷新可选的本机 `~/.fleet/box-record.json`。`fleet boxes` 无需 SSH 即可从平台注册表读取能力与状态。`fleet boxes --check-logins` 立即检查本机；常规登录检查缓存 24 小时。安装助手提供五分钟定时器。

代码阅读（`tools/devbox-fleet/bin/fleet_box.py:102`、`tools/devbox-fleet/fleet/alerts.py:103`、`tools/devbox-fleet/fleet/status.py:139`）：可选 `plan.box_requirements` 为运行中／已提交任务提供能力需求，由协调器告警并在原运行页面显示。本机刷新自动读取 `ROOT/cr/plan.json`；可选 `config.runs` 补充其他计划。使用 `fleet boxes --plan PLAN_JSON --html LOCAL_PAGE` 显示当前缺失，可重复 `--plan` 指定更多计划。常规清单读取会在后续渲染中保留未满足的警告，不发送告警。登录缺失在每日检查时发现，或通过本机登录检查立即发现。

代码阅读（`tools/devbox-fleet/bin/fleet_profile.py:54`）：`fleet profile check`、`fleet profile prepare`、`fleet profile brief`、`fleet profile test-job` 使用仓库的 `.fleet/profile.json`。`fleet repo setup REPO` 克隆、安装并核验可信仓库代码；执行前请审阅配置。未验证（Not verified）：六台真实实例、登录撤销、定时器／注销恢复、第二个私有仓库及生产部署。代码阅读（`tools/devbox-fleet/box/box-setup.sh:196`、`tools/devbox-fleet/briefs/build/integrate.md:17`）：安装流程在 PATH 就绪后调用可选的记录助手；集成提示在合并后的仓库存在配置时使用该配置，否则保留原隔离命令。外部部署流程接入仍未验证，参见 `docs/platform/devbox-fleet-build/p3.md`。

## P3 后续修复

### P3 第二次后续修复：可选要求与推送限制

代码阅读（`bin/fleet_box.py:224`、`fleet/alerts.py:124`、`fleet/alerts.py:375`）：能力要求省略或为空（包括空代理／类别列表，或仅针对其他实例的要求）时，不进行回执协调。注册覆盖值遵循同一规则；移除要求后，已有事件的恢复边界仅保存在本地，待要求恢复后再协调。回执推送保留仓库的 pre-push 钩子，并使用 `--no-follow-tags`。代码阅读（`bin/fleet_box.py:84`）：注册清单行使用 `lastReport.capabilities`，不受其乐观锁版本 `version` 影响。

代码阅读（`tools/devbox-fleet/fleet/alerts.py:324`、`tools/devbox-fleet/fleet/alerts.py:358`）：分布式能力告警在当前 Git 源的 `<namespace>/capability-alert-<key hash>` 分支预留回执。普通快进推送防止工作实例或协调器因旧副本而重复发布；源不可用时延后发布。运行结束清理前须保留这些分支。恢复后再次缺失会重新告警；发布失败或结果不明仍遵循六小时重试规则。

代码阅读（`tools/devbox-fleet/fleet/profile.py:307`、`tools/devbox-fleet/bin/fleet_box.py:91`）：`python3 tools/devbox-fleet/bin/fleet profile test-job --run > suite.tap 2>&1` 保留完整测试输出，不附加描述 JSON。清单拒绝其他实例别名的记录，不显示其类别，并说明别名不匹配。未验证（Not verified）：真实远端传输及所有者通知送达。

## P3 排队能力告警

代码阅读（`fleet/alerts.py:435`、`fleet/alerts.py:466`）：发送前按当前计划所需的实例、类别和代理重新检查排队中的能力告警，然后才处理回执。要求省略或为空、仅针对其他实例、代理／类别列表为空，或实例已从计划移除时，取消排队告警，不发布、不通知，也不新增源端回执。保留的待处理条目在每轮重新检查。代码阅读（`bin/fleet_box.py:254`）：本地注册覆盖值向同一检查提供实际生效的要求。未验证（Not verified）：真实登录撤销及远端告警送达。

## P3 排队能力告警的身份

代码阅读（`fleet/alerts.py:470`、`fleet/alerts.py:522`、`bin/fleet_box.py:248`）：排队告警保留原始缺失能力的 `missing` 类别／登录身份。移除缺失的类别或登录要求后，即使仍有健康能力要求，也取消该告警。若部分缺失能力仍被要求，消息只列出这些仍然需要的能力。旧格式解码器读取旧队列中精确的生成消息格式；无法识别的告警在处理回执前取消。

代码阅读（`fleet/engine.py:1066`）：P0 集成必须从待处理队列移除 `cancelled` 结果；引擎的确切改动见 `docs/platform/devbox-fleet-build/p3.md`。集成前，重新添加相同要求可能重新激活保留的事件。本包不修改引擎。未验证（Not verified）：真实登录撤销和远端通知送达。

## P3 移除要求后的新一轮能力丢失

代码阅读（`fleet/alerts.py:474`、`fleet/alerts.py:556`、`bin/fleet_box.py:279`）：移除能力要求时，在本地结束已知送达回执及重试限流，即使协调器待处理队列为空。要求缺失期间不写入源端回执。重新添加要求后，先协调保留的恢复边界，再处理新的能力丢失；旧的、同一时刻或无时间戳的观察不会抹去该边界。本地回执保留已接受的缺失能力身份，因此部分移除要求、只留下健康能力时也会结束该轮状态。被拒绝的旧观察不会改写缺失身份。独立检查也先结束上一轮状态。同一轮持续丢失仍只发出一次告警。

代码阅读（`fleet/alerts.py:33`、`fleet/boxrecord.py:32`、`fleet/health.py:112`、`bin/fleet_box.py:333`）：实例观察及告警回执保留已有微秒精度。本地要求撤销从操作时刻开始，即使缓存记录更旧。代码阅读（`fleet/alerts.py:50`）：如果操作时钟与已知送达／尝试时刻相同或更早，两种发送路径都使用该时刻后一微秒的保守本地排序标记；该标记不代表实例观察。等于保留恢复标记或过旧的观察仍被阻止，直到出现更新的观察。仍接受旧的秒精度时间戳。

代码阅读（`fleet/engine.py:1066`）：P0 仍须应用 `docs/platform/devbox-fleet-build/p3.md` 中既有的待处理条目移除语句。未验证（Not verified）：真实测试实例登录撤销、每日定时检查及远端通知送达。

## P3 告警排序与写入中断

代码阅读（`fleet/alerts.py:36`、`fleet/engine.py:999`、`bin/fleet_box.py:340`）：告警时间统一解析为 UTC 后排序，接受整秒、小数、Z 和 +00:00；缺失或无效时间排在最早。延迟到达的健康观察只有在同一本地锁内确认其晚于所有已保存的状态边界后，才会结束送达回执。恢复标记在重启后保留。代码阅读（`fleet/engine.py:1025`、`fleet/engine.py:1097`）：日志先保存协调器快照，本地或输出副本写入中断后仍可读取。所需的待处理条目移除条件现已包含在 P3 中，会移除 sent、resolved 和 cancelled 事件。此说明取代旧文档中留待 P0 集成的要求。未验证（Not verified）：真实测试实例登录撤销、每日定时检查及远端所有者通知送达。

## M1. 已集成工具包

代码阅读（Read in code；`supervise/facts.py:16`、`fleet/boxrecord.py:64`、`box/box-setup.sh:196`、`briefs/build/integrate.md:17`）：监督事实使用同一个有大小限制的实例记录读取器；安装在 PATH 就绪后调用可选记录助手；构建集成读取合并后仓库配置，并保留无配置时的旧流程。

代码阅读（Read in code；`test/devbox-fleet-p0-toolkit.test.js:1`、`tools/devbox-fleet/test-plan.json:1`）：部署检查仅运行快速测试集（quick set），Python 与 Node 均限时 300 s。合并前单独运行完整工具包测试；两种模式都输出数量及耗时。

```
python3 tools/devbox-fleet/run_tests.py quick
python3 tools/devbox-fleet/run_tests.py full
```

未验证（Not verified）：真实双机接管、重启／注销后的持续运行、定时登录缺失检查、外部送达、六机清单、第二个私有仓库及外部部署配置接入。各包说明保留所有者验收命令。

## P1. 用一份请求启动运行

代码阅读（`tools/devbox-fleet/bin/fleet_submit.py:584`、`tools/devbox-fleet/box/box-setup.sh:303`）：提交要求有效的第一版 `.fleet/profile.json`、配置选定的锁文件、`package.json` 和 `pnpm-lock.yaml`。运行器首次安装在自身的 `deps` 目录中，使用固定基准提交的清单及 pnpm 锁文件，执行固定命令 `COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack pnpm@10.10.0 install --frozen-lockfile`。仅当现有依赖的清单与该基准一致时才复用。缺少配置时拒绝提交，不会安装运行器。代码阅读（`tools/devbox-fleet/bin/fleet_profile.py:23`、`tools/devbox-fleet/fleet/profile.py:204`）：单独运行 `fleet profile prepare` 或 `fleet repo setup REPOSITORY` 所做的仓库准备使用配置中的 `install.command`、准备设置及核验命令；这些设置不替代运行器的固定安装命令。

代码阅读（`tools/devbox-fleet/fleet/submission_services.py:155`、`tools/devbox-fleet/supervise/manage.py:174`）：工具包文件必须与请求的确切提交一致。目标仓库中解析后的 `base` 提交必须包含 `tools/devbox-fleet/`，且该目录中的工具包文件必须完全一致。仅由该工具包的 `manage.generated_units` 生成安装的单元。请求、设置和环境均不能提供单元文本或单元命令；创建运行产物前指出被拒绝的键。预览和实际提交都会在创建提交检查点、发布分支或安装服务前，按生成的确切命令添加 `--self-check` 启动每个服务一次；仅使用单元的 `Environment` 值（等同于 `env -i`）、临时工作目录和 30 秒限制。真实启动代码加载工具包模块、读取设置并按单元的 `PATH` 解析外部程序，在写入状态或使用网络之前停止。输出一行 JSON，包含 `"ok": true`、程序、已加载模块及已解析程序。非零退出、超时或无效 JSON 均拒绝提交，并指出单元与原因。

代码阅读（`tools/devbox-fleet/supervise/template_validation.py:10`）：每轮提示词模板接受的名称取自实际 `render_prompt` 调用。渲染器填充的名称会被接受；未填充的名称在创建运行产物前被拒绝。

代码阅读（`tools/devbox-fleet/bin/fleet_submit.py:633`）：预览和实际提交共用确定性检查，在创建提交检查点、保存的工具包快照或运行分支之前完成。共同检查验证工作包提示词、每轮提示词、权限配置、运行器设置所读取的固定基准提交文件、本地 Git 作者和提交者身份、运行器设置要求的远端引用以及正整数设置超时，并确认默认传输所需的本地 SSH 可用。

代码阅读（`tools/devbox-fleet/bin/fleet_submit.py:453`、`tools/devbox-fleet/supervise/manage.py:206`）：默认运行器根目录为 `~/fleet/` 加命名空间，并将其中的 `/` 替换为 `-`。显式 `supervise.run_root` 优先。保留未展开的 `~/`，直到命令到达实例。

代码阅读（`tools/devbox-fleet/bin/fleet_submit.py:633`、`tools/devbox-fleet/supervise/suplib.py:140`）：预览会演练打包、已有工作包提示词、常驻说明、事实文件和单元模板，之后才创建提交状态或保存冻结工具包。预览会使用临时工具包副本，并通过 Git 获取本地对象；不会发布运行分支或安装服务。待规划的工作包由协调器写出后再检查。Git 同步后，在读取、复制或发布备注前，拒绝交接路径及其祖先中的符号链接。

代码阅读（`tools/devbox-fleet/fleet/request.py:186`）：`fleet submit` 仅接受 `"recipe": "build"`；`code-review` 和 `merge-main` 请使用原有计划命令。

代码阅读（`tools/devbox-fleet/fleet/request.py:59`、`tools/devbox-fleet/supervise/manage.py:206`）：各角色保留自己的模型与推理强度。`models.builder` 和 `models.reviewer` 选择工作代理；`models.supervisor` 和 `models.fallback` 选择主监督链。可选的 `models.standby` 和 `models.standby_fallback` 选择接管链。两个备用键均省略时沿用原有共享链；仅设置 `models.standby` 时重试该模型。监督模型前缀选择 Codex 或 Claude。

代码阅读（`tools/devbox-fleet/fleet/request.py:26`、`tools/devbox-fleet/bin/fleet_submit.py:219`、`tools/devbox-fleet/bin/fleet_submit.py:232`）：提交拒绝请求、工具包和运行产物中的符号链接，包括内部链接。预览为混合的 auto／指定协调器设置找到有效配对，并拒绝保留协调分支（`plan`、`out-*`、`fix-*`、`fixes*`、`main-merge`）及其子路径。重试在任何设置步骤前拒绝已改变的 SSH 别名、仓库路径、运行器根目录或本地仓库目标。

代码阅读（`tools/devbox-fleet/fleet/request.py:384`、`tools/devbox-fleet/templates/request.md:3`）：用一份 Markdown 请求描述目标、交付物、完成检查和不在范围内的内容。唯一的 JSON 围栏代码块包含所有运行设置；未知或缺失键会报出键名和行号。版本管理的固定简报提供报告、监督、合并、部署及结束规则。

```
fleet submit REQUEST --repo REPO --inventory INVENTORY_JSON --dry-run
fleet submit REQUEST --repo REPO --inventory INVENTORY_JSON
fleet steer resume --plan PLAN_JSON --repo REPO
```

代码阅读（`tools/devbox-fleet/bin/fleet_submit.py:741`）：在所有者的笔记本上提交，使用已有实例的私有清单。先检查预览中的远端提交、工作包或“待规划”、实例角色、模型、可用估时和所有者待办。`--dry-run` 到此结束。`--state-root PATH` 指定保留提交状态的目录；中断后重新提交同一请求。命令启动本次运行的监督器、运行器和报告，再做离线前检查。最终输出会说“you can close the laptop now”，或列出缺少的项目。运行日期采用 UTC；报告时间采用请求指定的时区。

代码阅读（`tools/devbox-fleet/briefs/plan.md:7`、`tools/devbox-fleet/fleet/request.py:175`）：`"packages": "plan"` 要求协调器先编写、检查并发布计划。每个工作包（包括后续新增包）均须有一句、最多 140 字符的 `summary`。提交的计划缺失摘要会失败；旧计划仅警告。`"start": "after-review"` 会暂停任务，等待所有者放行。运行上面的 resume 命令前，先获取已发布的计划分支，将当前 `cr/plan.json` 保存为 `PLAN_JSON`，并审阅该版本。

**未验证（Not verified）：**所有者笔记本上的三次真实演练提交、双实例执行、外部发布和真实离线。替身测试只验证代码路径；依赖持续运行前，按 P1 构建说明完成所有者检查。

代码阅读（`tools/devbox-fleet/fleet/submission_services.py:66`）：已安装工具包的受维护组件必须与解析后的 `base` 提交所规定的投影完全一致。提交冻结仓库中完整的 `tools/devbox-fleet/` 目录树；操作人员技能根目录中的文件不会提供冻结工具包的内容。

来源：仓库工具包及命令行参数解析器。本地教程证据与契约说明保存在一起。真实部署与发布是单独的发布步骤。

## P17. 由协调器指挥的测试池

所有者预留 T4/T8 并明确每月运行小时预算，在笔记本清单中设置 `account_cpu_limit`，更新技能，再分别执行 `fleet testbox grant COORDINATOR TESTBOX --ledger PRIVATE_LEDGER`。`--dry-run` 列出四步及各自撤销方式；`revoke` 只移除该配对。防火墙操作通过现有受限配置的供应脚本。

测试实例不持有 AI 登录、仓库密钥、生产密钥或令牌。强制 SSH 分派器只接受测试操作和测试仓库推送。`box/test-box-setup.sh --check` 只列出观察结果。任务脱离连接运行，按实例锁排队并使用仓库配置。连接丢失后自动在协调器重试一次，页面显示回退位置。测试实例在最后一次任务和保活均经过 60 分钟后自行停止；代理实例保持运行。部署任务仍在协调器执行自己的检查。

若 CPU 设置或可用容量不允许启动，发布的计划会将全部测试任务留在协调器。任务沿用安装时保存的资源路径。工作进程结束后，只要测试子进程仍存活，下一任务和空闲关机均继续等待。授权凭据以原子方式保存，中断后仍可恢复撤销。

**本轮未验证：**真实供应、就绪耗时、防火墙隔离、远端独立运行、空闲停止／重启及实例丢失。执行器和记录归 P6 所有；合并接口和所有者验证命令见 `docs/platform/devbox-fleet-build/p17.md`。
