npx skills add ...
npx skills add posthog/ai-plugin --skill investigating-replay
Investigates a session recording by gathering metadata, person profile, same-session events, and linked error tracking issues in one pass. Use when a user provides a recording or session ID and wants to understand what happened — who the user was, what they did, what errors occurred, and whether there are related error tracking issues. Replaces the manual chain of session-recording-get, persons-retrieve, execute-sql, and query-error-tracking-issues-list.
npx skills add posthog/ai-plugin --skill investigating-replay
When a user asks "what happened in this session?" or provides a recording/session ID to investigate, gather all relevant context in parallel rather than making them ask for each piece.
| Tool | Purpose |
|---|---|
posthog:session-recording-get | Recording metadata (duration, counts, status) |
posthog:persons-retrieve | Person profile (properties, distinct IDs) |
posthog:execute-sql | Query events, errors, and page views in session |
posthog:query-error-tracking-issues-list | Find error tracking issues linked to the session |
posthog:vision-observations-list | Check for an existing Replay Vision AI summary |
posthog:vision-scanners-list | Find summarizer scanners (scanner_type=summarizer) |
posthog:vision-scanners-scan-session | Run a summarizer scanner on the session (slow, optional) |
posthog:vision-scanners-create | Create a temporary summarizer scanner (ask first) |
posthog:vision-scanners-delete | Delete a temporary scanner after summarizing |
Start with the recording to get metadata and the person's distinct ID:
The recording id and the event $session_id are the same value. It selects the
recording here and the same-session events in Step 2. The response includes
distinct_id, person, start_time, end_time, duration, interaction counts,
console error counts, and viewing status. Use the distinct_id to fetch
the full person profile:
Use the recording id from Step 1 as the $session_id value. Get the timeline
of what the user did during the session:
For sessions with many events, focus on the most informative ones:
The recording id is the session ID. No rows means the session's events were
ingested without it. Find candidates from the person's events in the recording
window, padded by 100 seconds like the replay events query. person_id covers
all of the person's distinct IDs:
Continue only when one session ID clearly matches. Use it for the Step 2 and
Step 3 queries only. The replay URL and all Replay Vision calls take the
recording id.
If the recording has console errors or exceptions, find related error tracking issues:
If fingerprints are found, search for the corresponding error tracking issues to provide links and status:
Present the findings as a coherent narrative:
If the user wants a deeper analysis without reading through events manually, offer a Replay Vision summary. Follow "check-then-scan" — don't scan blindly, a scanner can only observe a given session once.
Check for an existing summary. A scheduled scanner may already have one:
Look for an observation where scanner_snapshot.scanner_type is summarizer
and status is succeeded. If found, read scanner_result.model_output
(title, summary, intent, outcome, friction_points, keywords) — done,
no new scan needed.
Find a summarizer scanner if none exists yet:
Scan the session with the chosen scanner. Warn this is async and takes several minutes (rasterize + LLM):
Retrieve the result by polling vision-observations-list (step 1) until
the new observation reaches succeeded.
If the project has no summarizer scanner, you can still produce a one-off summary with a throwaway scanner — but ask the user's permission before creating anything.
Ask permission to create a temporary summarizer scanner just to summarize this one session.
Create it disabled so it never sweeps on a schedule — a disabled scanner only runs when you trigger it on demand, so it won't touch other sessions or burn quota in the background:
Scan this session on demand with the new scanner, then poll for the result:
Poll vision-observations-list until the observation reaches succeeded and
read scanner_result.model_output.
Ask whether to keep or delete the scanner. Once you have the observation,
ask the user if they want to keep the temporary scanner or delete it with
vision-scanners-delete. Deleting is safe: the summary you just read is also
emitted as an event that persists after the scanner is gone, so cleaning up the
temporary scanner does not lose the result.
start_url from the recording tells you where the user's journey began —
use this to frame the narrative.person is null on the recording, the user was anonymous.
Person properties won't be available, but events still are.finding-sessions-to-watch — choose which sessions are worth investigating in the first placefinding-replay-for-issue — start from an error tracking issue and find its linked recordingsdiagnosing-missing-recordings — when a recording that should exist doesn'tcreating-replay-vision-scanners — automate this kind of watching as a scheduled scanner