harness_rule_add records a candidate, and the harness gathers evidence — automatically, with no human involved — before trusting it:
Candidates are injected into the system context (under the “Provisional rules (under evaluation)” heading) — a rule must be in force to be measurable — but the agent and every reader can see they are unproven.
Replay validation — the strong path
The PandaProbe platform is passive and trace-based: it scores traces a session already produced, so nobody can re-score the past “as if the rule had existed”. Counterfactual evidence requires re-running the scenario — and only you can re-run your agent. That is the replay function:ReplayValidator:
- Selects the newest failing cases whose signatures match the candidate (up to 3), plus up to 2 protected
wincases to catch collateral damage. - Renders the current rules — candidate included — and calls your replay function per case, sequentially and time-bounded (
replay_timeout_s). - Scores each returned session directly through the evaluator (never through the live turn pipeline).
- Promotes iff the targeted metric improved past
rule_promote_marginon a failing case and no case — failure or win — regressed pastrule_regress_marginon any metric. Otherwise retires, with the exact reason journaled.
Forward trials — the automatic fallback
Without a replay function, nothing breaks and nothing is silently faked: the fallback is announced once (log + avalidation journal event) and validation turns statistical.
- Baseline, captured at add time: the fraction of recently-journaled sessions whose notices matched the rule’s metric family (
breach:/relative:/trend:/percentile:on the rule’s metric). With no history the baseline is1.0— the rule was authored against a live failure, so assume it was firing. - Trial: every handled report — healthy or alerting — enrolls its session (up to
rule_trial_min_sessions, default 5, distinct sessions) and records whether that session showed the target condition while the candidate was in force. - Verdict: promote when the trial breach rate is
0, or improved on the baseline by at leastrule_promote_margin; otherwise retire.
The baseline denominator only sees sessions that journaled an incident, which biases it high — making the forward trial lenient about promotion, never about retirement. Replay remains the strong evidence path; wire one if you can.
How validation runs
You never call the validators yourself in normal operation. The hook feeds every handled report into the validation engine and kicks a single-flight background round — validation never blocks a turn, never touches the live evaluation bookkeeping, and any failure inside it degrades to a log line. For tests, scripts, and deterministic pipelines:Observing the lifecycle
Every transition is journaled with its evidence, and the agent can ask directly:harness_reflect additionally returns recent rule_promote / rule_retire events, so the agent’s reflection cycle learns which kinds of rules survive validation.
Configuration
| Knob | Default | Meaning |
|---|---|---|
rule_validation | true | The candidate lifecycle. false restores add→active (pre-v0.6 behavior). |
rule_trial_min_sessions | 5 | Distinct live sessions a forward trial observes before a verdict. |
rule_promote_margin | 0.05 | Minimum improvement of the targeted metric to promote. |
rule_regress_margin | 0.05 | Maximum tolerated drop on any other case/metric. |
replay_timeout_s | 300 | Hard bound per replay invocation — a hung replay degrades to inconclusive, never wedges validation. |

