MCPInstall

asciinema-cast-format

Asciinema v3 .cast file format reference. TRIGGERS - cast format, asciicast spec, event codes, parse cast file.

Installs
131
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/terrylica/cc-skills --skill asciinema-cast-format
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads asciinema-cast-format automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

asciinema-cast-format

Reference documentation for the asciinema v3 .cast file format (asciicast v2 specification).

Platform: All platforms (documentation only)

Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.

When to Use This Skill

Use this skill when:

  • Parsing or inspecting .cast file structure
  • Understanding NDJSON header and event formats
  • Building tools that read or write .cast files
  • Debugging recording issues or format errors
  • Learning the asciicast v2 specification

Format Overview

Asciinema v3 uses NDJSON (Newline Delimited JSON) format:

  • Line 1: Header object with recording metadata
  • Lines 2+: Event arrays with timestamp, type, and data

Header Specification

The first line is a JSON object with these fields:

FieldTypeRequiredDescription
versionintYesFormat version (always 2 for v3 recordings)
widthintYesTerminal width in columns
heightintYesTerminal height in rows
timestampintNoUnix timestamp of recording start
durationfloatNoTotal duration in seconds
titlestringNoRecording title
envobjectNoEnvironment variables (SHELL, TERM)
themeobjectNoTerminal color theme

Example Header

{
  "version": 2,
  "width": 120,
  "height": 40,
  "timestamp": 1703462400,
  "duration": 3600.5,
  "title": "Claude Code Session",
  "env": { "SHELL": "/bin/zsh", "TERM": "xterm-256color" }
}

Event Codes

Each event after the header is a 3-element array:

[timestamp, event_type, data]
CodeNameDescriptionData Format
oOutputTerminal output (stdout)String
iInputTerminal input (stdin)String
mMarkerNamed marker for navigationString (marker name)
rResizeTerminal resize event"WIDTHxHEIGHT"
xExitExtension for custom dataVaries

Event Examples

[0.5, "o", "$ ls -la\r\n"]
[1.2, "o", "total 48\r\n"]
[1.3, "o", "drwxr-xr-x  12 user  staff  384 Dec 24 10:00 .\r\n"]
[5.0, "m", "file-listing-complete"]
[10.5, "r", "80x24"]

Timestamp Behavior

  • Timestamps are relative to recording start (first event is 0.0)
  • Measured in seconds with millisecond precision
  • Used for playback timing and navigation

Calculating Absolute Time

/usr/bin/env bash << 'CALC_TIME_EOF'
HEADER_TIMESTAMP=$(head -1 recording.cast | jq -r '.timestamp')
EVENT_OFFSET=1234.5  # From event array

ABSOLUTE=$(echo "$HEADER_TIMESTAMP + $EVENT_OFFSET" | bc)
date -r "$ABSOLUTE"  # macOS
# date -d "@$ABSOLUTE"  # Linux
CALC_TIME_EOF

Parsing Examples

Extract Header with jq

/usr/bin/env bash << 'HEADER_EOF'
head -1 recording.cast | jq '.'
HEADER_EOF

Get Recording Duration

/usr/bin/env bash << 'DURATION_EOF'
head -1 recording.cast | jq -r '.duration // "unknown"'
DURATION_EOF

Count Events by Type

/usr/bin/env bash << 'COUNT_EOF'
tail -n +2 recording.cast | jq -r '.[1]' | sort | uniq -c
COUNT_EOF

Extract All Output Events

/usr/bin/env bash << 'OUTPUT_EOF'
tail -n +2 recording.cast | jq -r 'select(.[1] == "o") | .[2]'
OUTPUT_EOF

Find Markers

/usr/bin/env bash << 'MARKERS_EOF'
tail -n +2 recording.cast | jq -r 'select(.[1] == "m") | "\(.[0])s: \(.[2])"'
MARKERS_EOF

Get Event at Specific Time

