# Reconstructing a voice-message conversation

Use this workflow when many forwarded voice notes, text replies, reactions, links, and images must become one chronological dialogue.

## Source recovery and inventory

1. Identify the authoritative source messages before editing. If a long collection was compacted in the chat UI, recover the original persisted message bodies rather than reconstructing from summaries.
2. Save each large source body as a raw UTF-8 fixture before parsing.
3. Inventory separately:
   - voice-message blocks;
   - ordinary text messages;
   - reply-to relationships;
   - image/file paths and external URLs;
   - section labels and captions.
4. Keep an explicit count of source voice blocks and media items.

## Deduplication

Deduplicate at the **whole-message** level before editorial cleanup:

- Normalize only whitespace and casing for comparison, then hash the complete voice transcript or message body.
- Remove repeated forwarded copies with identical normalized hashes.
- Do not deduplicate repeated phrases within a speaker's monologue.
- Do not remove two short replies merely because they are similar.
- Record the number of duplicate copies removed and retain the first chronological occurrence.

## Speaker attribution

1. Use explicit addresses (for example, “Маргарита…” or “Настя…”), reply metadata, and the conversational role.
2. Build a stable role map early (e.g. astrologer/expert versus client) and test it against several unambiguous messages.
3. If attribution is genuinely uncertain, label it as uncertain instead of silently assigning a name.
4. Preserve text replies as their own turns; do not merge them into the preceding audio.

## Editorial layers

Maintain two deliverables when the user asks for a readable but complete record:

1. **Complete cleaned transcript** — every non-duplicate message in order; punctuation and obvious ASR terminology corrected; no substantive shortening.
2. **Optional editorial reading version** — smoother or condensed only when explicitly authorized and clearly labelled as abridged.

Never put a shortened selection in the target document while calling an external attachment the “full version” if the request was to place the complete transcript in the document.

For uncertain audio:

- Correct only contextually unambiguous terminology.
- Mark `[неразборчиво]` or `[возможно: …]` for unresolved speech.
- Do not use a summary to replace a damaged or missing transcript segment.

## Images and message position

- Represent each image with a stable unique placeholder during assembly.
- Keep the placeholder at the image's original chronological position.
- Replace placeholders with **inline embedded images** in the final document, not a link appendix, unless the user explicitly accepts links.
- Verify each placeholder count is exactly one before insertion and zero after insertion.
- Preserve a local copy of every image; temporary public hosts are transport aids, not durable archives.

## Verification

Before completion, verify:

- source message count versus output turn count after documented deduplication;
- first, middle, and final messages;
- every reply-to text and emoji-bearing message;
- speaker labels on a sample of unambiguous turns;
- image order and inline presence;
- no placeholders remain;
- target document export contains the full expected character/paragraph range;
- saved/synced state and target link.

A file existing or a large paste returning success is not enough. Re-export the final document and compare sentinel phrases from the beginning, middle, and end plus counts of media placeholders/images.