Files
transcribe/AGENTS.md
T
ddidderr 138c796399 feat: reconcile speaker identities through OpenRouter audio
Short chunk overlaps often contain only one participant, so returning
speakers receive new transcript IDs. MAI can also split one voice into
several IDs within a single request, which overlap stitching cannot fix.

Add an opt-in audio comparison pass: --speakers N selects Gemini 3.8 Flash
with a known count, and --speaker-model allows another compatible model.
Keep request-local identities separate, select up to three clean excerpts
per ID, and compare all excerpts in one OpenRouter request. Gemini uses
Google AI Studio because the Vertex backend limits prompts to one audio
file. No local model or extra Python dependency is required.

Only reconcile identities whose sample assignments agree. Preserve
uncertain identities separately, reject incomplete or malformed replies,
and retain the original words and timestamps. Bound sample count and
request size, clip sampling to the real audio duration, and extend worker
cleanup and buffered output to the comparison step. Document the sampled
method's limitations and additional provider request.

Test Plan:
- python3 -B -m unittest -v: all 82 tests passed, including real MP3
  encoding with fake transcription/comparison responses and cancellation.
- bash -n transcribe: passed.
- git diff --cached --check: passed.
- Live API and voice accuracy unverified: this workspace could not access
  the configured 1Password credential. Mocked responses prove pipeline
  behavior, not model accuracy on the supplied recording.
2026-09-12 10:04:56 +02:00

2.1 KiB

Repository instructions

Automatic commits are mandatory

  • Automatically commit each completed, validated change before finishing a task. Do not wait for the user to ask for a commit or request confirmation.
  • Keep commits focused. Include the implementation, regression tests, and relevant documentation together; commit independent changes separately.
  • Inspect staged and unstaged changes before committing. Stage only files that belong to the task. Do not commit user recordings, generated transcripts, credentials, or unrelated changes.
  • Use Conventional Commit subjects and explain the change and validation in the commit body, including a Test Plan: section.
  • Run the relevant checks, including python3 -B -m unittest -v, bash -n transcribe for shell changes, and git diff --cached --check. Report any validation that could not be completed; never claim a mocked provider test proves live API behavior.
  • After committing, inspect the commit and working tree, and report the commit hash with any remaining work. Do not push unless requested.

Project layout

  • transcribe: CLI options, audio preparation, and transcription requests.
  • chunks.py: upload boundaries and ordered overlap stitching.
  • subtitles.py: timestamp validation and SRT cue formatting.
  • transcript.py: readable text paragraphs and speaker markers.
  • diarization.py: optional OpenRouter audio sample comparison and speaker ID reconciliation.
  • test_*.py and tests/fake_provider.py: local regression tests without real credentials or provider requests.

Keep the CLI and its four Python helpers together. Preserve transcript order and emit stdout only after all chunks and output conversion succeed. Provider speaker IDs are request-local; reuse transcript IDs across requests only with supporting overlap or explicit shared-audio comparison evidence. Voice comparison must preserve transcription text and timestamps, validate complete sample assignments, and leave uncertain or conflicting identities separate. Keep chunk details out of the final transcript. Progress, processing details, and errors belong on stderr.