Discover alternative contexts

ithrl alternatives searches for up to two smaller contexts that preserve a fixed behavior. When two are selected, each retains a context item the other removes, and their reconstructed inputs differ. This is structural distinctness; it does not establish different meanings or causes.

Install ithrl[alternatives] or ithrl[all]. The workflow has provider-free validation. Native Codex and Copilot alternatives remain unqualified; existing reduction or comparison qualification does not establish support for this workflow. The local walkthrough requires Linux with atomic no-replace rename support for private plan and result publication.

Prepare a local plan

First follow the provider-free comparison setup and fake profile export. Keep its ithrl-compare-demo/case, empty protected ithrl-compare-demo/original directory and private ithrl-compare-demo/source-profile.json. No comparison execution is required: the saved profile supplies execution facts, not observations or starting context selections.

Prepare a new private plan with explicit preservation settings and resource ceilings:

ithrl prepare alternatives ithrl-compare-demo/case \
  --profile ithrl-compare-demo/source-profile.json \
  --output ithrl-compare-demo/alternatives-plan \
  --margin 0.2 --alpha 0.05 --original-samples 20 --candidate-samples 20 \
  --seed 1 --freshness 3600 --max-provider-calls 0 --max-wall-time 1000 \
  --format json

Preparation writes alternatives-plan/profile.json. The report shows the catalog size, unedited original reference, optional candidate background, maximum attempts, conservative call and runner-time estimates, and the declared ceilings. Preparation starts no harness, detects no credentials and collects no observations. structurally-prepared; native-admission-unchecked describes a draft, not permission or qualification for native execution.

Inspect the plan without creating a run or opening the observation database:

ithrl alternatives discover ithrl-compare-demo/alternatives-plan --dry-run --format json

The example settings exercise a deterministic fake runner. They are not a general sample-size or wall-time recommendation. A budget that admits the workflow does not guarantee a useful result.

Discover, review and confirm

  1. Run bounded discovery and postselection calibration:

    bash ithrl alternatives discover ithrl-compare-demo/alternatives-plan \ --observation-store ithrl-compare-demo/alternatives-observations.sqlite --format json

    The command calibrates the original, explores whole-record removals, freezes up to two contexts and calibrates each selected context against fresh original observations. Successful discovery stops at phase: review; final confirmation has not started. A stopped or interrupted run keeps its recorded progress and charges. The report supplies run_id. Use a fresh private observation store outside the source case, plan directory and protected workspace; its path stays frozen for continuation.

  2. Replace RUN_ID below with that identifier and inspect the saved evidence:

    bash ithrl inspect alternatives ithrl-compare-demo/case/.runs/RUN_ID --format json

    Review the selected count, retained and removed context counts, calibration results, declared budgets and actual, additional possible and pending provider calls. The fake example has zero provider calls. Discovery screens and calibration establish no confirmed preserving member.

  3. Open the frozen family's final confirmation explicitly:

    bash ithrl alternatives confirm ithrl-compare-demo/case/.runs/RUN_ID --format json

    Every selected member receives its own fresh original and candidate samples. No original observations are shared between members. Members run in their frozen order under one common confirmation clock. Confirmation neither changes the selected contexts nor searches for replacements. A complete collection reaches phase: complete; inspect the per-member confirmed values to determine which preservation bounds passed. The bundled example completes with one confirmed reproducer and zero provider calls; it does not demonstrate a pair of preserving alternatives.

  4. Inspect one member or the complete private snapshot:

    bash ithrl inspect alternatives ithrl-compare-demo/case/.runs/RUN_ID --member 1 --format json ithrl inspect alternatives ithrl-compare-demo/case/results/RUN_ID.json --format json

    Members are fixed integer slots 1 and 2; a nonexistent slot is refused. Inspection reads the published snapshot without starting a harness or opening the observation database.

Configure an investigation

Use a saved comparison profile with --profile. Alternatively, use --preflight RECEIPT --experiment EXPERIMENT only when the exact resolved experiment associated with that receipt was already saved. The receipt requirements also apply here. Neither source supplies historical sample credit. The target, execution plan, source case, fixed triggering input and original workspace protection remain bound to the plan.

Required statistics and budgets have no implicit values. Pass them explicitly as above, or save the following private TOML file and provide it through --settings SETTINGS:

margin = 0.2
alpha = 0.05
original_samples = 20
candidate_samples = 20
seed = 1
freshness_seconds = 3600
max_proposals = 32
screens_per_branch = 4

[limits]
max_provider_calls = 0
max_wall_time_seconds = 1000
inter_attempt_delay_seconds = 0

