Convert asciinema .cast recordings to clean .txt files for Claude Code analysis. Achieves 950:1 compression (3.8GB -> 4MB) by stripping ANSI codes and JSON structure.
Platform: macOS, Linux (requires asciinema CLI v2.4+)
When to Use This Skill
Use this skill when:
Converting .cast recordings to searchable .txt format
Preparing recordings for Claude Code Read/Grep tools
Batch converting multiple recordings
Reducing storage size of session archives
Extracting clean text from ANSI-coded terminal output
Why Convert?
Format
Size (22h session)
Claude Code Compatible
Searchable
.cast
3.8GB
No (NDJSON + ANSI)
Via jq
.txt
~4MB
Yes (clean text)
Grep/Read
Key benefit: Claude Code's Read and Grep tools work directly on .txt output.
Requirements
Component
Required
Installation
Notes
asciinema
Yes
brew install asciinema
v2.4+ for convert cmd
Workflow Phases (ALL MANDATORY)
IMPORTANT: All phases are MANDATORY. Do NOT skip any phase. AskUserQuestion MUST be used at each decision point.
Phase 0: Preflight Check
Purpose: Verify asciinema is installed and supports convert command.
bash
/usr/bin/env bash<<'PREFLIGHT_EOF'
if command -v asciinema &>/dev/null; then
VERSION=$(asciinema --version | head -1)
echo "asciinema: $VERSION"
# Check if convert command exists (v2.4+)
if asciinema convert --help &>/dev/null 2>&1; then
echo "convert: available"
else
echo "convert: MISSING (update asciinema to v2.4+)"
fi
else
echo "asciinema: MISSING"
fi
PREFLIGHT_EOF
If asciinema is NOT installed or convert is missing, use AskUserQuestion:
Question: "asciinema CLI issue detected. How would you like to proceed?"
Header: "Setup"
Options:
- Label: "Install/upgrade asciinema (Recommended)"
Description: "Run: brew install asciinema (or upgrade if outdated)"
- Label: "Show manual instructions"
Description: "Display installation commands for all platforms"
- Label: "Cancel"
Description: "Exit without converting"
Phase 1: File Discovery & Selection (MANDATORY)
Purpose: Discover .cast files and let user select which to convert.
Step 1.1: Discover .cast Files
bash
/usr/bin/env bash<<'DISCOVER_EOF'
# Search for .cast files with metadata
for file in $(fd -e cast . --max-depth 5 2>/dev/null | head -10); do
SIZE=$(ls -lh "$file" 2>/dev/null | awk '{print $5}')
LINES=$(wc -l < "$file" 2>/dev/null | tr -d ' ')
DURATION=$(head -1 "$file" 2>/dev/null | jq -r '.duration // "unknown"' 2>/dev/null)
BASENAME=$(basename "$file")
echo "FILE:$file|SIZE:$SIZE|LINES:$LINES|DURATION:$DURATION|NAME:$BASENAME"
done
DISCOVER_EOF
Question: "Which recording would you like to convert?"
Header: "Recording"
Options:
- Label: "{filename} ({size})"
Description: "{line_count} events, {duration}s duration"
- Label: "{filename2} ({size2})"
Description: "{line_count2} events, {duration2}s duration"
- Label: "Browse for file"
Description: "Search in a different directory"
- Label: "Enter path"
Description: "Provide a custom path to a .cast file"
Phase 2: Output Options (MANDATORY)
Purpose: Let user configure conversion behavior.
Question: "Select conversion options:"
Header: "Options"
multiSelect: true
Options:
- Label: "Plain text output (Recommended)"
Description: "Convert to .txt with all ANSI codes stripped"
- Label: "Create timestamp index"
Description: "Generate [HH:MM:SS] indexed version for navigation"
- Label: "Split by idle time"
Description: "Create separate chunks at 30s+ pauses"
- Label: "Preserve terminal dimensions"
Description: "Add header with original terminal size"
Phase 3: Output Location (MANDATORY)
Purpose: Let user choose where to save the output.
Question: "Where should the output be saved?"
Header: "Output"
Options:
- Label: "Same directory as source (Recommended)"
Description: "Save {filename}.txt next to {filename}.cast"
- Label: "Workspace tmp/"
Description: "Save to ${PWD}/tmp/"
- Label: "Custom path"
Description: "Specify a custom output location"