agent-bios 0.20.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/DEPENDENCIES.md +3 -2
  2. package/README.md +25 -9
  3. package/claude/guides/cli-multi-model-workflow.md +6 -6
  4. package/claude/guides/gpt-prompting.md +151 -75
  5. package/codex/agents/frontier.toml +1 -1
  6. package/codex/agents/reviewer.toml +1 -1
  7. package/codex/agents/workhorse.toml +1 -1
  8. package/codex/guides/cli-multi-model-workflow.md +6 -6
  9. package/codex/guides/gpt-prompting.md +151 -75
  10. package/compose/app_bridge/scripts/bridge.py +8 -0
  11. package/compose/instructions_app.py +20 -2
  12. package/compose/instructions_install.py +34 -8
  13. package/compose/instructions_setup.py +4 -1
  14. package/docs/advanced-launch.md +1 -1
  15. package/docs/macos-linux.md +92 -0
  16. package/docs/recovery.md +1 -1
  17. package/docs/releases/0.20.1.md +76 -0
  18. package/docs/releases/0.21.0.md +101 -0
  19. package/docs/setup.md +7 -3
  20. package/docs/windows.md +23 -14
  21. package/install.sh +72 -41
  22. package/launch/agent-launch.toml +11 -9
  23. package/launch/provision-venv.sh +3 -2
  24. package/package.json +3 -2
  25. package/provenance.json +1 -1
  26. package/session-distill/distill.py +22 -2
  27. package/session-distill/runlib/declare.py +70 -3
  28. package/session-distill/runlib/dispatch.py +26 -20
  29. package/session-distill/runlib/gate.py +149 -11
  30. package/session-distill/runlib/packet.py +3 -2
  31. package/session-distill/runlib/stage_form.py +1 -1
  32. package/session-distill/runlib/stage_judge.py +8 -4
  33. package/session-distill/runlib/views.py +1 -1
  34. package/session-distill/schemas/run.schema.json +10 -1
  35. package/session-distill/seats.json +35 -60
  36. package/wrappers/claude-run.sh +10 -7
  37. package/wrappers/codex-helm.sh +8 -8
  38. package/wrappers/codex-run.sh +9 -6
@@ -141,23 +141,25 @@ severity_map = { blocker = "blocker", high = "high", medium = "medium", low = "l
141
141
  # The model family this host speaks for. A review binding names a provider, and
142
142
  # the reverse map must be unique so it resolves to exactly one validatable seat.
143
143
  provider = "openai"
144
- models = ["gpt-6-astra", "gpt-6.1-sol", "gpt-6-luna"]
144
+ models = ["gpt-6.2-astra", "gpt-6.2-sol", "gpt-6-luna"]
145
145
 
146
146
  [hosts.codex.tiers.frontier]
147
- model = "gpt-6-astra"
147
+ model = "gpt-6.2-astra"
148
148
  effort = "max"
149
149
 
150
150
  [hosts.codex.tiers.helm]
151
- model = "gpt-6.1-sol"
151
+ model = "gpt-6.2-sol"
152
152
  effort = "xhigh"
153
153
 
154
154
  # Same model as HELM, one effort step down. The catalogue retired `terra` without a
155
155
  # same-role successor, so the tiers can no longer be three distinct models; effort is
156
156
  # what separates this seat from HELM, and a seat sharing HELM's model buys no
157
157
  # cross-model perspective — a review dispatched here is a lower-effort echo, not a
158
- # second reader.
158
+ # second reader. `gpt-6.1-terra` returned on 2026-11-24, described as an efficient model
159
+ # for visual understanding and computer use rather than for this seat's coding work, and
160
+ # the owner kept the shared model (D-20261124-20922b).
159
161
  [hosts.codex.tiers.workhorse]
160
- model = "gpt-6.1-sol"
162
+ model = "gpt-6.2-sol"
161
163
  effort = "high"
162
164
 
163
165
  [hosts.codex.tiers.sweep]
@@ -193,8 +195,8 @@ sweep = "${CODEX_HOME}/agents/sweep.toml"
193
195
  "claude-opus-5-5" = { display = "Claude Opus 5.5" }
194
196
  "claude-sonnet-5-5" = { display = "Claude Sonnet 5.5" }
195
197
  "claude-haiku-5-5" = { display = "Claude Haiku 5.5" }
196
- "gpt-6-astra" = { display = "GPT-6 Astra" }
197
- "gpt-6.1-sol" = { display = "GPT-6.1 Sol" }
198
+ "gpt-6.2-astra" = { display = "GPT-6.2 Astra" }
199
+ "gpt-6.2-sol" = { display = "GPT-6.2 Sol" }
198
200
  "gpt-6-luna" = { display = "GPT-6 Luna" }
199
201
 
200
202
  [hosts.claude]
@@ -315,7 +317,7 @@ tier = "frontier"
315
317
 
316
318
  [presets.deep-review.review.hosts.claude.methods."codex-exec"]
317
319
  provider = "openai"
318
- model = "gpt-6.1-sol"
320
+ model = "gpt-6.2-sol"
319
321
  effort = "ultra"
320
322
 
321
323
  [presets.deep-review.review.hosts.codex.base]
@@ -340,7 +342,7 @@ tier = "frontier"
340
342
 
341
343
  [presets.session-distill.review.hosts.claude.methods."codex-exec"]
342
344
  provider = "openai"
343
- model = "gpt-6.1-sol"
345
+ model = "gpt-6.2-sol"
344
346
  effort = "ultra"
345
347
 
346
348
  [presets.session-distill.review.hosts.codex.base]
@@ -4,13 +4,14 @@
4
4
  # the JSON Schema validator used by learn. Existing other packages are preserved.
5
5
  #
6
6
  # AGENT_LAUNCH_VENV override the venv location (default below)
7
- # AGENT_LAUNCH_PYTHON python used to create the venv (default: python3)
7
+ # AGENT_LAUNCH_PYTHON python used to create the venv (default: the installation's
8
+ # bound AGENT_BIOS_PYTHON, else python3)
8
9
  set -eu
9
10
 
10
11
  TEXTUAL_PIN="textual==8.2.8"
11
12
  JSONSCHEMA_PIN="jsonschema==4.26.0"
12
13
  VENV="${AGENT_LAUNCH_VENV:-$HOME/.local/share/agent-launch/venv}"
13
- PYTHON="${AGENT_LAUNCH_PYTHON:-python3}"
14
+ PYTHON="${AGENT_LAUNCH_PYTHON:-${AGENT_BIOS_PYTHON:-python3}}"
14
15
  PACKAGES=("$TEXTUAL_PIN")
15
16
  case "${1:-}" in
16
17
  "") [ "$#" -eq 0 ] || { printf 'usage: provision-venv.sh [--learning-only]\n' >&2; exit 2; } ;;
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "agent-bios",
3
- "version": "0.20.0",
4
- "releaseDate": "2026-11-17",
3
+ "version": "0.21.0",
4
+ "releaseDate": "2026-11-29",
5
5
  "description": "A thin, low-level instruction layer for LLM CLI agents: one set of principles and behavior whichever model you run. Stores private, editable instructions for explicitly activated sessions.",
