# Audio Transcript Plan
`kcode-audio-transcript-plan` 0.1.0 is the deterministic, side-effect-free boundary between completed `kcode-audio-ingress` recordings and consumers that persist transcript pieces. It owns no recording state, persistence, retries, locking, transport, or provider behavior.
## Contract
`TranscriptPlan::new(recording, effective_context_tokens)` derives ordered pieces from a `RecordingStatus`:
- the transcript budget is one quarter of the effective context, using four Unicode scalar values per estimated token;
- each piece is at most that transcript-only character budget;
- splitting prefers the latest paragraph boundary in the latter half of the budget, then a newline, then the hard boundary;
- the transcript and every split seam are trimmed exactly as in the originating implementation;
- completed empty transcripts are rejected; a non-complete recording produces an empty plan; and
- piece identities are `audio:<lowercase-hyphenated-recording-uuid>:<canonical-u32-index>`.
`TranscriptPlan::pieces` returns the complete ordered plan. Each `TranscriptPiece` exposes its identity, zero-based index, total count, trimmed transcript text, and transcript-only `estimated_tokens`. The estimate deliberately excludes metadata and speaker-label rendering; it does not promise that the complete formatted payload fits the quarter-context budget.
`parse_audio_piece_id` accepts only the exact canonical identity form. It rejects alternate UUID spellings, leading-zero indexes, overflow, missing or extra components, and non-audio identities.
`TranscriptPiece::metadata` reproduces the existing audio metadata object, including file information, zero-based piece index/count, and the packet confirmation state when a correction packet exists.
`TranscriptPiece::formatted_text` reproduces the existing History input. Legacy recordings without a correction packet render file metadata followed by transcript text. Packet-bearing recordings require `ConfirmationState::Confirmed`; every formatted piece includes the complete recording-wide observation mapping in packet order. An unconfirmed packet is a conflict. A structurally inconsistent confirmed packet is an internal error.
The caller must pass the same authoritative `RecordingStatus` used to create the plan when requesting metadata or formatted text. The library does not retain or duplicate the recording shape and does not perform source-currentness checks.
## Errors
`Error` has only `InvalidInput`, `Conflict`, and `Internal` categories. Invalid effective-context values are invalid input, unavailable human confirmation is a conflict, and impossible or inconsistent completed-source data is internal. Messages are bounded library-owned text and never expose raw dependency errors.
The library performs no I/O and has no release, recovery, or coordination state. Consumers own persistence, exact replay validation, concurrency fencing, and end-to-end formatted-payload limits. Tests cover quarter-context segmentation, Unicode-scalar counting, canonical identities, exact metadata, legacy rendering, and confirmed/unconfirmed speaker rendering.