Files
OBLITERATUS/obliteratus/experiments/map_cli.py
Joseph MaglyandClaude Opus 5.5 7d5dee7630 feat(experiments): causal targeting map across token scopes and doses
Add the causal targeting map (F13): measure a dossier estimate's
controlled-intervention effects across a declared grid and show benefit,
side effects, uncertainty and restoration together.

- Versioned map spec (sites x token scopes x doses, operation, decision
  dose, cell budget). Each (site, token scope) row runs through the
  existing harness with the grid's doses as its ladder, so every cell
  has its own matched control, restoration check and replay. Results are
  stored by path and sha256 and cells are rebuilt (and verdicts
  recomputed) on every read.
- Only the estimate's own site runs; other sites are recorded as
  untested "exploratory (transferred coordinate)" cells that can never
  attach to a dossier.
- Holm correction across tested decision-dose cells. A cell reads
  supported only when the recomputed harness verdict is supported and
  its adjusted p < 0.05; other doses are descriptive; untested cells
  carry a reason and no number.
- Cells report difference, interval, rates, collateral and invalid-output
  status, restoration, a link to the comparison and failure example ids.
- Resumable: completed rows are reused only on matching row and result
  digests; a different spec is refused.
- Candidate re-ranking across a dossier's maps, scoped to tested
  conditions; an Explorer heatmap per token scope.
- `obliteratus experiments map run|show|attach|rank` and a Python API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 20:28:28 -05:00

43 lines
2.4 KiB
Python

"""``obliteratus experiments map run|show|attach|rank`` (causal targeting maps)."""
def add_map(commands):
parser = commands.add_parser(
"map", help="Causal targeting map: controlled interventions over sites x token scopes "
"x doses for one ready dossier estimate")
sub = parser.add_subparsers(dest="map_command", required=True)
run = sub.add_parser("run", help="Run (or resume) a map spec; maps go to "
"<run>/maps/<digest>/map.json")
run.add_argument("spec", help="Causal map spec JSON file")
run.add_argument("--run", required=True, help="Run directory holding the dossier")
run.add_argument("--max-cells", type=int, help="Override budget.max_cells (not part of the "
"map identity)")
run.add_argument("--resume", help="Existing map.json to resume; refused for another spec")
show = sub.add_parser("show", help="Re-verify a stored map against its results")
show.add_argument("map", help="map.json")
attach = sub.add_parser("attach", help="Attach one decision cell's controlled comparison "
"to its dossier")
attach.add_argument("map", help="map.json")
attach.add_argument("--cell", required=True, help="Cell id, e.g. layer.0|last_token|6.0")
attach.add_argument("--dossier", required=True, help="Dossier JSON file")
rank = sub.add_parser("rank", help="Re-rank estimates of one dossier by measured results")
rank.add_argument("maps", nargs="+", help="map.json files of one dossier")
rank.add_argument("--dossier", help="Dossier JSON (lists ready estimates without a map)")
def run_map_command(args):
from obliteratus.experiments import causal_map
if args.map_command == "run":
return causal_map.summary(causal_map.run_map(args.spec, args.run,
max_cells=args.max_cells,
resume_from=args.resume))
if args.map_command == "show":
return causal_map.summary(causal_map.load_map(args.map))
if args.map_command == "attach":
return causal_map.attach_cell(args.map, args.cell, args.dossier)
from obliteratus.analysis.causal_map_rank import rank_candidates
return rank_candidates([causal_map.load_map(p) for p in args.maps], dossier=args.dossier)
__all__ = ["add_map", "run_map_command"]