# Evaluating the proactive layer

Research plan for a future paper. Not implemented.

## Contributions

|  | Contribution | Prior work lacks |
| --- | --- | --- |
| C1 | Git-as-truth event sourcing and [replay as policy test](https://fzkuji.github.io/OpenProgram/docs/reference/design/proactive/_research_archive/replay.html): decisions are a pure fold over the stream | Claude Code hooks and AgentSpec intercept immediately, with no event sourcing or offline replay |
| C2 | Framework-enforced interruption budgets and dismiss-triggered circuit breakers ([execution model](https://fzkuji.github.io/OpenProgram/docs/reference/design/proactive/execution-model.html) §5) | Hooks are open-loop: no feedback or self-muting |
| C3 | Lazy L2 inference written back as derived events ([events and state](https://fzkuji.github.io/OpenProgram/docs/reference/design/proactive/events-and-state.html) §4) | Inference that becomes recorded data reproducing the result |

- The two channels (synchronous gate, asynchronous observer) are not a contribution: they follow admission webhooks versus controllers. Present them as a design decision, with agent-specific evidence: measured 10 ms p99, fail-closed incident analysis, gates applying through sub-agent bypass.
- PRL, an unpublished internal design, is appendix motivation, never a baseline: reviewers cannot check it, and it was never implemented.

## Related work to address

| Work | Relationship |
| --- | --- |
| Claude Code hooks `PreToolUse` (allow, ask, deny) | The gate lane looks like a reimplementation; the gate-only baseline must compare |
| AgentSpec (arXiv 2503.18666), runtime enforcement | Gate semantics, no C1 or C2 |
| Horvitz 1999, interruption-cost literature | Predecessors of budgets and feedback; compare breaker thresholds with expected utility |
| ProactiveBench (arXiv 2410.12361) | Annotated proactive evaluation: use it, extend it or justify why not |
| Levels of automation | Explain why autonomy levels are outside the contribution |

## Experiments

Two weeks of one author's own use is anecdote: self-written policies, Hawthorne effects, 20–50 events.

| Experiment | Design |
| --- | --- |
| Large-scale replay | Map thousands of public trajectories (SWE-bench, SWE-agent, OpenHands) to the Event schema. At least two annotators on would-have-fired; report precision and Cohen's kappa |
| Recall | Independently annotated should-have-fired set; [replay cannot show false negatives](https://fzkuji.github.io/OpenProgram/docs/reference/design/proactive/_research_archive/replay.html#recall) |
| Human deployment | 8–12 developers, 1–2 weeks each. Derive session count for power from the expected event rate |

## Baselines

| Baseline | Description | Why |
| --- | --- | --- |
| prompt-only | The three policy intents in the system prompt, at zero runtime cost | The most consequential: at similar acceptance the runtime layer has no rationale |
| no-proactive | Layer off | Lower bound |
| gate-only | Gate lane only, roughly Claude Code hooks | Isolates observers and feedback |

## Metrics

| Metric | Measure |
| --- | --- |
| TestGapWatcher (primary) | Share of triggered modules that actually gain tests; their later bug rate |
| UnvalidatedCompletionNudge (primary) | Share of accepted suggestions that actually reveal regressions |
| Accept or dismiss (auxiliary) | Confounded by wrong advice, timing, prior knowledge, reflexive dismissal |
| Breaker sensitivity | Muting and missed-intervention curves for N∈{2,3,5}. Justify a counter over expected utility: no calibrated cold-start data |

## Supporting evaluations

- L1 and L2 inference separately: 100–200 annotated examples each for path-prefix → `touched_modules` (error-prone in monorepos), `claimed_completion` and similar; report accuracy separately.
- When policy precision is poor, separate state errors from decision errors.
- Ablations: no breaker; all-synchronous or all-asynchronous; L1 only. Measure precision loss and added latency. Added turn latency from synchronous observers supports the two channels.
- L2 cost: dollars and latency for at most two inferences per turn, against prompt-only.

## Dataset release

Replay and annotations as a dataset: opportunity taxonomy, two annotators, fire and no-fire cases, should-have-fired set. Apply the redaction schema first ([threat model](https://fzkuji.github.io/OpenProgram/docs/reference/design/proactive/_research_archive/threat-model.html) §5: events contain secrets and private code). Release augmented-mode L2 caches and model fingerprints to reproduce the annotation set, not the inference.
