
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.
- Installs
- 211
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/posthog/ai-plugin --skill investigating-replay- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads investigating-replay automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Investigating a session recording
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.
Available tools
| 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-observations-get | Read one observation in full (scanner_result) |
posthog:vision-scanners-inline-scan | Generate an AI summary of the session (slow, optional) |
posthog:vision-scanners-list | Find saved summarizer scanners (scanner_type=summarizer) |
posthog:vision-scanners-scan-session | Run a saved summarizer scanner on the session (slow) |
Workflow
Step 1 — Get recording metadata and person profile
Start with the recording to get metadata and the person's distinct ID:
posthog:session-recording-get
{
"id": "<session_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:
posthog:persons-retrieve
{
"id": "<person_uuid_from_recording>"
}
Step 2 — Query same-session events
Use the recording id from Step 1 as the $session_id value. Get the timeline
of what the user did during the session:
posthog:execute-sql
SELECT
timestamp,
event,
properties.$current_url AS url,
properties.$browser AS browser,
properties.$os AS os,
properties.$device_type AS device_type,
properties.$screen_width AS screen_width
FROM events
WHERE $session_id = '<session_id>'
ORDER BY timestamp ASC
LIMIT 200
For sessions with many events, focus on the most informative ones:
posthog:execute-sql
SELECT
timestamp,
event,
properties.$current_url AS url,
if(event = '$exception', properties.$exception_values[1], null) AS exception_message,
if(event = '$exception', properties.$exception_types[1], null) AS exception_type
FROM events
WHERE $session_id = '<session_id>'
AND event IN ('$pageview', '$pageleave', '$autocapture', '$exception', '$rageclick')
ORDER BY timestamp ASC
LIMIT 100
No rows? Recover the event session ID
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:
posthog:execute-sql
SELECT
properties.$session_id AS session_id,
count() AS event_count,
min(timestamp) AS first_seen,
max(timestamp) AS last_seen
FROM events
WHERE person_id = '<person_uuid>'
AND timestamp >= toDateTime('<start_time>') - INTERVAL 100 SECOND
AND timestamp <= toDateTime('<end_time>') + INTERVAL 100 SECOND
AND properties.$session_id IS NOT NULL
GROUP BY session_id
ORDER BY event_count DESC
LIMIT 10
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.
Step 3 — Check for linked error tracking issues
If the recording has console errors or exceptions, find related error tracking issues:
posthog:execute-sql
SELECT DISTINCT
properties.$exception_fingerprint AS fingerprint,
properties.$exception_types[1] AS type,
properties.$exception_values[1] AS message,
count() AS occurrences
FROM events
WHERE $session_id = '<session_id>'
AND event = '$exception'
GROUP BY fingerprint, type, message
ORDER BY occurrences DESC
LIMIT 10
If fingerprints are found, search for the corresponding error tracking issues to provide links and status:
posthog:query-error-tracking-issues-list
{
"searchQuery": "<exception_type or message>"
}
Step 4 — Synthesize the investigation
Present the findings as a coherent narrative:
- Who — person properties (name, email, country, plan, etc.)
- What — sequence of pages visited and key actions taken
- Problems — exceptions, console errors, rage clicks, and their frequency
- Related issues — linked error tracking issues with their status (active/resolved)
- Context — session duration, device/browser, activity score
Optional: AI summary via Replay Vision
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:
posthog:vision-observations-list { "session_id": "<session_id>" }The rows come back narrowed to
id,session_id,status,summary_lineandscanner_id. Look for one whosestatusissucceeded, then read it in full withvision-observations-getfor thatid: itsscanner_snapshot.scanner_typetells you whether it is asummarizer, andscanner_result.model_outputcarriestitle,summary,intent,outcome,friction_pointsandkeywords. If you find one, you are done — no new scan needed. -
Generate one with an inline scan of the built-in summary. It runs the same scan as the player's Summarize button, so a summary either of you started is shared, while a prompt of your own mints a separate scanner and a separate summary.
posthog:vision-scanners-inline-scan { "session_ids": ["<session_id>"], "built_in": "summarize_recording" }Leave
modelout so the server default applies. Warn the user this is async and takes several minutes (rasterize + LLM). Nothing is scheduled and there is nothing to clean up: the scanner an inline scan mints never sweeps on its own. A 400 here usually means the organization has not approved AI data processing yet. -
Read
results[0].scan_outcomebefore polling.startedmeans pollvision-observations-list(step 1) until the new observation reachessucceeded.already_scannedmeans a terminal observation already exists — read it via step 1, and if its status isfailedorineligiblesay so rather than polling. A nullscan_idorskipped_quotameans nothing ran: report the quota, do not poll.
The project already has a summarizer scanner
Use an inline scan for a one-off summary even then. Only reach for a saved scanner when the user wants that scanner's own prompt rather than the built-in one:
posthog:vision-scanners-list
{
"scanner_type": "summarizer"
}
Show the user the scanners (name + prompt), ask which to use, then run it against
the session and poll vision-observations-list until the observation reaches
succeeded:
posthog:vision-scanners-scan-session
{
"id": "<scanner_id>",
"session_id": "<session_id>"
}
Never create a scanner to answer a single question — vision-scanners-create
leaves a scheduled sweep behind that the inline scan does not.
Tips
- Run steps 1-3 in parallel when possible — they're independent queries.
- If the recording has very few events, the session was likely very short. Note this rather than suggesting something is broken.
- Console error count from the recording metadata is a good signal for whether to dig into exceptions. If it's 0, skip step 3.
- The
start_urlfrom the recording tells you where the user's journey began — use this to frame the narrative. - If
personis null on the recording, the user was anonymous. Person properties won't be available, but events still are.
Related skills
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
FAQ
What does the investigating-replay skill do?
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.
How do I install investigating-replay?
Run npx skills add https://github.com/posthog/ai-plugin --skill investigating-replay in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/investigating-replay/ (personal) or .claude/skills/investigating-replay/ (project).
Which AI agents can use investigating-replay?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is investigating-replay safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains investigating-replay?
It is published by posthog in posthog/ai-plugin, and it is an official skill from the maker of the technology it covers. It has 211 recorded installs.
More from posthog/ai-plugin
instrument-product-analytics
posthog/ai-plugin
Add PostHog product analytics events to track user behavior. Use after implementing new features or reviewing PRs to ensure meaningful user actions are captured. Also handles initial PostHog SDK setup if not yet installed.
instrument-feature-flags
posthog/ai-plugin
Add PostHog feature flags to gate new functionality. Use after implementing features or reviewing PRs to ensure safe rollouts with feature flag controls. Also handles initial PostHog SDK setup if not yet installed.
cleaning-up-stale-feature-flags
posthog/ai-plugin
Identify stale feature flags in a PostHog project and clean up the code that checks them. Use when the user wants to find, audit, or remove unused, fully rolled out, or abandoned feature flags, run a feature flag hygiene review or a weekly cleanup, reduce feature flag tech debt, or asks "which flags can I remove?". When the agent can read and edit a repository it performs the code cleanup itself: tested local changes, and one draft PR per flag when the user authorizes publishing. Agents without repository access generate a tailored cleanup prompt instead. Covers staleness detection, dependency checking, retained-path rules, and the code-first ordering. This skill does not archive or otherwise change a flag in PostHog.
auditing-experiments-flags
posthog/ai-plugin
Audit PostHog experiments and feature flags for configuration issues, staleness, and best-practice violations. Read when the user asks to audit, health-check, or review experiments or feature flags, check flag hygiene, or verify experiment setup.
querying-posthog-data
posthog/ai-plugin
Explains how to query PostHog data, defaulting to typed runners for supported product analytics. Read it before you write HogQL/SQL. Also read it before you call execute-sql against PostHog. Use it to find or aggregate PostHog entities. These entities include insights, dashboards, cohorts, feature flags, experiments, surveys, hog flows, warehouse data, and persons. Use it for trends, funnels, retention, lifecycle, paths, stickiness, web analytics, error tracking, logs, sessions, and LLM traces. Before you calculate a governed business or telemetry measure, check system.informationschema.metrics for an approved definition. Examples include MRR, activation, billable usage, active organizations, and failure rates. Use the approved definition before you derive a measure from raw events or use a typed domain tool. It also covers HogQL differences, system table schemas, functions, query examples, and schema discovery.
creating-experiments
posthog/ai-plugin
Guides agents through experiment creation: reading the project's setup with experiment-setup-context, defining the hypothesis, configuring rollout and bucketing, setting up analytics and running time, and reporting which choices are guesses. Delegates rollout decisions to configuring-experiment-rollout and metric setup to configuring-experiment-analytics. TRIGGER when: user asks to create a new experiment or A/B test, OR when you are about to call experiment-create. DO NOT TRIGGER when: user is updating an existing experiment, managing lifecycle, or only browsing experiments.
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.