packages/builtin-skills/src/acceptance/references/recording-cdp.md
Use this reference only for Web or Electron criteria that assert behavior over
time: streaming output, loading-to-loaded transitions, timers, animations, or
multi-step flows. Capture renderer frames through agent-browser; do not record
the host screen.
Run the capture loop in a persistent shell while driving the scenario from another shell. Choose exactly one capture function for the selected surface:
FRAME_DIR=$(mktemp -d)
# Web:
capture_frame() { agent-browser --session app screenshot "$1"; }
# Electron alternative:
# capture_frame() { agent-browser --cdp 9222 screenshot "$1"; }
i=0
while [ "$i" -lt 40 ]; do # about 20 seconds at 0.5 seconds per frame
printf -v frame_number "%06d" "$i"
capture_frame "$FRAME_DIR/frame_$frame_number.png"
i=$((i + 1))
sleep 0.5
done
Use a shorter interval such as 0.25 seconds for quick transitions and a longer
interval such as 1 second for slow flows. Keep the capture scoped to the
behavior under review.
# MP4
ffmpeg -y -framerate 2 -i "$FRAME_DIR/frame_%06d.png" \
-c:v libx264 -crf 23 -pix_fmt yuv420p ./proof/flow.mp4
# GIF with a generated palette
ffmpeg -y -framerate 2 -i "$FRAME_DIR/frame_%06d.png" \
-vf "scale=900:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
./proof/flow.gif
ffprobe -v error \
-show_entries format=duration:stream=codec_name,width,height,avg_frame_rate,nb_frames \
-of json ./proof/flow.mp4
Inspect the first frame, action frame, transient state, and settled frame before citing the artifact. Keep the original frame directory until verification is published; it is useful when a reviewer asks about a one-frame defect.
--by agent-browser for the captured frames and --by program for the
assembled media artifact.agent-browser and ffmpeg/ffprobe are required. Probe them before the run.Choose gif versus video and submit the artifact using the shared contract in
evidence.md.