Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(replay-vision): tune scanner prompts for friction and confidence (#60095)

Tue Haulunde8ef6b01c1b4
diff --git a/products/replay_vision/backend/temporal/scanners/base.py b/products/replay_vision/backend/temporal/scanners/base.py
index 06849d59e2b5..b79051d247b4 100644
--- a/products/replay_vision/backend/temporal/scanners/base.py
+++ b/products/replay_vision/backend/temporal/scanners/base.py
@@ -16,12 +16,7 @@ class BaseScannerOutput(BaseModel, frozen=True):
confidence: float = Field(
ge=0,
le=1,
- description=(
- "Calibrated confidence, 0.0 to 1.0 with one decimal; use the full range — most answers fall in 0.6-0.9. "
- "Ask: could a reasonable alternative answer be defended on the same evidence? If yes, cap at 0.7. "
- "Reserve 0.9+ for unambiguous evidence with no plausible alternative. "
- "1.0 should be exceedingly rare — pick 0.95 instead."
- ),
+ description="Calibrated confidence, 0.0 to 1.0 with one decimal. Apply the calibration rules from the system prompt.",
)
def to_event_properties(self) -> dict[str, Any]:
diff --git a/products/replay_vision/backend/temporal/scanners/prompts/base.jinja b/products/replay_vision/backend/temporal/scanners/prompts/base.jinja
index 70e466f45969..c372b92377a2 100644
--- a/products/replay_vision/backend/temporal/scanners/prompts/base.jinja
+++ b/products/replay_vision/backend/temporal/scanners/prompts/base.jinja
@@ -8,6 +8,12 @@ Approach:
- Ground every claim in direct evidence — a specific moment in the video or a specific event in the timeline. When evidence is ambiguous or absent, lower `confidence` and say so.
- Stay on the task. Don't drift into adjacent observations it didn't ask about.
- Prefer admitting uncertainty over fabricating detail.
+- PostHog already emits dedicated events for the common friction signals: `$rageclick` (user clicked the same element multiple times in quick succession) and `$dead_click` (a click that didn't trigger any state change). Treat these as ground truth — only conclude that the user rage-clicked or hit a dead click when the corresponding event is present. Do not infer rage-clicking from interaction bursts on tabs, dropdowns, or other re-clickable controls.
+
+Confidence calibration:
+- Default to the 0.6-0.8 band. Reserve 0.9+ for unambiguous conclusions corroborated by 2+ independent signals.
+- If your conclusion rests on a single event or moment with no corroboration, cap `confidence` at 0.8.
+- If `events_truncated` is true, cap `confidence` at 0.6 — you only saw part of the session.
<events_format>
Each event is an object with these fields:
@@ -20,7 +26,7 @@ Each event is an object with these fields:
- $event_type: interaction kind (click, submit, etc.)
- $exception_types / $exception_values: exception class + short description, when applicable
-Events are in chronological order; identical consecutive events have been deduplicated; sparse fields are omitted per-event. Very chatty sessions are truncated to the first batch of events — when that happens `session_metadata.events_truncated` is true and you should rely more on the video and lower your `confidence` accordingly.
+Events are in chronological order; identical consecutive events have been deduplicated; sparse fields are omitted per-event. Very chatty sessions are truncated to the first batch of events — when that happens `session_metadata.events_truncated` is true and you should rely more on the video (see the confidence cap above).
</events_format>
<events>
@@ -42,7 +48,7 @@ Session-level context. Fields (all optional, omitted when unknown):
- click_count / keypress_count / mouse_activity_count: interaction density
- start_url: where the user entered the session
- console_error_count: total console errors during the session
-- events_truncated: when true, the events table was cut off before the session end; weigh the video more and lower confidence
+- events_truncated: when true, the events table was cut off before the session end; weigh the video more
</session_metadata_format>
<session_metadata>
diff --git a/products/replay_vision/backend/temporal/scanners/prompts/indexer.jinja b/products/replay_vision/backend/temporal/scanners/prompts/indexer.jinja
index 7b74ab46b927..3052e5a02bd7 100644
--- a/products/replay_vision/backend/temporal/scanners/prompts/indexer.jinja
+++ b/products/replay_vision/backend/temporal/scanners/prompts/indexer.jinja
@@ -4,7 +4,7 @@
- `intent`: one sentence about what the user set out to do (their goal).
- `summary`: 1-2 sentences on the overall arc.
- `outcome`: one sentence on the final state — do not restate the summary.
-- `friction_points`: list of named blockers, errors, or frustrations the user hit (empty if none).
+- `friction_points`: list of named blockers, errors, or frustrations the user hit (empty if none). Only include things the user would notice — visible error states, dead clicks, rage clicks, abandoned actions, page reloads. Background JS console errors that don't affect the UI (ResizeObserver loops, feature-flag fetch failures, third-party script noise) are not friction.
- `keywords`: 5-15 distinctive lowercase terms — favor action verbs and specific feature names; skip generic terms ('user', 'session', 'navigation') and the product/team name.
Do not include any event citations or `event_id` hashes anywhere — this output is consumed by a vector-embedding pipeline and hex tokens would be noise.{% endblock %}