/usr/bin/env bash << 'TIME_EOF'
TARGET_TIME=60  # seconds
tail -n +2 recording.cast | jq -r "select(.[0] >= $TARGET_TIME and .[0] < $((TARGET_TIME + 1))) | .[2]"
TIME_EOF

Large File Considerations

For recordings >100MB:

File SizeLine CountApproach
<100MB<1Mjq streaming works fine
100-500MB1-5MUse --stream flag, consider ripgrep
500MB+5M+Convert to .txt first with asciinema

Memory-Efficient Streaming

/usr/bin/env bash << 'STREAM_EOF'
# Stream process large files
jq --stream -n 'fromstream(1|truncate_stream(inputs))' recording.cast | head -1000
STREAM_EOF

Use asciinema convert

For very large files, convert to plain text first:

asciinema convert -f txt recording.cast recording.txt

This strips ANSI codes and produces clean text (typically 950:1 compression).


TodoWrite Task Template

1. [Reference] Identify .cast file to analyze
2. [Header] Extract and display header metadata
3. [Events] Count events by type (o, i, m, r)
4. [Analysis] Extract relevant event data based on user need
5. [Navigation] Find markers or specific timestamps if needed

Post-Change Checklist

After modifying this skill:

  1. Event code table matches asciinema v2 specification
  2. Parsing examples use heredoc wrapper for bash compatibility
  3. Large file guidance reflects actual performance characteristics
  4. All jq commands tested with sample .cast files

Reference Documentation


Troubleshooting

IssueCauseSolution
jq parse errorInvalid NDJSON in .cast fileCheck each line is valid JSON with jq -c .
Header missing durationRecording in progressDuration added when recording ends
Unknown event typeCustom extension eventCheck for x type events (extension data)
Timestamp out of orderCorrupted fileEvents should be monotonically increasing
Large file jq timeoutFile too big for in-memoryUse --stream flag or convert to .txt first
Markers not foundNo markers in recordingMarkers are optional; not all recordings have them
Wrong version numberOlder cast formatThis skill covers v2 format (asciinema v3+)
Empty output from tailFile has only headerRecording may be empty or single-line

Post-Execution Reflection

After this skill completes, check before closing:

  1. Did the command succeed? — If not, fix the instruction or error table that caused the failure.
  2. Did parameters or output change? — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
  3. Was a workaround needed? — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.

Only update if the issue is real and reproducible — not speculative.

FAQ

What does the asciinema-cast-format skill do?

Asciinema v3 .cast file format reference. TRIGGERS - cast format, asciicast spec, event codes, parse cast file.

How do I install asciinema-cast-format?

Run npx skills add https://github.com/terrylica/cc-skills --skill asciinema-cast-format in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/asciinema-cast-format/ (personal) or .claude/skills/asciinema-cast-format/ (project).

Which AI agents can use asciinema-cast-format?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is asciinema-cast-format safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains asciinema-cast-format?

It is published by terrylica in terrylica/cc-skills. It has 131 recorded installs.

More from terrylica/cc-skills

View all →

mise-tasks

terrylica/cc-skills

Orchestrate multi-step project workflows using mise task definitions with dependency management and argument handling. Use whenever the user.

pandoc-pdf-generation

terrylica/cc-skills

PDF generation from markdown via Pandoc/XeLaTeX. TRIGGERS - markdown for PDF, print document, pandoc

Docs & Writing547 installs

mql5-indicator-patterns

terrylica/cc-skills

MQL5 indicator development patterns. TRIGGERS - MQL5 indicator, OnCalculate, indicator buffers, MetaTrader 5.

501 installs

Python logging with loguru, structlog, and orjson. TRIGGERS - loguru, structlog, structured logging

DevOps & Cloud402 installs

gdrive-access

terrylica/cc-skills

Access Google Drive via CLI with 1Password OAuth: list files, download, and sync folders. TRIGGERS - google drive, gdrive, drive folder, download drive, sync drive.

Backend & APIs356 installs

chezmoi-workflows

terrylica/cc-skills

Open the skill to read its SKILL.md instructions.

297 installs

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.