Skip to content

feat(audio): dictate a document into an audio file - #7151

Merged
kovtcharov-amd merged 15 commits into
amd:mainfrom
kovtcharov:claude/doc-dictation-9c7514
Nov 20, 2026
Merged

kovtcharov-amd merged 15 commits into
amd:mainfrom
kovtcharov:claude/doc-dictation-9c7514

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Getting a document as audio used to take two hand-described steps, produced only WAV (3 minutes is 9 MB), and showed no player once the file was saved to a folder of your own. Now one sentence does it in the Agent UI and the TUI: attach or name a PDF, Word, Excel, text or Markdown file, say "turn this into audio", and GAIA records it, plays it in the chat, and saves the audio where you asked. It reads the document as written, or rewrites tables, charts, footnotes and web addresses into spoken sentences when it has them, says which it chose, and saves that listening script beside the audio.

What a reviewer should weigh:

  • One tool does the whole job. dictate_document reads the file itself, so a long document is never shortened by passing through the model, and a new dictation skill tells the agent to call it without questions.
  • The player works for any save location, with the media boundary intact. The recording always stays in GAIA's audio folder and a copy goes to the user's path; text_to_speech now does the same. The only change to what the Agent UI serves is .mp3.
  • MP3 needs nothing new. It is Lemonade's own encoding of the Kokoro voice, joined frame by frame: 3 min 16 s is 3.9 MB against about 9 MB as WAV. A lower bitrate would need ffmpeg and is left out.
  • Long documents show progress and stop cleanly in both apps. The TUI's live line now shows a running tool's own progress, which also benefits other long tools.
  • A rewrite cannot change a number. Every figure in a listening script is checked against the document before recording. Gemma 4 E4B wrote 13,110 for 13,100 on the test report; that is now asked for once more and, if still wrong, refused with as-written offered instead.
  • Numbers are respelled for the voice. Transcribing the voice back showed it misreads decimals ("3.5" as "three. five"), footnote marks, and abbreviations; those are fixed before recording.

Limits, stated in the guide: English Kokoro voices only (other Lemonade speech models are not offered, as GAIA has not proven them); charts are described from the document's text, not the picture; one dictation covers about two hours of audio, and a longer document is recorded in page ranges.

Two notes for the reviewer:

  • No eval was run. This adds a tool, a skill and a tool bundle, which is LLM-affecting, but another session's eval was running on this machine, and evals run one at a time. Categories to watch on the next RC: tool_selection, gaia_tool_selection, web_system (it holds the text_to_speech scenario) and rag_quality (the document tools next to it). The dictation skill is listed as deferred in the skill-scenario coverage test, because the text lanes cannot judge audio.
  • Not the same as the voice-typing "dictation" in feat(voice): dictation and voice mode in the Agent UI and TUI #6789. That is speech to text in the composer; this is document to audio. This PR does not need the generated-media read grant from feat(images): image creation settings in the Agent UI and the TUI #6494.

Screenshots

The audio card after a dictation saved to a folder of the user's, from the rtl.visual.ts scene (English, then Arabic). The path stays left to right inside the Arabic line.

Audio card, English

Audio card, Arabic

Test plan

