# WO-03 — Finite policy providers and verified workflow replay

Status: in progress. Maps to source phases 3–4.

Define a provider interface with compact symbolic state, legal keyed choices,
mandatory observation/abstention, typed response validation, cancellation and
bounded latency. Keep native option probabilities separate from confidence
surrogates; no calibration claim follows from wire compatibility.

Implement deterministic baseline and adapters only against checked primary
contracts. Model/provider failures return bounded abstention or recovery, with no
hidden endpoint/model/device fallback. HTTP test fixtures perform no inference.
All chosen actions pass through the same state/effect/authority guard.

Compile workflow fragments only from verified steps. Resolve semantic targets
again on replay, require expected effects and current task authority, invalidate
drift, preserve idempotency and stop/pause/cancel. Record bounded redacted traces;
dry-run/shadow mode cannot actuate. Do not train positives from unverified actions.

Tests: unknown/duplicate IDs, malformed probabilities, stale revision, endpoint
failure/timeout/cancel, secrets redaction, confidence-versus-permission, ambiguous
workflow target, changed scope, replay after UI drift, interrupted multistep task,
and recovery without a per-click planner call. Model quality, comparative latency,
Qwen planning and live Moondream grounding are gated by WO-04, not mocked results.

## Persistent implementation (2026-10-12)

`packages/execution/src/rapid-computer-use/` now contains the shared typed
contracts, finite controller, System One wire adapter and deterministic baseline,
host-owned structured planner, verified workflow compiler/replayer, and evidence
event conversion. Action arguments/effects are included in idempotency and exact
host authority identities. Unknown actions, stale targets, concurrent dispatch,
unverified results and cancellation cannot silently become successful inputs.

The planner accepts the already selected host inference callback; it does not
load or select models. A host goal verifier is required for task completion.
Plans/recovery/action counts are bounded. Workflows are compiled from host
verified outcomes, re-resolve semantic targets and require current task authority.
Shadow comparison and dry-run do not execute actions. Raw confidence is not
treated as an option probability or permission.

The initial persistent core suite passed 46 tests and execution typecheck.
Subsequent integrated verification is recorded in WO-05. System One family names
describe wire adapters, not measured model quality or a deployed service.
Live Moondream, model comparisons, calibrated selection and production planner
configuration were open gates at this initial checkpoint; subsequent measurements
are recorded in WO-04 and the host integration below.

## Persistent workflows and trace playback

`UiWorkflowStore` writes only workflows compiled from verified host outcomes,
using bounded atomic owner-only files and a host-selected directory. Reload
requires the separately retained scope/revision pin, validates every step, and
rejects corrupt data, unknown fields, stale handles and path/link substitutions.
Replay resolves current semantic targets and uses current controller authority.

`UiTraceRecorder` snapshots legal choices before execution and cross-checks the
host result. It keeps dispatch uncertainty explicit and rejects repeated
acknowledgements as new positives. Bounded redacted features, provenance, costs
and outcome digests form a chained archive; field payloads, receipt paths and
known secret labels are omitted. `UiTraceStore` verifies the host's expected
archive revision. `playbackUiTrace` has no executor and bounds even a provider
that ignores cancellation. A file hash detects corruption; it does not grant
permission or establish independent training-label provenance.

The new persistence/trace suite passes 57 tests, including restart/reload,
scope drift, changed authorization, tampering, cancellation, duplicate outcomes,
Unicode-heavy state bounds, and no-input shadow replay. These are exported host
APIs; the current bot does not automatically deploy a planner or enable persistent
workflow caching. POSIX storage is implemented; Windows ACL-backed persistence
and automatic deployment into the active bot remain explicit integration work.

The combined core, visual, effect-receipt, persistence and trace run passes
232/232 tests. All eleven workspace projects build. Scoped coverage for the
three persistence/trace modules is 100% statements, lines and functions, and
84.88% branches; the repository-relative reports are in
`computer-use/evidence/persistence-coverage-20261012/`. These are offline host
contract checks, not live model-quality or all-platform measurements.

## Bounded local host sessions

`omnius computer-use TASK.json` and `runConfiguredHostUiSession` now connect the
planner, finite policy, semantic tools, trace recorder and optional workflow store
through a fresh runner-owned task. Operator scope, exact arguments/effects and
terminal predicates are supplied to planning and independently enforced at input.
Configured model requests use unique request IDs and current host preflight;
the command does not load models or borrow an active bot's cancellation owner.

All operations use ordinary admission and evidence settlement. Direct tool
validation is fenced across task ownership changes. A verified action renews
one observation opportunity; failed, repeated or unknown effects cannot renew it.
Terminal verification binds fresh observation/outcome/effect digests and must
commit the terminal receipt and completed objective ledger before success is
returned. Browser cleanup closes only the session's owned browser.

The shipped local form passes both real built-CLI success and SIGINT cancellation
checks in an isolated headless browser. The final integration run passes 477
checks across CLI, orchestrator and execution, with all eleven workspace packages
building. Live Qwen planning is a separate WO-04 measurement; fixture success
does not establish model planning quality. See
[HOST_SESSION.md](../../../computer-use/HOST_SESSION.md) for usage and limits.

The first live configured attempt exposed a top-level response mismatch and
stopped with no form input; its evidence remains in WO-04. The repair sends an
explicit native JSON schema, constrained by the operator's finite grants, and
retains bounded host-only response diagnostics when requested. Exact argument
presence is preserved, empty identities cannot act as wildcard targets, and
plain progress explanations replace implementation verb names. These guards
passed the subsequent build and affected checks recorded in WO-05; a live retry
is recorded separately.

## Actual finite policy in the visible browser

The configured policy now receives the trusted task goal/current step and exact
candidate arguments/effects alongside bounded semantic state. Relevant intent
cannot be silently truncated. Strict configured hosts bind the reply's model and
revision, preserve native option probabilities and retain physical HTTP receipt
hashes. Trace provenance records the decision model's revision.

The live headed fixture used one Qwen plan and four actual Kev selections, all
matching the four dispatched opaque action IDs. Moondream supplied the sole
pixel-only target, whose capture/geometry stayed bound to the verified click.
All four trace events validate; eleven progress explainers and a committed
terminal receipt agree with observed completion. The terminal report correctly
renders its independent host check. Model probabilities did not grant authority.

This verifies the explicit local host path with the selected models. It does not
promote Kev across applications or automatically replace the active Telegram
agent. WO-04 retains measured timing, startup failure and cleanup evidence;
WO-05 records the source/test delivery.
