How a Replay Works

[ Recorded case ] ----> [ Reconstruct inputs ] ----> [ Diverge & recompute ] ----> [ Honest result ] case_event_log variable values AS THEY only the CHANGED rules determinate delta, (the ground truth, WERE at each decision are re-evaluated, from or estimated (labelled), never recomputed) (lineage replayed to the the first node the or excluded with the node's timestamp) change bites reason > never guessed

The baseline is recorded reality — it is never simulated. Only the candidate configuration's changed rules are re-evaluated, and only from the first point they alter behaviour. Everything upstream is copied verbatim from the record.

The Determinism Split

You cannot re-run a human. HxReplay classifies every node instead of pretending:

Node classTreatment
DeterministicWHEN / routing rules, threshold auto-approvals. Recomputed under the candidate config with the production rules engine, from reconstructed decision-time inputs.
ExogenousHuman approvals, manual edits, external responses. Held fixed from the record. Timestamps are never shifted — a skipped stage shows as elided wall-clock time, not a fabricated shorter timeline.
ElidedWork the change removes, e.g. a review a new auto-approve skips. Struck from the counterfactual trace; the removed manual time is reported.
IndeterminateA path that never happened becomes reachable; an input that cannot be proven. Excluded from hard metrics, with the reason. Nothing is ever silently guessed.
The trust number. Every cohort result reports its determinacy coverage (e.g. "4,812 of 5,000 cases fully determinate; 188 excluded") plus an exclusion-reason breakdown — and a bias caveat: excluded cases skew toward exactly the cases the change affects most.

Decision-Time Inputs, Proven

A replay is only as good as its inputs. HxReplay rebuilds each variable's value at the instant of each decision by replaying the data-lineage record, and reports a per-field coverage status with every result:

CoverageMeaning
lineageReconstructed from the write history — the value the decision actually saw (a mid-case edit is honoured node by node).
constant_redactedpii/secret field. Production rules read these as *** through the redacting façade, so replay feeds the same constant — identical behaviour, and no PII ever enters the engine.
absentThe field verifiably did not exist yet at that instant (deterministic).
unknownHistory cannot be proven (pre-capture edits, no lineage) — the case is excluded, never guessed.

Two Modes

Estimating the Excluded (opt-in)

When a change makes a never-recorded path reachable, there is no human outcome to borrow. With Estimate excluded cases enabled, HxReplay walks a substitution ladder — and labels everything it produces:

  1. Recorded policy alternative — every AI decision already records what policy would have done; if one matches the node, it is substituted.

  2. Authored stage default — an explicit default_outcome on the stage in the case-type definition (authored, never inferred).

  3. Monte-Carlo — sampled from the historical remaining-cycle and outcome distribution of other same-type cases through that stage (tenant-scoped, seeded per case so runs are reproducible).

  4. Still nothing → the case stays excluded.

Estimated is a separate class. Estimated cases appear in their own labelled block and never enter the hard determinate metrics, the coverage ratio, or the cost figure.

Cost Delta (Case Costing)

Configure a tenant rate card (default hourly rate for manual work) and every replay result gains a cost block: baseline cost, counterfactual cost, and the headline — "this policy would have saved $X." The basis is stated on the result: manual recorded activity time × rate; automated work costs 0; determinate cases only. A per-case automatic time rollup (total / manual / auto, per stage and activity) comes free from already-recorded event durations — zero new capture.

Timers, Timesheets & Billing Export

Wall-clock durations measure elapsed time; billable effort is captured explicitly. A worker starts and stops a timer on the case they're handling (one running timer per person per case), or logs a timesheet entry after the fact — with an optional role so the right rate applies, and a billable flag for non-chargeable work.

Running a Replay in Studio

  1. Open Studio > HxReplay. On Single Case, paste a case id, edit the candidate rule JSON (or reference an HxBranch rule branch), and click Replay. Review the determinacy pill, the side-by-side metrics, the trace, and the input-coverage panel.

  2. On Cohort, pick the case-type, a date window and a case cap, then Run cohort replay. Refresh to see coverage, divergence rate, cycle-time stats, elided manual work — and the cost card if a rate card is configured.

  3. Reviewing a rule change in HxBranch? Click Simulate on history on the branch review screen — the branch arrives prefilled on the Cohort tab, so the merge decision ships with replay evidence attached.

  4. Set the rate card on the Runs tab (admin) to unlock cost deltas.

API Reference

# Single-case replay (inline; returns the side-by-side result + trace)
curl -s -X POST http://localhost:8200/api/v1/hxreplay/runs \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"kind":"single","case_id":"...","estimate":false,
       "candidate":{"rules":[{"id":"auto-approve","rule_type":"when",
         "definition_json":{"conditions":[{"field_path":"claim.amount","operator":"lt","value":500}],
                            "actions":[{"action_type":"auto_approve"}]}}]}}'

# Cohort replay (background; admin capability replay.run)
curl -s -X POST http://localhost:8200/api/v1/hxreplay/runs \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"kind":"cohort","branch_id":"...","estimate":true,
       "cohort_filter":{"case_type_id":"...","from":"2026-04-01","max_cases":500}}'

# Poll a run / fetch per-case results
curl -s http://localhost:8200/api/v1/hxreplay/runs/{run_id} -H "Authorization: Bearer $TOKEN"
curl -s http://localhost:8200/api/v1/hxreplay/runs/{run_id}/results/{case_id} \
  -H "Authorization: Bearer $TOKEN"

# Rate card (admin; powers the cost delta) + per-case time rollup
curl -s -X PUT http://localhost:8200/api/v1/costing/rate-card \
  -H "Authorization: Bearer $TOKEN" -d '{"hourly_rate":85,"currency":"USD"}'
curl -s http://localhost:8200/api/v1/costing/cases/{case_id}/time \
  -H "Authorization: Bearer $TOKEN"

Security & Integrity