Run against the real apps from an isolated GAIA home, chat model DeepSeek through Fireworks, voice kokoro-v1 on Lemonade.

  • Agent UI, typed path and a named folder: listening form chosen for a 2-page report with a table, chart and footnote; player in the chat (3:27); MP3 and .script.md saved in the folder; the reply named the form and why
  • Agent UI, PDF dropped on the composer, "word for word": as-written MP3 with a player and no permission prompt
  • Agent UI, 36-page PDF (20,000 words): refused as too long with a page range, then recorded in parts; the first part ran 10 minutes as one tool call and produced 34 min 28 s of audio with progress shown throughout; Stop during the next part ended the turn and left no partial file
  • TUI: one sentence produced the MP3 and script in the named folder, progress on the live line, and the audio card with its open and reveal keys
  • Listen-back with Whisper Large v3 Turbo: listening form 95.6% word match (1 of 62 numbers heard differently, and correct when that sentence was recorded alone); as-written 90.1% with every number heard; the last two minutes of the 34-minute file 95.5% against the script's end
  • python -m pytest tests/unit/test_dictation.py tests/unit/test_lemonade_speech.py tests/unit/chat/ui/test_generated_media.py tests/unit/test_chat_tool_requests.py
  • Routing: "Read notes.pdf aloud and save it as report.mp3", "Narrate chapter1.txt and save as chapter1.wav" and six more variants offer dictate_document first; "Transcribe meeting.mp3", "what does interview.mp3 say?" and six more that read an existing audio file still offer transcribe_media (tests/unit/test_chat_tool_requests.py)
  • python -m pytest tests/unit/test_flagship_tool_labels.py (activity label in English and Arabic, live-progress phrase)
  • python -m pytest hub/agents/gaia/python/tests/test_chat_dictation_tool.py hub/agents/gaia/python/tests/test_chat_tts_tool.py
  • cd src/gaia/apps/webui && npm test && npm run test:rtl (3,449 unit and 456 visual tests pass; a new visual test renders the audio card with its "Saved to" and "Script saved to" lines in English and Arabic, and both were read on screen)
  • cd tui && go test ./internal/ui/...
  • python util/lint.py --tool-descriptions, black, isort, and python util/check_doc_links.py --internal-only
  • Listening rewrite on Gemma 4 E4B (local, GPU): 6 of 7 runs passed the figure check (one after its retry), 1 was refused for a wrong figure; a full dictation gave 3 min 33 s of audio in 90 s with 95.1% listen-back match
  • Not tested: the listening rewrite on Qwen3.6; Linux and macOS; the packaged desktop app

Asking GAIA to "turn this PDF into audio" used to take two hand-written
steps, gave only WAV, and showed no player once the file was saved to a
folder of the user's own. One request now does it in the Agent UI and
the TUI: the new dictate_document tool reads a PDF, Word, Excel, text or
Markdown file, records it with the Kokoro voice and returns an MP3 or WAV.

- Two forms. "As written" keeps the author's words; "listening" has the
  chat model rewrite, part by part, what does not work by ear (tables,
  charts, footnotes, web addresses, reference codes). auto picks, the
  result says which and why, and the listening script is saved beside
  the audio.
- The recording always stays in GAIA's audio folder, the only place the
  Agent UI serves audio from, and a copy goes to the path the user
  named. text_to_speech does the same, so both get a player. The media
  boundary is unchanged apart from serving .mp3.
- MP3 is Lemonade's own encoding, joined frame by frame: no new
  dependency, about 2.4x smaller than WAV.
- Long documents record piece by piece to disk with progress on the
  live line in both apps, stop cleanly, and past about two hours of
  audio are refused with the page range that fits.
- What the voice was heard to misread is respelled before recording:
  decimals, money, version numbers, footnote marks, abbreviations.

A new bundled skill, dictation, tells the agent to call the tool
without questions and how to report the result. The tool list grows
from 105 to 106 and gains a speech bundle.
@github-actions github-actions Bot added documentation Documentation changes talk Talk agent changes audio Audio (ASR/TTS) changes cli CLI changes tests Test changes electron Electron app changes agents agent::email Email agent changes tui Go terminal UI (gaia-tui) labels Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Request changes

This adds one-sentence document dictation to MP3 or WAV in the Agent UI and the TUI, keeps a playable copy for text_to_speech, and shows a tool's own progress on the TUI's live line. The design is careful: reads and writes go through the same access checks as other tools, a failed or stopped run leaves no half-written file, and the tests are thorough. One fix is needed before merge.

  • Numbers vanish from the audio in some sentences. The rule that removes footnote marks also deletes a real number when it follows an abbreviation and comes before a capitalised word. "See p.14 The table" is spoken as "See p. The table", and "No.5 Engine" as "No. Engine". This happens in the as-written form too, which promises the author's exact words. Running the abbreviation rules before the footnote rule fixes it. Please add these cases to the tests.
  • Screenshots of the new audio card are missing. The PR says the card was checked in English but includes no screenshot, and the Arabic strings were not looked at on screen. Add a before/after screenshot of the card, in English and Arabic, with the "Saved to" and "Listening script" lines.

Real-world evidence

N/A: no evidence bundle was produced for this run. The PR's own test plan describes manual runs in the Agent UI and the TUI on DeepSeek through Fireworks. It doesn't show their output or screenshots. The verdict rests on reading the code and on running the speech-text rules on their own; the pytest suites couldn't run here, and CI was still pending when this was written.

🔍 Technical details