6
6
  "bin": {
7
7
  "agent-bios": "install.sh"
8
8
  },
9
+ "agentBiosStandalone": 1,
9
10
  "files": [
10
11
  "claude/CLAUDE.md",
11
12
  "claude/settings.template.json",
package/provenance.json CHANGED
@@ -1 +1 @@
1
- {"commit":"9cfe7f54af3e841e9739e30072c16c98a76b187d","committedAt":"2026-11-17T13:30:35+09:00","dirty":false}
1
+ {"commit":"628c445da7f28009051f3943e408f0bd63fb8813","committedAt":"2026-11-29T17:48:04+09:00","dirty":false}
@@ -354,8 +354,11 @@ def cmd_declare(args):
354
354
  split_csv(args.invalidates))
355
355
  say(f"amended {run_dir}: declaration_seq {amendment['seq']}, invalidates {amendment['invalidates']}")
356
356
  elif args.from_file:
357
- run = declare.create(run_dir, json.loads(pathlib.Path(args.from_file).read_text(encoding="utf-8")))
358
- say(f"declared {run_dir}: declaration_seq {run['declaration_seq']}")
357
+ # the seats the declaration leaves out come from seats.json's launch-profile tiers, recorded as resolved
358
+ run = declare.create(run_dir, declare.fill_seats(json.loads(pathlib.Path(args.from_file).read_text(encoding="utf-8"))))
359
+ filled = ", ".join(key + "=" + run["seats"][key] for key in (run.get("seat_resolution") or {}).get("filled") or {})
360
+ say(f"declared {run_dir}: declaration_seq {run['declaration_seq']}"
361
+ + (f", seats filled from launch-profile tiers: {filled}" if filled else ""))
359
362
  elif args.set:
360
363
  declare.set_fields(run_dir, assignments_of(args))
361
364
  say(f"set {len(args.set)} field(s) in {run_dir}/run.json")
@@ -1012,6 +1015,23 @@ def self_test():
1012
1015
  code, err = cli("declare", "--run-id", "r1", "--from", str(out / "declaration.json"))
1013
1016
  control("declare writes run.json at declaration_seq 0",
1014
1017
  code == 0 and records.read_json(records.run_json_path(run_dir))["declaration_seq"] == 0, err)
1018
+ # the seats the declaration leaves out are filled from seats.json's launch-profile tiers and recorded; the
1019
+ # ones it names are kept as written (owner, 2026-11-29)
1020
+ from runlib import gate as seat_gate
1021
+ r1_run, fx_seats = records.read_json(records.run_json_path(run_dir)), declare.fixture()["seats"]
1022
+ left_out = {key: seat for key, seat in seat_gate.seat_defaults().items() if key not in fx_seats}
1023
+ control("declare fills the seats a declaration leaves out from the launch-profile tiers",
1024
+ bool(left_out) and all(r1_run["seats"].get(key) == seat for key, seat in left_out.items())
1025
+ and all(r1_run["seats"].get(key) == seat for key, seat in fx_seats.items())
1026
+ and r1_run.get("seat_resolution") == {
1027
+ "profile": "launch/agent-launch.toml", "profile_sha256": seat_gate.launch_profile_sha256(),
1028
+ "filled": {key: seat_gate.seat_default_tiers()[key] for key in left_out}}, f"{err} {r1_run.get('seat_resolution')}")
1029
+ (out / "forged.json").write_text(json.dumps({**declare.fixture(), "seat_resolution": {
1030
+ "profile": "launch/agent-launch.toml", "profile_sha256": "0" * 64, "filled": {"S3": "claude:helm"}}}), encoding="utf-8")
1031
+ code, err = cli("declare", "--run-id", "r-forged", "--from", str(out / "forged.json"))
1032
+ control("declare refuses a declaration that carries its own seat resolution",
1033
+ code == 1 and "DECLARATION_INVALID seat_resolution" in err
1034
+ and not records.run_json_path(out / "r-forged").exists(), err)
1015
1035
  bad = {**declare.fixture(), "seats": {**declare.fixture()["seats"], "S4": "claude:claude-opus-9-9/high"}}
1016
1036
  (out / "bad.json").write_text(json.dumps(bad), encoding="utf-8")
1017
1037
  code, err = cli("declare", "--run-id", "r2", "--from", str(out / "bad.json"))
@@ -35,6 +35,14 @@ optional field, is an earlier run's measured table of what a token covers per se
35
35
  it only where its own run has measured nothing of that seat and kind (`dispatch.measured_density`).
36
36
  Nothing copies it forward; whoever declares the run writes it.
37
37
 
