Skip to content
asciinema-streaming-backup logo

Asciinema Streaming Backup

asciinema-streaming-backup

Real-time asciinema backup to GitHub orphan branch. TRIGGERS - streaming backup, asciinema backup, session backup, recording backup.

SKILL.md

Full skill instructions

asciinema-streaming-backup

Complete system for streaming asciinema recordings to GitHub with automatic brotli archival. Uses idle-detection for intelligent chunking, zstd for concatenatable streaming compression, and GitHub Actions for final brotli recompression.

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:

  • Setting up real-time backup of asciinema recordings to GitHub
  • Configuring idle-detection chunking for recordings
  • Creating orphan branch infrastructure for recording storage
  • Integrating GitHub Actions for brotli recompression

Platform: macOS, Linux Isolation: Uses Git orphan branch (separate history, cannot pollute main)


Architecture Overview

┌─────────────────┐     zstd chunks      ┌─────────────────┐     Actions      ┌─────────────────┐
│  asciinema rec  │ ──────────────────▶  │  GitHub Orphan  │ ───────────────▶ │  brotli archive │
│  + idle-chunker │   (concatenatable)   │  gh-recordings  │                  │  (300x compress)│
└─────────────────┘                      └─────────────────┘                  └─────────────────┘
         │                                        │
         │ Idle ≥30s triggers chunk               │ Separate history
         ▼                                        │ Cannot PR to main
    ~/​asciinema_recordings/                                 ▼
    └── repo-name/                          .github/​workflows/
        └── chunks/​*.zst                    └── recompress.yml

Requirements

ComponentRequiredInstallationVersion
asciinema CLIYesbrew install asciinema3.0+ (Rust)
zstdYesbrew install zstdAny
brotliYesbrew install brotliAny
gitYesPre-installed2.20+
gh CLIYesbrew install ghAny
fswatchOptionalbrew install fswatchFor real-time

Workflow Phases

Phase 0: Preflight Validation

Verify all tools installed, offer self-correction if missing. Run the preflight check script, then AskUserQuestion to offer installation for missing tools.

See Setup Scripts for the complete preflight-check.sh script.

Self-Correction: If tools are missing, generate installation command and offer to run it.


Phase 1: GitHub Account Detection

Detect available GitHub accounts from 5 sources (SSH config, SSH keys, gh CLI, mise env, git config) and let user choose which to use.

See Account & Repository Detection for the detection script, scoring logic, and AskUserQuestion flow.


Phase 1.5: Current Repository Detection

Detect current git repository context (CURRENT_REPO_OWNER, CURRENT_REPO_NAME, DETECTED_FROM) to provide intelligent defaults for Phase 2.

See Account & Repository Detection for the detection script.


Phase 2: Core Configuration

Gather essential configuration: repository URL (with auto-detection from Phase 1.5), recording directory, and branch name.

See Configuration Reference for all AskUserQuestion sequences and URL normalization logic.


Phase 3: Advanced Configuration

Allow customization of compression and behavior parameters:

ParameterDefaultRange
Idle threshold30s5-300s
zstd level31-22
Brotli level91-11
Auto-pushYesYes/​No
Poll interval5s2s, 5s, 10s

See Configuration Reference for all AskUserQuestion sequences.


Phase 4: Orphan Branch Setup

Create or configure the orphan branch with GitHub Actions workflow. Checks for existing branch first and offers clone/​reset/​verify options.

Key actions:

  1. Check if branch exists on remote via git ls-remote
  2. If exists: AskUserQuestion for clone/​reset/​verify
  3. If new: Create orphan branch, add workflow + directory structure, push

See Setup Scripts for the complete setup-orphan-branch.sh script. See GitHub Workflow for the full recompress.yml Actions workflow.


Phase 5: Local Environment Setup

Configure local directory and generate customized idle-chunker.sh with user parameters embedded from Phase 3.

Key actions:

  1. Clone orphan branch to ~/​asciinema_recordings/<repo>/
  2. Generate idle-chunker.sh with embedded configuration
  3. Display configuration summary and usage instructions

See Setup Scripts for local setup scripts. See Idle Chunker for the complete chunker implementation.


Phase 6: Autonomous Validation

Claude executes 8 tests autonomously, displaying formatted results. Only 2 tests require user action (recording test, chunker live test).

Test CategoryCountAutonomous?
Tool preflight5Yes
Compression round-trip3Yes
Repository validation4Yes
GitHub Actions trigger1Yes
Recording test1No (USER)
Chunker live test1No (USER)

See Autonomous Validation for the complete validation script, user-required test flows, and troubleshooting table.


Quick Start

First-Time Setup

/​usr/​bin/​env bash << 'PREFLIGHT_EOF'
# 1. Check requirements
for tool in asciinema zstd brotli git gh; do
  command -v "$tool" &>/​dev/​null && echo "$tool: OK" || echo "$tool: MISSING"
done

# 2. Create orphan branch (replace with your repo)
REPO="[email protected]:YOUR/​REPO.git"
./​setup-orphan-branch.sh "$REPO"

# 3. Validate setup
./​validate-setup.sh "$HOME/​asciinema_recordings/​REPO"
PREFLIGHT_EOF

Recording Session

/​usr/​bin/​env bash << 'SKILL_SCRIPT_EOF'
# Terminal 1: Start recording
WORKSPACE=$(basename "$PWD")
asciinema rec $PWD/​tmp/​${WORKSPACE}_$(date +%Y-%m-%d_%H-%M).cast

# Terminal 2: Start idle-chunker
~/​asciinema_recordings/​REPO/​idle-chunker.sh $PWD/​tmp/​${WORKSPACE}_*.cast
SKILL_SCRIPT_EOF

Key Design Decisions

DecisionRationale
zstd for streamingSupports frame concatenation (brotli doesn't)
brotli for archivalBest compression ratio (~300x for .cast files)
Orphan branchComplete isolation, can't pollute main history
Idle-based chunkingSemantic breakpoints, not mid-output splits
Shallow cloneMinimal disk usage, can't accidentally access main
30s idle thresholdBalances chunk frequency vs semantic completeness

Troubleshooting

See Troubleshooting Guide for common issues and fixes.


Post-Change Checklist

After modifying this skill:

  1. Orphan branch creation scripts use heredoc wrapper
  2. All bash blocks compatible with zsh (no declare -A, no grep -P)
  3. GitHub Actions workflow validates brotli recompression
  4. Idle chunker handles both macOS and Linux stat syntax
  5. Detection flow outputs parseable key=value format
  6. References validate links to external documentation

Reference Documentation

Post-Execution Reflection

After this skill completes, reflect before closing the task:

  1. Locate yourself. — Find this SKILL.md's canonical path before editing.
  2. What failed? — Fix the instruction that caused it.
  3. What worked better than expected? — Promote to recommended practice.
  4. What drifted? — Fix any script, reference, or dependency that no longer matches reality.
  5. Log it. — Evolution-log entry with trigger, fix, and evidence.

Do NOT defer. The next invocation inherits whatever you leave behind.

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
Imagica logo
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View