: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(signals): describe scouts by config row, not name prefix, in docs (#97868)
posthog[bot]d3a251951490
diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.mdindex 102d3e8c578a..b9be04ba8ce5 100644--- a/products/signals/ARCHITECTURE.md+++ b/products/signals/ARCHITECTURE.md@@ -23,7 +23,7 @@ Several additional Signals workflows also exist but are not part of the main rep- `backfill-error-tracking` (`backend/temporal/backfill_error_tracking.py`) — backfills recent error tracking issues as signals- `emit-eval-signal` (`backend/temporal/emit_eval_signal.py`) - compatibility-only workflow retained for existing Temporal histories; its activity no longer emits signals-- `run-signals-scout-coordinator` (`backend/temporal/agentic/scout_coordinator.py`) — periodic tick (every `COORDINATOR_INTERVAL_MINUTES = 30`) that fans out scheduled `signals-scout-*` scout runs per (team, skill). Spec'd separately below.+- `run-signals-scout-coordinator` (`backend/temporal/agentic/scout_coordinator.py`) — periodic tick (every `COORDINATOR_INTERVAL_MINUTES = 30`) that fans out scheduled runs for every enabled `SignalScoutConfig`, per (team, skill). Spec'd separately below.- `RunSignalsScoutWorkflow` (`backend/temporal/agentic/scout_scheduler.py`) — child workflow per planned run; thin wrapper around the harness activity. Spec'd separately below.### Activity decoration@@ -312,7 +312,7 @@ Defined in `backend/temporal/agentic/scout_coordinator.py`.**Flow:**-1. Activity `fetch_enabled_signals_scout_runs_activity` bounds candidates to the teams enrolled via the `signals-scout` feature flag's JSON payload allowlist — `guaranteed_team_ids` minus `skip_team_ids`, with a hardcoded fail-safe default (`_participating_teams` → `_enrolled_team_ids`, modeled on `posthog/temporal/ai_observability/team_discovery.py`). Enrollment is flag-driven: editing the payload in the flag UI enrolls or drains a team next tick with no manual seed. For each enrolled team it calls `sync_canonical_skills(team, prune=True)` to mirror the on-disk `signals-scout-*` skills onto the team's `LLMSkill` rows, then auto-registers a `SignalScoutConfig` for any scout skill missing one (`scout_harness/config_registry.register_missing_configs`). The `scout-create` endpoint atomically creates a custom skill and config; `scout-config-create` is the lower-level explicit upsert for an existing skill. Failures here are logged and the tick continues — a stale skill is preferable to a dead tick.+1. Activity `fetch_enabled_signals_scout_runs_activity` bounds candidates to the teams enrolled via the `signals-scout` feature flag's JSON payload allowlist — `guaranteed_team_ids` minus `skip_team_ids`, with a hardcoded fail-safe default (`_participating_teams` → `_enrolled_team_ids`, modeled on `posthog/temporal/ai_observability/team_discovery.py`). Enrollment is flag-driven: editing the payload in the flag UI enrolls or drains a team next tick with no manual seed. For each enrolled team it calls `sync_canonical_skills(team, prune=True)` to mirror the on-disk `signals-scout-*` skills onto the team's `LLMSkill` rows, then calls `scout_harness/config_registry.register_missing_configs`. That auto-registers a `SignalScoutConfig` for any `signals-scout-*` skill lacking one, and returns the union of those skills with every live skill that already holds a config — so a bare-named scout is dispatched like any other config, while a config whose skill is gone is skipped. Bare-named scouts get their config through the API: the `scout-create` endpoint atomically creates a custom skill and config, and `scout-config-create` is the lower-level explicit upsert for an existing skill. The create modal is not one of those routes — it calls `scout-create`, but its name field always applies the `signals-scout-` prefix. Failures here are logged and the tick continues — a stale skill is preferable to a dead tick.2. For each enabled config, the coordinator computes how overdue the scout is. Rolling schedules are due when `last_run_at is None`, or `now - last_run_at >= run_interval_minutes`. A config with a `run_cron_schedule` is due at the earliest unfulfilled cron slot, evaluated as wall-clock time in the project's timezone (so slots follow daylight-saving changes). It runs on the first coordinator tick at or after that slot. Saving the config after a slot has passed waits for the next slot. There is no sampling — every due scout is planned.3. Due runs are sorted most-overdue-first and truncated at `MAX_RUNS_PER_TICK` (50 per tick; the cost bound — overflow catches up next tick). `last_run_at` is advanced via `.update()` for everything dispatched (bypasses `save()`, so the per-tick write never hits the activity log). Planned runs are re-sorted by `(team_id, skill_name)` for stable child IDs.4. Each `PlannedRun` becomes a child `RunSignalsScoutWorkflow` started with `ParentClosePolicy.ABANDON` and a deterministic workflow ID per `(team_id, skill_name, tick_id)` so retried coordinators can't double-launch within a tick.@@ -565,12 +565,12 @@ Per-team configuration for which signal sources are enabled.### `SignalScoutConfig`-Per-scout binding for the headless **Signals agent**: one row per `(team, skill_name)`. The coordinator auto-creates a row when it discovers a `signals-scout-*` skill on a participating team. Changes are activity-logged (they drive spend); team-level participation is gated by the `signals-scout` flag at the coordinator, not here. See `backend/scout_harness/AGENTS.md` for the harness internals.+Per-scout binding for the headless **Signals agent**: one row per `(team, skill_name)`; the config is what makes the skill a scout, so a scout may carry any valid scout name. That set is narrower than the valid skill names. `skill_loader.reserved_scout_name_error` gates both registration paths, refusing the inbox's reserved sub-page names and any name prefix another product owns. The coordinator auto-registers a row when it discovers any live `signals-scout-*` skill on a participating team, canonical or hand-authored; a scout whose name lacks the prefix is registered directly instead, through `scout-create` or `scout-config-create` (the create modal always applies the prefix). Changes are activity-logged (they drive spend); team-level participation is gated by the `signals-scout` flag at the coordinator, not here. See `backend/scout_harness/AGENTS.md` for the harness internals.| Field | Type | Description || ---------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- || `team` | FK → Team | Owning team (`related_name="signal_scout_configs"`). `unique_together(team, skill_name)`. |-| `skill_name` | CharField | The `signals-scout-*` skill this row controls. Auto-registered by the coordinator when it finds the skill on a participating team. |+| `skill_name` | CharField | The scout skill this row controls, under any valid scout name. Auto-registered by the coordinator for any live `signals-scout-*` skill on a participating team; a scout without the prefix is registered directly instead. || `enabled` | Boolean | Per-scout switch; defaults `True`. Derived from `status` (`enabled = status in (active, pending_pause)`) but kept as a real column for SQL filtering and the warehouse mirror; `save()` reconciles the pair for writers that set only one side. || `status` | Char (choices) | Lifecycle source of truth: `active` / `pending_pause` / `paused_by_system` / `paused_by_user`. Who paused is the state itself: the system may resume its own pauses but must never touch a human's. `pending_pause` still runs (a warning, not a pause) and is cleared by any human config edit. || `pause_reason` | Char (nullable) | Why the system paused or warned: `no_output` (warn-only: silence flags a scout but never pauses it) / `ignored` (nobody acts on its reports: warns, then pauses) / `repeated_failures`. Also names the writer that owns the pause: a system writer may only move a pause carrying a reason it owns, and the inactivity sweep owns both of its reasons (`transition_status_by_system()`). Null outside `pending_pause` / `paused_by_system`. |@@ -594,7 +594,7 @@ Thin bridge from a Tasks `TaskRun` to the scout skill that ran inside it: one sc| `team` | FK → Team | Owning team (`related_name="signal_scout_runs"`). Denormalised tenant boundary; canonical value is `task_run.task.team`. || `task_run` | OneToOne → tasks.TaskRun | The `TaskRun` the scout span ran inside (`related_name="signal_scout_run"`, CASCADE — bridge row goes when the `TaskRun` is purged). || `scout_config` | FK → SignalScoutConfig (SET_NULL) | Audit pointer; `SET_NULL` so deleting and recreating a config doesn't destroy run history. |-| `skill_name` | CharField(200) | The `signals-scout-*` skill the run executed. |+| `skill_name` | CharField(200) | The scout skill the run executed. || `skill_version` | Int | The `LLMSkill.version` snapshot at run start. || `summary` | TextField | One-paragraph close-out the agent writes at end-of-run. Searchable via ILIKE on the list endpoint so future runs can dedupe even when no `Signal` row was emitted. || `metadata` | JSONField | Server-written run context in two regions: runner-stamped top-level keys (always `harness_prompt_version` / `report_channel` / `skill_origin`; plus `model` / `runtime_adapter` / `reasoning_effort` when routing overrode the default, plus `triggered_by` when the run was not dispatched by the schedule) and the nested `derived` map of harness-computed booleans written at finalize. See below. |@@ -1238,7 +1238,7 @@ New evaluation workflows record a removal patch and skip the per-result signal p### Resetting self-driving state for local re-testing-The self-driving wizard (`npx @posthog/wizard … self-driving`) enables signal sources, materializes and enables the scout fleet, and creates custom `signals-scout-*` skills for the project. To re-test a run from a clean slate without manually undoing each change, use the dev-only `reset_signals_self_driving` command (the practical inverse of `enable_signals_autonomy`; `DEBUG`-gated like `cleanup_signals`):+The self-driving wizard (`npx @posthog/wizard … self-driving`) enables signal sources, materializes and enables the scout fleet, and creates custom scout skills for the project. To re-test a run from a clean slate without manually undoing each change, use the dev-only `reset_signals_self_driving` command (the practical inverse of `enable_signals_autonomy`; `DEBUG`-gated like `cleanup_signals`):```textpython manage.py reset_signals_self_driving --team-id 1 --yes \@@ -1249,15 +1249,15 @@ For a fresh team the signals config tables are empty, so the reset **deletes** rCleared for the team:-| What | Tables / artifacts |-| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| Signal sources | `SignalSourceConfig` (all rows) |-| Scout fleet config | `SignalScoutConfig` (all rows) |-| Custom scouts | `LLMSkill` rows whose `name` starts `signals-scout-` and are **not** seeded — i.e. not in the set of names carrying `metadata.seeded_by == "signals_scout_harness"` (covers the common case where the key is absent entirely) (cascades `LLMSkillFile`) |-| Scout run-state | `SignalScratchpad`, `SignalProjectProfile`, `SignalScoutRun`, `SignalEmissionRecord` |-| Emitted findings | `SignalReport` + artefacts + ClickHouse rows + Temporal workflows (delegates to `cleanup_signals`; skip with `--keep-findings`) |-| Wizard report | `<install-dir>/posthog-self-driving-report.md` (only if `--install-dir` is given) |-| Wizard log | `/tmp/posthog-wizard.log` → backed up to `/tmp/posthog-wizard-previous-<timestamp>.log` then removed (override `--wizard-log`, skip `--keep-log`) |+| What | Tables / artifacts |+| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| Signal sources | `SignalSourceConfig` (all rows) |+| Scout fleet config | `SignalScoutConfig` (all rows) |+| Custom scouts | `LLMSkill` rows that hold a `SignalScoutConfig` row or whose `name` starts `signals-scout-`, and are **not** seeded — i.e. not in the set of names carrying `metadata.seeded_by == "signals_scout_harness"` (covers the common case where the key is absent entirely) (cascades `LLMSkillFile`) |+| Scout run-state | `SignalScratchpad`, `SignalProjectProfile`, `SignalScoutRun`, `SignalEmissionRecord` |+| Emitted findings | `SignalReport` + artefacts + ClickHouse rows + Temporal workflows (delegates to `cleanup_signals`; skip with `--keep-findings`) |+| Wizard report | `<install-dir>/posthog-self-driving-report.md` (only if `--install-dir` is given) |+| Wizard log | `/tmp/posthog-wizard.log` → backed up to `/tmp/posthog-wizard-previous-<timestamp>.log` then removed (override `--wizard-log`, skip `--keep-log`) |Preserved: canonical scouts and the `authoring-scouts` companion, identified by `metadata.seeded_by == "signals_scout_harness"`. That tag is the practical marker this DEBUG reset uses; it is not a perfect canonical test on its own — `_scout_origin` also requires the name to ship on disk, since `duplicate_skill` copies the tag verbatim — but the wizard authors custom scouts via `llma-skill-create` with no tag, so tag-only suffices here. The command does **not** touch `SignalTeamConfig` or `SignalUserAutonomyConfig` (autostart / per-user opt-in are set by `enable_signals_autonomy`, not the wizard); `llm_analytics` sources are gated by their `SignalSourceConfig` rows like any other source.@@ -1474,7 +1474,7 @@ products/signals/│ │ ├── __init__.py # Public re-exports (LoadedSkill, sync helpers, …)│ │ ├── runner.py # Per-run entrypoint; owns SignalScoutRun lifecycle + sandbox loop│ │ ├── prompt.py # System prompt assembly (skill + scratchpad + profile + run history)-│ │ ├── skill_loader.py # Resolves signals-scout-* LLMSkill rows for a run+│ │ ├── skill_loader.py # Resolves a scout's LLMSkill row for a run│ │ ├── lazy_seed.py # Canonical SKILL.md → LLMSkill sync (sync_canonical_skills)│ │ ├── limits.py # DEFAULT_MAX_RUNTIME_S + ACTIVITY_SLACK_S + WORKFLOW_HARD_CEILING_S + trigger-source vocabulary│ │ ├── run_gates.py # Pre-dispatch gates shared by the off-schedule run pathsdiff --git a/products/signals/backend/scout_harness/AGENTS.md b/products/signals/backend/scout_harness/AGENTS.mdindex dc06b5fc4481..4e29ebfd0817 100644--- a/products/signals/backend/scout_harness/AGENTS.md+++ b/products/signals/backend/scout_harness/AGENTS.md@@ -16,7 +16,7 @@ In production it is driven by `SignalsScoutCoordinatorWorkflow` (periodic tick eOrthogonal to the channel fork, the prompt also forks on the skill's origin (`LoadedSkill.origin`, resolved via `lazy_seed.scout_skill_row_origin`): a _custom_ scout — hand-authored, or a seeded canonical row the team has since edited in place (diverged) — gets a self-improvement section inviting evidence-backed `improve:<skill-name>:<topic>` scratchpad suggestions for its own skill body, which the owner reviews via the `exploring-scouts` / `authoring-scouts` meta skills. When such a scout also holds report tools, the section additionally invites escalating recurring or material suggestions as inbox reports about the scout itself (titled `Scout self-improvement: <skill-name> – <topic>`, `NO_REPO`, `requires_human_input`), authored/edited with the report tools it already holds and pointed to by the `report_id` stashed in the `improve:` entry — so self-improvement suggestions reach the owner through the inbox like any other report, with no extra scope or endpoint (the same per-tool fail-closed gating applies: an emit-only scout is never pointed at `edit_report`, and a signal-channel custom scout keeps the scratchpad-only path). A pristine canonical scout never sees it — applying such a suggestion would mark the seeded row diverged and cut it off from upstream sync. Canonical scouts get the _canonical-improvement_ section instead (`_CANONICAL_IMPROVEMENT`): skill-content gaps observed in the wild route upstream to the PostHog team via the `agent-feedback` MCP tool with `feedback_type="scout"` plus structured fields (`scout_skill_name`, `scout_skill_version`, `scout_category`) so fleet-wide feedback aggregates per skill/version, deduped across runs via `reported:<skill-name>:<topic>` scratchpad entries. The section's generalization rules are load-bearing privacy-wise — the feedback leaves the customer's project, so it must carry the pattern, never the project's data (no PII, values, URLs, numbers, or custom event/property names); tool/harness friction still routes via the shared operational-friction section. A _report-channel_ custom scout's run identity also carries a **skill owners** line (`LoadedSkill.authors`, rendered by `_skill_authors_line`):the skill's explicit owners when set (else the version-history creator + recent editors, resolved server-side), which the escalation guidance points `suggested_reviewers` at (owner first, via `scout-members-list`) — without it a scout only sees its pinned version's `created_by`, i.e. the last editor, and would route ownership to whoever most recently touched the skill. The scout owns routing: this line is context, not a rule, so a skill body can steer `suggested_reviewers` elsewhere (a named reviewer, a team convention) or say "don't route to me" and be honoured — `tools/report.py._build_suggested_reviewers` injects nothing, it only takes the scout's picks. Owners feed exactly one code rule there — a picked reviewer who is a current owner is stamped `is_skill_owner=True` so autostart never mints its session under an editor-controlled owner (`auto_start._resolve_autostart_assignee`, which also re-resolves the live owner set at identity time, since the stamp is a write-time snapshot; every entry additionally carries `source_skill`, committed atomically with the pick, so that re-resolution still knows the writing scout when the run's best-effort tally write was lost); the stamp changes identity eligibility, never who reviews. The line is gated on the report channel: a signal-channel scout has no `suggested_reviewers` field, so member names/emails (PII) must not reach its prompt.- `skill_loader.py`- Resolves `signals-scout-*` skills from the team's `LLMSkill` rows. Defines `SIGNALS_SCOUT_SKILL_PREFIX` and `LoadedSkill` (body + version + allowed_tools + origin + authors), plus `REPORT_CHANNEL_TOOLS` / `skill_uses_report_channel` — the shared report-channel opt-in predicate the runner (scope posture) and prompt builder (persona fork) both resolve from.+ Resolves a scout's `LLMSkill` row from the team's rows by name, under any valid scout name. Defines `SIGNALS_SCOUT_SKILL_PREFIX` — kept for the canonical on-disk paths, auto-registration, and display-name stripping, not as a naming requirement — and `LoadedSkill` (body + version + allowed_tools + origin + authors), plus `REPORT_CHANNEL_TOOLS` / `skill_uses_report_channel` — the shared report-channel opt-in predicate the runner (scope posture) and prompt builder (persona fork) both resolve from.`resolve_skill_authors` prefers the skill's **explicit owner set** (`LLMSkillOwner`, keyed on the logical `(team, name)` so it never drifts when the body is edited) — returned as `role="owner"`, seed-creator first. Only when a skill has no explicit owners does it fall back to reconstructing authorship from version rows (distinct non-null `created_by`: creator = earliest first-authored, then editors by last-edit recency, capped). Both paths are restricted to `team.all_users_with_access()` so a revoked user's profile stops flowing into a privileged prompt.`resolve_skill_owner_user_uuids` exposes the owner set (seed-creator first) to the report tools' reviewer provenance stamp (`is_skill_owner`). Author resolution is opt-in via `load_skill_for_run(..., include_authors=True)` — only the runner's prompt-building path pays for it; the report-authorization gate in `views.py` loads the skill per report write just to check `allowed_tools` and skips it.- `lazy_seed.py`