38
+ `fill_seats` is what `distill.py declare --from` does before `create`: every seat key seats.json
39
+ seats through a launch-profile tier and the declaration leaves out takes that tier's model and
40
+ effort from the checkout's `launch/agent-launch.toml`, and `seat_resolution` records which keys
41
+ were filled from which tier and the sha256 of the profile they were resolved against, so the run
42
+ holds concrete seats and says where they came from (owner, 2026-11-29). A seat the declaration
43
+ names is kept as written. `create` itself fills nothing, so a run.json that seats no stage key is
44
+ still refused by that stage by name.
45
+
38
46
  declare.py --self-test
39
47
  """
40
48
  import ast
@@ -159,6 +167,8 @@ def semantic_errors(run):
159
167
  if view_seat not in run["host_allowance"]:
160
168
  errors.append(f"ALLOWANCE_UNDECLARED seats.{VIEW_WINDOW_STAGE}: {view_seat} reads view windows and "
161
169
  f"has no host_allowance entry")
170
+ errors.extend(f"DECLARATION_INVALID seat_resolution.filled.{key}: not a seat this declaration names"
171
+ for key in ((run.get("seat_resolution") or {}).get("filled") or {}) if key not in run["seats"])
162
172
  return errors + density_errors(run) + retry_errors(run) + scope_errors(run)
163
173
 
164
174
 
@@ -334,6 +344,28 @@ def _validated(run, repo):
334
344
  raise Refused("\n".join(errors))
335
345
 
336
346
 
347
+ def fill_seats(run, seats_doc=None, profile=None):
348
+ """`run` with every seat key seats.json seats through a launch-profile tier, and the declaration leaves out, taken
349
+ from that tier (`gate.seat_defaults`), and `seat_resolution` recording the keys filled, the tier each came from and
350
+ the sha256 of the launch profile resolved against. A seat the declaration names is kept. Nothing is added when the
351
+ declaration names every key. `seat_resolution` is written here, never declared: a declaration carrying one is
352
+ refused, since it would state a resolution nothing made."""
353
+ if "seat_resolution" in run:
354
+ raise Refused("DECLARATION_INVALID seat_resolution: written by declare when it fills a seat, never declared")
355
+ profile = gate.LAUNCH_PROFILE if profile is None else pathlib.Path(profile)
356
+ tiers = gate.launch_tiers(profile)
357
+ defaults = gate.seat_defaults(seats_doc, tiers)
358
+ named = dict(run.get("seats") or {})
359
+ filled = {key: seat for key, seat in defaults.items() if key not in named}
360
+ if not filled:
361
+ return run
362
+ refs = gate.seat_default_tiers(seats_doc)
363
+ return {**run, "seats": {**named, **filled},
364
+ "seat_resolution": {"profile": str(profile.relative_to(REPO)) if profile.is_relative_to(REPO) else str(profile),
365
+ "profile_sha256": gate.launch_profile_sha256(profile),
366
+ "filled": {key: refs[key] for key in filled}}}
367
+
368
+
337
369
  def create(run_dir, run, repo=REPO):
338
370
  """Write `run.json` for a new run at declaration_seq 0 and bind its sha256 to seq 0 in the
