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.

106 KB
Raw Blame

Signals Agent Harness

This directory contains the headless Signals agent — a scheduled scout that explores a project, writes durable scratchpad entries across runs, and emits findings into the Signals inbox via emit_signal() using the signals_scout source variant.

It is the second agentic surface in Signals. The other one — report_generation/ — runs on demand when a SignalReport is promoted to candidate and produces a single research output for one report. The harness here is the inverse: it runs on a schedule, decides what to investigate from scratch, and pushes new signals into the same pipeline rather than acting on existing ones.

In production it is driven by SignalsScoutCoordinatorWorkflow (periodic tick every COORDINATOR_INTERVAL_MINUTES = 30 → fan out per-(team, skill) child workflows). Locally it is exercised via the run_signals_scout management command (see ../management/AGENTS.md).

What lives here

  • rubrics.py / rubrics_runner.py Store revisioned criteria on the scout config and generate separate suggestions in a background sandbox. Read the scout rubrics section of products/signals/ARCHITECTURE.md when changing persistence, generation, or access restrictions.

  • tool_catalogue.py Builds the scout tool catalogue from the committed MCP definitions through posthog/mcp_tool_definitions.py. The read-only endpoint is GET /api/projects/:id/signals/scout/configs/tool_catalogue/ in views.py. It omits superseded tools and reports scope requirements and feature conditions. Callers must evaluate feature flags for the project. scout_held_mcp_tools is the one answer to what a narrowed run holds: the picked list, SCOUT_RUN_CONTEXT_TOOLS, and the always-available tools.

  • tool_policy.py Refuses API writes a narrowed run did not pick a tool for. The runner stamps allowed_mcp_tools on Task.state (mcp_tool_allowlist) while scouts-tool-access is on, and APIScopePermission calls scout_tool_denial through facade/tool_policy.py for every request from a task-bound token. A non-GET request, or one that needs a write scope, passes only when its path and view match an api_operations entry of a held tool (posthog/mcp_tool_operations.py) or of SANDBOX_HARNESS_OPERATIONS. The method counts because some actions change state behind a read scope. A new non-GET endpoint the agent server or harness calls with the run's token belongs in SANDBOX_HARNESS_OPERATIONS. A hand-written MCP tool that makes a non-GET call lists its endpoints in services/mcp/schema/tool-definitions.json.

  • runner.py Per-run entrypoint (arun_signals_scout / run_signals_scout). Inserts the SignalScoutRun row, builds the prompt + toolset, spawns the sandbox session, pumps the agent loop until budget exhaustion or natural completion, finalizes the run, and returns a RunResult. The activity wrapper in temporal/agentic/scout_scheduler.py delegates straight to this. The run's scope posture is composed here (scout_scope_posture in posthog/temporal/oauth.py): the fleet-wide scout preset plus the write scopes this one scout was granted on SignalScoutConfig.write_scopes, intersected against SCOUT_GRANTABLE_WRITE_SCOPES here and again at mint time, and withheld entirely on a dry run (emit=False) so a preview never mutates the project, and narrowed to SCOUT_DEFAULT_WRITE_SCOPES when the acting user came from the team-level fallback (resolve_acting_user_id_for_team), since that member never approved the rest of the grant. A new config starts with those defaults (notebook:write), through the model default and the config API alike. The column value is handed to the posture builder unshaped, because coercing a stray JSON object with list() would turn its keys into a grant. The grant is stamped on the run row's metadata["write_scopes"] and on both lifecycle events, because the config can be widened or revoked afterwards and would otherwise rewrite what past runs could reach; the prompt's # Write access section is rendered from the same resolved value, so it can never name an object the token was refused. Who may set the grant is decided in views.py (assert_can_grant_scout_write_scopes): the scout's resolved acting user (skill_loader.resolve_scout_acting_user_id) or a project admin, never LLMSkillOwner, since any skill editor can rewrite that list; a scoped credential must also carry each scope it adds.

  • trial_launch.py / trial_state.py / trial_access.py / trial_views.py Private live comparisons. Read these when changing scout launch overrides, request-bound memory/report routing, or trial access. The server-bound sandbox task selects private state; caller-supplied run IDs never select another trial's context. trial_result.py checks runtime settings and exports finished state, while trial_reads.py overlays saved starting notes and recent runs. trial_gateway.py supplies short-lived gateway-only credentials for private report validation through the existing gateway. trial_inspection.py supplies the comparison UI with source readiness, supported model/effort choices, and the operator's recent private runs.

  • trial_comparison.py / trial_comparison_types.py / trial_comparison_views.py / trial_comparison_serializers.py Server-owned comparisons. Read these when changing automatic launch, rubric freezing, lifecycle status, retries or comparison history. Immutable plans bind variant groups to the saved rubric before runs start; small history records omit prompts and evidence. ../temporal/agentic/scout_trial_comparison.py waits for the scouts and starts the existing evaluation workflow using only IDs in Temporal payloads.

  • trial_evaluation.py / trial_evaluation_types.py / trial_evaluation_report.py / trial_judge.py Private comparison scoring. Read these when changing evidence snapshots, criterion verdicts, access checks, or aggregate scores. trial_evaluation.py saves complete evidence files in private object storage; trial_judge.py runs one sandbox agent per scout run through the Tasks facade. ../trial_judging.py defines the prompt and checks citations against the original files; trial_evaluation_report.py builds the deterministic report. ../temporal/agentic/scout_trial_evaluation.py passes only IDs through Temporal. trial_rubrics.py reads reviewed, saved criteria and their captured reference through the rubric facade. Rubric editing, storage and generation remain in the rubric feature. Read the online trial guide for scoring semantics and operator controls.

  • prompt.py Reviewer guidance forks on signals-research-reviewer-selection (report_content_gates.team_research_reviewer_selection_enabled, resolved per run in runner.py and stamped as strict_reviewer_selection), so the trial measures the prompt change too. With the flag on, selection requires evidence for each person on the affected behavior, and team roster order and broad activity alone are insufficient. An empty list is permitted only when code evidence exists. A report with no repository or NO_REPO routes to the most plausible member through scout-members-list, and reviewer routing in the skill body is a route to follow. With the flag off, the _LEGACY sections keep the earlier "always route" guidance. Do not add a backend fallback reviewer for an empty list: it would route by config ownership rather than by area, and it would hide what the scout decided. Assembles the system prompt: persona + skill body + relevant scratchpad entries + project profile inventory + recent run summaries. Scratchpad and run history are filtered by skill so a specialist only sees its own past work. build_run_prompt forks on the run's channel via skill_loader.skill_uses_report_channel: a scout that opted into the report channel gets the report persona + report-authoring guidance (search the inbox first, edit before authoring a duplicate, set suggested_reviewers to route the report); every other scout gets the signal persona that fires weak emit_signal findings. The bootstrap, scratchpad, fleet-seams, recency, and close-out sections are shared between both, as is Linking what you reference (_linking_section), which turns every PostHog id a scout names in reader-facing prose into a markdown link built from a tool-returned URL (a result's *url field, else generate-app-url) instead of a hand-assembled path, keeping the bare id when neither source reaches the entity; its pull-request clause is report_links.PULL_REQUEST_LINK_RULE, shared with the pipeline's presentation turn so both surfaces link a pull request the same way and name its repository when it is not the one the report is about; its report-only caveats — a chart: target is not a URL, and a report title / summary first line stay plain text because the inbox renders both as text — render on the report channel alone, since that is where charts exist, where Attaching charts sits in the tail, and where those fields are written. Cross-scout discipline lives here rather than in each SKILL.md, because a seam is bilateral: run step 2 sends every scout through the fleet-wide scout-runs-list for the entities it is about to investigate (gated on a match, so a scout doesn't spend its budget reading the fleet's whole output), the scratchpad section teaches searching by entity identity rather than only the scout's own key prefix, and _FLEET_SEAMS states the overlap rule in both directions — don't restate a sibling's finding, but don't defer a finding you hold evidence for either, since an uncovered surface is invisible where a duplicate is not. Skills keep their own domain ownership map. Both channels also share the self-validation follow-up discipline (_self_validation_followups_section + FOLLOWUP_KEY_PREFIX): every scout keeps a queue of followup:<skill-name>:<entity> scratchpad entries for work whose fix is measurable later (probe + baseline + validate-after date in the content), and decides for itself, run by run, whether to spend the run validating that queue — the cadence is the scout's judgment, not a harness schedule, so the section carries the decision criteria (due entries accumulated, a while since the queue was last worked, a dismissal note saying a fix shipped) and there is no harness trigger. A validation pass is self-reported in the close-out summary and in the touched entries, which is also how future runs know when the queue was last worked. The section is composed per-run because its re-surface clause is matched per-tool to the same fail-closed rule as the channel sections, and it defers resolved-inbox-report re-measurement to the canonical signals-scout-inbox-validation scout when the scout_fleet roster shows it actively running — the per-scout queue exists precisely because that fleet scout may not be enabled, and because signal-channel findings and recorded watches never become resolved reports it could re-measure. Queue entries are team-shared data — and remember() upserts keep the original created_by_run, so attribution never proves who last wrote the content: the section tells the scout to treat every stored probe as untrusted and re-derive it from the live report or finding it names, never execute it as stored. The report persona is further gated per-tool: it names only the report tool(s) actually in allowed_tools (emit-only, edit-only, or both), and drops the author-time sections for an edit-only scout — the report endpoints fail closed on the exact tool, so the prompt must never steer a scout toward one it lacks. External MCP servers carries the same fail-closed discipline: when the run's sandbox mounts team-shared MCP Store connections (the per-scout selection on SignalScoutConfig.mcp_gateway_server_ids, pre-resolved by the runner through the MCP Store facade with the launch path's own parameters), the section names them and carves them out of the exec-interface rule in How to call tools — their tools are direct mcp__<server>__<tool> calls, their output untrusted input — and renders nothing when none mount, so a scout is never steered at servers it doesn't hold. Orthogonal 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. One last fork is per-trigger rather than per-scout: a run dispatched with a note renders _run_note_section as the prompt's last section, delimited and framed as untrusted input for this run alone (capped at limits.MAX_RUN_NOTE_CHARS by the manual endpoint that accepts one). The framing follows triggered_by: a manual run's note is advisory steering a person typed alongside the scout's usual work, while a check dispatch's note is the run's whole assignment, so it renders _CHECK_NOTE_TEMPLATE instead — the check to answer, and the instruction to close it with scout-check-record-result. A workflow dispatch's note names an event subject, so _WORKFLOW_NOTE_TEMPLATE makes that subject the run's first job, makes the skill's routine optional, and forbids advancing incremental state on a partial pass; a workflow dispatch without a note still renders _WORKFLOW_NO_NOTE_SECTION, so the run knows an event started it. triggered_by itself (and, for a workflow run, trigger_workflow_id) renders in Your run identity on every run, so a skill can branch on it. Last because it is the most per-run value there is, and both runtimes cache on prefix. It is deliberately apart from Notes left for you, which covers the durable notes a scout fetches for itself: a one-off nudge read as fleet steering is one a scout would be right to remember forever. The section renders outside _render_tail, since that pass formats any section carrying a {schema_json} placeholder and a note is free prose. Steering that should outlive the run is a scout note instead.

  • skill_loader.py 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.

  • acting_user.py resolve_scout_run_acting_user is the one answer to who a run acts as: the trial's user, else skill_loader.resolve_scout_acting_user_id, else the team fallback (resolve_acting_user_id_for_team, flagged is_team_fallback so the runner withholds the write grant). The runner and precheck.py both call it, so a scheduled pre-check reads exactly the tables its run can read. A query with no user loses every access-scoped system.* table and every warehouse table. The pre-check dry run runs as the requester instead, so a config editor cannot read through the acting user's access.

  • lazy_seed.py Canonical skill sync. Reads products/signals/skills/signals-scout-*/ from disk and reconciles them against the team's LLMSkill rows: creates missing rows, updates ones the team hasn't edited, leaves diverged / hand-authored rows alone, tombstones rows whose canonical skill was deleted. Only rows tagged metadata.seeded_by="signals_scout_harness" are ever updated. Called both lazily (coordinator tick, runner cold-start) and explicitly via the sync_signals_scout_skills management command. It also parses the retirement marker (canonical_deprecation_for, see deprecation.py) and the three config-shaping frontmatter keys, none of which enters the content hash (all belong to the config, not the skill row): scout-tags (canonical_config_tags_for), scout-role (is_operational_scout), and scout-display-name (canonical_display_name_for). scout-display-name is the label the scout ships under, and every canonical scout states one, because the clients' fallback sentence-cases the slug and turns signals-scout-apm into "Apm". scout-role: operational marks a scout that watches the self-driving system itself rather than a product surface — the fleet's follow-up validation scout — and an unknown value fails the parse rather than falling back, since a silently downgraded operational scout is the silencing the role exists to prevent.

  • deprecation.py The retirement lifecycle of a canonical scout: the scout-status / scout-deprecation frontmatter marker (parse_scout_deprecation), the shape it is stored in on LLMSkill.metadata (DEPRECATION_METADATA_KEY), and retire_scout_configs, which moves a project's config to status=paused_by_system, pause_reason=retired through transition_status_by_system. retired is its own writer, so nothing else resumes a retired scout, and the transition obeys the same ownership rule every system writer does: a pause a person made stands, and so does a tripped failure breaker's. The pass runs from sync_canonical_skills(prune=True) on two triggers — a sunset that has passed, and a skill the prune just reaped — so a scout deleted from disk without an announcement leaves no config enabled behind a skill that is gone, which is the ghost row this exists to prevent. Only a row the sync owns and the project never edited is ever marked or retired, so a fork keeps running.

  • fleet_sync.py materialize_scout_fleet(team, surface=...) — the on-demand configs/sync/ path, and the only place that records what a materialization did. Resolves the seed posture + holdback from one flag read, runs sync_canonical_skills(prune=True) and register_missing_configs, then captures signals_scout_fleet_synced with the per-bucket counts the SyncResult carries (created / updated / diverged / tombstoned / pruned / retired configs), the configs it registered, the fleet it left behind, whether the project had one before (was_empty — the rescue metric), the surface the caller declared, and how long the pass took. Every sync captures, zero counts included: a no-op sync is the denominator for "how often does opening the tab find work to do". Best-effort, like every other scout event. It also carries the mass-prune tripwire. A reap that takes more than half the canonical fleet, and at least MASS_PRUNE_FLOOR scouts, is not a retirement — it means the sync read a fleet the deploy did not ship — so it stamps unexpected_prune on the event and captures UnexpectedScoutFleetPrune into error tracking. A detector, not a guard: by the time the count exists the rows are tombstoned.

  • config_registry.py register_missing_configs(team_id) — auto-creates an enabled, default-schedule SignalScoutConfig for any signals-scout-* skill lacking one ("author a skill, get a scout"). Called by the coordinator tick; the HTTP surface registers explicitly via the write-scoped config create endpoint instead (reads stay side-effect free). A canonical scout's scout-tags frontmatter (read through lazy_seed.canonical_config_tags_for) is stamped on the row it creates, which is how a product surface claims its scouts by tag instead of by hardcoded skill name — AI observability's self-driving tab lists the ai-observability-tagged configs. Forward-only like the rest of the seed posture: adding the key to an already-seeded scout leaves that team's existing config untagged until someone tags it through the config API. The scout's scout-display-name is stamped the same way, and additionally backfilled onto existing rows by reconcile_canonical_display_names — every canonical config predates the key, so nothing else would ever give them a label. That pass writes only where display_name is blank, so it can run on every tick without ever undoing a rename. An operational scout (scout-role: operational) is the one exception to all of that: it seeds enabled and auto_pause_exempt, past the enabled_skills allowlist and past the enabled-scout cap (it still counts toward the cap, so its slot is visible), and reconcile_operational_configs runs on every tick to put rows seeded before the role existed back on those terms. The reconcile undoes only the harness's own silencing — a sweep warning or pause via transition_status_by_system, and a row the seed created disabled, which the model stores as paused_by_user and the reconcile tells apart by its null status_changed_at. A person's pause and a repeated_failures pause are both left standing. The holdback still gates the scout, whatever its role, and the config API refuses to delete it (views.destroy).

  • suggestions.py / suggestions_runner.py Pre-computed scout suggestions: the push-side twin of the "Suggest a scout" chat button. suggestions.py (temporalio-free, cheap to import) holds the structured-output contract the headless run returns (ScoutSuggestionBatch: 3-5 items, each a canonical "turn this on" pick or a custom draft with a ready-to-create draft_body), the signals-scout-suggestions flag-payload settings (enabled, eligibility_tier 0-4 (0 = allowlist only), refresh_days, max_children_per_tick, allow/blocklist, failure breaker), the planner (plan_suggestion_runs: recomputes the priority queue from Postgres every tick; a project that has never ingested an event is no candidate at any tier, because the scan could only refuse it, and the gate is read from Team.ingested_event on the project or any of its environments at plan time rather than stamped on the row, so the project re-enters the queue on its first event and an allowlisted project is scanned either way; tier, then never-generated, then most overdue, then most recently engaged; engagement is a report view or rating, a scout a person turned on or off (status_changed_by), or a scout a person created (created_by), never a plain edit or a system touch; nothing is stored as a queue; engagement is read only for the teams already in the tier map, since SignalReportAction.last_at is deliberately unindexed and an unbounded filter on it scans the whole action history; a team past the failure breaker doubles its refresh interval per further failure, because the cooldown is shorter than the refresh window and so could never hold a scheduled retry back), the dispatch-time activity check (select_teams_to_scan: after the plan is made and before a child is dispatched, one bounded ClickHouse read per picked candidate over the project and its child environments together, counting events and distinct active days in activity_window_days, on the offline cluster, since a scheduled fleet scan must not compete with interactive queries (a Temporal activity keeps Workload.ONLINE unless it says otherwise, and readonly=True would return before the offline routing rather than add to it); a project under min_events_in_window or under min_active_days_in_window is stamped low_activity instead of scanned, because the scan could only refuse it, and either knob at 0 turns that half of the check off; the read is capped at ACTIVITY_READ_MAX_ROWS rows and refuses at the cap rather than truncating, because the cap counts rows read while the query counts the rows inside the window, so a truncated read would answer with a small count that reads like a quiet project; a refused read counts as active, since a project whose window does not fit the cap is active whatever the refusal hid; it carries a wall-clock cap too (ACTIVITY_READ_MAX_EXECUTION_S), because sync_execute sets none and the pooled client's socket timeout is effectively infinite in production, so a stalled read would hold a worker thread past the planning activity's deadline; a read that fails dispatches anyway, since the coordinator stamps last_requested_at either way and a quiet minute of ClickHouse must not cost a project its refresh window; allowlisted projects are scanned whatever the read says, and the manual refresh endpoint never runs the check, because a person who pressed the button asked for the scan; the coordinator therefore overselects the plan by SUGGESTIONS_OVERSELECT_FACTOR so a tick still fills when several candidates are skipped, and the skipped ones are stamped last_requested_at alongside the dispatched ones so the planner leaves them for a full refresh window rather than re-reading them every tick), draft validation (validate_suggestion_items drops anything the one-click Create could not apply as-is), and persistence on SignalScoutSuggestionSet (one row per team, items as JSON, every write under a row lock since each is a read-modify-write of the column; dismissals carry forward by skill_name and survive as hidden tombstones when a batch omits the name, compacted to the dismissal fields so a dropped draft body does not sit in the row forever; a batch persisted after the fleet moved is stored stale, and a batch that merely aged past refresh_days, whether it held items or concluded there was nothing to suggest, reads as stale through effective_status, since nothing writes that status on expiry; a failed generation anywhere after the gates keeps the prior items and counts toward the breaker; a low_activity stamp keeps the prior items the same way but leaves the breaker alone, since a quiet project is not a broken one: the count is preserved but ignored for scheduling while the status holds, so the backoff cannot push the next activity check out past one refresh window, and it counts again as soon as a scan runs; a quiet row also does not expire to stale, so the project waits a full refresh window and is then re-checked; mark_stale_if_fleet_changed is wired to SignalScoutConfig saves in ../receivers.py). Reads hide dismissed, created, and already-enabled items, plus custom drafts whose name a stored skill or config has since taken; the manual refresh endpoint honors the same kill switch and blocklist as the planner, runs the scan as its authenticated caller rather than the resolved team member, and a manual dispatch stamps last_requested_at so the coordinator does not double up. suggestions_runner.py is the one piece that needs the tasks agent facade: arun_scout_suggestions gates (AI-processing consent, an acting user; deliberately no self-driving credits gate, since a scan opens no pull request and so bills nothing, while a skip would still burn the team's whole refresh window), mints a read_only headless task with the reserved SIGNALS_SCOUT_SUGGESTIONS origin, no GitHub token and no MCP Store servers, because the scan reads project text any member can write, parses the batch with no prose salvage (an unparseable close-out is a failed generation), validates, and persists. Both it and the activity check emit $scout_suggestions_generated through the one emitter in suggestions.py (capture_suggestions_generated), so a skipped project reads as status=skipped, skip_reason=low_activity plus the two measured numbers on the same event the completed runs use, and the daily roll-up needs no new column. The skip carries a stable event id, keyed on the project and the refresh stamp the decision was made against, because the planning activity retries and would otherwise count one skipped scan several times; a completed run needs none, since its activity runs at most once. Driven by temporal/agentic/scout_suggestions.py (coordinator + child, same shape as the scout coordinator, own schedule) and exposed read/dismiss/refresh at signals/scout/suggestions/ (../scout_suggestions_api.py), where membership, token scope, and resource-level RBAC all anchor to the canonical parent team. The prompt shares SCOUT_PROJECT_SCAN_GUIDANCE (in prompt.py) with the chat template so the two voices never drift.

  • slack_delivery.py / slack_delivery_queue.py / slack_charts.py Best-effort direct Slack delivery for configured scout outputs. Finding emissions and surfaced report emits/edits snapshot the run config's destination after their database write commits, then enqueue the shared retrying Celery worker. The destination targets a single channel or up to MAX_SCOUT_SLACK_DM_TARGETS members who each get an individual DM (one Celery task per recipient, so retries and permanent failures stay independent; a group DM would need the mpim:write scope the Slack app doesn't request). Integrations are project-scoped, so a workspace connected from any environment in the project can receive the canonical parent team's scout output. A report message renders its charts through the exports facade (render_png_export, attributed to the run's acting user, so the insight access check applies; a system render that expires with its delivery url, so it stays out of the user's export quota and does not outlive its only reference) and appends them as image blocks pointing at a signed delivery url; chart links in the prose still reduce to their label. A threaded report carries its charts on the lead message, since the replies only hold the summary's tail. Only InsightVizNode / SavedInsightNode charts render, capped per report and by a render-time budget (a render only starts if it can finish inside the budget), with rendered assets remembered per delivery so a Slack retry does not re-render, and every failure is skipped rather than failing the delivery — the whole chart build is best effort, not only the render. The Slack integration row is resolved again after the build, since a workspace reconnected during the render window replaces the token on the same row. A threaded report splits its summary at the shallowest section level that summary repeats at, so a sub-section rides in its parent's reply and the thread mirrors the outline the reader sees in the inbox; a level used once is the report's own title rather than a seam, so the split descends past it. A section is opened by an ATX heading or by a bold label, since scouts label their sections in bold far more often than they write a heading and Slack renders **Evidence** and ## Evidence identically. Bold labels rank below every heading level, and a label standing on its own line ranks above one leading a paragraph, so a report that mixes the forms still splits at its headings. A bold run inside a paragraph, one with no blank line before it, and one too long to read as a label are all left alone. The split runs at any length, because a typical digest fits inside one Slack section and a length test leaves it in the channel as the wall of text threading exists to break up. A summary with no section label has no seam and stays one message, hard-chunked only past the section cap. Slack fetches each image url itself and rejects the whole message when it cannot reach one, so a rejected message is posted again without its charts, which carry CHART_BLOCK_ID_PREFIX block ids to be dropped as whole units; a deployment Slack cannot reach still gets the prose and the report link. This path bypasses the HTTP chart-render throttle, so the cap is the guard. One ChartRenderBudget spans a delivery's initial build and any rebuild, so an edit landing mid-render cannot buy a second set of renders; only a cache miss spends one. The budget also holds the assets the delivery has rendered, so a rebuild keeps them even where the retry cache is off. That cache is written after every render (the task acks late, so a worker lost mid-delivery leaves finished renders for the retry) and signs each entry with SIGNALS_SLACK_CHART_CACHE_SIGNING_KEYS (comma-separated new,old; first signs, all verify) rather than SECRET_KEY; reuse is off wherever that setting is unprovisioned. A content edit made through the scout's edit tool enqueues a fresh full delivery and claims the report's latest-delivery marker before publishing to the broker, giving the claim up again if the publish fails (a claim naming a task that never runs would silence the report for the marker's whole TTL). Every full delivery yields to a marker naming another delivery, not only one that rebuilt mid-render: an edit landing before a delivery starts leaves its build nothing to rebuild, so the content is already current and it would otherwise post the edited report a second time. The marker is scoped to the destination as well as the report, since two scouts editing one report into different channels are not competing. A note-only delivery carries its own note rather than report content and is never marked, so it never yields.

  • tools/ Implementations of the four harness-internal tools the agent calls during a run. The effective toolset for a run is the intersection of the skill's allowed_tools list with what tools/__init__.py re-exports — there is no separate registry module today.

    • emit.py — emit_signal_* tools that push findings as cross_source_issue signals into the standard ingestion pipeline.
    • scratchpad.py — remember, forget, and search_scratchpad tools backed by the SignalScratchpad model. Entries are durable by default; an optional expires_at (mirroring notes.py) retires a time-boxed memory on its own, since a scout that writes one almost never comes back to forget it. remember is a full-state upsert, so a write with no expires_at clears an expiry an earlier write set — sticky expiry would keep hiding an entry that has since become permanent, with no way for the rewriting scout to know a clock was on it. search_scratchpad drops expired rows unless include_expired=True (the human audit path); expiry first only hides a row, so within its post-expiry grace the key stays taken and both forget and the upsert still find it. The daily prune_expired_scratchpad_entries janitor (in ../tasks.py) then hard-deletes rows whose expiry is more than SCRATCHPAD_EXPIRY_GRACE_DAYS in the past, so a lapsed memory cannot pile up forever; durable (expires_at-null) rows are never swept. A reader that goes to the manager rather than through search_scratchpad stays unfiltered on purpose — derived_metadata._touched_followup_queue is the one such reader, and has to be, since a followup: entry lapsing after a run doesn't undo the validation work that run did. run_id on a remember write is best-effort lineage, never a gate: the serializer coerces one it can't parse to None (_BestEffortUUIDField, the same stance expires_at takes) and the view drops one that names no run on this project, because a scout retypes the id out of its run prompt and a truncated copy must not cost the memory. When nothing usable comes off the body the view falls back to tools/runs.run_id_for_sandbox_task, which resolves the writing run from the task the caller's sandbox token is bound to — provenance the sandbox cannot choose, so lineage survives the typo. Non-sandbox callers and the pipeline stages resolve to no run and are unaffected. A best-effort field must also present as a plain string in the OpenAPI schema — _BestEffortDateTimeField carries @extend_schema_field(OpenApiTypes.STR), and codegen strips the uuid format for _BestEffortUUIDField. A format keyword makes the generated MCP client refuse the value before the request leaves the caller, so the tolerance never runs and the write is lost anyway. The scratchpad is shared with the report pipeline, not scout-only. remember / forget are gated on their own signal_scratchpad_internal:write scope rather than the wider signal_scout_internal:write, so the pipeline's research and implementation runs can persist what they judged without also getting emit_signal and record_output. Scouts keep both tools, because SCOUT_INTERNAL_SCOPES carries the scratchpad scope too; the pipeline's own postures are the signals_research / signals_implementation presets in posthog/temporal/oauth.py. signals_research withholds task:write: it turns the MCP read-only header off so its scratchpad tools survive, and that header was the only thing keeping the task-write toolset (report state included) away from a stage meant to read. Those stages have no SignalScoutRun, so created_by_run cannot name them. They stamp SignalScratchpad.created_by_identity instead — a pipeline:* string from ../pipeline_identity.py, resolved server-side from the token's bound task (its ai_stage, written once at run creation) rather than passed in, since a writer that could name itself could name a scout's skill. _to_entry reads it as created_by_skill when there is no run, so scout-scratchpad-search attributes every entry the same way. Like created_by_run it is written on create only, so an upsert keeps the original author.
    • notes.py — list_notes / leave_note / delete_note backed by the SignalScoutNote model: steering notes humans (or other agents) leave for the fleet over the public MCP surface (scout-notes-* tools), the inbound counterpart to the scratchpad. A note targets one scout by skill_name or the whole fleet (blank), optionally expiring via expires_at; the run prompt's Notes left for you section directs every scout to read its notes in step 1 in three passes (new since the completed_at of its last completed run, standing notes with no expires_at from the last 30 days via only_without_expiry, and a text search per entity it investigates) and treat them as advisory steering. How to read each origin lives in the scout-notes-list tool description, because scouts read it through info and the response field's help text never reaches them; the prompt keeps only the memory rules for report_dismissal and report_reviewer_correction. A third audience is a stage of the report pipeline, addressed through the reserved pipeline:* family (PIPELINE_AUDIENCES, holding pipeline:report-research today): a pseudo-target riding the same skill_name column, allowlisted at write time so an unrecognized one is rejected instead of silently steering no one, and skipping the scout-skill lookup because a stage has no LLMSkill row. list_notes matches skill_name exactly, so no scout ever sees a pipeline note; the research loader in ../report_steering.py pastes the pipeline:report-research notes and tells the run to search the rest with text. validate_note_target, the shared write-time rule, and the audience constants live in ../note_targets.py, an import-light module, because the Django admin form calls the rule at registry load and importing anything under tools/ runs that package's __init__, which pulls in every harness tool. Unlike the scratchpad there is no sandbox-only write gate, but writes still demand skill-authoring-level authorization (keys need llm_skill:write on top of signal_scout:write, and every writer must clear the llm_skill RBAC editor bar) — so a note-writer could already steer the fleet by editing its skills, and notes add no new steering power. Five more writers derive rows from inbox activity. ../dismissal_notes.py: judging an inbox report with a note (dismiss, snooze, or restore) also leaves it here as an origin=report_dismissal note, targeted at the scout that authored the report, so a reviewer's verdict reaches the scout without it having to re-find the report. Resolving does not, since that says the report did its job rather than that filing it was wrong. ../discussion_notes.py: opening a discussion on a report (the inbox "Discuss" action, which kicks off a Q&A task) also leaves the user's question here as an origin=report_discussion note, targeted at the authoring scout — framed as context to weigh or ignore, not a verdict, so the scout can fold a durable preference/correction into its scratchpad or dismiss it as noise. ../feedback_notes.py: the thumbs rating at the end of a report body ("Was this report useful?") carries its optional note here as an origin=report_feedback note, targeted at the authoring scout. Unlike a dismissal it never falls back to a fleet-wide note — feedback is a verdict on one scout's own report, so with no resolvable authoring scout nothing is forwarded and the call is a no-op — and it never changes the report's state; the analytics event the client fires stays the durable record of the rating. ../reviewer_correction_notes.py: a user-attributed reviewer edit that changes the set (adding or removing a suggested reviewer) also leaves an origin=report_reviewer_correction note, and it is the only derived origin addressed to more than one scout — every live scout that emitted or edited the report (resolve_touching_scout_skills, since an editing scout may be the one that put the reviewers there) plus every scout whose reviewer: memory names a removed GitHub login or PostHog user UUID (_memory_holders, one exact-term search under the reviewer: key prefix), ordered emitting scout first and capped at MAX_NOTE_TARGETS, so a scout still routing on a stale login hears about the correction. A report no live scout touched falls back to the fleet-wide blank dismissals use, but only when no holder resolved, since a run reads the fleet-wide notes alongside its own and a holder would hear the same edit twice. An impersonated edit forwards nothing, matching the reviewer-corrections project profile, which excludes impersonated activity rows for the same reason. GitHub logins and user UUIDs are shape-checked before rendering and capped per edit (MAX_CORRECTION_REVIEWERS), because both write paths into the reviewers artefact accept any string of any length and the value lands in a backtick span every scout reads. Repeat delivery coalesces only for the same report, target, and latest action inside SUPPRESSION_WINDOW. Corrections on other reports and reversals remain separate evidence. Scouts search related notes without a skill_name filter before selection, so feedback can cross producers. Self-removal alone does not establish a standing exclusion. Like a dismissal it may fall back fleet-wide, and unlike discuss/feedback it does not demand the signal_scout:write / llm_skill:write key scopes, because the logins already reach scouts through the report's reviewers artefact and the project profile. ../report_scout_notes.py: the notes endpoint itself writes an origin=report_note row when the create names a report, since the content quotes the report's id, and appends the report's scout_note_left artefact in the same transaction so the steering stays on the report after the note is retired. It is the only derived origin a person writes head-on rather than one forwarded from another action, so its gate sits on the endpoint: the steering gate plus the inbox:write and task:write scopes and the task editor bar, matching the reports artefact API the entry lands through. All four forwarding paths re-check the same steering gate (token scoped_teams, canonical-project access, and the llm_skill editor bar) since the dismiss, discuss, feedback, and reviewer-edit actions need only inbox:write, and all forward only on the canonical team. The discuss and feedback paths additionally demand the signal_scout:write / llm_skill:write key scopes: a dismissal's text reaches runs anyway through the reports API, whereas the note is the only path a discussion question or feedback note takes to a scout, so an inbox:write credential must not open it alone. The discuss path is triggered from the tasks viewset (which holds the request the gate reads) through facade/api.py:forward_report_discussion_note, never from the tasks facade. On the read side, every derived origin quotes report content (report id, title, the note text), so SignalScoutNoteViewSet.list withholds them from any caller failing the reports read gate (_may_read_reports); both that gate and ../report_steering.py read the list off SignalScoutNote.derived_origins() rather than naming the kinds, so a newly added origin is withheld from the moment it exists. The derived rows are context with a TTL; the dismissal artefact / discussion task / feedback analytics event / reviewer suggested_reviewers artefact + suggested_reviewers_changed activity-log row stays the record of truth. Notes reach two surfaces outside the fleet, both through ../report_steering.py. load_report_steering puts no note text into the description of the self-driving implementation task; it renders a short nudge that tells the run to pull notes (scout-notes-list) and fleet memory (scout-scratchpad-search) itself, because the report author already read the notes and most of them do not apply to a code change. load_research_steering pastes only the pipeline:report-research audience into the report-research prompt and nudges the run to search every other origin by entity (list_notes text), because the derived ones are feedback on exactly the judgment that stage is about to make; that run is read-only, already holds the report's raw signals, and writes back only to the report on the same team.
    • structured_output.py — record_structured_output (+ _sync): the structured-output channel, next to signals and reports. Opt-in via SignalScoutConfig.structured_output_schema (a JSON Schema describing ONE record, validated at config-write time by validate_structured_output_schema — which also rejects non-local $ref/$dynamicRef, and every validator here uses a no-retrieval registry, so a user-controlled schema can never make the worker fetch a URL; null = channel off, and the record endpoint fails closed). Setting the schema is skill-authoring-level steering (schema description fields are free prose rendered verbatim into a privileged prompt), so the config viewset gates it behind llm_skill:write + the llm_skill editor bar, like scout notes; clearing it stays on the base config scope. Records validate against the dispatch-time schema snapshot the runner stamps on the run row (metadata["structured_output_schema"]), so a mid-run schema edit can't reject records matching what the run was shown — while clearing the config schema mid-run still fails the channel closed (re-checked inside the capacity-reservation transaction with the config row locked, so a clear racing a submit serializes cleanly). Each submitted record is validated against the schema (all-or-nothing per call — an invalid record fails the batch with nothing written) and written into the team's own project as a $scout_structured_output event via one capture_batch_internal call (person processing off, deterministic uuid over (run, batch index, subject, payload) so a resubmitted batch collapses at ingestion while in-batch duplicates stay distinct). The events ARE the record — there is no Postgres row store, so past records are read like any events (insights, HogQL) and retention follows event retention — which is also why a delivery failure fails the call (StructuredOutputDeliveryError → 503) with an instruction to retry — the events carry a stable timestamp (the run's created_at) alongside the deterministic uuid, so the dedupe sorting key (toDate(timestamp) is part of it) stays identical across retries even past UTC midnight — and why the channel fails loudly for a dry-run emit=False scout, an org without AI-processing consent (mirroring emit._preflight_emit_gates), or a disabled signals_scout source instead of suppressing quietly (the runner also withholds the prompt section and schema snapshot when emit is off). Cardinality is the scout's call — the schema describes one record; a run may submit one, one per judged entity, or a batch (caps: MAX_RECORDS_PER_CALL per call, MAX_RECORDS_PER_RUN per run via the structured_output_count counter on run.metadata, reserved under the run-row lock before the forward — it counts accepted batches, so failed or retried forwards still spend cap). The prompt renders the exact configured schema in a per-run # Structured output section only when the channel is live, so the prompt and the validator can never describe two different contracts.
    • checks.py — record_check_result: the only way a scout run closes the report check it was dispatched to answer (agent-kind SignalReportCheck, dispatched by ../report_check_agent.py with triggered_by="check"). The verdict goes through the check executor's own funnel (../report_check_execution.record_check_verdict), so an agent result advances or retires its check by the same rules a measured one does, and lands on the report as a check_result artefact attributed to the run's task. Binding is what keeps the tool narrow: it admits only a check whose resolved lane is this run's own skill and that is still waiting on a dispatch (dispatched_at set), so the widest thing a run can do is answer the question it was asked. Deliberately NOT gated on allowed_tools like the report channel — the dispatch binding is the gate, so the fallback lane needs no frontmatter change to answer a check. It takes inconclusive with a required reason for a run whose tools worked but whose evidence cannot settle the claim, so errored stays a real tool or model failure. The prompt tells a run to record passed or failed when the evidence meets the check's stated bar. A run that never calls it leaves the check stamped, and the coordinator records an errored result once the result window passes. The same module holds the authoring tools — create_report_check / list_report_checks / cancel_report_check, exposed as scout-report-check-create / -list / -cancel — which are the other direction: a run that surfaces something whose fix will show in data writes the re-measurement down instead of leaving a note for a future run to find. They write through ../report_check_authoring.create_check, the one place a check row is written, so a scout-written check obeys the same per-report cap, the same metric-query copy, and the same bounds as one written through the REST endpoint, and is attributed to the run's task like every other scout write. Unlike record_check_result these ARE gated on the report channel (signal_scout_report:write plus the edit_report allowed_tools opt-in, through _resolve_in_progress_run), because a check is a write on a report rather than an answer to a question the coordinator already asked. Their actions resolve the run through _resolve_own_in_progress_run, which also refuses a sandbox token minted for a different run, and create and cancel pass _preflight_emit_gates first, so a dry-run scout writes no check.
    • profile.py — project_profile_* tools that read the deterministic SignalProjectProfile snapshot.
    • runs.py — runs_* tools that read past SignalScoutRun rows for dedupe and cross-skill awareness.
  • profile/

    • builders.py — deterministic builders that compute the inventory payload for SignalProjectProfile. Sections fall into three layers: capability / configured (sticky — products_in_use, integrations, external_data_sources, signal_source_configs, scout_fleet, …), aggregated recency (recent_activity — per-scope counts off the activity log, cross-cutting orientation across every entity type), and per-entity recent inventory (recent_surveys, recent_feature_flags, recent_experiments, recent_alerts, recent_hog_functions, recent_hog_flows, recent_notebooks, recent_cohorts, recent_actions, recent_dashboards, business_knowledge). Per-entity sections are deliberately light (counts + 5 most-recent items with name, status, timestamp); deep drilldowns go via the per-entity MCP list tools. See the module docstring at profile/builders.py for the authoritative section list — when adding or renaming a section, bump INVENTORY_SOURCE_VERSION so the cache invalidates cleanly. One section is not answered from the row: emit_eligibility is derived by tools/emit.py:emit_eligibility, which the builder calls with no run to get the team-wide floor and SignalProjectProfileViewSet.current re-derives for whichever scout is reading (resolved from its sandbox token's task binding, so the scout passes nothing). A profile row is shared by every scout on the team, so it cannot see a single scout's dry-run emit toggle — and a scout reading can_emit=true that the write path then refuses with scout_emit_disabled is exactly the relapse this shared derivation closes. can_emit is blocking_reason is None, and with a run in hand blocking_reason comes straight from _preflight_emit_gates, the same call emit_report and edit_report make at write time.
  • inactivity.py The stop switch on the waste axis (the failure breaker below covers the failure axis). sweep_inactive_scouts() judges consumption, not emission: a scout counts as consumed only when a person acted on a report it wrote or edited in the TOUCHED_REPORT_LOOKBACK — a log artefact attributed to a user (pipeline writers append log artefacts of their own, so unattributed ones don't count), a SignalReportAction row (the light interactions the inbox UI records server-side: opening a report's detail view via the viewed endpoint, rating it with the thumbs via feedback — reading counts on purpose, since that is how digest-style reports are consumed), or the report recently reaching resolved/deleted (resolved deliberately includes the GitHub webhook's resolve-on-merge, so a PR merged on GitHub with no in-app action still counts; suppressed is deliberately excluded because the same webhook suppresses on close-unmerged with no human involved). The two pause_reasons behave differently: ignored (the scout holds at least one report older than ESTABLISHED_REPORT_AGE and none of its reports show consumption) warns and then pauses after WARNING_GRACE; no_output (silent, with no judgeable report evidence) only ever warns, because a watch scout's silence can be its job. A scout with output but nothing judgeable on the report side — findings-only, Slack-routed (consumption happens in Slack where no evidence flows back), or every report younger than ESTABLISHED_REPORT_AGE — is left alone. It speaks the scout lifecycle vocabulary rather than keeping fields of its own: the warning is status=pending_pause (still scheduled), the pause is status=paused_by_system (syncing enabled=False), both through transition_status_by_system. The helper's ownership rule is writer-scoped: the sweep owns both of its reasons (so it can reclassify its own warning in either direction — no_output becomes ignored when report evidence establishes, restarting the grace clock, and ignored downgrades to no_output when its evidence ages out of the lookback, so a pause never lands on stale grounds), and neither the sweep nor the failure breaker can touch the other's pauses. Driven by the daily pause_inactive_signal_scouts Celery task rather than the coordinator tick, which stays bounded. A dry-run scout, one inside in_cold_start_grace(), one that has barely run (MIN_RUNS_IN_WINDOW), and one flagged auto_pause_exempt (watchdogs whose value is staying quiet, including every operational scout, which register_missing_configs stamps for exactly this reason) are all left alone; new warnings are capped per sweep (MAX_WARNS_PER_SWEEP), which also bounds later pauses, since a pause only ever follows a warning by WARNING_GRACE. Unlike the failure breaker there is no probe — an inactivity pause never runs again on its own. Re-enabling through the config API resumes the scout and re-anchors its grace window, so the sweep waits a full fresh COLD_START_GRACE and re-derives its verdict before judging it again (permanent immunity stays the explicit auto_pause_exempt field, never a resume side effect); that resume also emits signals_scout_auto_pause_reverted, the sweep's false-positive metric (the warn and pause emit signals_scout_auto_pause_warned / signals_scout_auto_paused).

  • limits.py Runtime ceilings as module constants: DEFAULT_MAX_RUNTIME_S (per-run budget), ACTIVITY_SLACK_S, and WORKFLOW_HARD_CEILING_S (= DEFAULT_MAX_RUNTIME_S + ACTIVITY_SLACK_S, the activity-level ceiling that gates the workflow's start_to_close_timeout). Also the failure-streak circuit breaker's knobs: failure_streak_pause_threshold(runs_in_tolerance_window) — consecutive failed runs before the breaker pauses the lane, derived per-lane so the same wall-clock tolerance holds at every cadence (one failure past the runs the schedule fits into FAILURE_STREAK_MIN_SPAN_MINUTES of continuous failure, FAILURE_STREAK_MIN_RUNS floor, capped at FAILURE_STREAK_MAX_RUNS + 1), with interval_runs_in_tolerance_window sizing the evenly spaced case — and AUTO_PAUSE_PROBE_INTERVAL_S (how long a paused lane holds before the coordinator dispatches one probe).

  • team_limits.py Single source of truth for a team's effective scout caps + metadata, resolved from the signals-scout flag payload in one read. The same three-layer cap resolution (team_configs[team] → default_team_config → code constant) the coordinator enforces at dispatch — for the run budgets and for max_enabled_scouts, the ceiling on how many scouts a project may have switched on, which resolve_max_enabled_scouts / max_enabled_scouts_for_team serve to the config write surfaces, auto-registration and the system resume alike, plus enrollment (_parse_enrollment → guaranteed_team_ids / skip_team_ids, with a cloud/dev-gated fallback) and the editorial banner string. guaranteed_team_ids may contain the "*" wildcard (ENROLL_ALL_TOKEN): with it, enrollment inverts from an explicit allowlist to "every team that has enabled scout configs" — the self-serve gate, where the product-autonomy- gated UI creates the configs; explicit ids alongside "*" are still force-provisioned and skip_team_ids still hard-excludes. The global per-tick ceiling is flag-tunable too (_resolve_global_max_runs_per_tick ← max_runs_per_tick_global, default MAX_RUNS_PER_TICK). background_lanes (parse_background_lanes → a tuple of BackgroundEnrollment, one per skill: skill_name, enabled, audience, team_ids, interval_minutes, max_new_teams_per_tick, bands, backoff, budget, require_precheck) runs scouts without a person asking. The older single background block parses as one lane with the default skill signals-scout-general, and applies only when background_lanes is absent. A lane is its skill: every background query below also filters on skill_name, so a lane never pauses, samples, budgets, or backs off another lane's configs. For each lane the coordinator creates one managed_by=background config per listed team whose organization approved AI data processing, seeding only that skill, and pauses a background config with background_removed when its team leaves the lane or its skill leaves the list. Background configs dispatch only through _collect_background_runs, which checks consent again, so each lane's kill switch (enabled: false) and the consent check gate every background run. A malformed lane, or two lanes with one skill_name, parses the whole list to None, and the coordinator then does nothing, so a typo cannot pause a cohort. A project can be in more than one lane; the shared tick caps, the enabled-scout cap, and withheld_skills apply to every lane. require_precheck makes a lane's configs use the skill's default pre-check (scout-precheck-query) whatever precheck_default_rollout says (precheck.resolve_effective_precheck). A lane whose skill ships no default dispatches nothing and logs it. A lane's bands sample a percentage of each activity band on top of the hand-picked team_ids. background_bands.py writes the bands once a day to SignalScoutBackgroundBand (the refresh_signal_scout_background_bands Celery task), with an audience of not_set_up or set_up per project, and a lane samples only the rows of its own audience. Eligibility, the band rules, and the one fleet-wide ClickHouse read are in its module docstring. A project in band n is sampled when background_sample_bucket(team_id, skill_name) < bands[n].percent. The bucket is a stable digest salted with the skill, so each lane samples on its own, and a higher percent keeps every project a lower one sampled. signals-scout-general keeps the salt it had before lanes, so its cohort did not move. A sampled project gets its config through the same creation path and max_new_teams_per_tick cap, with the band's interval_minutes, and SignalScoutConfig.background_band records the band. A lower percent, a band at 0, or a project that leaves its band removes the team from the listed set, so the existing background_removed pause applies, and a managed_by=team config never pauses. A malformed band entry counts as 0 percent for that band alone. A hand-picked team keeps no band. The runner stamps background_band on the run metadata and on both lifecycle events, next to managed_by. A lane's backoff (enabled, factor, max_interval_minutes) slows down a background config that nobody engages with. SignalScoutConfig.background_backoff_level counts the runs in a row with no engagement, and the coordinator makes the config due at min(run_interval_minutes × factor^level, max_interval_minutes), so run_interval_minutes keeps the nominal band cadence. The stamp moves the level when it dispatches a run: up by one when the previous dispatch created a SignalScoutRun and no member engaged since, and back to 0 when one did. A previous dispatch that the child skipped (quota, daily report limit, an active run) keeps the level. Planning reads the same engagement, so engagement makes a backed-off config due at the band interval at once. Engagement is a SignalReportAction row of any type or a person-attributed dismissal or log artefact on the team's reports, read for all due teams together (_engaged_team_ids). A login is not engagement. A config above level 0 is stamped at the tick start rather than at its slot anchor, because a slot on a changing period would dispatch it early. Without the block, nothing reads or moves the level, and a managed_by=team config never backs off. The runner stamps background_backoff_level and background_effective_interval_minutes next to background_band; both describe the cadence after the run. A lane's budget (max_runs_per_day, optional max_runs_per_tick) caps the runs of that lane one region dispatches in a trailing 24h window. The coordinator counts the SignalScoutRun rows stamped with the background origin (BACKGROUND_RUN_METADATA), and each tick admits at most min(max_runs_per_day - runs_last_24h, max_runs_per_tick) due background runs, including breaker probes. Without max_runs_per_tick, the day spreads evenly across the ticks of one day. The order is never-run first, then backoff level 0, then most overdue, then band and config pk. The rest are not stamped, so they stay due for the next tick, and their backoff level does not move. 0 stops background dispatch and keeps every config as it is. A missing or malformed block means no lane budget. A managed_by=team config and a scout a person enabled never count against the budget. Each tick logs and captures one signals_scout_background_tick per enabled lane with skill_name, due, dispatched, deferred, runs_last_24h, max_runs_per_day, never_run_due, and oldest_due_age_s. Kept free of the temporalio stack so it stays cheap to import on the API path; both the coordinator and the metadata endpoint import from here so the reported caps never drift from what dispatch allows. resolve_team_metadata() backs the metadata viewset; seed_config_layers_for_team() lets the on-demand sync endpoint seed the same launch posture.

  • derived_metadata.py Computes the metadata["derived"] region on the run row at finalize: booleans the harness reads back off the run's own settled output (has_emit_report, has_edit_report, has_self_improvement, has_chart, has_self_validation, has_structured_output, has_not_in_use_closeout). Deliberately server-derived rather than scout-reported, so a flag can't be omitted or contradicted by the model, and computed in one place at finalize rather than stamped incrementally at each emit/edit site. has_self_improvement classifies authored report titles through tools/report.is_self_improvement_title, the same predicate the lifecycle events use, so the run row and the event stream can never disagree. has_self_validation reads both follow-up mechanisms: a report check the run's task created or recorded a verdict on, or the run window against the skill-namespaced followup: scratchpad keys, since working that queue means writing to it. Creating a check counts where creating a queue entry does not, because a check is the validation being scheduled rather than a note asking a future run to do it. The field name stays put while scouts move from the queue onto checks, so dashboards built on it keep meaning "a run that checked whether a past fix held". has_not_in_use_closeout cannot read the run window, because not-in-use: keys are not skill-namespaced and sibling scouts on one team run at the same time. The scratchpad remember view instead counts each not-in-use: write on the run its sandbox token is bound to (metadata.not_in_use_writes), never the body run_id, and finalize reads that counter plus the run's output columns.

  • serializers.py DRF serializers for the harness HTTP surface (runs, scratchpad, project profile). Annotated for drf-spectacular so the generated MCP tools have informative schemas.

  • views.py SignalScoutRunViewSet, SignalScoutConfigViewSet, SignalScratchpadViewSet, SignalScoutNoteViewSet, SignalProjectProfileViewSet, SignalScoutMetadataViewSet, SignalScoutMembersViewSet, SignalScoutViewSet. Routed under project_signals_scout_* basenames in products/signals/backend/routes.py and exposed as scout-* MCP tools via products/signals/mcp/tools.yaml. Authored Monitoring scouts submit through scout-monitoring-result-submit, gated by a server-minted capability and the token-bound run. Assignment identifiers and the evidence window come from the persisted run brief. Validation errors permit correction within the same run; the ordinary close-out is prose and does not submit a verdict. SignalScoutViewSet backs scout-create: it creates a custom signals-scout-* skill and its runnable config atomically, grants the report-channel tools server-side, and treats an identical definition as a retry while rejecting conflicting definitions. SignalScoutMembersViewSet (scout-members-list) is the reviewer-routing roster: it returns the project's members (those with access to the team) with user_uuid / email / github_login so a report-channel scout can populate suggested_reviewers at cold start. The roster is member PII the scout needs to route, gated on the internal signal_scout_internal scope object (scope_object = "signal_scout_internal", default list → signal_scout_internal:read, satisfied by the sandbox token's …:write) — so, like emit-signal, it is reachable only inside a scout run and never enters a customer's public MCP catalog. (The narrower signal_scout_report scope was considered but is transient — kept only while emit-signal and emit-report coexist — so the durable tool stays on signal_scout_internal.) Membership is resolved server-side via report_generation/resolve_reviewers.list_project_members (through Team.all_users_with_access(), so private-project access control is honored), the project-nested path that the org-nested org-members-list tool (stripped + 403'd for a scoped-team token) can't provide. Each row also carries the teams that member is on, and ?team=<slug> narrows the roster to one team with its maintainers first, which is how a slug from a scout note, CODEOWNERS, or an owners.yaml owner becomes reviewers (report_generation/team_membership.py resolves the roster through the engineering_analytics facade). The filter returns 400 rather than an empty list when the project has no synced roster or the roster holds no rows for the slug: team rosters sync one by one, so an absent slug almost always means unsynced coverage, and a scout that reads an empty list as "no such team" stops routing to a team that exists. A search or team call that returns at most MAX_MEMBERS_WITH_ACTIVITY rows also attaches each member's activity (headline, theme labels, and the type and name of the top owned and watched objects) through activity_summary/search.member_activities, behind the same enrollment and activity-summary-search flag gates as activity-summary-search. The read is best effort: a failure logs and leaves activity null, so it can never take the roster down. It stays in the viewset, not in list_project_members, so resolve_reviewers is unaffected. The config viewset remains the lower-level no-wait creation path: create registers (upserts) a config for an already-authored skill with its schedule/emit posture in one call. list is strictly read-only (its MCP tool is annotated readOnly) — it never mints config rows. The metadata viewset is the read-only scout/metadata/current/ endpoint that reports enrollment + banner + enforced limits via team_limits.resolve_team_metadata.

Mental model

arun_signals_scout() is the main entrypoint. One call → one SignalScoutRun row → one sandbox session → zero or more emitted signals.

  • The harness inserts the bridge row at the start of a run (inside _spawn_and_run). SignalScoutRun is now a thin bridge to a Tasks TaskRun — run status / timing / error live on task_run, not on the bridge row. Single-flight is a best-effort app-layer guard: _has_running_run skips dispatch when a prior run for the same (team, skill_name) has task_run.status = IN_PROGRESS. The old WHERE status='running' partial unique index was dropped in the bridge simplification; _self_heal_stale_runs now reaps the orphan case at the app layer (failing any QUEUED/IN_PROGRESS run older than STALE_RUN_CUTOFF_S before the guard), so a worker crash no longer wedges a lane permanently. A task_run.status-based DB constraint is still a possible follow-up for stronger single-flight guarantees.
  • A (team, skill) lane that never succeeds is its own failure mode, distinct from the orphan case above: every dispatch is well-formed, takes a sandbox lease for the full runtime cap, produces nothing, and books a failed run — indefinitely, since the lane stays due every tick and nothing reconciles "this has never worked". The runner maintains a failure-streak circuit breaker for it: consecutive_failure_count on the config row is bumped on a failed run and zeroed on a successful one, and at the lane's threshold the runner pauses it through SignalScoutConfig.transition_status_by_system (status=paused_by_system, pause_reason=repeated_failures, which also syncs enabled=False like any pause). The threshold is per-lane, not fleet-wide: failure_streak_pause_threshold sets it one failure past the runs the lane's own schedule fits into FAILURE_STREAK_MIN_SPAN_MINUTES of continuous failure (_failure_streak_runs_in_window — the fullest window of occurrences across a year-long sample when a cron is set, widened by two hours of DST slack since project-local wall-clock schedules pack extra runs into the spring-forward night (Antarctica/Troll jumps two hours), else the evenly spaced count off the tick-quantized run_interval_minutes, the cadence dispatch actually produces), so the streak has to outlast the same wall clock whatever the schedule. Only scheduled runs feed the streak — a manual "run now" is off-schedule, so its failures must not count against a schedule-sized threshold (a burst of retries would pause a daily lane in minutes), while a manual success still clears the streak and can resume a paused lane. A single count could not: at the tightest cadences it trips healthy scouts partway through a platform outage, and at the default daily one it would have to grow into weeks of lease burn to buy tolerance those lanes never needed (an outage costs a daily lane at most one run). Counting occurrences rather than reading one gap is what keeps a bursty cron honest — 0,30 0 * * * has a 30-minute gap but only runs twice a day, so gap-sizing would hand it a lane-that-runs-all-day budget. The resolved threshold rides on signals_scout_config_auto_paused next to the count and the lane's schedule, so a trip is readable without re-deriving it. The breaker is half-open on purpose — a pause is not a tombstone, so the coordinator dispatches one probe per AUTO_PAUSE_PROBE_INTERVAL_S to lanes paused with repeated_failures (_collect_probe_runs, cooldown anchored on last_run_at so a failed probe restarts it with no extra bookkeeping); a probe that succeeds resumes the lane through the same helper and normal cadence returns with nobody intervening. The helper's reason-scoped ownership rule keeps it honest: the breaker may only resume its own repeated_failures pauses and can never touch paused_by_user, so an operator switching a scout off always wins. The streak is read-only on the config serializers (scout-configs-list); any config edit resets it, a resume (human enabled=true or a successful probe) always starts it clean, and the trip emits signals_scout_config_auto_paused once.
  • The sandbox is opened with the team's MCP token plus the harness-internal tools. The skill body is loaded into the system prompt; each scout has its own SignalScoutConfig row (keyed on (team, skill_name)) whose enabled flag, run_interval_minutes, and optional project-local cron run_cron_schedule the coordinator's per-scout due-check honors.
  • The agent model is per-scout too, from SignalScoutConfig.model — an optional model-id pin resolved as the top layer of model_selection.resolve_scout_model, honored only while the scouts-model-config dogfood flag is on for the team (scout_model_config_enabled; the flag is the kill switch, so stored pins go inert the moment it's off). A pin beats the scouts-model-selection experiment distribution — an explicit per-scout choice must not be rerouted by a fleet trial — and its runtime adapter is inferred from the id like any payload-routed model. Setting the field through the config API is rejected for teams outside the flag; clearing it is always allowed.
  • Sandbox network egress is per-scout, from SignalScoutConfig.network_access: trusted (default) provisions the shared SIGNALS_REPORT_RESEARCH env at the Tasks TRUSTED level (the platform trusted-domain allowlist), and full provisions a separate SIGNALS_SCOUT_FULL_NETWORK env at FULL (unrestricted). The env split is load-bearing: upsert_internal_sandbox_env reasserts policy per call on the per-team env row named, so a full-network run on the shared env would flip the policy for report research and every trusted scout on the team. That helper only reuses rows already marked internal and scrubs the user-controllable execution fields (custom image, env vars, repositories) on every call, so a same-named env a user pre-created via the sandbox environment API can never inject configuration into an internal run. Runs that departed from the default stamp metadata["network_access"] on the bridge row and carry it on both lifecycle events via _attach_run_shape_props (absent = trusted in both places), since the config can be edited after the fact. A future custom mode (user-supplied allowlist) should mirror the Tasks NetworkAccessLevel vocabulary.
  • Scout sandbox GitHub credentials are always read-only: the runner requests github_read_access on every scout run, so provisioning mints an ephemeral downscoped installation token (contents/metadata/pull_requests read, team-level installs only, never persisted — get_readonly_github_token in the tasks product) instead of the write-capable token that task creation would otherwise attach, or injects nothing when the mint isn't possible. The token backs the preinstalled gh CLI via GH_TOKEN/GITHUB_TOKEN. Separately, the gh prompt guidance for code-derived reviewer evidence — commit history by path, cross-checked against scout-members-list, cited in each reviewer's reason — renders only for report-channel scouts whose team passes both the github_read_access posture in the signals-scout flag payload (team_configs/default_team_config, resolved by team_limits.github_read_access_for_team; default ON, an explicit false at either layer is the kill switch) AND the mint-feasibility preflight (tasks_facade.can_mint_readonly_github_token), so a tokenless run is never steered at gh.
  • MultiTurnSession.start() creates a Tasks (Task, TaskRun) pair to drive the sandbox. The synchronous before_task_dispatch hook creates the scout bridge and protected trial state in the same transaction, before any workflow can mint credentials or start the first turn. The bridge links to TaskRun through its OneToOne FK (task_run), which powers the task_url deep-link and normal token/cost attribution. Status, errors, and execution state live on TaskRun. The bridge row does carry a metadata JSON column — the API-native record of run context that isn't worth a dedicated column — in two server-written regions. Top-level keys are stamped write-once at creation by _create_run_row, and split by whether they are always present. harness_prompt_version / report_channel (none/emit/edit/both) / skill_origin / github_guidance / business_knowledge_maintained / strict_reviewer_selection always are: together they pin down which instructions the run was given, which is the thing an eval or A/B has to hold constant. The last five are composition forks the build alone doesn't capture, since the same prompt build renders different sections depending on channel, skill origin, whether a read-only GitHub token could be minted, whether the team's knowledge base looks maintained (flag + upkeep, per business_knowledge.is_maintained_for_team), and whether the team is in the reviewer-selection trial. Each is unrecoverable after the fact (the prompt has no version history, a skill's allowed_tools can be edited, a seeded canonical row flips to custom the moment a team edits it taking every past run's origin with it, and the flag / source state behind the last two can change between runs), which is why they are stamped rather than resolved at read time. model / runtime_adapter / reasoning_effort appear only when something overrode the agent-server default — a SignalScoutConfig.model pin (honored while the scouts-model-config dogfood flag is on for the team, and the top layer of model_selection.resolve_scout_model), the scouts-model-selection gate, or a runtime pin — so their absence is meaningful. service_tier (the OpenAI queue a Codex run asked for: flex, priority, or default) follows the same rule and travels with the model it was configured beside: the selected slice's own object form, or the pipeline pin's when the pin's model runs, never inherited across models, and dropped on a claude runtime. That is what lets one slice trial flex against the remainder's standard queue on the same model. An entry that names its model in the object form makes its key a label for the arm rather than the model id, so one model can also carry several explicit arms (sol-flex and sol both resolving to gpt-5.6-sol) that duplicate JSON keys could not express; the stamp always carries the resolved model id, never the label. All five are attached to both lifecycle events via _attach_run_shape_props, since that is where the A/B readout happens, and github_guidance and business_knowledge_maintained are resolved in arun_signals_scout rather than inside _spawn_and_run so the failure and cancellation paths can report them too. New runner-known run dimensions belong here, not grown as ad-hoc columns. run_note is the one key that is neither a dimension nor runner-resolved: the one-off steering a person typed on the configs/<id>/run/ trigger, kept verbatim because it is the only record of why a manual run behaved differently from the scheduled ones around it. It is prose, not a value to group by. The nested derived object is written once at finalize by derived_metadata.py and holds booleans the harness computes from the run's own settled output (has_emit_report, has_edit_report, has_self_improvement, has_chart, has_self_validation, has_structured_output, has_not_in_use_closeout), so "what kind of run was this?" is a field lookup rather than a parse of the prose summary. Nothing in the column is scout-authored: a self-reported flag would only be as reliable as the model remembering to write it, which is what makes this column safe to query directly. Both regions surface on the run serializers / scout-runs-* MCP tools, with one exception: the dispatch-time structured_output_schema snapshot is stripped on the way out (RunMetadataField.to_representation) — it exists for record validation, and repeating up to 20 KB of schema per row would bloat every run listing. A missing derived region is unknown rather than all-false: the run predates the field, died before finalize, or its stamp failed (best-effort and logged, since observability must not fail a run that already committed its output). The flags read the authored reports' current state at finalize rather than an emit-time snapshot, so a title or chart changed after the emit is what lands; the emit-time record stays on the report lifecycle events.
  • Each run emits scout-owned lifecycle analytics events (best-effort, keyed on the team): signals_scout_run_started (the run cleared the guards and a TaskRun exists), signals_scout_run_finished (terminal: completed/failed/cancelled + runtime + emit count), and signals_scout_run_reaped (a stranded orphan was reaped by _self_heal_stale_runs). They join on run_id/task_run_id and are the event-derived (no-warehouse-lag) basis for throughput, stall, and worker-death alerting — a started with no finished is a run that died before finalize; a reaped run emits no finished. When the model resolution (a config pin, the scouts-model-selection gate, or a runtime pin) routes the run, started and finished also carry model / runtime_adapter (and service_tier when a slice or pin asked for an OpenAI queue), so run outcomes are sliceable by model and queue without joining through $ai_generation; absence means the agent-server default served it. A finished run that died at the per-turn poll wall also carries the turn-log diagnostics from TurnPollTimeout.diagnostics() (poll_timeout_stage + elapsed/stale/line counts), because every wall failure raises one error string and the fleet's timeout rate is otherwise a single undifferentiated bucket: no_turn_output (the agent never emitted a turn-relevant line — it never got going), stalled_after_output (worked, then went quiet past the salvage window), active_at_budget (still streaming when the budget expired — the budget is the constraint, not the agent). signals_scout_fleet_synced is the fleet-level companion, emitted from fleet_sync.py on the request path rather than per run — see that module's bullet above. signals_scout_config_auto_paused fires once when a (team, skill) lane's failure-streak breaker trips (see the run-lifecycle bullet above) — the alertable signal for a wedged lane, which is otherwise invisible in a stream of individually-unremarkable failed runs. The report channel adds signals_scout_report_emitted / signals_scout_report_edited (plus customer-facing $scout_report_* copies), stamped with derived classification properties (report_kind = finding/self_improvement, is_self_improvement_report) via _report_classification_props in tools/report.py — classified server-side off the prompt's mandated title prefix (prompt.SELF_IMPROVEMENT_REPORT_TITLE_PREFIX), so self-improvement reports are separable without downstream title heuristics. That helper is the single extension point for future derived telemetry dimensions on these events — add new flags there (both events pick them up), not as model columns.
  • Emit happens via the harness's emit_signal_* tools, which call emit_signal() with source_product="signals_scout" and source_type="cross_source_issue". From there the signal flows through the same emitter → buffer → grouping v2 path as any other source.
  • weight is the pipeline's promotion knob, not a scout judgment, so no scout surface carries it: not the emit schema, not the skills, not the emission rows the API returns. The harness pins every emitted finding to SCOUT_SIGNAL_WEIGHT = 1.0 (tools/emit.py), so a fresh report's total_weight meets WEIGHT_THRESHOLD (default 1.0) on the first signal and promotes immediately. Promotion is governed by the scout's own judgment about what is worth emitting, dedupe, and the safety filter.
  • Findings can carry tags — lowercase kebab-case category slugs, normalized and capped by normalize_tags in tools/emit.py. Tags persist in the signal's extra.tags (queryable in the signal store) and on the SignalScoutEmission row. The vocabulary lives in the scout loop, not the harness: the base prompt's Tagging your findings section instructs each scout to maintain a tags:<domain>:taxonomy scratchpad entry (read first-move like any memory, evolved as categories emerge), and the emission rows are the queryable ground truth a scout can audit its taxonomy against. The harness only normalizes, caps, and persists.
  • Scratchpad entries and run history are read at prompt assembly time. The agent can also write scratchpad entries mid-run via remember / forget — that's how a specialist with no anomalies to chase records "no LLM activity here, close out fast" so future runs of the same skill short-circuit cold.

Where the rest of the system meets this directory

  • Report checks — ../report_check_agent.py, dispatching through scout_scheduler.start_check_signals_scout_run. The fourth dispatch source (TRIGGERED_BY_CHECK): a forward-looking check attached to an inbox report, asking a scout to re-establish the report's claim after a soak window. It runs on the scout its config names, or on signals-scout-inbox-validation when it names none, which is the common case because most reports are pipeline-authored. It reuses run_gates in full, but stamps no last_run_at and never feeds the failure-streak breaker, because the check owns the clock and the scout's cadence decides nothing about it. A lane that cannot run records an errored result on the report naming the reason; a refusal that clears on its own defers the check instead.
  • Coordinator — temporal/agentic/scout_coordinator.py and scout_scheduler.py. Polls every COORDINATOR_INTERVAL_MINUTES = 30; dispatches each scout whose per-scout schedule (run_interval_minutes, default every 24 hours, or an optional project-local cron run_cron_schedule that takes precedence) is due, most-overdue first, hard cap MAX_RUNS_PER_TICK per tick (flag-tunable via max_runs_per_tick_global), ScheduleOverlapPolicy.SKIP to drop ticks rather than queue them. Each tick captures signals_scout_coordinator_tick (the global ceiling, dispatched and globally deferred runs) and one signals_scout_capacity_tick per project with due runs (due, dispatched, deferred, deferred_reason of per_tick, per_day or global, the resolved caps, runs_last_24h, enabled_scouts, max_enabled_scouts). The events carry the limits the tick resolved, so a chart compares usage to the live flag payload and keeps no copy of it. A dispatched rolling-interval scout has its last_run_at stamped at its own stable slot on the tick grid (_slot_anchor, keyed on a digest of the config id), not at the post-fan-out wall clock. That is what keeps dispatch spread across the day: a wall-clock anchor accumulated each tick's planning and fan-out latency, so a cohort eventually slipped onto the next tick and merged into that tick's cohort, and every merge made the resulting wave slower to fan out and more likely to slip again. Anchoring on the grid also returns a run deferred by a per-team cap or a missed tick to the slot it was meant to have, instead of re-anchoring wherever it happened to land. slot_aligned_dispatch: false in the flag payload reverts to wall-clock stamping. Cron scouts and breaker-paused lanes under probe keep the wall clock, because their last_run_at is a croniter reference and a probe cooldown clock respectively, not a schedule anchor. The tick's fan-out is paced rather than emitted in one burst: planned runs are strided into batches dispatched DISPATCH_BATCH_INTERVAL_SECONDS apart across a DISPATCH_SMEAR_SECONDS window (flag-tunable via dispatch_smear_seconds, 0 disables), each stamped right after its own dispatch. Every batch stamps with the tick's own start time, so pacing moves neither a slot anchor nor a cron reference. The coordinator is therefore alive for a chunk of each tick rather than for seconds: the schedule caps its execution_timeout at one interval, and any later edit to SignalsScoutCoordinatorWorkflow.run needs a workflow.patched() gate for executions in flight across the deploy. child_start_delay: true in the flag payload moves the spread into each child: the coordinator starts every child of the tick at once (in chunks of CHILD_START_CHUNK_SIZE), stamps them in one call, and exits, and each child sleeps a stable per-config delay (_start_delay_seconds, a digest fraction of the smear) before its pre-check. A cron scout's delay is capped at CRON_START_DELAY_CAP_SECONDS, a config with no previous run gets none, and a child checks its config again after the sleep and skips with config_disabled when it is gone or disabled. With the key on, the tick cap stays under CHILD_START_DELAY_MAX_RUNS_PER_TICK, because Temporal limits the pending children of one workflow. Workflow durations then include the sleep, so read the start rate from signals_scout_run_started, not from the dispatch counters. A lane paused by the failure-streak breaker (status=paused_by_system, pause_reason=repeated_failures) is excluded by the enabled=True dispatch filter like any other pause; the coordinator additionally dispatches one probe per AUTO_PAUSE_PROBE_INTERVAL_S to such lanes (_collect_probe_runs).
  • Source scout refresh — ../facade/source_scouts.py. A product that creates scouts for its objects registers a refresher by dotted path, keyed on the config's source_product. The runner calls it after the canonical sync and before it loads the skill, so a refresher that publishes new skill text reaches that run. Failures are logged and the run continues with the stored skill. Replay Vision uses it to keep template scouts on the latest template text.
  • Models — SignalScoutConfig, SignalScoutRun, SignalScratchpad, SignalScoutNote, SignalProjectProfile in ../models.py.
  • Source variant — SignalSourceConfig.SourceProduct.SIGNALS_SCOUT paired with SourceType.CROSS_SOURCE_ISSUE.
  • Scout fleet — the signals-scout-* skills live at ../../skills/signals-scout-*/ (the generalist plus the specialists; the fleet list there is the roster). See ../../skills/AGENTS.md for the fleet convention.
  • Local commands — run_signals_scout (one-shot run), run_scout_suggestions (one-shot suggestion scan / print the plan), and sync_signals_scout_skills (force a canonical-skill sync). All documented in ../management/AGENTS.md.

When editing this flow

  • Keep the harness loop generic. Skill-specific logic belongs in the SKILL.md of the scout, not in runner.py or prompt.py.
  • A value that varies by team or by run renders in the block at the end of the prompt, never in the prose above it. build_run_prompt closes with the governed-metrics nudge, the external MCP servers, the write grant, the structured-output schema, and the run identity, per-team values before per-run ones; everything above is identical across runs of the same channel. Both runtimes cache on prefix, so one interpolation moved back up the prompt leaves every section after it uncacheable, and the fleet pays for the whole body again on the first turn of every run. Where a stable section needs such a value, point at the block by section name (First: read your skill and the reviewer-routing guidance both do) rather than interpolating it in place. TestPromptCacheablePrefix pins the split.
  • A product-specific prompt injection has a bar to clear. Every product team eventually wants its thing in the run prompt, and the prompt is long enough that a fleet-wide addition costs every run tokens and cache. The data-catalog nudge (_GOVERNED_METRICS_NUDGE in prompt.py, resolved per run by _project_has_governed_metrics in runner.py) is the reference. It follows actual usage, not availability: a project with no approved metrics renders nothing, because a product being generally available does not mean a project uses it. Its text is fixed, with no per-team names or ids, so the prompt has two states and a project's data never reaches it. It is a nudge, not a rule: it says the capability exists and leaves the decision to the scout, and it never outranks the skill body. A failed check renders nothing, so an outage can only cost steering. The check runs as the run's acting user, so the prompt never points a run at something it cannot read. Every rendered state, including the empty one, is pinned by a test. No prompt text exists to satisfy an eval or a judge: if a judge cannot see compliance, fix what the judge reads. Anything reaching the prompt for one product meets all of these, or belongs in that scout's SKILL.md instead. The business-knowledge section (_BUSINESS_KNOWLEDGE, resolved per run in runner.py via business_knowledge.is_maintained_for_team) follows the same shape: it renders only when that product's flag is on — which is also what puts its tools in the run's toolset — and the team's knowledge base looks maintained, so the section states the base as a fact instead of spending fleet-wide tokens on a self-check whose usual answer is "skip". It reads is_maintained_for_team rather than the is_available_for_team that on-demand callers use, because a prompt section rides on every run of the lane: a base a team tried once and left alone is available forever, and would tax the lane forever. Business knowledge records no searches anywhere, so that predicate reads the source rows for upkeep instead (see its docstring); if search telemetry lands, gate on real use instead of the shape.
  • New harness-internal tools: add the implementation under tools/, re-export it from tools/__init__.py, and add a corresponding scope check on the viewset in views.py so the MCP surface and the sandbox surface stay aligned.
  • If you change the canonical SKILL.md format or directory layout, update lazy_seed.discover_canonical_skills() and the parser tests — the coordinator call to sync_canonical_skills() runs on every tick and silently swallows parser errors (logs only), so a quiet schema break can leave canonical content stale on every team.
  • Run lifecycle lives on the linked TaskRun (task_run.status), managed by MultiTurnSession — the SignalScoutRun bridge row carries no status of its own. A TaskRun stranded in IN_PROGRESS (worker SIGKILL before finalize) would block new runs for that (team, skill) via _has_running_run — so _self_heal_stale_runs fails any such run older than STALE_RUN_CUTOFF_S before the guard, letting the lane recover within a tick or two instead of wedging until manual intervention.
  • Emit path goes through emit_signal() and only emit_signal() — with one sanctioned carve-out: a scout that opts into the report-authoring channel (emit_report / edit_report in its skill's allowed_tools) writes a full SignalReport directly. That write does NOT go through harness code touching SignalReport or the embeddings pipeline itself — it goes through the scout_report/ service (create_scout_report / update_scout_report), which owns the report row + the bound document_embeddings signal write (the grouping substrate, minus the matcher). Harness/tool code calls that service; it still never touches SignalReport or the embeddings pipeline directly. See ../scout_report/persistence.py and the scouts-emit-reports spec. Both report-channel actions are tracked on the run as queryable columns: emit_report appends to SignalScoutRun.emitted_report_ids (via _record_report_emit), and edit_report appends — deduped — to edited_report_ids (via record_report_edit), so "which reports did this run author vs. edit?" is a column lookup, not an event-stream or artefact-log join. Both writes are best-effort and post-commit (an edit/emit never fails because its tally write did). emit_report is retry-safe, edit_report is not. Every emission is stored under a key (_emit_idempotency_key: the caller's idempotency_key, else a digest of the report's content, run-scoped either way) held by a partial unique index on SignalReport.scout_idempotency_key, so a retry after a proxy timeout returns the first report with idempotent_replay set instead of authoring a twin. The tool checks the key before the safety judge so a retry costs no LLM call; the index is what settles a retry that arrives while the first call is still judging, surfacing to the tool as ScoutReportAlreadyEmittedError. A replay never re-queues the Slack delivery or re-fires autostart, and books its own idempotent_replay outcome on signals_scout_report_emitted so retries stay measurable without counting as reports. This covers the transport failure only; telling a topic an earlier run already filed from a new one is still the scout's job (inbox search + the report: scratchpad pointer).
  • A project member can author through the same channel. tools/report_author.py holds two ReportAuthor implementations: ScoutRunReportAuthor and UserReportAuthor, which backs POST /signals/reports/ (inbox-reports-create, behind the inbox-reports-create-mcp flag). The user author has its own idempotency scope (user:<id>), checks AI-processing consent and a per-user daily cap (USER_REPORT_DAILY_LIMIT, returned as 429) in preflight_skip_reason, so a replay returns before the cap and the cap stops a call before the judge. The report is stored user_authored, and auto_start.maybe_autostart_from_report_artefacts blocks it on every evaluation, because the endpoint needs only inbox:write. Its backing signals carry the user_authored source product instead of signals_scout.
  • A report's routing is correctable in place. edit_report takes suggested_reviewers and repository, each replacing what the report holds and re-running autostart, so a report that surfaced routed to no one, or against the wrong codebase, is fixed rather than re-filed as a duplicate. repository takes the same owner/repo / NO_REPO input emit_report does (_normalize_repository), and the selection it writes is autostart_eligible because a scout naming a repository is a decision, not the reading of the prose that _refresh_inferred_repository may overturn. Omitting the field leaves the report's target alone, and a repository-only edit changes Inbox routing without queueing another Slack report delivery. The result's repository is the target the report holds once the edit settles, read back from the stored selection rather than echoed from the input, and a requested target the report did not take fails the call — repository_set alone reports only this process's intent, which a dropped field or a later write can outlive.
  • A report's work decision is correctable in place too. edit_report takes actionability + actionability_explanation (+ already_addressed) as one unit, and priority + priority_explanation. Each replaces the actionability_judgment / priority_judgment status artefact that autostart reads (set_scout_report_decision), logs an attributed work-log note, and re-runs autostart after the commit, so a promoted report can open a draft PR and a demoted or already-addressed one stops autostart from opening one. The report's inbox status does not move, because an edit must never take down a report someone else authored. A re-send of the stored decision is a no-op. The explanations pass the edit safety judge, since autostart copies the priority explanation into the implementation task. A decision-only edit changes Inbox routing without queueing another Slack report delivery.
  • A report can name the GitHub issues it is about. emit_report and edit_report take source_issues (GitHub issue URLs only, at most five per call), stored as one source_issue artefact per issue (../source_issues.py). The edit is additive and skips an issue the report already names. A READY report queues the GitHub writeback after commit, which comments only on an issue the team's GitHub source has ingested, and grouping attaches that issue's own signal to the report instead of opening a second one. A private trial rejects the field, since the writeback comment is public.
  • An edit_report result carries warnings: one entry per request field the edit did not apply, with the reason, while the rest of the edit landed. supersedes_implementation uses it today.
  • Report metrics are typed report content with a maximum of six entries. metrics on emit_report is the initial whole set. On edit_report, omit it or send null to preserve the current set, send [] to clear it, or send a list to replace it. A metrics-only edit changes Inbox content and does not queue another Slack report delivery. Every metric requires a bounded live InsightVizNode/TrendsQuery built only from EventsNode or ActionsNode sources. It rejects breakdown and compare mode and produces exactly one output series. An affected_users metric uses exactly one series with math: dau. An affected_sessions metric uses exactly one series with math: unique_session. Neither kind uses formulas or group math. Consumers derive BoldNumber for the whole-window value and ActionsBar for longitudinal buckets. List and detail responses omit legacy authored comparisons. Metrics default to date_from: "-13d" with a daily interval. This gives 14 inclusive buckets, including today. A longer window keeps only the trailing 14 strip buckets, while the whole-window value covers the full window. Do not author comparisons. Non-currency units are lowercase. Currency units use uppercase ISO codes such as USD.
  • If you add or rename a workflow/activity in temporal/agentic/, update posthog/temporal/tests/ai/test_module_integrity.py (TestSignalsProductModuleIntegrity) to match.
  • If you change the harness layout or tool surface, update this file to match.

Narrowed scout API writes

tool_policy.py checks held tools at the API boundary, including soft-delete payloads on shared PATCH endpoints. Harness and scout run writes must target the token-bound task’s current run; report artefacts are not a harness bypass. test_scout_tool_policy.py covers these boundaries and nested skill file paths.