🟡 The footnote-strip rule deletes real numbers after p., No. and Fig. (src/gaia/audio/dictation.py, _SPEAKABLE, third rule)
(?<=[a-z)%][.,;])\d{1,2}(?=\s+[A-Z]) runs before the p., pp., No. and Fig. expansions. speakable() runs on every piece in both forms. I ran the _SPEAKABLE slice on its own:

'See p.14 The table' -> 'See p. The table'
'Use No.5 Engine'    -> 'Use No. Engine'
'Read Fig.3 Below'   -> 'Read Fig. Below'

Move the four abbreviation rules (pp., p., No., Fig.) above the three footnote rules, so the number is attached to its word before the footnote rule can see it. _FOOTNOTE in listening_reasons has the same pattern, so these sentences also push auto into a listening rewrite for a footnote that isn't there. That costs a model call but loses no words. Add these three strings to tests/unit/test_dictation.py. The guide's claim that "p." and "No." are "said in full" (docs/guides/dictation.mdx) depends on this fix.

🟡 No screenshot of the changed Agent UI card
AudioCard.tsx gains two visible lines and two new strings, media.savedTo and media.listeningScript. The rubric and the reviewing-agent-ui skill ask for a screenshot embedded in the PR, in English and Arabic. The PR's own test plan says the Arabic was not reviewed on screen.

🟢 Stop waits for a whole rewrite reply (src/gaia/agents/tools/dictation_tools.py, _listening_reply)
check() runs only between parts. A Stop pressed mid-part waits for up to REWRITE_MAX_TOKENS (4096) tokens, which can take a minute or more on a local model. AgentSDK.send_messages accepts cancel=. Pass cancel=getattr(self, "_cancel_event", None) and turn LLMCallCancelled into ToolCancelled. Without that translation, the new exception would escape the tool's except list.

🟢 Copy-then-script failure reports an error after the audio copy landed (dictation_tools.py, _dictate_document)
Suppose the audio copy to the user's folder succeeds and the .script.md copy then fails. The tool returns status: error with kept_at set to the cache path, but the user's MP3 already exists. Consider reporting success with a warning that the script wasn't copied, so the reply matches what is on disk.