339
371
  declaration log; a declaration is never replaced."""
@@ -412,7 +444,7 @@ def fixture():
412
444
  digest = lambda name: records.sha256_bytes(name.encode()) # noqa: E731
413
445
  pinned = gate.seats()
414
446
  claude = pinned["hosts"]["claude"]["version"]
415
- sonnet, opus = pinned["stage_seats"][VIEW_WINDOW_STAGE][0], "claude:claude-opus-5-5/high"
447
+ sonnet, opus = gate.stage_seats()[VIEW_WINDOW_STAGE][0], "claude:claude-opus-5-5/high"
416
448
  astra = "codex:gpt-6-astra/xhigh"
417
449
  return {
418
450
  "question": "Which repeated work patterns deserve a place in the library?",
@@ -499,6 +531,41 @@ def self_test():
499
531
  return [f"RAISED {exc!r}"]
500
532
  return []
501
533
 
534
+ # S0 fills the seats a declaration leaves out from seats.json's launch-profile tiers (owner, 2026-11-29). The
535
+ # profile here is a planted copy whose tiers bind models of its own, so the controls test the fill rather than
536
+ # whichever models the real profile binds today, and keep testing when it moves.
537
+ with tempfile.TemporaryDirectory(prefix="declare-tiers-") as tmp:
538
+ planted_profile = pathlib.Path(tmp) / "agent-launch.toml"
539
+ planted_profile.write_text("".join(
540
+ f'[hosts.{host}.tiers.{tier}]\nmodel = "planted-{host}-{tier}"\neffort = "high"\n\n'
541
+ for host in ("claude", "codex") for tier in gate.SEAT_TIERS), encoding="utf-8")
542
+ planted_seats = {"seat_tiers": {"S3": "claude:workhorse", "S7": "claude:helm", "S9b": "codex:workhorse"},
543
+ "cross_review": {"S9b": "S7"}}
544
+ bare = {**fixture(), "seats": {"S3": "claude:named/high"}}
545
+ filled = fill_seats(bare, planted_seats, planted_profile)
546
+ control("S0 fills every seat a declaration leaves out from its launch-profile tier and keeps a named one",
547
+ [] if filled["seats"] == {"S3": "claude:named/high", "S7": "claude:planted-claude-helm/high",
548
+ "S9b": "codex:planted-codex-workhorse/high"}
549
+ and filled.get("seat_resolution") == {"profile": str(planted_profile),
550
+ "profile_sha256": gate.launch_profile_sha256(planted_profile),
551
+ "filled": {"S7": "claude:helm", "S9b": "codex:workhorse"}}
552
+ else [f"{filled['seats']} {filled.get('seat_resolution')}"])
553
+ whole = {**fixture(), "seats": {"S3": "claude:named/high", "S7": "claude:x/high", "S9b": "codex:y/high"}}
554
+ control("a declaration that names every seat key is filled with nothing",
555
+ [] if fill_seats(whole, planted_seats, planted_profile) == whole else ["changed"])
556
+ control("a declaration carrying its own seat resolution is refused",
557
+ refusal(fill_seats, {**bare, "seat_resolution": {"profile": "p", "profile_sha256": "0" * 64,
558
+ "filled": {"S7": "claude:helm"}}},
559
+ planted_seats, planted_profile),
560
+ "DECLARATION_INVALID seat_resolution")
561
+ control("seats.json naming the sweep tier fills nothing and is refused by name",
562
+ refusal(fill_seats, bare, {"seat_tiers": {"S7": "claude:sweep"}}, planted_profile),
563
+ "SEAT_TIER_EXCLUDED seat_tiers.S7")
564
+ control("a seat resolution naming a key the declaration does not seat is refused",
565
+ mutated(lambda run: run.update(seat_resolution={"profile": "launch/agent-launch.toml", "profile_sha256": "0" * 64,
566
+ "filled": {"S99": "claude:helm"}})),
567
+ "DECLARATION_INVALID seat_resolution.filled.S99")
568
+
502
569
  # The declaration's fields, copied here once: design §4.1's contents plus what the plan adds
503
570
  # (WP-01: declaration_seq, host_allowance, destinations; P3 / design §13.2: account, hosts) and
504
571
  # `posture`, whose authority is design/session-distill/2026-10-21T0318--2d4fbd4--plan-addendum-wp01.md,
@@ -516,9 +583,9 @@ def self_test():
516
583
  control("schema-requires-exactly-the-declared-fields",
517
584
  [] if set(SCHEMA["required"]) == declared
518
585
  and set(SCHEMA["properties"]) == declared | {"density", "retry", "retrieval", "judge",
519
- "sweeps", "environment"}
586
+ "sweeps", "environment", "seat_resolution"}
520
587
  and all(f"{name} (optional)" in SCHEMA["$comment"]
521
- for name in ("density", "retry", "retrieval", "judge", "sweeps", "environment"))
588
+ for name in ("density", "retry", "retrieval", "judge", "sweeps", "environment", "seat_resolution"))
522
589
  else [f"schema requires {sorted(SCHEMA['required'])}, declares {sorted(SCHEMA['properties'])}"])
523
590
  measured = {"bytes_per_token": 1.852, "measured_in": "c2-20261110", "samples": 8, "at": "2026-11-10T23:22:00+09:00"}
524
591
  s3_seat = fixture()["seats"][VIEW_WINDOW_STAGE] # a name of its own: `sonnet` is assigned later in this function
@@ -1935,7 +1935,7 @@ class Supervisor:
1935
1935
  run, _digest, _amendments = records.declaration_state(self.run_dir, who="dispatch")
1936
1936
  held = gate.seats(self.seats_path)
1937
1937
  declared = {v for k, v in run["seats"].items() if k == stage or k.startswith(f"{stage}.")}
1938
- if seat not in declared | set(held.get("stage_seats", {}).get(stage, [])):
1938
+ if seat not in declared | set(gate.stage_seats(held).get(stage, [])):
1939
1939
  raise Refused(f"SEAT_UNPINNED {call_id}: {seat} is neither declared in run.json nor pinned in seats.json for {stage}")
1940
1940
  # what the driver sends, counted by the rule's owner over everything this call SENDS: the packet
1941
1941
  # (its template, principles block and window payload are one object by now), the schema, and what
@@ -3799,7 +3799,7 @@ def self_test(scratch=None):
3799
3799
  # file the admission reads, never copied, so re-measuring preflight cannot leave this test behind. The
3800
3800
  # seat and the Claude host version are read from it too, so a re-pin moves this suite with it.
3801
3801
  vstage = "S3"
3802
- vseat, pinned_claude = gate.seats()["stage_seats"][vstage][0], gate.seats()["hosts"]["claude"]["version"]
3802
+ vseat, pinned_claude = gate.stage_seats()[vstage][0], gate.seats()["hosts"]["claude"]["version"]
3803
3803
  claude_flags = gate.pinned_flags_sha256("claude", pinned_claude, "hermetic")
3804
3804
  claude_allowance = gate.seats()["hosts"]["claude"]["host_allowance"]["hermetic"]["allowance_tokens"]
3805
3805
 
@@ -5140,22 +5140,24 @@ def self_test(scratch=None):
5140
5140
  control("call-reserved-before-the-run-stopped-dispatches-nothing", (got or "").startswith("RUN_STOPPED INPUT_BOUND_EXCEEDED")
5141
5141
  and launches == before and not (dv / "calls" / later["call_id"]).exists(), f"{got} {launches[len(before):]}")
5142
5142
 
5143
- # seats are pinned per stage (design §4 in seats.json, or run.json); a view-window call needs its measured allowance
5144
- design_4 = { # design §4's stage table, "Seat (default)" column, copied by hand
5145
- "S3": ["claude:claude-sonnet-5-5/high"], "S4": ["claude:claude-opus-5-5/high"],
5146
- "S6": ["claude:claude-opus-5-5/high", "codex:gpt-6-astra/xhigh", "claude:claude-sonnet-5-5/medium", "codex:gpt-6-luna/medium"],
5147
- "S7": ["claude:claude-opus-5-5/high"], "S7b": ["codex:gpt-6-astra/xhigh"], "S9b": ["codex:gpt-6-astra/high"]}
5148
- # the owner's departures from that table, each named with its date: approving the C3 run (2026-11-12) the owner
5149
- # seated gpt-6.1-sol as S6's Judge B in place of gpt-6-astra, and on 2026-11-13 seated the same model for S7b and
5150
- # S9b. A seat that differs from §4 and is not listed here fails.
5151
- owner_departures = {("S6", 1): "codex:gpt-6.1-sol/xhigh", ("S7b", 0): "codex:gpt-6.1-sol/xhigh",
5152
- ("S9b", 0): "codex:gpt-6.1-sol/high"}
5153
- expected_seats = {stage: [owner_departures.get((stage, n), seat) for n, seat in enumerate(row)] for stage, row in design_4.items()}
5154
- pinned = {k: v for k, v in gate.seats().get("stage_seats", {}).items() if not k.startswith("$")}
5155
- control("stage-seats-are-design-section-4", pinned == expected_seats, f"{pinned}")
5156
- control("and-an-owner-departure-replaces-a-seat-the-design-names",
5157
- all(design_4[stage][n] != seat for (stage, n), seat in owner_departures.items()) and expected_seats != design_4,
5158
- f"{owner_departures}")
5143
+ # seats are pinned per stage through seats.json's launch-profile tiers (or declared in run.json); a view-window call
5144
+ # needs its measured allowance. The owner's table of 2026-11-29 (D-20261129-946698), copied by hand: each stage on
5145
+ # the tier its work matches, each cross review on the same tier of the other host, S9b's per-row check on WORKHORSE,
5146
+ # and no SWEEP seat. Until then the seats were model names, design §4 and the owner's departures from it.
5147
+ import tomllib
5148
+ owner_tiers = {"S3": "claude:workhorse", "S4": "claude:helm", "S6.A": "claude:helm", "S6.B": "codex:helm",
5149
+ "S6.sweep_a": "claude:workhorse", "S6.sweep_b": "codex:workhorse", "S7": "claude:helm",
5150
+ "S7b": "codex:helm", "S9b": "codex:workhorse"}
5151
+ control("seat-tiers-are-the-owner-s-table", gate.seat_default_tiers() == owner_tiers, f"{gate.seat_default_tiers()}")
5152
+ # read from the launch profile here by this suite's own reading, not through gate.launch_tiers
5153
+ profile = tomllib.loads(gate.LAUNCH_PROFILE.read_text(encoding="utf-8"))
5154
+ by_profile = {}
5155
+ for key, ref in owner_tiers.items():
5156
+ host, _colon, tier = ref.partition(":")
5157
+ bound_tier = profile["hosts"][host]["tiers"][tier]
5158
+ by_profile.setdefault(key.split(".")[0], []).append(f"{host}:{bound_tier['model']}/{bound_tier['effort']}")
5159
+ control("and-each-stage-seat-is-its-tier-in-the-launch-profile", gate.stage_seats() == by_profile,
5160
+ f"{gate.stage_seats()} {by_profile}")
5159
5161
  # a slot is unmeasured (no number) or measured (a positive count and the measurement it came from);
5160
5162
  # the negative rows build their own slots, so the control keeps testing when every live slot is measured
5161
5163
  def allowance_slot_problem(slot):
@@ -5201,8 +5203,12 @@ def self_test(scratch=None):
5201
5203
  plain, measured = supervisor(da), supervisor(da, seats_path=measured_seats)
5202
5204
  got, untouched = admitted(plain, "S6", "claude:claude-opus-5-5/max", False)
5203
5205
  control("seat-neither-declared-nor-pinned-refused", (got or "").startswith("SEAT_UNPINNED") and untouched, f"{got}")
5204
- got, _untouched = admitted(plain, "S6", "codex:gpt-6-luna/medium", False)
5205
- control("seat-pinned-by-design-section-4-admitted", got is None, f"{got}")
5206
+ # a seat seats.json pins for S6 through its tier and the run does not declare, so admission is the pin's alone
5207
+ tier_pinned = gate.seat_defaults()["S6.sweep_b"]
5208
+ got, _untouched = admitted(plain, "S6", tier_pinned, False)
5209
+ control("seat-pinned-through-its-tier-admitted",
5210
+ got is None and tier_pinned not in records.declaration_state(da, who="dispatch self-test")[0]["seats"].values(),
5211
+ f"{got} {tier_pinned}")
5206
5212
  got, untouched = admitted(supervisor(da, seats_path=claude_unmeasured), vstage, vseat, True)
5207
5213
  control("view-window-call-without-a-measured-allowance-refused", (got or "").startswith("ALLOWANCE_UNMEASURED") and untouched,
5208
5214
  f"{got}")
@@ -49,7 +49,9 @@ import importlib.util
49
49
  import itertools
50
50
  import json
51
51
  import pathlib
52
+ import re
52
53
  import sys
54
+ import tomllib
53
55
 
54
56
  if __package__ in (None, ""): # run as a script: put session-distill/ on the import path
55
57
  sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
@@ -198,6 +200,96 @@ def seats(path=SEATS):
198
200
  return _seats[path]
199
201
 
200
202
 
203
+ # The launch profile whose tiers seat distill's stages (owner, 2026-11-29): seats.json names a tier per run.json seat
204
+ # key (`seat_tiers`) and the model and effort come from here, so a model change in the profile moves distill's seats
205
+ # with it. The checkout's own file, never a user's saved preset: a run's seats do not depend on whose machine declared
206
+ # it. SWEEP is not a distill tier (same decision): the stages that swept on cheap seats sit on WORKHORSE.
207
+ LAUNCH_PROFILE = pathlib.Path(__file__).resolve().parents[2] / "launch" / "agent-launch.toml"
208
+ SEAT_TIERS = ("frontier", "helm", "workhorse")
209
+ SEAT_KEY = re.compile(r"^S[0-9]+b?(\.[A-Za-z0-9_-]+)?$") # run.schema.json's seat keys
210
+ _tiers = {}
211
+
212
+
213
+ def launch_tiers(path=LAUNCH_PROFILE):
214
+ """`{host: {tier: {"model": ..., "effort": ...}}}` as the launch profile binds them (`[hosts.<host>.tiers.<tier>]`)."""
215
+ path = pathlib.Path(path)
216
+ if path not in _tiers:
217
+ profile = tomllib.loads(path.read_text(encoding="utf-8"))
218
+ _tiers[path] = {host: dict(entry.get("tiers") or {}) for host, entry in (profile.get("hosts") or {}).items()
219
+ if isinstance(entry, dict)}
220
+ return _tiers[path]
221
+
222
+
223
+ def launch_profile_sha256(path=LAUNCH_PROFILE):
224
+ """The sha256 of the launch profile's bytes: what a run records beside the seats its tiers resolved to."""
225
+ return hashlib.sha256(pathlib.Path(path).read_bytes()).hexdigest()
226
+
227
+
228
+ def resolved_seats(doc, tiers=None):
229
+ """`(seats, problems)`: every run.json seat key seats.json's `seat_tiers` names, resolved to `host:model/effort`
230
+ through the launch profile's tiers, and by name what keeps a key from resolving or a cross review from being one:
231
+ SEAT_TIER_UNKNOWN (not a seat key, not `host:tier`, or a tier the profile does not bind with a model and an
232
+ effort), SEAT_TIER_EXCLUDED (the SWEEP tier), CROSS_REVIEW_UNSEATED (a pair seat_tiers does not seat) and
233
+ CROSS_REVIEW_SAME_PROVIDER (a reviewer on the host of the work it reviews)."""
234
+ tiers = launch_tiers() if tiers is None else tiers
235
+ found, problems = {}, []
236
+ for key, ref in ((doc or {}).get("seat_tiers") or {}).items():
237
+ if str(key).startswith("$"):
238
+ continue
239
+ where, (host, colon, tier) = f"seat_tiers.{key}", str(ref).partition(":")
240
+ if not SEAT_KEY.match(str(key)):
241
+ problems.append(f"SEAT_TIER_UNKNOWN {where}: {key!r} is not a run.json seat key")
242
+ elif not (host and colon and tier):
243
+ problems.append(f"SEAT_TIER_UNKNOWN {where}: {ref!r} is not host:tier")
244
+ elif tier not in SEAT_TIERS:
245
+ problems.append(f"SEAT_TIER_EXCLUDED {where}: {ref!r} names the sweep tier, which seats no distill stage "
246
+ f"(owner, 2026-11-29); a distill tier is one of {list(SEAT_TIERS)}" if tier == "sweep" else
247
+ f"SEAT_TIER_UNKNOWN {where}: {ref!r} names no distill tier, one of {list(SEAT_TIERS)}")
248
+ else:
249
+ bound = (tiers.get(host) or {}).get(tier) or {}
250
+ model, effort = bound.get("model"), bound.get("effort")
251
+ if isinstance(model, str) and model and isinstance(effort, str) and effort:
252
+ found[key] = f"{host}:{model}/{effort}"
253
+ else:
254
+ problems.append(f"SEAT_TIER_UNKNOWN {where}: the launch profile binds no model and effort for {host} "
255
+ f"{tier} ([hosts.{host}.tiers.{tier}] in {LAUNCH_PROFILE.name})")
256
+ for key, producer in ((doc or {}).get("cross_review") or {}).items():
257
+ if str(key).startswith("$"):
258
+ continue
259
+ where = f"cross_review.{key}"
260
+ if key not in found or producer not in found:
261
+ problems.append(f"CROSS_REVIEW_UNSEATED {where}: {key} reviews {producer}, and seat_tiers seats "
262
+ f"{[k for k in (key, producer) if k in found] or 'neither'}")
263
+ elif found[key].partition(":")[0] == found[producer].partition(":")[0]:
264
+ problems.append(f"CROSS_REVIEW_SAME_PROVIDER {where}: {key} ({found[key]}) reviews {producer} "
265
+ f"({found[producer]}) on the same host; a cross review is the other provider's")
266
+ return found, problems
267
+
268
+
269
+ def seat_defaults(doc=None, tiers=None):
270
+ """`{seat key: host:model/effort}`: the seat each run.json seat key takes when a declaration names none, seats.json's
271
+ tier resolved through the launch profile. Refused by name while any of seats.json's tiers does not resolve."""
272
+ found, problems = resolved_seats(seats() if doc is None else doc, tiers)
273
+ if problems:
274
+ raise Refused("\n".join(problems))
275
+ return found
276
+
277
+
278
+ def seat_default_tiers(doc=None):
279
+ """`{seat key: host:tier}` as seats.json names them: what a run records for each seat it took by default."""
280
+ held = seats() if doc is None else doc
281
+ return {k: v for k, v in (held.get("seat_tiers") or {}).items() if not str(k).startswith("$")}
282
+
283
+
284
+ def stage_seats(doc=None, tiers=None):
285
+ """`{stage: [host:model/effort, ...]}`: the seats pinned for each stage, in seat_tiers order (design §4's shape:
286
+ a stage's keys are `S6`, `S6.A`, ...)."""
287
+ out = {}
288
+ for key, seat in seat_defaults(doc, tiers).items():
289
+ out.setdefault(key.split(".")[0], []).append(seat)
290
+ return out
291
+
292
+
201
293
  def seat_capacity(seat, host_version, path=SEATS):
