# Delivery reliability plan

## Scope

Align omp-spt with spt-core's published busy/idle injection contract without duplicating core custody. Listener events surface immediately through OMP's native message API; active-only traffic surfaces independently through authenticated polling at each active context boundary. Established endpoints keep local OMP work alive while communications recover.

## Decisions

- Declare `hook` injection for activity and idle delivery.
- Treat `before_agent_start` as the busy transition and `ctx.isIdle()` as steady-state truth.
- At every active `context` boundary, publish busy and then run `api poll --include-deferred`; inject non-empty stdout as model-only context.
- Keep listener and poll delivery independent. Do not batch, reorder, persist, or acknowledge above spt-core.
- Retry listener recovery indefinitely with capped backoff. State and poll failures preserve the cyan endpoint identity and append warning-styled ` · comms recovering...`; they never shut down an established OMP session.
- Preserve explicit activation failure before the endpoint binds.
- Use the existing 15-second command deadline.

## Public-contract limitation

The published listener and poll surfaces are destructive drains without receipt or acknowledgment operations. omp-spt does not add a second durable spool. A process failure after spt-core emission and before OMP consumption remains a core contract gap.

## Tasks

1. Update scope, hazard, ADR, manifest, and requirement wording to the agreed ownership and recovery contract.
2. Refactor extension state publication, health rendering, listener recovery, and context polling.
3. Add focused tests for injection declaration, prompt-start busy publication, active-only polling, model-only poll context, degraded recovery, independent listener delivery, and nonfatal listener exhaustion.
4. Run targeted tests, full deterministic gates, traceability, review, and live endpoint smoke scenarios.
5. Bump the adapter version, build the three release helpers, package `adapter.spt`, publish the GitHub release, update the installed adapter, and smoke-test the published version.

## Gate

`node --test tests/omp-extension.mjs`, `bash ci/run-gates.sh`, `traceable-reqs check`, release artifact validation, and live fresh-endpoint delivery smoke tests all pass. The published adapter version and GitHub release tag agree.