Docs drift: I grepped docs/, hub/agents/** and hub/skills/** for the old wording: "105" tools, text_to_speech in the desktop bundle, and "must end in .wav". No stale claims are left; docs/eval.mdx's web_system row still reads correctly. Sibling paths are covered: the email sidecar's _RENDER_TOOL_TO_LANG, the tool label in profiles.py, the relayed-result keys in sse_translation.py, and the TUI live line all gained dictate_document.

Eval: this change affects the model (a new tool, skill and bundle, plus the requested_tools regex). The PR names the categories to watch on the next RC (tool_selection, gaia_tool_selection, web_system, rag_quality), which CLAUDE.md allows when no eval hardware is free.

Strengths

  • synthesize_file writes piece by piece to disk, checks that each MP3 or WAV piece matches the format of the first before joining them, and unlinks the file on any BaseException. A stop or failure never leaves a partial file under the user's name.
  • text_to_speech and dictation now share speech_settings, new_speech_file and copy_for_user. The media route widens only by .mp3, and the card shows the user's paths as text, never as links.
  • The new tests pin the right things: real MP3 frame parsing, page-range refusals with the range that fits, cancel cleanup, and the TUI rule that a model phase replaces a tool's progress.

A listening rewrite could record a number the document never states.
Gemma 4 E4B wrote "thirteen thousand one hundred ten" for 13,100 and
"eighteen" for 180 on the test report, and nothing caught it.

Each rewritten part's numbers, in digits or in words, are now compared
with the page before anything is recorded. A part that states a figure
the document does not is asked for once more; if it is still wrong the
dictation is refused and as-written is offered. Figures the script
leaves out are returned for the user to check. The prompt also tells
the model to copy numbers digit for digit.
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Request changes

Neither fix from the last review has landed. The new commit adds a useful figure check to listening scripts, but these two are still open:

  • 🟡 Numbers still vanish from the audio after "p.", "No." and "Fig." "See p.14 The table" is still spoken as "See p. The table", in the as-written form too. Run the abbreviation rules before the footnote rule, and add these cases to the tests.
  • 🟡 Still no screenshot of the new audio card. Add one in English and one in Arabic showing the "Saved to" and "Listening script" lines. The PR's test plan still says the Arabic was not checked on screen.
🔍 Technical details
  • src/gaia/audio/dictation.py:444: the footnote rule (?<=[a-z)%][.,;])\d{1,2}(?=\s+[A-Z]) still runs before the pp., p., No. and Fig. expansions at lines 450–453. Move those four rules above lines 440–444. tests/unit/test_dictation.py has no p.14, No.5 or Fig.3 case.
  • The PR body's test plan still reads "the Arabic strings on the audio card (written, not reviewed on screen)" and embeds no images.

"See p.14 The table" was spoken as "See p. The table": the rule that
drops footnote marks ran before "p.", "pp.", "No." and "Fig." were
expanded, so the number after them was taken for a footnote. This hit
the as-written form too, which promises the author's words.

- Abbreviations are expanded first, and a number after one is never
  read as a footnote, in speech or when choosing the form.
- Stop during a listening rewrite ends the reply in progress instead of
  waiting for the part to finish.
- When the audio reaches the user's folder but the script copy fails,
  the result says so instead of reporting the whole dictation failed.
- A model that cannot answer returns an error instead of escaping the
  tool.
- The audio card's second line reads "Script saved to", matching "Saved
  to", and a visual test covers the card in English and Arabic.
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Request changes

The numbers-after-"p.", "No." and "Fig." fix has landed and is tested. One finding from the last review is still open:

  • 🟡 There is still no screenshot of the new audio card on the PR. The test plan now says the English and Arabic cards were checked on screen, but the description has no images. Embed two screenshots, one in English and one in Arabic, each showing the "Saved to" and "Script saved to" lines. A change to the Agent UI needs a screenshot on the PR, and a written note does not replace it.
🔍 Technical details
  • Abbreviation fix verified: src/gaia/audio/dictation.py now expands pp./p./No./Fig. before the footnote rule. The footnote rule also gained (?<!\bp\.)… guards, and tests/unit/test_dictation.py:80,225-228 cover p.14, No.5, Fig.3 and pp.12.
  • Screenshot: the rubric's real-world evidence rule says Agent UI changes need screenshots embedded as rendered ![](https://raw.githubusercontent.com/…) images. The rtl.visual.ts run already produces these PNGs, so they can be committed to an evidence branch and linked.

Main added named-picture and named-recording requests beside the speech
signal; both are kept. A dictation that names its output file
("save it as report.mp3") no longer also asks for transcribe_media, since
that .mp3 is the result, not a recording to transcribe. The audio card's
visual scene sits beside main's new scenes, and the capability matrix is
regenerated for the new speech bundle.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Not merging yet, for two reasons:

  • "Read notes.pdf aloud and save it as report.mp3" doesn't offer the dictation tool. It offers text-to-speech plus the transcription tool, which reads the .mp3 name as a recording to transcribe. "Narrate chapter1.txt and save as chapter1.wav" fails the same way. Dictation only kicks in when the request says "dictate", "audiobook", "into audio" or "as audio/mp3". Naming an output file after "save it as" never triggers it.
  • Test Gaia Agent is red because of this PR. The new dictate_document tool has no activity-list label in en.ts/ar.ts, and no live-narration phrase.

The bot's request for English and Arabic screenshots of the audio card is also still open.

🔍 Technical details
  • requested_tools results at 2769f9c:
    • 'Read notes.pdf aloud and save it as report.mp3' → ['text_to_speech', 'transcribe_media']
    • 'Narrate chapter1.txt and save as chapter1.wav' → ['text_to_speech', 'transcribe_media']
    • 'Convert report.docx and save it as report.mp3' → ['transcribe_media']
  • The cause: _DICTATION_NAMED matches as mp3 but not as <name>.mp3, so wanted doesn't include dictate_document. The transcribe_media skip in the _MEDIA_NAMED loop then never applies.
  • Possible fix: treat an output audio name ("save/write/export … as/to .mp3|.wav") as a dictation signal when the request has no _EXISTING_AUDIO words. Add these three strings to test_chat_tool_requests.py next to the existing "Dictate report.pdf and save it as …" case. Keep the transcription negatives ("Transcribe meeting.mp3", "what does interview.mp3 say?") passing.
  • CI failures, all in tests/unit/test_flagship_tool_labels.py: add tool.dictate_document.done/.active to en.ts and ar.ts, and a dictate_document phrase to _NARRATION_OVERRIDES in src/gaia/ui/event_narration.py. That test reached main in fix(webui): name every tool step in plain words, and say when you declined #7483.
  • RAG Integration Tests hit the 10-minute job limit with no failed step. It looks like infra, but re-run it once the fixes above are pushed.
  • Writes are fine: the audio and script copies go through write_access_error, the same allowed-folder check text_to_speech uses.

"Read notes.pdf aloud and save it as report.mp3" offered text-to-speech and
the transcription tool, because naming an output audio file never counted as
a dictation request and the .mp3 name looked like a recording to transcribe.
A message whose only audio file names are save targets (save/write/export/
narrate ... as/to <name>.mp3|.wav|.m4a|.ogg|.flac) now offers dictation
first. A message that names an audio file to read from still routes to
transcription, so "Transcribe meeting.mp3", "what does interview.mp3 say?"
and "Convert interview.mp3 to interview.wav" are unchanged.

Also gives dictate_document its activity-list label in English and Arabic
and a live-progress phrase, which the flagship tool-label test requires.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Both blockers are fixed in 861231c, and the screenshots were already in the description.

  • Dictation now triggers when a document is to be saved as an audio file. "Read notes.pdf aloud and save it as report.mp3", "Narrate chapter1.txt and save as chapter1.wav" and "Convert report.docx and save it as report.mp3" all offer dictation first now. Requests to transcribe an existing recording still go to transcription: "Transcribe meeting.mp3", "what does interview.mp3 say?" and "Convert interview.mp3 to interview.wav".
  • Test Gaia Agent should go green. dictate_document now has its activity-list label in English and Arabic, plus a live-progress phrase.
  • Screenshots: the description already embeds the English and Arabic audio cards from the rtl.visual.ts scene (evidence/pr-7151). I re-rendered both after merging main. The Arabic one came out byte-identical, and both show the "Saved to" and "Script saved to" lines with each path kept left to right.
🔍 Technical details
  • tool_requests.py: the new _AUDIO_OUTPUT pattern matches a save verb (save/write/export/narrate/read/convert/…) followed within the same sentence by as|to|into|called|named <name>.mp3|.wav|.m4a|.ogg|.flac. Quoted names with spaces are handled. _audio_files sorts each named audio file into "saved to" or "read from". Dictation is offered only when nothing is read from, so "Read interview.mp3 aloud and save it as copy.wav" stays text-to-speech plus transcription. That same guard now covers the older _DICTATION_NAMED path too, so "Convert interview.mp4 into audio" goes to transcription.
  • Tests in tests/unit/test_chat_tool_requests.py: 8 positives and 8 transcription negatives. There are also adversarial cases: an audio input with an audio output, report.mp3s.txt, and report.wavy.
  • Verified locally:
    • The PR's pytest files plus test_flagship_tool_labels.py and test_tool_loader_selection.py pass, 750 tests in all.
    • The full vitest suite passes (3790), as does the rtl.visual.ts dictation scene in both locales.
    • black and isort are clean.
  • test_full_tool_bundles.py::test_skill_catalogue_renders_for_the_flagship fails here only because it reads the live local Lemonade version. That is environment-only and the same on main.

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Not merging yet: Unit Tests (Linux) fails on this PR's new dictation hub skill. Every hub skill needs labelled example requests for the skill suggester, and dictation has none. Merging would turn main red.

Fix: add about three made-up requests that should suggest dictation plus one near-miss negative (e.g. "transcribe meeting.mp3") to the suggester's case file, then rerun the calibration test.

The routing re-test passes. All 8 dictation phrasings, including "Read notes.pdf aloud and save it as report.mp3" and "Narrate chapter1.txt and save as chapter1.wav", offer dictate_document first. All 9 transcription and conversion phrasings, including "Convert interview.mp4 into audio" and "Convert song.flac to song.mp3", don't offer it. The en and ar labels are present.

🔍 Technical details
  • tests/unit/test_skill_suggester.py::test_every_hub_skill_has_labelled_requests: hub skill(s) dictation have no request in tests/fixtures/skills/skill_suggestion_cases.json. That was the only failure in the run: 1 failed, 40701 passed.
  • After adding the cases, run test_calibration_against_the_real_embedder as the assertion message says.

@kovtcharov-amd kovtcharov-amd added enhancement New feature or request skill Claude Code skill files (.claude/skills/) labels Nov 12, 2026
# Conflicts:
#	hub/agents/gaia/python/gaia_agent/chat_agent.py
#	hub/agents/gaia/python/gaia_agent/tool_requests.py
#	hub/agents/gaia/python/tests/fixtures/non_claude_system_prompt.txt
#	hub/skills/README.md
#	src/gaia/apps/webui/visual/rtl.visual.ts
#	tests/unit/test_chat_tool_requests.py
#	tests/unit/test_tool_loader_token_budget.py
The speech tool now snapshots through copy_for_user, so the agent module's
before_change import from main went unused after the merge.
@kovtcharov-amd kovtcharov-amd added the ready_for_ci Run CI workflows on draft PR without requesting review label Nov 16, 2026
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

The dictation skill now has labelled example requests for the skill suggester, and main is merged in.

  • Three requests that should suggest dictation (a PDF to MP3, an audiobook of a chapter, a handbook saved as audio) and one near miss, "Transcribe interview.mp3 into text", which expects transcribe-meeting and does not accept dictation.
  • The real-embedder calibration test was not run here, because this machine doesn't run local models. It needs a run where the embedder is available.
🔍 Technical details
  • Conflicts with main's mailbox and skill-capture request signals in tool_requests.py were kept side by side: dictation and speech first, then mail, then media, then skills. The docstring now lists seven signals.
  • rtl.visual.ts and test_chat_tool_requests.py: main's versions plus this PR's appended dictation tests.
  • hub/skills/README.md counts twenty-six skills; the system-prompt fixture keeps main's data-explore line and adds dictation.
  • Dropped the unused before_change import: the speech tool snapshots through copy_for_user.
  • Local: PR's pytest files, test_skill_suggester.py, test_flagship_tool_labels.py, test_tool_loader_selection.py and the flagship package suite pass, apart from two test_stdio.py cloud-model tests that fail the same way on main. tsc, vitest on touched files and go test ./internal/ui/chat pass.

@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

You can now ask GAIA to turn a PDF, Word, Excel, text or Markdown file into an MP3 or WAV in one sentence, in both the Agent UI and the TUI. GAIA either reads the file as written or rewrites it so it is easy to follow by ear, and it checks every number in a rewrite against the document before recording. I found nothing that blocks the merge. File paths go through the same read and write permission checks as text_to_speech, and the Agent UI still only plays audio from GAIA's own audio folder (.mp3 is the one new type it serves).

Worth fixing before or soon after merge:

  • Every recording is now stored twice and never cleaned up. When the user picks a folder, the full file stays in GAIA's audio cache as well. A two-hour dictation is about 140 MB as MP3 and about 345 MB as WAV, and nothing ever clears that cache. Speaking text to a chosen folder (text_to_speech) used to keep just one copy.
  • Saving spoken text to a folder shows no "Saved to" line on the audio card. Dictation shows where the copy went; text_to_speech doesn't report it.

Real-world evidence

N/A: this job produced no evidence bundle. My verdict rests on reading the code only; I couldn't run the PR's unit tests here because pytest isn't installed on this runner. The PR description reports real runs against the Agent UI and TUI, a listen-back check with Whisper, and English and Arabic screenshots of the audio card, but this job didn't reproduce any of them. Real inference on the Strix Halo pool is left to the next RC's eval, and the description names the categories to watch: tool_selection, gaia_tool_selection, web_system and rag_quality.

🔍 Technical details

🟡 Follow-up: Audio cache keeps a duplicate of every saved recording, with no cleanup (src/gaia/agents/tools/dictation_tools.py:136, hub/agents/gaia/python/gaia_agent/chat_agent.py:602)
new_speech_file() always writes into ~/.gaia/cache/audio/generations, and copy_for_user() then copies the file to the user's path. Before this PR, text_to_speech with an output_path wrote only the user's file. No code prunes generations/ (the only other reference is generated_media.py:56, which serves files from it). The duplicate is what lets the player work after the user saves to their own folder, so a cap or age-based prune of that folder is the right fix, not removing the duplicate. Suggested issue title: "Prune ~/.gaia/cache/audio/generations; dictation duplicates every saved file."

🟢 text_to_speech doesn't report saved_to, so its audio card has no "Saved to" line (chat_agent.py:631-645)
media_card and RESULT_AUDIO_KEYS add saved_to/script_path to the card, but only dictate_document returns saved_to. text_to_speech returns the user's copy as output_path/file_path, so the card for that tool never says where the file went.

            result = {
                "status": "success",
                "output_path": str(saved),
                "file_path": str(saved),
                "audio_path": str(audio),
                "duration_seconds": round(duration, 2),
                "format": audio_format,
                "voice": voice,
                "model": model,
                "chunks": len(pieces),
            }
            if destination is not None:
                result["saved_to"] = str(destination)
            return result

🟢 new_speech_file() runs outside the try in text_to_speech (chat_agent.py:602)
If speech_folder().mkdir raises an OSError, the tool wrapper reports it as a generic failure rather than the structured {"status": "error"} the other failures in this tool return. Moving the call inside the existing try fixes this.

🟢 Orphaned audio when the script write fails (dictation_tools.py:2153-2155 in the diff)
If script_file.write_text raises OSError after the audio was recorded, the except OSError branch returns an error but leaves the finished audio in the cache without telling the agent where it is. The CopyFailed path already returns it as kept_at; this path could do the same, or delete the file.

🟢 Doc drift: CLAUDE.md's KNOWN_TOOLS table has no dictation row
src/gaia/agents/registry.py now registers "dictation", but the table in CLAUDE.md ("Agent Registry & Tool Mixins") wasn't updated. Add a row: dictation → gaia.agents.tools.dictation_tools.DictationToolsMixin, "Turn a document into a WAV/MP3 file with the local Kokoro voice".

Checked and fine

  • tools_count 105→106 matches across gaia-agent.yaml, __init__.py, SKILL.md and CHANGELOG.md. The mixin is registered in KNOWN_TOOLS, and the host method it needs (_make_extraction_chat) is on the base Agent.
  • Overwriting a user's file follows the existing text_to_speech behaviour: write_access_error is checked before any work starts, before_change takes a snapshot, and the copy is written to a .part file and then moved into place.
  • When a run is stopped or fails, synthesize_file deletes the half-written file. mp3_frames checks frame headers and refuses free-format and Layer I/II frames, and the format is compared between pieces before frames from different replies are joined.
  • The docs (gaia.mdx, talk.mdx, agent-ui.mdx, cli.mdx) match the new MP3 and copy-to-folder behaviour, and no stale ".wav only" claim remains.
  • CI: an earlier "Unit Tests Result" run shows fail (3s) and the run for the current head is still pending. Confirm it is green before merge.

Strengths

  • The rewrite is checked against the document's numbers, gets one retry, and is then refused with a way forward. That stops a confident-looking audio file from stating a wrong figure.
  • Audio is written to disk one piece at a time, Stop works between pieces and in the middle of a rewrite request, and a stopped or failed run leaves no file behind.
  • The routing tests cover the confusable cases ("dictate notes.pdf to notes.mp3" compared with "transcribe meeting.mp3"), and the module's text rules are pure functions with thorough unit tests.

text_to_speech now reports saved_to when the user named a folder, so its card
shows the same "Saved to" line a dictation does.
@kovtcharov-amd kovtcharov-amd added ready_for_ci Run CI workflows on draft PR without requesting review and removed ready_for_ci Run CI workflows on draft PR without requesting review labels Nov 16, 2026
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Fixed the second suggestion: speaking text into a folder now shows the "Saved to" line on its audio card, like a dictation.

The first one, keeping GAIA's own copy alongside the user's, is deliberate: the player only serves files from GAIA's audio folder, so dropping that copy would drop the player. Clearing old audio from that folder is a separate cleanup question for the maintainer.

@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

This adds a dictation skill and tool that turns a PDF, Word, Excel or text document into one MP3 or WAV file. A document with tables, footnotes or links is first rewritten for listening, and every figure in the rewrite is checked against the source. The work is solid. The checks are careful, a failed or stopped run leaves no file behind, and Stop really ends the run. The visible flows were exercised in both apps.

  • One thing to confirm before merge: long MP3s are stitched together from many short recordings. If Lemonade's MP3 encoder puts a length header at the start of each recording, browsers may show only the first segment's length and seek badly in a 30-minute file. Check one long MP3 in the app's player, or drop those header frames when joining.
  • Eval still owed: this changes what the model sees (a new tool, skill and tool bundle) and no eval ran. The PR names the categories for the next RC to watch, which is what the project rules ask for.

Real-world evidence

N/A here: no evidence bundle was produced for this run. The PR body carries its own proof: English and Arabic screenshots of the audio card, Agent UI and TUI runs (a 36-page PDF recorded in parts, Stop leaving no partial file), and a Whisper listen-back of 90–96% word match. Nothing was re-run by this review, so the verdict rests on static review plus that author-supplied evidence. Untested by the author: the listening rewrite on Qwen3.6, Linux and macOS, and the packaged desktop app.

🔍 Technical details

Issues

🟡 Joined MP3 may carry a stale Xing/Info header (src/gaia/audio/lemonade_tts.py, mp3_frames). mp3_frames drops ID3 tags but keeps every MPEG frame. Encoders such as LAME write a Xing/Info frame first, holding the frame count and seek table for that one reply. Concatenated, the file's first frame then describes only piece 1, and Chromium/Electron's <audio> reads its duration and seek table from that frame. The card's text duration comes from duration_seconds, so it would look right while the player's scrubber does not. The test fixture (mp3_bytes) has no Info frame, so the tests can't catch this. If Lemonade's replies carry one, skip it: a frame whose side-info region (offset 4 + side-info size: 9 for MPEG-2 mono, 17 for MPEG-1 mono, 32 for MPEG-1 stereo) begins with b"Xing" or b"Info". Add a fixture with an Info frame to cover it. If the replies have no Info frame, a one-line note in the PR settles it.

🟢 text_to_speech with output_path now writes two files. It used to write only to the user's path. It now always records into ~/.gaia/cache/audio/generations/ and copies from there, so every saved recording is stored twice. That's needed for the inline player, but nothing prunes that folder, and dictations up to two hours make it grow faster. This is a follow-up, not a blocker.

🟢 A folder name with a dot is treated as a file (dictation_tools.py, _dictation_destinations). destination.is_dir() or not destination.suffix sends a not-yet-created folder like Reports v1.2 down the file branch, which then refuses it because the name doesn't end in .mp3 or .wav. The error is loud and says what to do, so this is minor. A trailing / or \ in output_path could be read as "folder" too.

Strengths

  • Stop and failure leave nothing half-written: synthesize_file unlinks on any BaseException, and copy_for_user writes .part then os.replace, so a user never sees a truncated file under their chosen name.
  • Write access to both the audio and the .script.md is checked before any LLM or TTS work, so a refusal costs nothing.
  • text_to_speech now shares voice/speed/format handling with dictation instead of keeping its own copy. The docs (README, SKILL, CHANGELOG, CAPABILITY_MATRIX, the guides) and tools_count were all updated together.

…h file cannot be made

A long MP3 is joined from many short recordings; a leading Xing/Info or VBRI
frame from each one would make a player read the whole file as the first
piece's length, so the joiner drops it. A listening script that cannot be
written now says where the finished audio is instead of orphaning it, an
audio folder that cannot be created is a structured error from
text_to_speech, and a folder path ending in a separator is a folder even
when its name has a dot.

Also adapts the unsupported-format tests to .epub now that main reads
.pptx, and lists the dictation mixin in CLAUDE.md's KNOWN_TOOLS table.
@github-actions github-actions Bot added the devops DevOps/infrastructure changes label Nov 20, 2026
…der on Linux

On Linux and macOS a dictation saved to "Reports v1.2\" landed in a folder
literally named with the trailing backslash; the separator is now stripped
before the path is resolved. The dictation skill also gets search queries and
held-out suggester examples, which main now requires of every hub skill, and
its CHANGELOG entry moves from the released 0.3.6 section to Unreleased.
…to it

Saving a dictation to "D:\" went to D:'s current folder, and "C:\" or "C:/"
to the chat workspace, because every trailing separator was stripped and left
a bare drive letter. Trailing separators are now stripped only when what is
left is not a drive, a UNC share root or "/", so roots resolve to themselves
while "folder\" and "a/b/" still lose theirs.
# Conflicts:
#	docs/guides/tui.mdx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent::email Email agent changes agents audio Audio (ASR/TTS) changes cli CLI changes devops DevOps/infrastructure changes documentation Documentation changes electron Electron app changes enhancement New feature or request ready_for_ci Run CI workflows on draft PR without requesting review skill Claude Code skill files (.claude/skills/) talk Talk agent changes tests Test changes tui Go terminal UI (gaia-tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants