# CLI session workflows

- **CLI session workflows**: `session-workflows.ts` resolves IDs, unique prefixes, source paths, and saved replays. Discovery returns coverage with a 30-second cache and `--refresh`. Inspection/diagnosis are bounded; export applies saved edits only to the saved snapshot and strips local SSH repository identity. `share --dry-run` and `export --stdout` must not write files or upload; propagate read-only discovery to provider caches. SSH read-only discovery uses staged sessions. Keep stdout clean for `--json` and `--stdout`. `--source`/`--snapshot` select the version; revisions bind effective scenes/annotations, not generation time. Search continuation uses an inclusive scene offset; field character pages use UTF-16 offsets. Renamed replay JSON is standalone and must never borrow neighboring sidecars or publication metadata. CLI saved reads reject damaged sidecars; saves replace atomically. Export audit paths are format-specific and carry artifact hashes. Sessions page by list revision; diagnose pages each signal with a separate signal revision. JSON failures use one stderr error/code/suggestions object.

- `replays` lists effective saved snapshots without provider discovery or cache writes. Apply edits to the same validated replay read; never expose original prompt/title previews when sidecars are unreadable. Keep duplicate IDs distinct by path and location, paginate with stable identity, and return per-item revisions for exact subsequent reads.
- Inspection and diagnosis expose provider quality notes and tool-result coverage. Exclude tool containers; honor explicit `hasResult`, falling back to result presence for legacy snapshots. Missing results are unknown evidence, not successes or failures.
- `doctor --read-only` checks discovery under stdout/preflight storage rules; regular ready coverage does not imply every session can preflight. Preserve SQLite guards. Checkpoint-required errors provide opt-in file-export and saved-JSON recovery steps; never execute those steps automatically.