202
294
  """`(context_capacity, basis)` seats.json declares for `seat` at `host_version`, or `(None, reason)`.
203
295
 
@@ -275,7 +367,7 @@ def host_schema_problems(c):
275
367
  return out
276
368
 
277
369
 
278
- def seats_problems(doc):
370
+ def seats_problems(doc, tiers=None):
279
371
  """What makes seats.json's pins disagree with the version each was established at, by name (`PIN_PATH_VERSION`,
280
372
  `PIN_STALE`); empty when none does. A host's pinned binary is the versioned file (plan P2), so its path names the
281
373
  pinned version as one of its parts. Everything measured or observed for a host is valid at the version it was
@@ -285,7 +377,10 @@ def seats_problems(doc):
285
377
  version is named here, and the re-pin takes each with it: re-measured, marked unmeasured, or declared carried.
286
378
 
287
379
  And every seat a stage is seated with has a capacity (`CAPACITY_UNDECLARED`): a seat with none was the one
288
- exception check (d) could not hold, and a re-pin that drops a capacity leaves that seat unbounded by name."""
380
+ exception check (d) could not hold, and a re-pin that drops a capacity leaves that seat unbounded by name. A stage
381
+ is seated through its launch-profile tier (`resolved_seats`), so what keeps a tier from resolving, or a cross
382
+ review from being one, is named here too, and a tier the profile moves to a model with no capacity is named
383
+ CAPACITY_UNDECLARED before any call."""
289
384
  out = []
