# PRD, architecture, and plan delta

## Requirements

1. Write `claude_reasoning_guard.json`, `codex_reasoning_guard.json`, and
   `opencode_reasoning_guard.json` under `.prd_plugin/local/`.
2. Retain bounded session records per host; a new session must not overwrite
   prior session evidence.
3. Backfill Claude only from trusted assistant records whose role is
   `assistant` and whose content block type is `text`.
4. Keep Codex `summary_text` ingestion and apply live, recent-X, and full
   semantics consistently.
5. Migrate the legacy single report safely and idempotently.
6. Show readable provider/surface/session history in status and UI; distinguish
   Codex Desktop, Codex CLI, Claude Desktop, Claude CLI, OpenCode, and an honest
   unknown fallback; include the latest observed model and effort for every
   retained session while keeping session IDs secondary.
7. Preserve local-only, atomic, bounded, sanitized, model-free, network-free,
   replay-safe behavior.
8. Verify with fixtures and an old Claude transcript without starting Claude.

## Architecture

Add a host-ledger envelope around the existing session-state kernel rather than
duplicating the classifier. Host adapters normalize eligible historical text
records into the existing summary processing path. One lock protects migration
and host-ledger writes. A single allowlisted surface field belongs to each
session record alongside latest model and effort; these fields do not create
more ledgers or another state owner.

## Implementation

- Extend existing Reason Guard tests first for report paths, multi-session
  retention, migration, Claude parsing/backfill, OpenCode persistence, privacy,
  concurrency, coverage, Desktop/CLI metadata, override behavior, and unknown
  fallback.
- Make the smallest state and adapter changes in the existing hook.
- Update status, UI, templates, docs, wiki, installer parity, and release
  metadata.
- Forward OpenCode's latest `message.updated` model and effort-like variant
  through a bounded content-free session cache.
- Run focused tests, an offline historical-Claude reproduction, benchmarks,
  full verification, review, and repeated CHML audits.
