# Internal PL/Baumanagement Jourfix audio → protocol pattern

Use this reference when the user sends or references a long Teams/MP4/audio recording for an **internal Baumanagement / PL Jourfix** and wants both transcription and a management-ready protocol, possibly styled after an earlier FPS protocol.

## Proven workflow

1. **Gather sources**
   - Recording/audio is the truth source for what was actually discussed.
   - User-provided context/prep document is for topic recognition and agenda structure only.
   - Prior formatted DOCX/PDF is a layout/style reference, not content truth.

2. **Transcribe locally first**
   - For long recordings already stored locally, use the AutoProtocol/WhisperX venv if available:
     ```bash
     cd /home/agent/projects/Autoprotocol
     .venv/bin/python <transcription_script>.py
     ```
   - Save raw transcript as both `.json` and `.txt` with timestamps and speaker IDs.
   - Do not hard-map speakers to names unless the transcript makes it reliable. Use the user-provided participant list in the protocol kopfdaten/participants instead.

3. **Generate two separate content artifacts**
   - `*_protocol.md`: thematic, non-chronological, senior-Baumanager protocol.
   - `*_bereinigtes_transkript.md`: chronological cleaned transcript with timestamp + speaker + fachliche Aussage.

4. **Use CodexCLI for long synthesis via stdin file**
   - Put the full instruction in `prompt.txt` and reference local source paths.
   - Prefer:
     ```bash
     codex exec --skip-git-repo-check --model gpt-5.5 \
       --cd /home/agent --sandbox workspace-write --ephemeral \
       --output-last-message <out>/codex_last_message.txt \
       - < <out>/prompt.txt
     ```
   - Avoid `"$(cat prompt.txt)"` for long prompts: it exposes the whole prompt in the process list and can lead to confusing stdin/appended-output behaviour.

5. **Protocol structure**
   - Title block like the FPS style: `PROTOKOLL`, session type, project number/name.
   - Tables: Kopfdaten, Teilnehmende, Ampelstatus, Termine, Entscheide, Pendenzen.
   - Thematic sections for internal PL/Baumanagement Jourfix:
     - Rückblick Projektteam / Bauherrschaft
     - Projektstand & Termine
     - Nachträge / Baukostenindex / Controlling
     - Vergaben / Subunternehmer
     - critical suppliers such as Sanika/Fertigbäder
     - Montage-/Logistikkonzept
     - Qualität / PQM / Revisions- und Abdichtungsdokumentation
     - Schadenfälle / Versicherungen / Gutachter
     - S+G / Arbeitssicherheit
     - Abwesenheiten / Ressourcen / Organisation

6. **DOCX/PDF production**
   - Build `.docx` from the final Markdown, using prior FPS protocol style where requested: blue headings, full-width tables, compact bullets, clear kopfdaten/participants tables.
   - Explicitly set page size to **A4** before LibreOffice conversion.
   - Convert PDF from the final DOCX only.

7. **Verification**
   - Reopen DOCX and check table count / key terms (`Furkastrasse`, `Pendenzenliste`, `Entscheide`, `Offene Fragen`).
   - Run `pdfinfo` and `pdftotext` to confirm A4, page count, searchable text, key terms.
   - Render at least first page and a dense table/transition page; visually check for clipped rows, overlap, header/footer collisions, and readability.

## Content discipline

- Remove smalltalk and filler, but keep fachliche risk/decision/task content.
- Use `Unklar` / `nicht explizit festgelegt` when responsibility, date, or decision is not explicit.
- Do not turn the cleaned transcript into a summary; preserve chronological traceability.
- The protocol is thematic and outcome-oriented; it is not a raw transcript.
