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
package/session-cost.py CHANGED
@@ -25,8 +25,17 @@ from datetime import datetime, timezone
25
25
  # Whole table re-read against the vendor pricing page on 2026-10-21. That pass added the
26
26
  # 5.5 generation and corrected `claude-sonnet-5`, which carried Sonnet 4.6's rates — it
27
27
  # had been overcharging every Sonnet 5 session by half since it was written.
28
+ # `claude-fable-5-2` added 2026-11-11 from the same page — the vendor's platform docs at
29
+ # `about-claude/pricing`, named without its URL because `gates/check-endpoints.py` forbids a
30
+ # shipped file from carrying one. Its "Model pricing" table
31
+ # reads base input / 5m cache writes / 1h cache writes / cache hits / output — NOT this
32
+ # tuple's order, so the row is reordered rather than copied across. The generation's cache
33
+ # hit is 0.025x base input, which is why it reads cheaper per cached token than Opus 5.5 on
34
+ # a dearer model. The page prices Mythos 5.2 identically; no Mythos row past `claude-mythos-5`
35
+ # is carried here, so a Mythos session reports unpriced rather than at a guessed rate.
28
36
  PRICES = {
29
37
  "claude-fable-5": (10.0, 50.0, 1.00, 12.50, 20.0),
38
+ "claude-fable-5-2": (8.0, 40.0, 0.20, 10.0, 16.0),
30
39
  "claude-fable-5-1": (10.0, 50.0, 0.25, 12.50, 20.0),
31
40
  "claude-mythos-5": (10.0, 50.0, 1.00, 12.50, 20.0),
32
41
  "claude-opus-5-5": (4.0, 20.0, 0.20, 5.0, 8.0),
@@ -89,8 +98,19 @@ def moment(ts):
89
98
  return parsed if parsed.tzinfo else parsed.replace(tzinfo=timezone.utc)
90
99
 
91
100
 
101
+ # The usage keys this report reads. The vendor calls the transcript format internal and liable to
102
+ # change between versions, so a usage object carrying none of them is a moved format, not a free
103
+ # request: it is counted and named with the host version. A key added beside these is no alarm.
104
+ USAGE_KEYS = ("input_tokens", "output_tokens", "cache_read_input_tokens", "cache_creation_input_tokens",
105
+ "cache_creation")
106
+
107
+
92
108
  def scan(path):
93
- """-> {(scope, model): {in,out,cr,cw5,cw1,turns}}, (t_min, t_max), {scope: agent_ids}
109
+ """-> {(scope, model): {in,out,cr,cw5,cw1,turns}}, (t_min, t_max), {scope: agent_ids}, drift
110
+
111
+ `drift` is what the totals leave out: `unread`, the responses whose usage object carries none
112
+ of USAGE_KEYS, `versions`, the host versions those records name, and `bad_lines`, the lines
113
+ that are not JSON.
94
114
 
95
115
  A single API response is written to the transcript several times as it
96
116
  streams, each line carrying output_tokens *so far* (e.g. 2, 2, 2, 540).
@@ -100,17 +120,22 @@ def scan(path):
100
120
  """
101
121
  best, tmin, tmax = {}, None, None
102
122
  agents = {"main": set(), "sub": set()}
123
+ drift = {"unread": 0, "versions": set(), "bad_lines": 0}
103
124
  anonymous = itertools.count()
104
125
  try:
105
126
  handle = open(path, errors="replace")
106
127
  except OSError as exc:
107
128
  print(f"session-cost: cannot read {path}: {exc}", file=sys.stderr)
108
- return {}, (None, None), agents
129
+ return {}, (None, None), agents, drift
109
130
  with handle:
110
131
  for line in handle:
111
132
  try:
112
133
  d = json.loads(line)
113
134
  except json.JSONDecodeError:
135
+ drift["bad_lines"] += 1
136
+ continue
137
+ if not isinstance(d, dict):
138
+ drift["bad_lines"] += 1
114
139
  continue
115
140
  at = moment(d.get("timestamp"))
116
141
  if at is not None:
@@ -133,10 +158,13 @@ def scan(path):
133
158
  key = (scope, ident if ident else f"anonymous-{next(anonymous)}")
134
159
  prev = best.get(key)
135
160
  if prev is None or u.get("output_tokens", 0) > prev[1].get("output_tokens", 0):
136
- best[key] = (model, u)
161
+ best[key] = (model, u, d.get("version"))
137
162
 
138
163
  agg = {}
139
- for (scope, _), (model, u) in best.items():
164
+ for (scope, _), (model, u, version) in best.items():
165
+ if not any(k in u for k in USAGE_KEYS):
166
+ drift["unread"] += 1
167
+ drift["versions"].add(version if isinstance(version, str) and version else None)
140
168
  a = agg.setdefault((scope, model), dict(inp=0, out=0, cr=0, cw5=0, cw1=0, turns=0))
141
169
  a["inp"] += u.get("input_tokens", 0)
142
170
  a["out"] += u.get("output_tokens", 0)
@@ -148,7 +176,7 @@ def scan(path):
148
176
  else:
149
177
  a["cw5"] += u.get("cache_creation_input_tokens", 0)
150
178
  a["turns"] += 1
151
- return agg, (tmin, tmax), agents
179
+ return agg, (tmin, tmax), agents, drift
152
180
 
153
181
  def cost(model, a):
154
182
  p = price_for(model)
@@ -176,8 +204,12 @@ def report(session_path):
176
204
  f"{'cache_rd':>10}{'cache_wr':>10}{'cost$':>9}")
177
205
  print(hdr); print("-" * len(hdr))
178
206
  span_min = span_max = None
207
+ unread, versions, bad_lines = 0, set(), 0
179
208
  for label, path in sources:
180
- agg, (tmin, tmax), agents = scan(path)
209
+ agg, (tmin, tmax), agents, drift = scan(path)
210
+ unread += drift["unread"]
211
+ versions |= drift["versions"]
212
+ bad_lines += drift["bad_lines"]
181
213
  if tmin:
182
214
  span_min = min(span_min or tmin, tmin); span_max = max(span_max or tmax, tmax)
183
215
  for (scope, model), a in sorted(agg.items()):
@@ -205,6 +237,15 @@ def report(session_path):
205
237
  print(f"\nwall clock: no usable timestamps | modeled total cost: ${grand:,.2f}")
206
238
  if unpriced:
207
239
  print(f"WARN unpriced models: {set(unpriced)}")
240
+ if unread:
241
+ named = sorted(v for v in versions if v)
242
+ writer = ", ".join(f"Claude Code {v}" for v in named) + (", " if named and None in versions else "")
243
+ writer += "a record naming no host version" if None in versions else ""
244
+ print(f"WARN {unread} response(s) carry a usage object with none of the keys this report reads "
245
+ f"({', '.join(USAGE_KEYS)}), written by {writer}: the transcript format has moved, and the "
246
+ f"totals above count them as zero")
247
+ if bad_lines:
248
+ print(f"WARN {bad_lines} line(s) are not a JSON record and were skipped")
208
249
  for key in sorted(tiered_seen):
209
250
  print(f"NOTE {key}: {TIERED[key]}")
210
251
  return 0
@@ -418,7 +459,9 @@ def _self_test():
418
459
 
419
460
  def check(name, got, want):
420
461
  ok = got == want
421
- print(f" {'ok ' if ok else 'FAIL'} {name}" + ("" if ok else f" got {got!r} want {want!r}"))
462
+ # A failure goes to stderr too: the umbrella runs this quietly and shows stderr alone.
463
+ print(f" {'ok ' if ok else 'FAIL'} {name}" + ("" if ok else f" got {got!r} want {want!r}"),
464
+ file=sys.stdout if ok else sys.stderr)
422
465
  if not ok:
423
466
  failures.append(name)
424
467
 
@@ -450,7 +493,8 @@ def _self_test():
450
493
  with tempfile.TemporaryDirectory() as td:
451
494
  # A version-specific cache rate must reach the public report without
452
495
  # changing the older model's rate. Run the real CLI/scan/cost path.
453
- for model, expected in (("claude-fable-5-1", "$0.25"),
496
+ for model, expected in (("claude-fable-5-2", "$0.20"),
497
+ ("claude-fable-5-1", "$0.25"),
454
498
  ("claude-fable-5", "$1.00")):
455
499
  transcript = write(td, model + ".jsonl", [
456
500
  {"type": "assistant", "message": {
@@ -465,6 +509,32 @@ def _self_test():
465
509
  "modeled total cost: " + expected in result.stdout),
466
510
  (0, True))
467
511
 
512
+ # A usage key the vendor renames reads as zero. The report names how many responses it
513
+ # could not read and the host version that wrote them; a key added beside the known ones
514
+ # is no alarm; a line that is not JSON is counted, not skipped in silence.
515
+ def cost_report(name, records, raw=""):
516
+ path = write(td, name, records)
517
+ if raw:
518
+ with open(path, "a", encoding="utf-8") as fh:
519
+ fh.write(raw)
520
+ done = subprocess.run([sys.executable, os.path.abspath(__file__), path], capture_output=True, text=True)
521
+ return done.returncode, done.stdout
522
+ moved = [{"type": "assistant", "version": "9.9.9-planted", "message": {
523
+ "id": f"moved-{n}", "model": "claude-opus-5", "usage": {"inputTokens": 10, "outputTokens": 5}}}
524
+ for n in range(2)]
525
+ code, out = cost_report("moved.jsonl", moved)
526
+ check("a renamed usage key is reported by count and host version",
527
+ (code, "WARN 2 response(s) carry a usage object with none of the keys" in out, "9.9.9-planted" in out),
528
+ (0, True, True))
529
+ code, out = cost_report("added.jsonl", [{"type": "assistant", "version": "9.9.9-planted", "message": {
530
+ "id": "added", "model": "claude-opus-5",
531
+ "usage": {"input_tokens": 10, "output_tokens": 5, "planted_new_key": 3}}}])
532
+ check("a usage key added beside the known ones raises nothing", (code, "WARN" in out), (0, False))
533
+ code, out = cost_report("bad-line.jsonl", moved[:0] + [{"type": "assistant", "message": {
534
+ "id": "fine", "model": "claude-opus-5", "usage": {"input_tokens": 10}}}], raw="{not json\n")
535
+ check("a line that is not JSON is counted", (code, "WARN 1 line(s) are not a JSON record" in out),
536
+ (0, True))
537
+
468
538
  # Claude: two requests. The first is written twice as it streams, the
469
539
  # second is a sidechain that must not be counted.
470
540
  claude = write(td, "claude.jsonl", [
@@ -542,7 +612,8 @@ def _self_test():
542
612
  check("an unmeasurable transcript reports failure, not zero",
543
613
  context_report(empty), False)
544
614
 
545
- print("\nself-test: " + (f"{len(failures)} FAILED" if failures else "all passed"))
615
+ print("\nself-test: " + (f"{len(failures)} FAILED" if failures else "all passed"),
616
+ file=sys.stderr if failures else sys.stdout)
546
617
  return 1 if failures else 0
547
618
 
548
619
 
@@ -0,0 +1,6 @@
1
+ {
2
+ "backlog": [],
3
+ "pending_events": [],
4
+ "transcripts": {},
5
+ "windows": {}
6
+ }