Instrucciones de origen · Vista previa de solo lectura
name
asciinema-converter
description
Convert .cast recordings to .txt for analysis. TRIGGERS - convert cast, cast to txt, strip ANSI, batch convert.
allowed-tools
Read, Bash, Glob, Write, AskUserQuestion
asciinema-converter
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+)
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.
/usr/bin/env bash << 'PREFLIGHT_EOF'ifcommand -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; thenecho"convert: available"elseecho"convert: MISSING (update asciinema to v2.4+)"fielseecho"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.
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"