290
385
  hosts = (doc or {}).get("hosts") or {}
291
386
  for host, entry in sorted(hosts.items()):
@@ -315,11 +410,11 @@ def seats_problems(doc):
315
410
  out.append(f"PIN_STALE seat_capacity.{seat}: reported at host {held.get('host_version')!r}, and the pin is "
316
411
  f"{pinned!r}; report it again at the pinned version, or remove it")
317
412
  declared = (doc or {}).get("seat_capacity") or {}
413
+ found, tier_problems = resolved_seats(doc, tiers)
414
+ out.extend(tier_problems)
318
415
  seated = {}
319
- for stage, rows in sorted(((doc or {}).get("stage_seats") or {}).items()):
320
- if not stage.startswith("$") and isinstance(rows, list):
321
- for seat in rows:
322
- seated.setdefault(seat, stage)
416
+ for key, seat in found.items():
417
+ seated.setdefault(seat, key.split(".")[0])
323
418
  for seat, stage in sorted(seated.items()):
324
419
  if not isinstance(declared.get(seat), dict):
325
420
  out.append(f"CAPACITY_UNDECLARED seat_capacity.{seat}: {stage} is seated with it and seats.json declares no "
@@ -2666,17 +2761,60 @@ def self_test():
2666
2761
  ("a-seat-capacity-at-another-version",
2667
2762
  lambda d: d.setdefault("seat_capacity", {}).update(
2668
2763
  {"claude:planted/high": {"context_capacity": 1, "host_version": "0.0.1", "basis": "b"}}),
2669
- "PIN_STALE seat_capacity.claude:planted/high"),
2670
- # a seat of its own, so the control keeps testing whichever seats the real file holds
2671
- ("a-seated-seat-with-no-capacity",
2672
- lambda d: d.setdefault("stage_seats", {}).update(Splanted=["codex:planted/xhigh"]),
2673
- "CAPACITY_UNDECLARED seat_capacity.codex:planted/xhigh")):
2764
+ "PIN_STALE seat_capacity.claude:planted/high")):
2674
2765
  ran.append(name)
