Al grabar sesiones automatizadas de terminal usando agentes como Antigravity y AsciiNema, existe un problema común: el agente teclea y ejecuta las instrucciones instantáneamente en 0 milisegundos. El resultado es un video ilegible que salta al final antes de que puedas leer algo.
La primera solución suele ser inyectar comandos de sleep explícitos en la terminal, pero esto contamina las instrucciones mostradas en el video haciéndolo ver poco natural. ¿La verdadera solución? Aprovechar el idle time (tiempo inactivo) nativo de AsciiNema enviando la entrada de comandos de forma secuencial pero esperando silenciosamente desde nuestra herramienta conectada a la terminal.
🛠 El Skill Agentico: Asciinema Recorder
A continuación tienes el Skill completo que puedes enseñarle a tu agente para que adopte esta nueva habilidad de manera nativa sin usar comandos sleep en la terminal:
---
name: asciinema-recorder
description: Automatically use asciinema to record terminal sessions when the user asks to record commands or a process.
---
# Asciinema Recorder Skill
When the user asks you to "grabar los comandos" (record the commands), "record terminal", or create an asciinema recording for a specific task:
## Execution Steps
1. Use the `run_command` tool to start an asciinema recording in the background using a temporary file. Crucially, **always set a descriptive title** for the video using the `-t` flag based on the context of what you are doing. For example:
`asciinema rec -t "Navigating through project directories" /tmp/recording.cast`
Set `WaitMsBeforeAsync` to around 2000-5000ms to ensure the process starts properly and returns a background Command ID.
2. Execute the commands the user requested using the `send_command_input` tool with the background Command ID.
- NOTE: `send_command_input` sends stdin directly to the running `asciinema` subshell process.
- **Crucial**: Make sure to append `\n` to your inputs so they are executed.
- **Crucial pacing**: Terminal commands execute instantly and disappear fast. **DO NOT** use explicit `sleep` commands as they look unnatural in tutorials.
- **Instead**: You MUST make sequential asynchronous `send_command_input` calls, and set the **`waitForPreviousTools: true`** flag on each one, along with a `WaitMs` (e.g., 2000 to 4000). Asciinema naturally records these idle `WaitMs` periods without printing anything extra to the screen!
- Example command sequence:
1. Tool Call `send_command_input`: `cd ~/Source\n` | `WaitMs: 2000` | `waitForPreviousTools: true`
2. Tool Call `send_command_input`: `ls -l\n` | `WaitMs: 3000` | `waitForPreviousTools: true`
3. Tool Call `send_command_input`: `sw_vers\n` | `WaitMs: 3000` | `waitForPreviousTools: true`
- By structuring your tool calls this way, the resulting cast video will naturally pause for exactly `WaitMs` between executions, allowing viewers to read the output smoothly!
3. When finished with the commands, use `send_command_input` with `exit\n` and `waitForPreviousTools: true` to properly close the recording session leaving a final pause for reading.
4. If the user wants to upload the video, use `run_command` synchronously to run:
`asciinema upload /tmp/recording.cast`
Capture the URL it outputs and share it with the user.
🚀 Cómo implementarlo (Paso a Paso)
A continuación te indicamos los pasos exactos para configurar Antigravity y probar tu primera terminal automatizada.
Paso 1: Instalación de Dependencias
Tu máquina (o entorno remoto) debe tener la utilidad asciinema instalada antes de poder grabar comandos. Usualmente instalado vía brew o apt-get.
Paso 2: Crear el Archivo Skill
Crea un archivo llamado SKILL.md en el directorio ~/.agents/skills/asciinema-recorder/ y pega el texto del cajón de arriba exactamente así.
💡 Sugerencia de Prompt Integrado
¿Quieres saltarte el proceso manual? ¡Fácil! Pega esto tal como está en tu agente (Antigravity o Claude) y él hará todo por ti:
Por favor, instala la herramienta CLI 'asciinema' en mi entorno de OS actual de forma global (ej. usando brew). Posteriormente, crea un archivo estructurado de nombre SKILL.md en el directorio de la carpeta ~/.agents/skills/asciinema-recorder/ que contenga estrictamente el texto del "Asciinema Recorder Skill" oficial para Antigravity. Acusa recibo una vez terminado.