Explicit CLI settings override their TOML counterparts. The per-attempt timeout comes from the recorded execution plan; settings cannot change it. --inter-attempt-delay applies one global pause across child runs and defaults to zero. Future pauses count toward admission and freshness.

Discovery examines at most 32 structural proposals, including invalid and duplicate ones, and collects at most four three-per-arm screens in each of two branches. TOML can lower these ceilings. Pure reconstruction refusals consume proposal capacity without model requests. This bounded traversal can miss preserving contexts; it establishes neither exhaustive coverage nor minimality.

With screen ceiling s, original confirmation target O, candidate target C and fixed maximum family size two, the conservative attempt ceiling is:

3 + 12*s + 2*(6 + O + C)

It reserves initial calibration, both branches, postselection calibration and confirmation for both possible members. Provider-call bounds come from the saved execution profile. Runner time includes the shared cleanup allowance; the wall-time ceiling covers the complete family. All final blocks must fit their common opening time and freshness window. Admission refuses insufficient call, time, freshness or private-evidence capacity before collection.

Freeze an optional paragraph background

--selection SELECTION accepts a private ContextSelection containing one source-bound paragraph-removal edit and no whole-record removals. Obtain eligible fields and section IDs with ithrl inspect sections CASE; the selection guide describes the descriptor. The edit stays fixed on every discovered and selected candidate. Discovery cannot remove its edited record. The reference always remains the full, unedited original, so preservation concerns the combined paragraph and whole-record intervention.

Saved reduced contexts, arbitrary text appends, tool output span edits and repair grading are outside this workflow. A saved selection grants no preserving status and supplies no samples.

Interpret preservation

Calibration requires at least two matches among three valid observations in each applicable arm. The initial original check has three original observations; postselection calibration has three fresh original and three candidate observations per member. Calibration and discovery never enter final confidence bounds.

For member j, preservation concerns p(candidate_j) - p(original_j) >= -margin. The method uses one-sided exact Clopper–Pearson bounds with tail error alpha / (2 * 2) for each candidate lower and original upper bound. A member confirms when their difference is at least -margin. The maximum family size stays two even when one member is selected; unused error allocation is not reassigned.

Bounds require independent, stationary valid Bernoulli attempts within each arm and fresh confirmation independent of discovery. The family allocation bounds false advertised preservation claims without requiring independence between members. Operational errors stay outside behavioral denominators and can leave collection incomplete; they do not become nonmatches. Known reported-model mismatches receive no sample credit.

No member is promoted until every selected member has complete, archived, eligible confirmation and passing postselection calibration. All member calibration must finish before any final confirmation attempt. The report distinguishes confirmed, partial and unresolved: confirmed: false with a bound means preservation was not established by complete evidence; confirmed: null means the family conclusion is unavailable. Neither establishes behavioral loss. Describe two confirmed members as structural alternatives. One confirmed member is a single reproducer. Neither result establishes semantic diversity, historical cause, a minimal context, or preservation after combining the members' removals.

The design and sensitivity study explains the cost and power limits. Choose the margin and sample counts before exploration; do not relax them after seeing confirmation.

Resume and retain private evidence

To continue an interrupted phase, use its canonical run directory:

ithrl alternatives resume ithrl-compare-demo/case/.runs/RUN_ID --format json

Resume keeps the frozen case, profile, contexts, store, budgets and phase. At review, it leaves confirmation unopened; only confirm opens that gate. Once confirmation is open, resume can continue it. It does not redispatch unresolved attempts or repeat completed confirmation. Changed source, execution or implementation identities require a new run; preserve the old evidence instead of editing its identities or discarding charges.

The store must remain the same private database file; replacing it with another file refuses continuation. Preparation and inspection perform no database recovery. An active continuation can let SQLite recover its interrupted rollback journal after the stored file identity and private layout have been verified, under the parent and store locks. This neither initializes an empty file nor grants sample credit to an unresolved dispatch. Native execution still requires its explicit acknowledgment; completed and stopped runs perform no recovery.

A hot store without a bound alternatives run cannot be recovered by this workflow. Preserve the private database and its journal for investigation; do not delete the journal or edit saved identities. Start discovery with a new private store outside the case, plan and protected workspace. Keep the old evidence and conservative charges separate; the new run imports no sample credit from that store. This is a new experiment, not continuation of the interrupted one.

The canonical parent lives at CASE/.runs/RUN_ID/alternatives-state.json; child sampled state and observations remain authoritative for dispatch and execution. CASE/results/RUN_ID.json is a private, atomically updated snapshot containing the parent, child progress and resolved observations for offline interpretation. The observation store remains at its recorded private location. Keep all artifacts private: profiles and snapshots contain full execution settings, source paths and edit descriptors. Share reviewed summaries rather than these files.