2675
2766
  bent = copy.deepcopy(held_seats)
2676
2767
  bend(bent)
2677
2768
  got = seats_problems(bent)
2678
2769
  if not any(line.startswith(want) for line in got):
2679
2770
  failures.append(f"{name}: expected a line starting {want!r}, got {got}")
2771
+ # a stage is seated through its launch-profile tier: the real profile's tiers resolve every real key, and each break
2772
+ # is planted on keys and tiers of its own, so the controls keep testing whichever tiers the real files bind
2773
+ real_tiers = launch_tiers()
2774
+ planted_tiers = {**real_tiers, "codex": {**real_tiers.get("codex", {}), "frontier": {"model": "planted", "effort": "xhigh"}},
2775
+ "claude": {**real_tiers.get("claude", {}), "frontier": {"model": "planted", "effort": "high"}}}
2776
+ real_found, real_tier_problems = resolved_seats(held_seats)
2777
+ ran.append("seat-tiers-resolve-through-the-launch-profile")
2778
+ if real_tier_problems or not real_found or set(real_found) != set(seat_default_tiers(held_seats)):
2779
+ failures.append(f"seat-tiers-resolve-through-the-launch-profile: {real_tier_problems} {real_found}")
2780
+ ran.append("a-moved-tier-moves-the-seat")
2781
+ moved = resolved_seats({"seat_tiers": {"S99": "codex:frontier"}}, planted_tiers)[0]
2782
+ if moved != {"S99": "codex:planted/xhigh"}:
2783
+ failures.append(f"a-moved-tier-moves-the-seat: {moved}")
2784
+
2785
+ def seat(key, ref):
2786
+ return lambda d: d.setdefault("seat_tiers", {}).update({key: ref})
2787
+
2788
+ def reviewed(key, producer, key_ref, producer_ref):
2789
+ return lambda d: (d.setdefault("seat_tiers", {}).update({key: key_ref, producer: producer_ref}),
2790
+ d.setdefault("cross_review", {}).update({key: producer}))
2791
+ for name, bend, want in (
2792
+ # a seat of its own, so the control keeps testing whichever seats the real file holds
2793
+ ("a-seated-seat-with-no-capacity", seat("S99", "codex:frontier"),
2794
+ "CAPACITY_UNDECLARED seat_capacity.codex:planted/xhigh"),
2795
+ ("a-seat-on-the-sweep-tier", seat("S99", "codex:sweep"), "SEAT_TIER_EXCLUDED seat_tiers.S99"),
2796
+ ("a-seat-on-a-tier-distill-does-not-know", seat("S99", "codex:planted"),
2797
+ "SEAT_TIER_UNKNOWN seat_tiers.S99"),
2798
+ ("a-seat-on-a-host-the-profile-does-not-bind", seat("S99", "planted:helm"),
2799
+ "SEAT_TIER_UNKNOWN seat_tiers.S99"),
2800
+ ("a-seat-that-is-not-host-tier", seat("S99", "helm"), "SEAT_TIER_UNKNOWN seat_tiers.S99"),
2801
+ ("a-seat-key-that-is-no-stage", seat("planted", "codex:helm"), "SEAT_TIER_UNKNOWN seat_tiers.planted"),
2802
+ ("a-cross-review-on-the-host-it-reviews", reviewed("S99.b", "S99.a", "claude:frontier", "claude:frontier"),
2803
+ "CROSS_REVIEW_SAME_PROVIDER cross_review.S99.b"),
2804
+ ("a-cross-review-of-an-unseated-key",
2805
+ lambda d: d.setdefault("cross_review", {}).update({"S99.b": "S99.none"}),
2806
+ "CROSS_REVIEW_UNSEATED cross_review.S99.b")):
2807
+ ran.append(name)
2808
+ bent = copy.deepcopy(held_seats)
2809
+ bend(bent)
2810
+ got = seats_problems(bent, planted_tiers)
2811
+ if not any(line.startswith(want) for line in got):
2812
+ failures.append(f"{name}: expected a line starting {want!r}, got {got}")
2813
+ ran.append("a-cross-review-on-the-other-host-is-one")
2814
+ crossed = copy.deepcopy(held_seats)
2815
+ reviewed("S99.b", "S99.a", "codex:frontier", "claude:frontier")(crossed)
2816
+ if any(line.startswith(("CROSS_REVIEW", "SEAT_TIER")) for line in seats_problems(crossed, planted_tiers)):
2817
+ failures.append(f"a-cross-review-on-the-other-host-is-one: {seats_problems(crossed, planted_tiers)}")
2680
2818
  # a call's manifest declares the built-in context without the declaration's provenance, and none at another version
