diagnosing-replay-capture-gaps
Explains why part of one session recording was not captured, by reading the exported rrweb JSON (`*-ph-recording.json`) and the SDK lifecycle and config…
от PostHog★ 41 278 звёзд на GitHub
Установить diagnosing-replay-capture-gaps в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Diagnosing gaps in what a replay captured
The user has one recording open and something is missing: the start, the end, a page, or a stretch in the middle. The recording itself is the best evidence. posthog-js writes its config, its start reason, and its lifecycle (pauses, idle, session changes, page loads) into the recording as custom events.
Your job is to separate three things:
- Expected gaps: the SDK did what it was configured to do (sampling, triggers, URL blocklist, idle, hidden tab, minimum duration).
- Lost data: the SDK recorded, but data did not reach PostHog (tab closed before upload, blocked
/s/requests, a proxy that breaks/s/). - Not recorded at all: the SDK never ran or never started on those pages (a second app with replay off, recorder script blocked, init removed).
Name which one it is, and back it with timestamps from this recording.
Inputs
| Input | What it holds |
|---|---|
Attached file ending in -ph-recording.json |
The full export, with every custom event and snapshot. Query it with jq. Never print it whole. |
session_recording_data context item |
A compact timeline: page loads, console, network, custom events. Use it when no file is attached. |
posthog:execute-sql |
The session's events and SDK diagnostic properties. Shows pages the user visited that the recording lacks. |
posthog:session-recording-get |
Metadata: start and end time, duration, active seconds, snapshot_source. |
The recipes need the export, or at least the session_recording_data item.
An agent cannot create either with MCP tools. The user exports the file from the replay player and attaches it.
With neither, use the investigating-replay skill, and tell the user that attaching the export makes this diagnosis possible.
Workflow
Step 1: Build the lifecycle timeline
Run the recipes in reading-the-export.md.
Set START_MS from the recording's start_time first, so the recipes print player time. The player starts at start_time when that is earlier than the first snapshot.
- Timeline: page loads (Meta), full snapshots, and SDK custom events, in seconds of player time, with window ids.
- Windows: for each
windowId, the first event, the first full snapshot, and the last event. - Gaps: stretches of 30 seconds or more with no data.
- Config:
$remote_config_received,$recording_started,triggerGroupSamplingDecisionMade, and the replay-related keys of$posthog_config.
Mobile SDKs do not write these custom events. For mobile, use the windows and gaps recipes and the SQL in Step 3.
Step 2: Explain each gap from the timeline
Read the custom events around each gap. The lifecycle tags table says what each one means.
sessionIdlebefore a gap andsessionNoLongerIdleafter it: the user was inactive. Expected. The SDK takes no snapshots while idle.window hidden/window visible: the user was in another tab or app. Expected.recording pausedwithreason: url blocker: the page matched the URL blocklist. Expected.browser offline: data was buffered offline and may be lost if the tab closed.$session_id_changeor$session_ending: the rest is in another recording.nextSessionIdnames it.- A window whose first full snapshot is much later than its first non-Custom event: the start was lost. That is the "first N can't be played" banner.
Custom events alone before the full snapshot do not count. A backdated
sessionIdleopens the window over an idle span, and the SDK records nothing while idle. - A window that ends at the last interaction before a navigation, with no later Meta and no
$pageviewor$url_changedevent: the next page was not captured.
Step 3: Compare with what the user actually did
Events show pages and actions that the recording lacks.
Bound both queries by time, because $session_id alone does not limit the partitions it reads.
Take <start> and <end> from session-recording-get, or from the first and last snapshot timestamps.
A session lasts at most 24 hours, so a one-day buffer on each side keeps events from before the recording started.
First, the pages and SDK states the session has:
SELECT
properties.$current_url AS url,
properties.$lib AS lib,
properties.$lib_version AS lib_version,
properties.$recording_status AS recording_status,
groupUniqArray(properties.$session_recording_start_reason) AS start_reasons,
groupUniqArray(event) AS event_types,
count() AS events,
min(
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/causes.md
- references/reading-the-export.md
FAQ
Что делает скилл diagnosing-replay-capture-gaps?
Explains why part of one session recording was not captured, by reading the exported rrweb JSON (`*-ph-recording.json`) and the SDK lifecycle and config events inside it. Applies when that export, or the `session_recording_data` context item that PostHog AI adds, is attached. With neither, use investigating-replay. Use when a user debugs one replay and asks why it starts late, stops early, only shows the first or landing page, stops after cookie consent or a page navigation, has blank stretches or gaps, is shorter than the real visit, is split across sessions, or shows "the first N minutes can't be played". Not for sessions with no recording, or recordings that stopped across the project: use diagnosing-missing-recordings for those.
Как установить скилл diagnosing-replay-capture-gaps?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл diagnosing-replay-capture-gaps запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…