Add --save-transcript and --save-dir flags for transcript/audio file output#191
Merged
Conversation
Adds three save flags to `assembly stream`, grouped under a new "Saving" help panel alongside the existing --save-audio: - --save-transcript PATH: write finalized turns to a text file, one per line (the same plain text `-o text` emits), flushed per turn so a Ctrl-C leaves a complete transcript so far. - --save-dir DIR + --name TITLE: hand filename assembly to the CLI. Files land under DIR/YYYY-MM-DD/ with a timestamped, slugged stem (YYYY-MM-DD-HHMMSS[-slug]), and a matching WAV shares the stem — so a wrapper script's hand-rolled date(1) + tr/sed slug block can go away. New core pieces: streaming/transcript.py (the turn-by-turn text writer, parallel to record.tee_wav) and streaming/naming.py (slug + path assembly). StreamSession grows a transcript writer opened/closed in _guarded and fed from both the plain and --llm turn paths. Also splits the --system-audio tests out of test_stream_session.py into test_stream_system_audio.py to stay under the 500-line file gate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UcH9QQmiZXviKzCpof7gJ4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds transcript and audio file saving to
assembly stream, with two modes:--save-transcript PATH: Write finalized turns to a plain-text file, one line per turn--save-dir DIR --name "Title": Auto-name both transcript and WAV underDIR/YYYY-MM-DD/with a timestamped, slugged stemKey changes
New modules:
aai_cli/streaming/naming.py: Filename assembly for--save-dir(date bucketing, slug generation, path validation)aai_cli/streaming/transcript.py:TranscriptWriterclass that appends finalized turns to a UTF-8 text file, flushing per turn for robustness against Ctrl-CModified modules:
aai_cli/commands/stream/_exec.py:save_transcript,save_dir,namefields toStreamOptions_reject_save_with_show_code()validation (save flags incompatible with--show-code)_resolve_save_targets()to assemble final paths from flags, with mutual-exclusivity checksStreamSessioninitializationaai_cli/streaming/session.py:_finalized_turn_line()helper to format turns for the transcript (matching text renderer's speaker prefixes)save_transcriptfield toStreamSessionTranscriptWriterinto turn recording and LLM follow modeaai_cli/commands/stream/__init__.py: Added CLI options for--save-transcript,--save-dir,--namewith help text and examplesTest coverage:
tests/test_stream_session.py: Refactored to focus on session lifecycle and transcript saving; removed system-audio tests (moved to new file)tests/test_stream_system_audio.py: New file with all--system-audiofamily tests (parallel sessions, worker errors, mic/system wiring)tests/test_stream_exec.py: Added tests for transcript writing, file validation, and--save-dirauto-naming with date bucketingtests/test_streaming_naming.py: Unit tests for slug generation, path resolution, and directory creationtests/test_streaming_transcript.py: Unit tests forTranscriptWriterand path validationImplementation details
--save-dirauto-names files with a sortable timestamp (YYYY-MM-DD-HHMMSS) and optional slug from--name, bucketed underDIR/YYYY-MM-DD/--save-dircannot combine with explicit--save-audio/--save-transcriptpaths, and cannot be used with--system-audio(two parallel streams can't share one WAV)test_stream_system_audio.pyto keeptest_stream_session.pyunder the 500-line gatehttps://claude.ai/code/session_01UcH9QQmiZXviKzCpof7gJ4