agent-bios 0.19.4 → 0.20.1

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 (162) hide show
  1. package/DEPENDENCIES.md +20 -5
  2. package/README.md +14 -19
  3. package/claude/agents/frontier.md +1 -1
  4. package/claude/guides/claude-prompting.md +475 -234
  5. package/claude/guides/cli-multi-model-workflow.md +8 -7
  6. package/claude/guides/gpt-prompting.md +319 -144
  7. package/claude/guides/session-distill-workflow.md +93 -43
  8. package/claude/guides/tooling-gotchas.md +3 -1
  9. package/codex/agents/frontier.toml +1 -1
  10. package/codex/agents/reviewer.toml +1 -1
  11. package/codex/agents/workhorse.toml +1 -1
  12. package/codex/guides/claude-prompting.md +475 -234
  13. package/codex/guides/cli-multi-model-workflow.md +8 -7
  14. package/codex/guides/gpt-prompting.md +319 -144
  15. package/codex/guides/session-distill-workflow.md +93 -43
  16. package/codex/guides/tooling-gotchas.md +3 -1
  17. package/compose/assemble.py +4 -1
  18. package/compose/canary.sh +8 -6
  19. package/compose/host_platform.py +158 -15
  20. package/compose/instructions-state.py +183 -41
  21. package/compose/instructions_install.py +222 -27
  22. package/compose/instructions_session.py +250 -75
  23. package/compose/instructions_setup_cli.py +2 -36
  24. package/compose/instructions_store.py +160 -3
  25. package/compose/instructions_transaction.py +29 -5
  26. package/docs/advanced-launch.md +5 -1
  27. package/docs/releases/0.20.0.md +102 -0
  28. package/docs/releases/0.20.1.md +76 -0
  29. package/install.sh +42 -14
  30. package/launch/agent-launch.py +152 -18
  31. package/launch/agent-launch.toml +28 -16
  32. package/launch/agent-launch.zsh +104 -13
  33. package/launch/claude_subcommands.py +179 -0
  34. package/launch/shell_integration.py +7 -1
  35. package/learn/collect-learning.py +60 -9
  36. package/learn/migrate-learnings.py +70 -4
  37. package/learn/redact.py +2 -1
  38. package/package.json +36 -3
  39. package/provenance.json +1 -1
  40. package/session-cost.py +80 -9
  41. package/session-distill/coverage.json +6 -0
  42. package/session-distill/distill.py +2575 -0
  43. package/session-distill/grammar/__init__.py +0 -0
  44. package/session-distill/grammar/owner_lines.py +874 -0
  45. package/session-distill/originators.json +9 -0
  46. package/session-distill/packets/cross_review.md +31 -0
  47. package/session-distill/packets/form.md +86 -0
  48. package/session-distill/packets/judge.md +81 -0
  49. package/session-distill/packets/placement_contract.md +90 -0
  50. package/session-distill/packets/propose.md +124 -0
  51. package/session-distill/packets/read.md +57 -0
  52. package/session-distill/packets/reconsider.md +53 -0
  53. package/session-distill/packets/s7b.md +65 -0
  54. package/session-distill/packets/s9b.md +39 -0
  55. package/session-distill/packets/stitch.md +35 -0
  56. package/session-distill/packets/sweep.md +33 -0
  57. package/session-distill/runlib/__init__.py +0 -0
  58. package/session-distill/runlib/bound.py +1102 -0
  59. package/session-distill/runlib/breaker.py +467 -0
  60. package/session-distill/runlib/census.py +2347 -0
  61. package/session-distill/runlib/claims.py +420 -0
  62. package/session-distill/runlib/controls.py +902 -0
  63. package/session-distill/runlib/coverage.py +881 -0
  64. package/session-distill/runlib/declare.py +888 -0
  65. package/session-distill/runlib/delivery_evidence.py +1145 -0
  66. package/session-distill/runlib/derive.py +812 -0
  67. package/session-distill/runlib/destinations.py +3072 -0
  68. package/session-distill/runlib/dispatch.py +7940 -0
  69. package/session-distill/runlib/drift.py +1077 -0
  70. package/session-distill/runlib/entry.py +401 -0
  71. package/session-distill/runlib/evidence.py +890 -0
  72. package/session-distill/runlib/exposure.py +1162 -0
  73. package/session-distill/runlib/gate.py +2727 -0
  74. package/session-distill/runlib/gitread.py +79 -0
  75. package/session-distill/runlib/inventory.py +19624 -0
  76. package/session-distill/runlib/journal.py +1919 -0
  77. package/session-distill/runlib/ledger.py +3210 -0
  78. package/session-distill/runlib/ledger_compat.py +101 -0
  79. package/session-distill/runlib/ledger_migration.py +190 -0
  80. package/session-distill/runlib/lifecycle_intake.py +693 -0
  81. package/session-distill/runlib/lineage.py +454 -0
  82. package/session-distill/runlib/measures.py +249 -0
  83. package/session-distill/runlib/monitor.py +1180 -0
  84. package/session-distill/runlib/operations.py +522 -0
  85. package/session-distill/runlib/packet.py +838 -0
  86. package/session-distill/runlib/placement.py +1769 -0
  87. package/session-distill/runlib/projection.py +4090 -0
  88. package/session-distill/runlib/ranking.py +740 -0
  89. package/session-distill/runlib/receipts.py +200 -0
  90. package/session-distill/runlib/records.py +1965 -0
  91. package/session-distill/runlib/search.py +249 -0
  92. package/session-distill/runlib/sequencing.py +829 -0
  93. package/session-distill/runlib/sources.py +641 -0
  94. package/session-distill/runlib/stage_adjudicate.py +845 -0
  95. package/session-distill/runlib/stage_apply.py +1378 -0
  96. package/session-distill/runlib/stage_approvals.py +758 -0
  97. package/session-distill/runlib/stage_close.py +1220 -0
  98. package/session-distill/runlib/stage_confirm.py +929 -0
  99. package/session-distill/runlib/stage_delivery.py +3080 -0
  100. package/session-distill/runlib/stage_form.py +2576 -0
  101. package/session-distill/runlib/stage_judge.py +4248 -0
  102. package/session-distill/runlib/stage_propose.py +3307 -0
  103. package/session-distill/runlib/stage_read.py +5179 -0
  104. package/session-distill/runlib/stage_render.py +2739 -0
  105. package/session-distill/runlib/stage_retrieve.py +924 -0
  106. package/session-distill/runlib/stage_review_korean.py +1002 -0
  107. package/session-distill/runlib/stage_review_proposals.py +1292 -0
  108. package/session-distill/runlib/stagelock.py +412 -0
  109. package/session-distill/runlib/stop.py +1061 -0
  110. package/session-distill/runlib/targets.py +809 -0
  111. package/session-distill/runlib/usage.py +280 -0
  112. package/session-distill/runlib/validate.py +319 -0
  113. package/session-distill/runlib/views.py +4327 -0
  114. package/session-distill/schemas/adjudication.schema.json +35 -0
  115. package/session-distill/schemas/approval.schema.json +35 -0
  116. package/session-distill/schemas/census.schema.json +128 -0
  117. package/session-distill/schemas/checks.schema.json +207 -0
  118. package/session-distill/schemas/claim.schema.json +16 -0
  119. package/session-distill/schemas/confirmation.schema.json +24 -0
  120. package/session-distill/schemas/coverage.schema.json +66 -0
  121. package/session-distill/schemas/cross_review.schema.json +24 -0
  122. package/session-distill/schemas/event.schema.json +20 -0
  123. package/session-distill/schemas/evidence.schema.json +20 -0
  124. package/session-distill/schemas/expected_observation.schema.json +18 -0
  125. package/session-distill/schemas/form.schema.json +103 -0
  126. package/session-distill/schemas/intake.schema.json +71 -0
  127. package/session-distill/schemas/inventory.schema.json +872 -0
  128. package/session-distill/schemas/judge.schema.json +77 -0
  129. package/session-distill/schemas/ledger.schema.json +313 -0
  130. package/session-distill/schemas/observation.schema.json +16 -0
  131. package/session-distill/schemas/propose.schema.json +555 -0
  132. package/session-distill/schemas/read.schema.json +76 -0
  133. package/session-distill/schemas/reconsider.schema.json +122 -0
  134. package/session-distill/schemas/run.schema.json +150 -0
  135. package/session-distill/schemas/s7b.schema.json +200 -0
  136. package/session-distill/schemas/s9b.schema.json +28 -0
  137. package/session-distill/schemas/stitch.schema.json +25 -0
  138. package/session-distill/schemas/sweep.schema.json +25 -0
  139. package/session-distill/seats.json +149 -0
  140. package/session-distill/tables/allowed_pairs.json +257 -0
  141. package/session-distill/tables/controls.json +30 -0
  142. package/session-distill/tables/delivery_evidence.json +36 -0
  143. package/session-distill/tables/delivery_evidence_fixtures.json +731 -0
  144. package/session-distill/tables/destinations.json +684 -0
  145. package/session-distill/tables/drift_layers.json +68 -0
  146. package/session-distill/tables/exposure_rules.json +192 -0
  147. package/session-distill/tables/placement_rules.json +148 -0
  148. package/session-distill/tables/propose_fixtures.json +154 -0
  149. package/session-distill/tables/ranking.json +194 -0
  150. package/session-distill/tables/redundancy.json +10 -0
  151. package/session-distill/tables/structural_rules.json +44 -0
  152. package/session-distill/tables/transition_fixtures.json +398 -0
  153. package/session-distill/tables/transitions.json +69 -0
  154. package/session-distill/tables/unit_outcome.json +67 -0
  155. package/session-distill/tables/unit_outcome_fixtures.json +2364 -0
  156. package/wrappers/claude-run.sh +481 -33
  157. package/wrappers/claude_hermetic_evidence.py +1423 -0
  158. package/wrappers/codex-helm.sh +46 -15
  159. package/wrappers/codex-run.sh +183 -20
  160. package/wrappers/codex_frame_filter.py +1199 -0
  161. package/wrappers/codex_protocol.py +737 -0
  162. package/wrappers/jsonl_lines.py +65 -0
@@ -7,9 +7,9 @@ host; that is the launch adapter's job.
7
7
  """
8
8
  from __future__ import annotations
9
9
  try:
10
- from host_platform import sync_directory, cli_argv
10
+ from host_platform import sync_directory, cli_argv, jsonl_lines_for
11
11
  except ImportError:
12
- from .host_platform import sync_directory, cli_argv
12
+ from .host_platform import sync_directory, cli_argv, jsonl_lines_for
13
13
 
14
14
  import copy
15
15
  import contextlib
@@ -30,6 +30,16 @@ except ImportError:
30
30
  from .instructions_transaction import environment_value, transaction_lock, guard_pending, pending_operations, operation_scope_active, reject_symlink_ancestors
31
31
 
32
32
  SCHEMA_VERSION = 1
33
+ RECEIPT_DIR = "receipts"
34
+ RECEIPT_SCHEMA = "InstallationReceipt/v1"
35
+ RECEIPT_ROLES = {"release", "owned"}
36
+ RECEIPT_INSTALLER = {"digest_at_import", "digest", "build", "root", "files", "package_modules_run"}
37
+ _SHA256 = re.compile(r"[0-9a-f]{64}")
38
+ # Snapshot input -> the file in the receipt's release artifacts that must carry the same bytes. The
39
+ # installer digest cannot answer this: an old installer runs the new package's store and catalog.
40
+ RECEIPT_ARTIFACTS = {"compiler_digest": "compose/instructions_catalog.py",
41
+ "store_schema_digest": "compose/instructions_store.py",
42
+ "bootstrap_digest": "compose/bootstrap/SKILL.md"}
33
43
  LOCAL_PACKAGE = "@local/personal"
34
44
  SURFACES = {"always", "relevant", "requested", "event", "delegated"}
35
45
  KINDS = {"rule", "guide", "skill", "hook", "agent"}
@@ -200,6 +210,133 @@ def _snapshot_assets(value: Any, files: list[str]) -> dict[str, Any]:
200
210
  return _copy_json(value)
201
211
 
202
212
 
213
+ def read_installation_receipt(state_root: Path, receipt_id: str) -> dict[str, Any]:
214
+ """A success receipt whose bytes hash to its id; anything else is not evidence.
215
+
216
+ The id lives outside the body (the file name), so reading one is also the check that the
217
+ body was not edited: a re-serialization with reordered keys hashes the same, a changed
218
+ field does not.
219
+ """
220
+ _safe_part(receipt_id, "receipt id")
221
+ path = Path(state_root) / "runtime" / RECEIPT_DIR / f"{receipt_id}.json"
222
+ _reject_symlink_path(path)
223
+ if not path.is_file():
224
+ raise ValidationError("installation receipt is missing")
225
+ raw = path.read_bytes()
226
+ if hashlib.sha256(raw).hexdigest() != receipt_id:
227
+ raise ValidationError("installation receipt does not hash to its id")
228
+ receipt = json.loads(raw)
229
+ if not isinstance(receipt, dict) or receipt.get("schema") != RECEIPT_SCHEMA or receipt.get("result") != "success":
230
+ raise ValidationError("not a success installation receipt")
231
+ _receipt_contract(receipt)
232
+ return receipt
233
+
234
+
235
+ def _receipt_contract(receipt: dict[str, Any]) -> None:
236
+ """Hold a receipt to the contract the installer writes, not only to its own hash.
237
+
238
+ A body can hash to its file name and still be no evidence: it can carry the id that must live
239
+ outside it, claim two different installer digests where a difference refuses the receipt, lack
240
+ the fields a verdict reads, or hold artifact rows of another shape. Each of those was accepted
241
+ as bound, or raised where a verdict was promised (X r1 F4), so each is a named refusal here and
242
+ `installation_binding` turns it into `unbound` with its reason.
243
+ """
244
+ carried = [key for key in ("receipt_id",) if key in receipt]
245
+ if carried:
246
+ raise ValidationError("installation receipt carries its own id: " + ", ".join(carried))
247
+ installer = receipt.get("installer")
248
+ if not isinstance(installer, dict):
249
+ raise ValidationError("installation receipt names no installer")
250
+ if set(installer) != RECEIPT_INSTALLER:
251
+ # Every field here is one the writer ALWAYS writes, so a receipt missing one, or carrying a field
252
+ # the writer never writes, was not written by that installer (X r2 F2).
253
+ raise ValidationError("installation receipt's installer is not the shape the installer writes: "
254
+ + ", ".join(sorted(RECEIPT_INSTALLER.symmetric_difference(installer))))
255
+ digests = [installer["digest_at_import"], installer["digest"]]
256
+ if not all(isinstance(value, str) and _SHA256.fullmatch(value) for value in digests):
257
+ raise ValidationError("installation receipt's installer digests are not digests")
258
+ if digests[0] != digests[1]:
259
+ # The installer refuses the receipt on a difference, so a receipt holding one was not written
260
+ # by that installer: the claim about which code ran is unusable either way.
261
+ raise ValidationError("installation receipt claims two different installer digests")
262
+ if not isinstance(installer["root"], str) or not installer["root"]:
263
+ raise ValidationError("installation receipt's installer names no root")
264
+ if not (installer["build"] is None or (isinstance(installer["build"], str) and installer["build"])):
265
+ raise ValidationError("installation receipt's installer build is neither a version nor absent")
266
+ files = installer["files"]
267
+ if not isinstance(files, list) or not files:
268
+ raise ValidationError("installation receipt lists no installer files")
269
+ for row in files:
270
+ if not isinstance(row, dict) or set(row) != {"path", "sha256"} \
271
+ or not isinstance(row["path"], str) or not row["path"] \
272
+ or not (isinstance(row["sha256"], str) and _SHA256.fullmatch(row["sha256"])):
273
+ # A null sha256 is an unreadable installer file, on which the writer refuses the receipt.
274
+ raise ValidationError("installation receipt holds an installer file row of another shape")
275
+ if _digest(files) != installer["digest"]:
276
+ # The digest IS the hash of these rows, canonically, so the two can be held against each other
277
+ # rather than taken on the receipt's word.
278
+ raise ValidationError("installation receipt's installer digest is not the hash of its own file list")
279
+ modules = installer["package_modules_run"]
280
+ if not isinstance(modules, list):
281
+ raise ValidationError("installation receipt lists no package modules")
282
+ for row in modules:
283
+ if not isinstance(row, dict) or set(row) != {"path", "sha256"} or not isinstance(row["path"], str) \
284
+ or not isinstance(row["sha256"], str) or not row["sha256"]:
285
+ raise ValidationError("installation receipt holds a package module row of another shape")
286
+ for field, kind in (("transaction_id", str), ("release_digest", str), ("baseline_ref", str),
287
+ ("selection", list), ("at", int)):
288
+ if not isinstance(receipt.get(field), kind) or (kind is str and not receipt[field]) \
289
+ or (kind is int and isinstance(receipt[field], bool)):
290
+ raise ValidationError(f"installation receipt's {field} is not a {kind.__name__}")
291
+ begun_by = receipt.get("begun_by_installer_digest")
292
+ if "begun_by_installer_digest" not in receipt:
293
+ raise ValidationError("installation receipt names no beginning installer digest, not even as absent")
294
+ if begun_by is not None and not (isinstance(begun_by, str) and _SHA256.fullmatch(begun_by)):
295
+ raise ValidationError("installation receipt's beginning installer digest is not a digest")
296
+ if begun_by == installer["digest"]:
297
+ # The writer normalises "begun by the installer that finished it" to null, so an equal pair is a
298
+ # claim no installer makes, and reading it as "a different installer began this" would be false.
299
+ raise ValidationError("installation receipt's beginning installer digest equals the finishing one")
300
+ artifacts = receipt.get("artifacts")
301
+ if not isinstance(artifacts, list) or not artifacts:
302
+ raise ValidationError("installation receipt lists no artifacts")
303
+ for row in artifacts:
304
+ # `role` is checked for being a string BEFORE set membership: an unhashable role raised a
305
+ # TypeError where a verdict was promised (X r2 F1).
306
+ if not isinstance(row, dict) or set(row) != {"path", "sha256", "role"} \
307
+ or not isinstance(row["path"], str) or not row["path"] \
308
+ or not (isinstance(row["sha256"], str) and _SHA256.fullmatch(row["sha256"])) \
309
+ or not isinstance(row["role"], str) or row["role"] not in RECEIPT_ROLES:
310
+ raise ValidationError("installation receipt holds an artifact row of another shape")
311
+
312
+
313
+ def installation_binding(state_root: Path, inputs: dict[str, Any]) -> dict[str, Any]:
314
+ """Does the receipt a snapshot names cover the artifacts the snapshot recorded?
315
+
316
+ A verdict, never a refusal: a development override (`AGENT_BIOS_PACKAGE_ROOT` at an older
317
+ tree) legitimately produces snapshots no current receipt covers, and `bound: False` is what
318
+ makes installer exposure unknown downstream rather than stopping a launch.
319
+ """
320
+ receipt_id = inputs.get("installation_receipt_id")
321
+ if not isinstance(receipt_id, str) or not receipt_id:
322
+ return {"bound": False, "reason": "snapshot records no installation receipt"}
323
+ try:
324
+ receipt = read_installation_receipt(state_root, receipt_id)
325
+ except (InstructionsStoreError, ValueError, OSError) as exc:
326
+ return {"bound": False, "receipt_id": receipt_id, "reason": str(exc)}
327
+ hashes = {entry["path"]: entry["sha256"] for entry in receipt["artifacts"]
328
+ if isinstance(entry, dict) and entry.get("role") == "release"}
329
+ wrong = [f"{field} != {path}" for field, path in RECEIPT_ARTIFACTS.items()
330
+ if not inputs.get(field) or hashes.get(path) != inputs[field]]
331
+ if receipt.get("baseline_ref") != inputs.get("baseline_ref"):
332
+ wrong.append("baseline_ref")
333
+ if wrong:
334
+ return {"bound": False, "receipt_id": receipt_id, "reason": "artifacts differ from the receipt: " + ", ".join(wrong)}
335
+ return {"bound": True, "receipt_id": receipt_id, "transaction_id": receipt["transaction_id"],
336
+ "installer_digest": receipt["installer"]["digest"], "release_digest": receipt["release_digest"],
337
+ "begun_by_installer_digest": receipt.get("begun_by_installer_digest")}
338
+
339
+
203
340
  def verify_snapshot(path: Path, expected_content_ref: str) -> dict[str, Any]:
204
341
  """Validate a persisted snapshot without consulting current authoring state."""
205
342
  root = Path(path)
@@ -438,7 +575,7 @@ class InstructionsStore:
438
575
  if not path.is_file():
439
576
  return []
440
577
  events: list[dict[str, Any]] = []
441
- for line_no, raw in enumerate(path.read_text(encoding="utf-8").splitlines(), 1):
578
+ for line_no, raw in enumerate(jsonl_lines_for(__file__).read(path), 1):
442
579
  if not raw.strip():
443
580
  continue
444
581
  try:
@@ -1464,6 +1601,17 @@ class InstructionsStore:
1464
1601
  selected.append(item)
1465
1602
  return selected
1466
1603
 
1604
+ def _current_installation_receipt_id(self) -> str | None:
1605
+ """The receipt of the install transaction the current install record belongs to, if it committed."""
1606
+ record = _json_read(self.runtime / "private-install.json")
1607
+ transaction_id = record.get("transaction_id") if isinstance(record, dict) else None
1608
+ if not isinstance(transaction_id, str):
1609
+ return None # installed before receipts existed: the snapshot stays unbound
1610
+ journal = _json_read(self.runtime / "installer-transactions"
1611
+ / _safe_part(transaction_id, "transaction id") / "journal.json")
1612
+ receipt_id = journal.get("receipt_id") if isinstance(journal, dict) and journal.get("state") == "COMMITTED" else None
1613
+ return receipt_id if isinstance(receipt_id, str) else None
1614
+
1467
1615
  def snapshot(self, host: str, selection: list[str] | None = None, dry_run: bool = False,
1468
1616
  native: bool = False, *, selection_mode: str | None = None,
1469
1617
  cwd: str | Path | None = None) -> dict[str, Any]:
@@ -1519,6 +1667,14 @@ class InstructionsStore:
1519
1667
  "store_schema_digest": _digest(Path(__file__).read_bytes()),
1520
1668
  "bootstrap_digest": _digest(bootstrap_path.read_bytes()),
1521
1669
  }
1670
+ # Recorded BEFORE content_ref is derived, so activation binds a session to exactly one
1671
+ # installation transaction even when several transactions served the same release — and
1672
+ # only when the receipt covers the files this store just hashed.
1673
+ receipt_id = self._current_installation_receipt_id()
1674
+ inputs["installation_receipt_id"] = (
1675
+ receipt_id if receipt_id and installation_binding(
1676
+ self.state_root, {**inputs, "installation_receipt_id": receipt_id})["bound"]
1677
+ else None)
1522
1678
  if native:
1523
1679
  import sys
1524
1680
  inputs["native"] = True
@@ -1631,6 +1787,7 @@ class InstructionsStore:
1631
1787
  verified = verify_snapshot(root, content_ref)
1632
1788
  output = verified["output"]
1633
1789
  return {"content_ref": content_ref, "path": str(root), "inputs": verified["inputs"],
1790
+ "installation_binding": installation_binding(self.state_root, verified["inputs"]),
1634
1791
  "items": verified["items"], "files": output.get("files"),
1635
1792
  "item_refs": output.get("item_refs"), "instruction_text": output.get("instruction_text"),
1636
1793
  "unavailable": output.get("unavailable"), "assets": output.get("assets", {})}
@@ -9,10 +9,11 @@ from __future__ import annotations
9
9
 
10
10
  import contextlib
11
11
  import base64
12
+ import datetime
12
13
  try:
13
- from host_platform import file_locks as fcntl, redirected
14
+ from host_platform import LockWaitExpired, file_locks as fcntl, lock_within, process_identity, redirected
14
15
  except ImportError:
15
- from .host_platform import file_locks as fcntl, redirected
16
+ from .host_platform import LockWaitExpired, file_locks as fcntl, lock_within, process_identity, redirected
16
17
  import hashlib
17
18
  import json
18
19
  import os
@@ -82,6 +83,26 @@ def _depths(name: str) -> dict[str, int]:
82
83
  return value
83
84
 
84
85
 
86
+ def _setup_holder(root: Path) -> str | None:
87
+ """The setup apply holding the transaction lock, if one does: the one writer that records itself, in
88
+ its receipt (written under the lock), so a waiter can name it. A receipt whose owner no longer runs,
89
+ or whose pid now belongs to another process, names nobody."""
90
+ for path in sorted((root / "setup" / "receipts").glob("*.json")):
91
+ try:
92
+ receipt = json.loads(path.read_text(encoding="utf-8"))
93
+ owner = receipt.get("owner") or {}
94
+ pid = owner.get("pid")
95
+ if receipt.get("state") != "running" or not isinstance(pid, int):
96
+ continue
97
+ if owner.get("process_identity") is None or process_identity(pid) != owner["process_identity"]:
98
+ continue
99
+ started = datetime.datetime.fromtimestamp(receipt["created_at"]).astimezone().isoformat(timespec="seconds")
100
+ except (OSError, ValueError, TypeError, KeyError, AttributeError, OverflowError):
101
+ continue
102
+ return f"setup apply {receipt.get('review_id')}, pid {pid}, started {started}"
103
+ return None
104
+
105
+
85
106
  @contextlib.contextmanager
86
107
  def _transaction_lock(state_root: Path, *, readonly: bool) -> Iterator[bool]:
87
108
  root = Path(state_root).expanduser()
@@ -115,12 +136,15 @@ def _transaction_lock(state_root: Path, *, readonly: bool) -> Iterator[bool]:
115
136
  if readonly and not stat.S_ISREG(os.fstat(descriptor).st_mode):
116
137
  raise TransactionError(f"unsafe instructions transaction lock: {lock}")
117
138
  try:
118
- fcntl.flock(descriptor, fcntl.LOCK_EX | (fcntl.LOCK_NB if readonly else 0))
139
+ if readonly:
140
+ fcntl.flock(descriptor, fcntl.LOCK_EX | fcntl.LOCK_NB)
141
+ else:
142
+ lock_within(descriptor, f"the instructions transaction lock ({lock})", holder=lambda: _setup_holder(root))
119
143
  except BlockingIOError:
120
- if not readonly:
121
- raise
122
144
  yield False
123
145
  return
146
+ except LockWaitExpired as exc:
147
+ raise TransactionError(str(exc)) from exc
124
148
  depths[key] = 1
125
149
  try:
126
150
  yield True
@@ -120,10 +120,14 @@ Review runs cross-family by default (`review_family`, default `cross`; `same` se
120
120
 
121
121
  ## Internal adapters and permission boundaries
122
122
 
123
- When the internal Codex wrappers are available to a configured route, `codex-helm` follows the local CLI default and launches the HELM main with `--dangerously-bypass-approvals-and-sandbox`; an explicit `--sandbox MODE` disables bypass for that run regardless of flag order. `AGENTS.md` gives root/main local Codex sessions standing ordinary-subagent authorization when the delegation gates fire. A non-Ultra HELM main sets native multi-agent off by default and instructs HELM to send tiered dispatch through the internal `codex-run` adapter, where the selected model, effort, and sandbox are pinned; native multi-agent defaults on only when the HELM main itself is explicitly Ultra. FRONTIER is instructed to run as a separate `gpt-6-astra` root that is always read-only, at max by default, Ultra for genuinely divisible complex work, or a lower supported effort when cost or latency dominates. Because the HELM main has bypass authority and arbitrary expert `-c` by design, this dispatch route is an instruction-backed, live-E2E-verified default rather than a security boundary. Keep `codex-run` as the low-level internal adapter, not as a user-facing policy boundary. Both wrappers accept `-c key=value` as an expert override, and that override may intentionally change wrapper defaults for a single run. The private installer keeps wrapper files in its immutable release rather than populating `$CODEX_HOME/bin`; a route that still names a native-home wrapper is unavailable until its adapter path is resolved.
123
+ When the internal Codex wrappers are available to a configured route, `codex-helm` follows the local CLI default and launches the HELM main with `--dangerously-bypass-approvals-and-sandbox`; an explicit `--sandbox MODE` disables bypass for that run regardless of flag order. `AGENTS.md` gives root/main local Codex sessions standing ordinary-subagent authorization when the delegation gates fire. A non-Ultra HELM main sets native multi-agent off by default and instructs HELM to send tiered dispatch through the internal `codex-run` adapter, where the selected model, effort, and sandbox are pinned; native multi-agent defaults on only when the HELM main itself is explicitly Ultra. FRONTIER is instructed to run as a separate `gpt-6.2-astra` root that is always read-only, at max by default, Ultra for genuinely divisible complex work, or a lower supported effort when cost or latency dominates. Because the HELM main has bypass authority and arbitrary expert `-c` by design, this dispatch route is an instruction-backed, live-E2E-verified default rather than a security boundary. Keep `codex-run` as the low-level internal adapter, not as a user-facing policy boundary. Both wrappers accept `-c key=value` as an expert override, and that override may intentionally change wrapper defaults for a single run. The private installer keeps wrapper files in its immutable release rather than populating `$CODEX_HOME/bin`; a route that still names a native-home wrapper is unavailable until its adapter path is resolved.
124
124
 
125
125
  `claude-run` is the Claude-side review adapter carried by the release, and it takes `--model` and `--effort` to pin the seat. Omitting either warns and dispatches anyway, matching `codex-run`: refusing outright turned "the review ran unpinned" into "the review did not run", which is the worse of the two. The honest signal is downstream instead — an unpinned dispatch can name no seat, so it emits no receipt and the method adjudicates to UNKNOWN rather than to a clean pass. Its default denies the mutating tools, which is not the OS-level sandbox its Codex twin gets — do not read the two defaults as equivalent guarantees.
126
126
 
127
+ `claude-run --profile hermetic` is the isolated route, for a call whose judgment must not carry your own instructions. Each call runs in a cell — a fresh `HOME`, `CLAUDE_CONFIG_DIR` and working directory under `--cell-root`, a directory of your own with mode 700, outside your home, with no `CLAUDE.md`, `CLAUDE.local.md`, `AGENTS.md`, `.claude/`, `.codex/`, `.mcp.json` or settings file in it or above it — with an environment built from scratch, so your `CLAUDE.md` files, skills, memory, MCP servers, hooks and settings are denied to it, and so are those in the working directory and its ancestors. The flags that deny them are `--safe-mode --setting-sources "" --strict-mcp-config --disable-slash-commands --tools ""`. Login is the subscription token (`claude setup-token`), given as `CLAUDE_CODE_OAUTH_TOKEN` or in a file named by `CLAUDE_RUN_TOKEN_FILE`; it reaches the child's environment only, never an argument or a file the adapter writes. Instructions you mean the call to have go through `--append-system-prompt-file F --declared-sha256 H`. The session is kept until the call ends, because its transcript is the only record of what the host loaded: with `REVIEW_CAPTURE_DIR` set, `claude_hermetic_evidence.py` — installed beside the adapter and found nowhere else — writes that record to `host.json` (instruction files, appended prompts by sha256, skills, agents, hooks by event, MCP servers, the requests as sent) for a gate to compare with what was declared, and the stream to `stream.jsonl`. `--use producing --tools Read --manifest DIR` grants the one tool Claude can confine to a directory, and `DIR` must be the call's working directory; nothing else is granted. Each call names the versioned `claude` executable and the version it must report (`--claude-bin`, `--host-version`); a symlink or another version is refused before the call. The flag set was verified against Claude Code 2.1.317, and the profile name and flag-set hash are recorded with every call, so a host upgrade that changes their meaning shows in the record rather than in the result.
128
+
129
+ `codex-run --capture DIR` (or `REVIEW_CAPTURE_DIR`, with `REVIEW_CALL_ID` naming the call) records what one call showed about itself: the effective context rendered beforehand with the call's own homes and overrides (`prompt-input.txt`, `instruction-sources.json`), codex's thread and turn events, the server frames and usage rows reduced to an allow-list that keeps no prompt or output text, and `host.json` and `usage.json`; the receipt then carries the call id, the capture's digest and the other evidence keys. The model that answered is visible only on codex's trace frames, which appear only when the caller sets `RUST_LOG` to open `tungstenite::protocol=trace`, `codex_otel.log_only=info` and `codex_core::responses_retry=warn`. That channel is unsupported and changes with codex-cli releases, so a capture without it, or after an upgrade that removed it, attests no model. A capture runs one codex executable (`CODEX_RUN_BIN`, else `codex` on `PATH` resolved to its versioned file) and refuses to start when its version is not `CODEX_RUN_VERSION` or when the context cannot be rendered, and it refuses a named Codex configuration profile (`-p`, or `-c profile=`), whose layered settings the rendering cannot reproduce. An inline instruction override (`-c developer_instructions=…` or `-c instructions=…`) is recorded with the hash of its text among the call's appended prompts; an override naming an instruction file is refused. Capture adds `--json` and an output file to the exec arguments and changes nothing else: stdout is still the final message and stderr still carries codex's whole stream.
130
+
127
131
  ## Review receipts
128
132
 
129
133
  **Review receipts.** A launch reports what it *projected*, because at launch no review has run — so a clean verdict without a receipt is PROPOSED, never ACHIEVED. Given `REVIEW_RECEIPT_DIR`, both adapters record what they observed of the dispatch they just performed: exit status, a hash of the packet fed in, a hash of the bytes returned, and the seat actually sent. Unset, they behave exactly as they would otherwise and write nothing. `agent-launch --fold-receipts DIR PACKET MAIN_DISPATCH_ID` folds a run into a `ReviewReceipts/v1` bundle — several passes of one method become the one record it is judged on — and `agent-launch --verify-receipts PLAN BUNDLE` adjudicates it, exiting non-zero unless every selected method verified. Adapting another tool needs no change here: call `agent-launch --emit-receipt` from your adapter and prove it conforms with `agent-launch --check-adapter SEAT -- CMD`, which is adjudicated by the same code that credits a real review. A receipt is still written by whoever ran the review, so this buys drift rather than honesty: what it stops is a reviewer that quietly never ran, returned nothing, or exited non-zero reading as a clean pass.
@@ -0,0 +1,102 @@
1
+ # agent-bios 0.20.0
2
+
3
+ Release changes relative to 0.19.4.
4
+
5
+ ## The purpose statement describes the shipped product
6
+
7
+ The product purpose described team work environments built from Instructions,
8
+ Domain knowledge and Decision memory, with the team as the unit of sharing. What
9
+ ships is a personal library of Instructions, chosen per Claude Code or Codex
10
+ session, with packages others publish. The purpose text in the README and its
11
+ Korean reference now says that. The team work-environment initiative is stopped;
12
+ its design records remain as history.
13
+
14
+ ## The session-distill driver is in the package
15
+
16
+ `session-distill/distill.py` and its modules, schemas, tables and packets ship for
17
+ the first time. The driver runs a session-distill run as declared stages: a census
18
+ of the window's sessions, their immutable copies and inventories, the readings and
19
+ the formation of candidates, the evidence checks, two judges per candidate, the
20
+ proposals and their review, the owner's review file in Korean with a faithfulness
21
+ check, the owner's decisions and their confirmation, and the close.
22
+
23
+ What this release's run produces is evidence about the window, the owner's review of
24
+ it, and a record of what the owner decided. **It changes no library file.** A
25
+ proposal that would place, correct, re-deliver or reduce instruction text is refused
26
+ by name (`RELEASE_1_NO_LIBRARY_CHANGE`), and where the evidence supports such a
27
+ change the proposal names it in its reason for the owner to read; the change itself
28
+ is the author's work by hand. The run writes the ledger it is given and, for a
29
+ periodic run, the coverage state it names, and refuses to write either, or its own
30
+ run directory, inside the instructions: under a checkout's `claude/`, `codex/` or
31
+ `ko/` trees, or in a host's home as `CLAUDE_CONFIG_DIR` and `CODEX_HOME` configure
32
+ it. Testing whether an applied change helps (stage S8) is not part of this release.
33
+
34
+ Running it still requires an agent-bios checkout. Its runbook,
35
+ `session-distill-workflow`, is an author guide and is not delivered by a packaged
36
+ install, and the launcher now withholds the Session distill preset on a packaged
37
+ install, where it was still offered.
38
+
39
+ The driver declares its dependencies in `DEPENDENCIES.md`: Python 3.12, `jsonschema`
40
+ at the version it was measured with (a missing or different one is refused by name),
41
+ `git`, `zstd` for a compressed session capture, and the Claude Code and Codex CLIs for
42
+ the calls it makes.
43
+
44
+ ## Isolated review runs
45
+
46
+ - `claude-run --profile hermetic` runs a call in a cell: a fresh `HOME`,
47
+ `CLAUDE_CONFIG_DIR` and working directory under a cell root you name, so the call
48
+ carries none of your instructions. The run records the request as sent and the
49
+ context the host loaded, and a call counts as isolated only on that record.
50
+ - `codex-run --profile hermetic` gave Codex only a temporary `CODEX_HOME`, while Codex
51
+ also reads the repository's `AGENTS.md` and your skills from `HOME`: a review run
52
+ inside a repository saw that repository's working rules and your skills. Codex now
53
+ runs with an empty temporary `HOME` and no project documents.
54
+ - `codex-run --capture DIR` records what one call showed about itself. It reads a
55
+ version-bound trace channel of the Codex CLI, so it refuses a Codex whose version is
56
+ not the one it was verified against, and every exit before Codex starts names its
57
+ code.
58
+
59
+ Installation deploys and verifies the helpers these routes load beside themselves
60
+ (`claude_hermetic_evidence.py`, `jsonl_lines.py`, `codex_frame_filter.py`,
61
+ `codex_protocol.py`, `claude_subcommands.py`, `host_platform.py`).
62
+
63
+ ## Model bindings
64
+
65
+ The Claude FRONTIER seat moves from Fable 5.1 to `claude-fable-5-2`, and Fable 5.1
66
+ leaves the launch profile's model list rather than staying beside it. The Claude
67
+ prompting guide was re-derived for Fable 5.2 before the binding moved.
68
+
69
+ ## Reliability
70
+
71
+ - Every lock the package takes waits a bounded time: it says after two seconds what it
72
+ waits for, and after thirty refuses, naming the lock.
73
+ - A child process's group is ended before the child is reaped, on every path, and no
74
+ wait on a child's output is unbounded.
75
+ - Every reader of a JSONL log, the hosts' and the package's own, reads through one
76
+ splitter from the file's bytes, so a record ends at LF or CRLF and nowhere else.
77
+ - A Codex session's activation records the rollout file the host wrote, so a session's
78
+ selection and delivery can be read from its transcript, and an installation receipt
79
+ names the installer that executed.
80
+ - Shell scripts no longer pipe a long output into `grep -q`, which under `pipefail` read
81
+ a match as a miss.
82
+
83
+ ## Upgrading
84
+
85
+ ```bash
86
+ npm i -g agent-bios@0.20.0
87
+ agent-bios install
88
+ ```
89
+
90
+ Install the exact version: right after a release, `@latest` can still resolve to the
91
+ previous one.
92
+
93
+ ## Not established by this release
94
+
95
+ No packaged install has run a session-distill run; the driver's evidence is its own
96
+ suites, run from a checkout, and a check that the packed tarball starts the driver and
97
+ imports every module it ships. A file the driver reads only once a command runs is held
98
+ by the payload check's classification of every driver file, not by a run. The driver's
99
+ refusal to write inside the instructions reads a destination as it resolves when the
100
+ command starts; a parent directory another process replaces afterwards is not held. The
101
+ Windows script route and the Claude Desktop route are not re-established by this
102
+ release.
@@ -0,0 +1,76 @@
1
+ # agent-bios 0.20.1
2
+
3
+ Release changes relative to 0.20.0.
4
+
5
+ ## Codex seats on GPT-6.2
6
+
7
+ The Codex catalogue now lists GPT-6.2 Astra and GPT-6.2 Sol as its current models
8
+ and calls GPT-6 Astra and GPT-6.1 Sol the previous generation. The shipped launch
9
+ profile's Codex column now binds:
10
+
11
+ | Seat | Codex |
12
+ | --- | --- |
13
+ | FRONTIER | `gpt-6.2-astra` · max |
14
+ | HELM | `gpt-6.2-sol` · xhigh |
15
+ | WORKHORSE | `gpt-6.2-sol` · high |
16
+ | SWEEP | `gpt-6-luna` · max (unchanged) |
17
+
18
+ The Claude column is unchanged. WORKHORSE keeps HELM's model and differs by effort
19
+ alone: the catalogue's other current model, `gpt-6.1-terra`, is described for visual
20
+ understanding and computer use rather than for that seat's coding work. The deep
21
+ reviewer that the Deep review and Session distill presets dispatch from a Claude
22
+ session is now `gpt-6.2-sol` at `ultra`. The Codex agent files and the `codex-helm`
23
+ defaults follow the same bindings.
24
+
25
+ ## The GPT prompting guide covers GPT-6.2
26
+
27
+ The guide was re-derived from the vendor's documents before the bindings moved, and
28
+ its Korean reference follows. A GPT-6.2 section states what the vendor observes on
29
+ 6.2 Astra and Sol: more concise output by default, final answers that must stand on
30
+ their own, and how to state completion and coding expectations. It also states what
31
+ changes in the API from 6.2:
32
+
33
+ - editing earlier history drops the reasoning carried after it;
34
+ - top-level `instructions` are placed after `input`, past the cache, and billed as
35
+ uncached input, so reusable instructions belong in the first `developer` message;
36
+ - `prompt_cache_options.ttl` replaces `prompt_cache_retention`.
37
+
38
+ The 6.2 models' instructions in the Codex client skip new tests unless a test is
39
+ requested, required by the repository, or needed for a specific regression, so a 6.2
40
+ run that must add tests has to say so.
41
+
42
+ The guide also drops claims its sources no longer make and corrects one they
43
+ contradict: a conversation that changed its reasoning effort mid-way can still use
44
+ automatic compaction through `context_management`.
45
+
46
+ ## Session distill
47
+
48
+ The driver's Codex pin moves to codex-cli 0.171.0, because the versioned 0.167.0 binary
49
+ it named is no longer installed after the Codex CLI's update. Its Codex seats (S6's second judge, S7b and S9b)
50
+ move to `gpt-6.2-sol`, and each seat's context window is read from the catalogue the
51
+ 0.171.0 binary carries. Two things a Codex call shows about itself have not been
52
+ observed on 0.171.0: the trace shape its capture reads, and the built-in skills the
53
+ host loads. The first Codex call of a run is that observation, and a capture that
54
+ differs is refused by name. The Codex host allowance is not measured on 0.171.0
55
+ either; only the stage that reads session windows (S3, a Claude seat) needs one, so
56
+ it holds no Codex stage back. The checkout's re-pin runbook lists these measurements
57
+ and the others a model change requires. Running the driver still requires an
58
+ agent-bios checkout.
59
+
60
+ ## Upgrading
61
+
62
+ ```bash
63
+ npm i -g agent-bios@0.20.1
64
+ agent-bios install
65
+ ```
66
+
67
+ Install the exact version: right after a release, `@latest` can still resolve to the
68
+ previous one.
69
+
70
+ ## Not established by this release
71
+
72
+ No call was made to a GPT-6.2 model for this release. The instruction-behavior
73
+ benchmark has not been re-run on the new bindings. The driver has made no Codex call on
74
+ codex-cli 0.171.0, so neither the capture's trace shape nor the host's built-in skills
75
+ are confirmed there, and its Codex host allowance is unmeasured. OpenAI's Codex documentation lists the GPT-6.2 models for
76
+ the Codex app and CLI and not for the IDE extension.
package/install.sh CHANGED
@@ -629,11 +629,15 @@ install_capability() {
629
629
 
630
630
  handle_capabilities() {
631
631
  local requested="$1" name command line
632
+ # One requested name per line, split on commas and spaces as the loop below splits them,
633
+ # so `grep -qx` reads a here-string rather than a pipe (see the claude-run check in verify).
634
+ local nl=$'\n' requested_lines
635
+ requested_lines="${requested//[, ]/$nl}"
632
636
  # Fail on a typo rather than silently installing nothing.
633
637
  local known; known=$(capability_table | cut -f1)
634
638
  local want
635
639
  for want in ${requested//,/ }; do
636
- printf '%s\n' "$known" | grep -qx "$want" || {
640
+ grep -qx "$want" <<<"$known" || {
637
641
  log "unknown --with capability: $want (known: $(printf '%s' "$known" | tr '\n' ' '))"; return 1; }
638
642
  done
639
643
  while IFS=$'\t' read -r name command line; do
@@ -644,7 +648,7 @@ handle_capabilities() {
644
648
  # the rename `--with ultracode` names the claude-backed reviewer — which needs no
645
649
  # install — while the tool the user probably meant stays missing and is only hinted
646
650
  # at further down. The request silently no-opped and install still exited 0.
647
- if [ -z "$line" ] && printf '%s\n' "${requested//,/ }" | tr ' ' '\n' | grep -qx "$name"; then
651
+ if [ -z "$line" ] && grep -qx "$name" <<<"$requested_lines"; then
648
652
  log "note: $name needs no install (it is the host CLI); nothing was installed for it"
649
653
  local installable
650
654
  installable=$(capability_table | awk -F'\t' -v me="$name" '$1 != me && $3 != "" { print $1 }' | tr '\n' ' ')
@@ -652,7 +656,7 @@ handle_capabilities() {
652
656
  fi
653
657
  continue
654
658
  fi
655
- if printf '%s\n' "${requested//,/ }" | tr ' ' '\n' | grep -qx "$name"; then
659
+ if grep -qx "$name" <<<"$requested_lines"; then
656
660
  [ -n "$line" ] && install_capability "$name" "$line" \
657
661
  || log "note: $name has no configured install line"
658
662
  elif [ -n "$line" ] && [ -t 0 ] && [ "$DRY_RUN" != 1 ]; then
@@ -814,14 +818,27 @@ cmd_install() {
814
818
  done
815
819
  codex_config_additions merge || exit 1
816
820
  deploy_file "$REPO/wrappers/codex-run.sh" "$CODEX_DIR/bin/codex-run" "+x"
821
+ # codex-run resolves its capture helper beside itself, so the helper lands in the same bin.
822
+ deploy_file "$REPO/wrappers/codex_frame_filter.py" "$CODEX_DIR/bin/codex_frame_filter.py"
823
+ # ...and the helper resolves the app-server client and its protocol check beside itself.
824
+ deploy_file "$REPO/wrappers/codex_protocol.py" "$CODEX_DIR/bin/codex_protocol.py"
817
825
  deploy_file "$REPO/wrappers/codex-helm.sh" "$CODEX_DIR/bin/codex-helm" "+x"
818
826
  # The claude-side adapter lands under CLAUDE_DIR for the same reason its codex twin
819
827
  # lands under CODEX_DIR: each is that host's, and a single shared bin would make the
820
828
  # two families' review routes indistinguishable from their install paths.
821
829
  deploy_file "$REPO/wrappers/claude-run.sh" "$CLAUDE_DIR/bin/claude-run" "+x"
830
+ # Its hermetic profile resolves this helper beside itself and nowhere else.
831
+ deploy_file "$REPO/wrappers/claude_hermetic_evidence.py" "$CLAUDE_DIR/bin/claude_hermetic_evidence.py"
832
+ # ...and that helper resolves the one JSONL splitter beside itself and nowhere else.
833
+ deploy_file "$REPO/wrappers/jsonl_lines.py" "$CLAUDE_DIR/bin/jsonl_lines.py"
822
834
  migrate_user_presets || exit 1 # must precede the deploy below, which overwrites profiles.toml
823
835
  deploy_file "$REPO/launch/agent-launch.toml" "$LAUNCH_DIR/profiles.toml"
824
836
  deploy_file "$REPO/launch/agent-launch.zsh" "$LAUNCH_DIR/shell.zsh"
837
+ # The wrapper runs the subcommand lister it finds beside itself.
838
+ deploy_file "$REPO/launch/claude_subcommands.py" "$LAUNCH_DIR/claude_subcommands.py"
839
+ # The launcher below lands alone in BIN_DIR, so the lock helper it loads by path (the shared
840
+ # bounded wait) lands beside its config, where it looks when no package is beside itself.
841
+ deploy_file "$REPO/compose/host_platform.py" "$LAUNCH_DIR/host_platform.py"
825
842
  # UI text catalogs: deploy-managed siblings of the config, one per language.
826
843
  # The launcher resolves them from the config path, so the deployed home is
827
844
  # $LAUNCH_DIR/i18n exactly as the checkout's is launch/i18n.
@@ -897,7 +914,7 @@ cmd_install() {
897
914
  info "[dry-run] project instructions-status"
898
915
  else
899
916
  local projection_log
900
- projection_log="$(mktemp -t instructions-projection)"
917
+ projection_log="$(mktemp "${TMPDIR:-/tmp}/instructions-projection.XXXXXX")"
901
918
  if python3 "$REPO/compose/instructions-state.py" project --repo "$REPO" >"$projection_log" 2>&1; then
902
919
  info "instructions-status projected"
903
920
  rm -f "$projection_log"
@@ -1054,6 +1071,8 @@ cmd_verify() {
1054
1071
  verify_match "$REPO/launch/agent-launch.py" "$BIN_DIR/agent-launch" || fail=1
1055
1072
  verify_match "$REPO/launch/agent-launch.toml" "$LAUNCH_DIR/profiles.toml" || fail=1
1056
1073
  verify_match "$REPO/launch/agent-launch.zsh" "$LAUNCH_DIR/shell.zsh" || fail=1
1074
+ verify_match "$REPO/launch/claude_subcommands.py" "$LAUNCH_DIR/claude_subcommands.py" || fail=1
1075
+ verify_match "$REPO/compose/host_platform.py" "$LAUNCH_DIR/host_platform.py" || fail=1
1057
1076
  # Evidence, never a verdict: a shadow that was repaired is the mechanism working.
1058
1077
  shell_shadow_summary
1059
1078
  # Not `whence -v`: a function redefined at preexec carries no "from FILE" annotation,
@@ -1110,6 +1129,10 @@ PY
1110
1129
  # adapter would satisfy it by never running — a deploy target whose only check skips
1111
1130
  # itself when the deploy failed is not checked at all.
1112
1131
  verify_present "$CLAUDE_DIR/bin/claude-run" || fail=1
1132
+ verify_present "$CLAUDE_DIR/bin/claude_hermetic_evidence.py" || fail=1
1133
+ verify_present "$CLAUDE_DIR/bin/jsonl_lines.py" || fail=1
1134
+ verify_present "$CODEX_DIR/bin/codex_frame_filter.py" || fail=1
1135
+ verify_present "$CODEX_DIR/bin/codex_protocol.py" || fail=1
1113
1136
  # Then WHICH version landed, because this file is on the panel's dispatch path now and
1114
1137
  # an older copy would dispatch reviews that quietly emit nothing. The earlier check
1115
1138
  # here asserted that an unpinned dispatch is refused; that guard was deliberately
@@ -1117,12 +1140,16 @@ PY
1117
1140
  # "the review did not run" — so asserting it would now fail against correct behaviour.
1118
1141
  # `--help` is the only probe that reaches no network: an unpinned run warns and then
1119
1142
  # dispatches for real.
1143
+ # The help is captured before it is matched. Piped straight into `grep -q`, the match ends
1144
+ # grep early, claude-run takes SIGPIPE writing the rest of its help, and under pipefail
1145
+ # that exit reads as "no match" (gates/check-package.sh fails on the piped shape).
1120
1146
  if [ -x "$CLAUDE_DIR/bin/claude-run" ]; then
1121
- if "$CLAUDE_DIR/bin/claude-run" --help 2>/dev/null | grep -q 'REVIEW_RECEIPT_DIR'; then
1122
- info "claude-run is receipt-aware"
1123
- else
1124
- log "claude-run predates the receipt contract — reviews through it emit nothing"; fail=1
1125
- fi
1147
+ local run_help
1148
+ run_help="$("$CLAUDE_DIR/bin/claude-run" --help 2>/dev/null)" || true
1149
+ case "$run_help" in
1150
+ *REVIEW_RECEIPT_DIR*) info "claude-run is receipt-aware" ;;
1151
+ *) log "claude-run predates the receipt contract — reviews through it emit nothing"; fail=1 ;;
1152
+ esac
1126
1153
  fi
1127
1154
  local vpy="${AGENT_LAUNCH_VENV:-$HOME/.local/share/agent-launch/venv}/bin/python"
1128
1155
  if [ -x "$vpy" ] && "$vpy" -c 'import textual' 2>/dev/null; then
@@ -1159,7 +1186,7 @@ PY
1159
1186
  # and the install-scenario harness each learned this after a failure cost an eleven-
1160
1187
  # minute re-run that came back green; verify is where a USER meets it, with no clone to
1161
1188
  # re-run from.
1162
- parity_log="$(mktemp -t verify-parity)"
1189
+ parity_log="$(mktemp "${TMPDIR:-/tmp}/verify-parity.XXXXXX")"
1163
1190
  if "$REPO/gates/check-parity.sh" >"$parity_log" 2>&1; then
1164
1191
  info "repo mirror parity OK"; rm -f "$parity_log"
1165
1192
  else
@@ -1248,8 +1275,9 @@ cmd_uninstall() {
1248
1275
  # BACKUP_DIR is set only on the manifest path above.
1249
1276
  local p
1250
1277
  for p in "$CODEX_DIR/bin/codex-run" "$CODEX_DIR/bin/codex-helm" \
1251
- "$CLAUDE_DIR/bin/claude-run" \
1252
- "$LAUNCH_DIR/profiles.toml" "$LAUNCH_DIR/shell.zsh" "$BIN_DIR/agent-launch"; do
1278
+ "$CLAUDE_DIR/bin/claude-run" "$CLAUDE_DIR/bin/claude_hermetic_evidence.py" "$CLAUDE_DIR/bin/jsonl_lines.py" \
1279
+ "$LAUNCH_DIR/profiles.toml" "$LAUNCH_DIR/shell.zsh" "$LAUNCH_DIR/claude_subcommands.py" \
1280
+ "$BIN_DIR/agent-launch"; do
1253
1281
  [ -f "$p" ] && { run rm -f "$p"; [ "$DRY_RUN" = 1 ] || info "removed $p"; }
1254
1282
  done
1255
1283
  # Skills: only the names the shipped tree carries, mirrored under each host's skills
@@ -1479,7 +1507,7 @@ cmd_onboard() {
1479
1507
  # onboarding prints a completed summary over a status file that never learned the
1480
1508
  # selection was applied. That is the state this whole change exists to remove, so it
1481
1509
  # cannot be the one still guarded by `|| true`.
1482
- record_log="$(mktemp -t instructions-record-apply)"
1510
+ record_log="$(mktemp "${TMPDIR:-/tmp}/instructions-record-apply.XXXXXX")"
1483
1511
  if ! python3 "$REPO/compose/instructions-state.py" record-apply \
1484
1512
  --requested "$sel" --outcome applied >"$record_log" 2>&1; then
1485
1513
  log "ONBOARDING INCOMPLETE: the instructions applied, but recording that outcome failed —"
@@ -1646,7 +1674,7 @@ cmd_status() {
1646
1674
  zsh_found="$(zsh_hook_locations)"
1647
1675
  if [ -z "$zsh_found" ]; then
1648
1676
  info "zsh hook absent"
1649
- elif printf '%s\n' "$zsh_found" | grep -qxF "$ZSHRC"; then
1677
+ elif grep -qxF "$ZSHRC" <<<"$zsh_found"; then
1650
1678
  info "zsh hook present $(printf '%s' "$zsh_found" | tr '\n' ' ')"
1651
1679
  else
1652
1680
  # Present and working, but somewhere this installer will neither update nor remove.