2681
2819
  ran.append("builtin-context-is-the-declaration-without-its-provenance")
2682
2820
  codex_entry = held_seats["hosts"]["codex"]
@@ -727,8 +727,9 @@ def self_test():
727
727
  "S7b": {"s7b": lambda: json.loads(s7b.schema_bytes())},
728
728
  "S9b": {"s9b": lambda: json.loads(s9b.schema_bytes())}}
729
729
  seats_doc = json.loads((REPO / "session-distill" / "seats.json").read_text(encoding="utf-8"))
730
- codex_stages = {stage for stage, held in seats_doc["stage_seats"].items()
731
- if not stage.startswith("$") and any(str(seat).startswith("codex:") for seat in held)}
730
+ from runlib import gate as gates # gate imports this module, so inside the self-test only
731
+ codex_stages = {stage for stage, held in gates.stage_seats(seats_doc).items()
732
+ if any(str(seat).startswith("codex:") for seat in held)}
732
733
  handed = {name: json.loads(schema_bytes(make())) for stage in sent_by for name, make in sent_by[stage].items()}
733
734
  found = {name: provider_schema(held, "codex") for name, held in handed.items()}
734
735
  reached = []
@@ -2377,7 +2377,7 @@ def self_test():
2377
2377
  and "with its retry's correction room" in short_by_one, short_by_one)
2378
2378
 
2379
2379
  # W r1, F4: a run that died holding a reservation of S4 is closed, or refused beside, when S4 runs again
2380
- s4_seat = gate.seats()["stage_seats"][STAGE][0]
2380
+ s4_seat = gate.stage_seats()[STAGE][0]
2381
2381
 
2382
2382
  def reserved_copy(label, plant=None):
2383
2383
  """A copy of the golden run whose S4 reservation a dead run left open, `plant` marking what it got to."""
@@ -3658,14 +3658,18 @@ def self_test():
3658
3658
  and any(x.startswith("CROSS_OVER_CAPACITY B") for x in kw.get("packet_check", lambda m: [])(huge))
3659
3659
  for _i, _s, kw in asked_c), f"{said_c[:200]} {len(asked_c)}")
3660
3660
  # C3 (lead's (가)): before the first sweep, the whole plan's claims are held against what S6 has left, all
3661
- # or none; driven over the same copy with both sweep seats measured, so each call's claim is computable
3661
+ # or none; driven over the same copy with both sweep seats measured, so each call's claim is computable.
3662
+ # Both capacities are planted, for the seats the stage's own declaration names: seats.json keeps a row only
3663
+ # for a seat some tier resolves to (D-20261129-946698), so a live row is nothing a fixture's seat can lean on
3662
3664
  summary_pre = guarded(lambda: records.read_json(capped / SUMMARY), {})
3663
3665
 
3664
3666
  def preflight(left):
3665
- sup = Asked(fx_seats(root, name=f"sweep-preflight-{left}.json",
3666
- capacities={"codex:gpt-6-luna/medium": 272_000}, codex_allowance=19_167))
3667
- sup.remaining = lambda stage_: left
3668
3667
  with records.run_stage(capped, STAGE, INPUTS) as stg:
3668
+ swept = sweep_seats(stg.declaration)
3669
+ sup = Asked(fx_seats(root, name=f"sweep-preflight-{left}.json",
3670
+ capacities={swept["a"]: 1_000_000, swept["b"]: 272_000},
3671
+ codex_allowance=19_167))
3672
+ sup.remaining = lambda stage_: left
3669
3673
  try:
3670
3674
  section, _receipts = sweep_stage(capped, stg, sup, stg.declaration, judged_w, judgments_w,
3671
3675
  sources_w, {}, "calibration")
@@ -3134,7 +3134,7 @@ def self_test():
3134
3134
  "quarantined by name", [q["reason"] for q in golden(root, "nobound", overhead=bound.INPUT_BOUND - 10_000)["manifest"]["quarantined"]],
3135
3135
  "WINDOW_UNBOUNDED")
3136
3136
  # The S3 seat and the Claude host version these controls cut against are the checkout's pins.
3137
- s3_seat, pinned_claude = gate.seats()["stage_seats"]["S3"][0], gate.seats()["hosts"]["claude"]["version"]
3137
+ s3_seat, pinned_claude = gate.stage_seats()["S3"][0], gate.seats()["hosts"]["claude"]["version"]
3138
3138
  # BA#1: cutting a window reads the SAME declaration the dispatcher admits against, and there is no
3139
3139
  # default - a window cut against an invented capacity is cut against nothing.
3140
3140
  refused("control, BA#1: a seat seats.json declares no context capacity for cuts no window",