: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.
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.pyStore revisioned criteria on the scout config and generate separate suggestions in a background sandbox. Read the scout rubrics section ofproducts/signals/ARCHITECTURE.mdwhen changing persistence, generation, or access restrictions.tool_catalogue.pyBuilds the scout tool catalogue from the committed MCP definitions throughposthog/mcp_tool_definitions.py. The read-only endpoint isGET /api/projects/:id/signals/scout/configs/tool_catalogue/inviews.py. It omits superseded tools and reports scope requirements and feature conditions. Callers must evaluate feature flags for the project.scout_held_mcp_toolsis the one answer to what a narrowed run holds: the picked list,SCOUT_RUN_CONTEXT_TOOLS, and the always-available tools.tool_policy.pyRefuses API writes a narrowed run did not pick a tool for. The runner stampsallowed_mcp_toolsonTask.state(mcp_tool_allowlist) whilescouts-tool-accessis on, andAPIScopePermissioncallsscout_tool_denialthroughfacade/tool_policy.pyfor 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 anapi_operationsentry of a held tool (posthog/mcp_tool_operations.py) or ofSANDBOX_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 inSANDBOX_HARNESS_OPERATIONS. A hand-written MCP tool that makes a non-GET call lists its endpoints inservices/mcp/schema/tool-definitions.json.runner.pyPer-run entrypoint (arun_signals_scout/run_signals_scout). Inserts theSignalScoutRunrow, builds the prompt + toolset, spawns the sandbox session, pumps the agent loop until budget exhaustion or natural completion, finalizes the run, and returns aRunResult. The activity wrapper intemporal/agentic/scout_scheduler.pydelegates straight to this. The run's scope posture is composed here (scout_scope_postureinposthog/temporal/oauth.py): the fleet-wide scout preset plus the write scopes this one scout was granted onSignalScoutConfig.write_scopes, intersected againstSCOUT_GRANTABLE_WRITE_SCOPEShere and again at mint time, and withheld entirely on a dry run (emit=False) so a preview never mutates the project, and narrowed toSCOUT_DEFAULT_WRITE_SCOPESwhen 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 withlist()would turn its keys into a grant. The grant is stamped on the run row'smetadata["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 accesssection 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 inviews.py(assert_can_grant_scout_write_scopes): the scout's resolved acting user (skill_loader.resolve_scout_acting_user_id) or a project admin, neverLLMSkillOwner, 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.pyPrivate 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.pychecks runtime settings and exports finished state, whiletrial_reads.pyoverlays saved starting notes and recent runs.trial_gateway.pysupplies short-lived gateway-only credentials for private report validation through the existing gateway.trial_inspection.pysupplies 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.pyServer-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.pywaits 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.pyPrivate comparison scoring. Read these when changing evidence snapshots, criterion verdicts, access checks, or aggregate scores.trial_evaluation.pysaves complete evidence files in private object storage;trial_judge.pyruns one sandbox agent per scout run through the Tasks facade.../trial_judging.pydefines the prompt and checks citations against the original files;trial_evaluation_report.pybuilds the deterministic report.../temporal/agentic/scout_trial_evaluation.pypasses only IDs through Temporal.trial_rubrics.pyreads 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.pyReviewer guidance forks onsignals-research-reviewer-selection(report_content_gates.team_research_reviewer_selection_enabled, resolved per run inrunner.pyand stamped asstrict_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 orNO_REPOroutes to the most plausible member throughscout-members-list, and reviewer routing in the skill body is a route to follow. With the flag off, the_LEGACYsections 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_promptforks on the run's channel viaskill_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, setsuggested_reviewersto route the report); every other scout gets the signal persona that fires weakemit_signalfindings. 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*urlfield, elsegenerate-app-url) instead of a hand-assembled path, keeping the bare id when neither source reaches the entity; its pull-request clause isreport_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 — achart:target is not a URL, and a reporttitle/ 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-widescout-runs-listfor 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_SEAMSstates 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 offollowup:<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 canonicalsignals-scout-inbox-validationscout when thescout_fleetroster 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 — andremember()upserts keep the originalcreated_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 inallowed_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 onSignalScoutConfig.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 directmcp__<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 vialazy_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-backedimprove:<skill-name>:<topic>scratchpad suggestions for its own skill body, which the owner reviews via theexploring-scouts/authoring-scoutsmeta 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 (titledScout self-improvement: <skill-name> – <topic>,NO_REPO,requires_human_input), authored/edited with the report tools it already holds and pointed to by thereport_idstashed in theimprove: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 atedit_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 theagent-feedbackMCP tool withfeedback_type="scout"plus structured fields (scout_skill_name,scout_skill_version,scout_category) so fleet-wide feedback aggregates per skill/version, deduped across runs viareported:<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 pointssuggested_reviewersat (owner first, viascout-members-list) — without it a scout only sees its pinned version'screated_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 steersuggested_reviewerselsewhere (a named reviewer, a team convention) or say "don't route to me" and be honoured —tools/report.py._build_suggested_reviewersinjects nothing, it only takes the scout's picks. Owners feed exactly one code rule there — a picked reviewer who is a current owner is stampedis_skill_owner=Trueso 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 carriessource_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 nosuggested_reviewersfield, so member names/emails (PII) must not reach its prompt. One last fork is per-trigger rather than per-scout: a run dispatched with anoterenders_run_note_sectionas the prompt's last section, delimited and framed as untrusted input for this run alone (capped atlimits.MAX_RUN_NOTE_CHARSby the manual endpoint that accepts one). The framing followstriggered_by: a manual run's note is advisory steering a person typed alongside the scout's usual work, while acheckdispatch's note is the run's whole assignment, so it renders_CHECK_NOTE_TEMPLATEinstead — the check to answer, and the instruction to close it withscout-check-record-result. Aworkflowdispatch's note names an event subject, so_WORKFLOW_NOTE_TEMPLATEmakes 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_byitself (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.pyResolves a scout'sLLMSkillrow from the team's rows by name, under any valid scout name. DefinesSIGNALS_SCOUT_SKILL_PREFIX— kept for the canonical on-disk paths, auto-registration, and display-name stripping, not as a naming requirement — andLoadedSkill(body + version + allowed_tools + origin + authors), plusREPORT_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_authorsprefers the skill's explicit owner set (LLMSkillOwner, keyed on the logical(team, name)so it never drifts when the body is edited) — returned asrole="owner", seed-creator first. Only when a skill has no explicit owners does it fall back to reconstructing authorship from version rows (distinct non-nullcreated_by: creator = earliest first-authored, then editors by last-edit recency, capped). Both paths are restricted toteam.all_users_with_access()so a revoked user's profile stops flowing into a privileged prompt.resolve_skill_owner_user_uuidsexposes the owner set (seed-creator first) to the report tools' reviewer provenance stamp (is_skill_owner). Author resolution is opt-in viaload_skill_for_run(..., include_authors=True)— only the runner's prompt-building path pays for it; the report-authorization gate inviews.pyloads the skill per report write just to checkallowed_toolsand skips it.acting_user.pyresolve_scout_run_acting_useris the one answer to who a run acts as: the trial's user, elseskill_loader.resolve_scout_acting_user_id, else the team fallback (resolve_acting_user_id_for_team, flaggedis_team_fallbackso the runner withholds the write grant). The runner andprecheck.pyboth call it, so a scheduled pre-check reads exactly the tables its run can read. A query with no user loses every access-scopedsystem.*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.pyCanonical skill sync. Readsproducts/signals/skills/signals-scout-*/from disk and reconciles them against the team'sLLMSkillrows: 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 taggedmetadata.seeded_by="signals_scout_harness"are ever updated. Called both lazily (coordinator tick, runner cold-start) and explicitly via thesync_signals_scout_skillsmanagement command. It also parses the retirement marker (canonical_deprecation_for, seedeprecation.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), andscout-display-name(canonical_display_name_for).scout-display-nameis the label the scout ships under, and every canonical scout states one, because the clients' fallback sentence-cases the slug and turnssignals-scout-apminto "Apm".scout-role: operationalmarks 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.pyThe retirement lifecycle of a canonical scout: thescout-status/scout-deprecationfrontmatter marker (parse_scout_deprecation), the shape it is stored in onLLMSkill.metadata(DEPRECATION_METADATA_KEY), andretire_scout_configs, which moves a project's config tostatus=paused_by_system,pause_reason=retiredthroughtransition_status_by_system.retiredis 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 fromsync_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.pymaterialize_scout_fleet(team, surface=...)— the on-demandconfigs/sync/path, and the only place that records what a materialization did. Resolves the seed posture + holdback from one flag read, runssync_canonical_skills(prune=True)andregister_missing_configs, then capturessignals_scout_fleet_syncedwith the per-bucket counts theSyncResultcarries (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), thesurfacethe 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 leastMASS_PRUNE_FLOORscouts, is not a retirement — it means the sync read a fleet the deploy did not ship — so it stampsunexpected_pruneon the event and capturesUnexpectedScoutFleetPruneinto error tracking. A detector, not a guard: by the time the count exists the rows are tombstoned.config_registry.pyregister_missing_configs(team_id)— auto-creates an enabled, default-scheduleSignalScoutConfigfor anysignals-scout-*skill lacking one ("author a skill, get a scout"). Called by the coordinator tick; the HTTP surface registers explicitly via the write-scoped configcreateendpoint instead (reads stay side-effect free). A canonical scout'sscout-tagsfrontmatter (read throughlazy_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 theai-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'sscout-display-nameis stamped the same way, and additionally backfilled onto existing rows byreconcile_canonical_display_names— every canonical config predates the key, so nothing else would ever give them a label. That pass writes only wheredisplay_nameis 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 andauto_pause_exempt, past theenabled_skillsallowlist and past the enabled-scout cap (it still counts toward the cap, so its slot is visible), andreconcile_operational_configsruns 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 viatransition_status_by_system, and a row the seed created disabled, which the model stores aspaused_by_userand the reconcile tells apart by its nullstatus_changed_at. A person's pause and arepeated_failurespause 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.pyPre-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 acanonical"turn this on" pick or acustomdraft with a ready-to-createdraft_body), thesignals-scout-suggestionsflag-payload settings (enabled,eligibility_tier0-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 fromTeam.ingested_eventon 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, sinceSignalReportAction.last_atis 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 inactivity_window_days, on the offline cluster, since a scheduled fleet scan must not compete with interactive queries (a Temporal activity keepsWorkload.ONLINEunless it says otherwise, andreadonly=Truewould return before the offline routing rather than add to it); a project undermin_events_in_windowor undermin_active_days_in_windowis stampedlow_activityinstead 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 atACTIVITY_READ_MAX_ROWSrows 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), becausesync_executesets 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 stampslast_requested_ateither 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 bySUGGESTIONS_OVERSELECT_FACTORso a tick still fills when several candidates are skipped, and the skipped ones are stampedlast_requested_atalongside the dispatched ones so the planner leaves them for a full refresh window rather than re-reading them every tick), draft validation (validate_suggestion_itemsdrops anything the one-click Create could not apply as-is), and persistence onSignalScoutSuggestionSet(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 byskill_nameand 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 storedstale, and a batch that merely aged pastrefresh_days, whether it held items or concluded there was nothing to suggest, reads asstalethrougheffective_status, since nothing writes that status on expiry; a failed generation anywhere after the gates keeps the prior items and counts toward the breaker; alow_activitystamp 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 tostale, so the project waits a full refresh window and is then re-checked;mark_stale_if_fleet_changedis wired toSignalScoutConfigsaves 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 stampslast_requested_atso the coordinator does not double up.suggestions_runner.pyis the one piece that needs the tasks agent facade:arun_scout_suggestionsgates (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 aread_onlyheadless task with the reservedSIGNALS_SCOUT_SUGGESTIONSorigin, 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_generatedthrough the one emitter insuggestions.py(capture_suggestions_generated), so a skipped project reads asstatus=skipped,skip_reason=low_activityplus 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 bytemporal/agentic/scout_suggestions.py(coordinator + child, same shape as the scout coordinator, own schedule) and exposed read/dismiss/refresh atsignals/scout/suggestions/(../scout_suggestions_api.py), where membership, token scope, and resource-level RBAC all anchor to the canonical parent team. The prompt sharesSCOUT_PROJECT_SCAN_GUIDANCE(inprompt.py) with the chat template so the two voices never drift.slack_delivery.py/slack_delivery_queue.py/slack_charts.pyBest-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 toMAX_SCOUT_SLACK_DM_TARGETSmembers who each get an individual DM (one Celery task per recipient, so retries and permanent failures stay independent; a group DM would need thempim:writescope 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 itschartsthrough 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 asimageblocks 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. OnlyInsightVizNode/SavedInsightNodecharts 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## Evidenceidentically. 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 carryCHART_BLOCK_ID_PREFIXblock 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. OneChartRenderBudgetspans 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 withSIGNALS_SLACK_CHART_CACHE_SIGNING_KEYS(comma-separatednew,old; first signs, all verify) rather thanSECRET_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'sallowed_toolslist with whattools/__init__.pyre-exports — there is no separate registry module today.emit.py—emit_signal_*tools that push findings ascross_source_issuesignals into the standard ingestion pipeline.scratchpad.py—remember,forget, andsearch_scratchpadtools backed by theSignalScratchpadmodel. Entries are durable by default; an optionalexpires_at(mirroringnotes.py) retires a time-boxed memory on its own, since a scout that writes one almost never comes back toforgetit.rememberis a full-state upsert, so a write with noexpires_atclears 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_scratchpaddrops expired rows unlessinclude_expired=True(the human audit path); expiry first only hides a row, so within its post-expiry grace the key stays taken and bothforgetand the upsert still find it. The dailyprune_expired_scratchpad_entriesjanitor (in../tasks.py) then hard-deletes rows whose expiry is more thanSCRATCHPAD_EXPIRY_GRACE_DAYSin 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 throughsearch_scratchpadstays unfiltered on purpose —derived_metadata._touched_followup_queueis the one such reader, and has to be, since afollowup:entry lapsing after a run doesn't undo the validation work that run did.run_idon arememberwrite is best-effort lineage, never a gate: the serializer coerces one it can't parse toNone(_BestEffortUUIDField, the same stanceexpires_attakes) 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 totools/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 —_BestEffortDateTimeFieldcarries@extend_schema_field(OpenApiTypes.STR), and codegen strips theuuidformat for_BestEffortUUIDField. Aformatkeyword 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/forgetare gated on their ownsignal_scratchpad_internal:writescope rather than the widersignal_scout_internal:write, so the pipeline's research and implementation runs can persist what they judged without also gettingemit_signalandrecord_output. Scouts keep both tools, becauseSCOUT_INTERNAL_SCOPEScarries the scratchpad scope too; the pipeline's own postures are thesignals_research/signals_implementationpresets inposthog/temporal/oauth.py.signals_researchwithholdstask: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 noSignalScoutRun, socreated_by_runcannot name them. They stampSignalScratchpad.created_by_identityinstead — apipeline:*string from../pipeline_identity.py, resolved server-side from the token's bound task (itsai_stage, written once at run creation) rather than passed in, since a writer that could name itself could name a scout's skill._to_entryreads it ascreated_by_skillwhen there is no run, soscout-scratchpad-searchattributes every entry the same way. Likecreated_by_runit is written on create only, so an upsert keeps the original author.notes.py—list_notes/leave_note/delete_notebacked by theSignalScoutNotemodel: 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 byskill_nameor the whole fleet (blank), optionally expiring viaexpires_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 thecompleted_atof its last completed run, standing notes with noexpires_atfrom the last 30 days viaonly_without_expiry, and atextsearch per entity it investigates) and treat them as advisory steering. How to read eachoriginlives in thescout-notes-listtool description, because scouts read it throughinfoand the response field's help text never reaches them; the prompt keeps only the memory rules forreport_dismissalandreport_reviewer_correction. A third audience is a stage of the report pipeline, addressed through the reservedpipeline:*family (PIPELINE_AUDIENCES, holdingpipeline:report-researchtoday): a pseudo-target riding the sameskill_namecolumn, 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 noLLMSkillrow.list_notesmatchesskill_nameexactly, so no scout ever sees a pipeline note; the research loader in../report_steering.pypastes thepipeline:report-researchnotes and tells the run to search the rest withtext.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 undertools/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 needllm_skill:writeon top ofsignal_scout:write, and every writer must clear thellm_skillRBAC 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 anorigin=report_dismissalnote, 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 anorigin=report_discussionnote, 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 anorigin=report_feedbacknote, 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 anorigin=report_reviewer_correctionnote, 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 whosereviewer:memory names a removed GitHub login or PostHog user UUID (_memory_holders, one exact-term search under thereviewer:key prefix), ordered emitting scout first and capped atMAX_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 insideSUPPRESSION_WINDOW. Corrections on other reports and reversals remain separate evidence. Scouts search related notes without askill_namefilter 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 thesignal_scout:write/llm_skill:writekey 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 anorigin=report_noterow when the create names a report, since the content quotes the report's id, and appends the report'sscout_note_leftartefact 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 theinbox:writeandtask:writescopes and thetaskeditor bar, matching the reports artefact API the entry lands through. All four forwarding paths re-check the same steering gate (tokenscoped_teams, canonical-project access, and thellm_skilleditor bar) since the dismiss, discuss, feedback, and reviewer-edit actions need onlyinbox:write, and all forward only on the canonical team. The discuss and feedback paths additionally demand thesignal_scout:write/llm_skill:writekey 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 aninbox:writecredential must not open it alone. The discuss path is triggered from the tasks viewset (which holds the request the gate reads) throughfacade/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), soSignalScoutNoteViewSet.listwithholds them from any caller failing the reports read gate (_may_read_reports); both that gate and../report_steering.pyread the list offSignalScoutNote.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; thedismissalartefact / discussion task / feedback analytics event / reviewersuggested_reviewersartefact +suggested_reviewers_changedactivity-log row stays the record of truth. Notes reach two surfaces outside the fleet, both through../report_steering.py.load_report_steeringputs 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_steeringpastes only thepipeline:report-researchaudience into the report-research prompt and nudges the run to search every other origin by entity (list_notestext), 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 viaSignalScoutConfig.structured_output_schema(a JSON Schema describing ONE record, validated at config-write time byvalidate_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 (schemadescriptionfields are free prose rendered verbatim into a privileged prompt), so the config viewset gates it behindllm_skill:write+ thellm_skilleditor 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_outputevent via onecapture_batch_internalcall (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'screated_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-runemit=Falsescout, an org without AI-processing consent (mirroringemit._preflight_emit_gates), or a disabledsignals_scoutsource instead of suppressing quietly (the runner also withholds the prompt section and schema snapshot whenemitis 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_CALLper call,MAX_RECORDS_PER_RUNper run via thestructured_output_countcounter onrun.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 outputsection 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-kindSignalReportCheck, dispatched by../report_check_agent.pywithtriggered_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 acheck_resultartefact 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_atset), so the widest thing a run can do is answer the question it was asked. Deliberately NOT gated onallowed_toolslike the report channel — the dispatch binding is the gate, so the fallback lane needs no frontmatter change to answer a check. It takesinconclusivewith a requiredreasonfor a run whose tools worked but whose evidence cannot settle the claim, soerroredstays a real tool or model failure. The prompt tells a run to recordpassedorfailedwhen 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 asscout-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. Unlikerecord_check_resultthese ARE gated on the report channel (signal_scout_report:writeplus theedit_reportallowed_toolsopt-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_gatesfirst, so a dry-run scout writes no check.profile.py—project_profile_*tools that read the deterministicSignalProjectProfilesnapshot.runs.py—runs_*tools that read pastSignalScoutRunrows for dedupe and cross-skill awareness.
profile/builders.py— deterministic builders that compute the inventory payload forSignalProjectProfile. 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 atprofile/builders.pyfor the authoritative section list — when adding or renaming a section, bumpINVENTORY_SOURCE_VERSIONso the cache invalidates cleanly. One section is not answered from the row:emit_eligibilityis derived bytools/emit.py:emit_eligibility, which the builder calls with no run to get the team-wide floor andSignalProjectProfileViewSet.currentre-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-runemittoggle — and a scout readingcan_emit=truethat the write path then refuses withscout_emit_disabledis exactly the relapse this shared derivation closes.can_emitisblocking_reason is None, and with a run in handblocking_reasoncomes straight from_preflight_emit_gates, the same callemit_reportandedit_reportmake at write time.
inactivity.pyThe 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 theTOUCHED_REPORT_LOOKBACK— a log artefact attributed to a user (pipeline writers append log artefacts of their own, so unattributed ones don't count), aSignalReportActionrow (the light interactions the inbox UI records server-side: opening a report's detail view via theviewedendpoint, rating it with the thumbs viafeedback— reading counts on purpose, since that is how digest-style reports are consumed), or the report recently reachingresolved/deleted(resolveddeliberately includes the GitHub webhook's resolve-on-merge, so a PR merged on GitHub with no in-app action still counts;suppressedis deliberately excluded because the same webhook suppresses on close-unmerged with no human involved). The twopause_reasons behave differently:ignored(the scout holds at least one report older thanESTABLISHED_REPORT_AGEand none of its reports show consumption) warns and then pauses afterWARNING_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 thanESTABLISHED_REPORT_AGE— is left alone. It speaks the scout lifecycle vocabulary rather than keeping fields of its own: the warning isstatus=pending_pause(still scheduled), the pause isstatus=paused_by_system(syncingenabled=False), both throughtransition_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_outputbecomesignoredwhen report evidence establishes, restarting the grace clock, andignoreddowngrades tono_outputwhen 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 dailypause_inactive_signal_scoutsCelery task rather than the coordinator tick, which stays bounded. A dry-run scout, one insidein_cold_start_grace(), one that has barely run (MIN_RUNS_IN_WINDOW), and one flaggedauto_pause_exempt(watchdogs whose value is staying quiet, including every operational scout, whichregister_missing_configsstamps 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 byWARNING_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 freshCOLD_START_GRACEand re-derives its verdict before judging it again (permanent immunity stays the explicitauto_pause_exemptfield, never a resume side effect); that resume also emitssignals_scout_auto_pause_reverted, the sweep's false-positive metric (the warn and pause emitsignals_scout_auto_pause_warned/signals_scout_auto_paused).limits.pyRuntime ceilings as module constants:DEFAULT_MAX_RUNTIME_S(per-run budget),ACTIVITY_SLACK_S, andWORKFLOW_HARD_CEILING_S(= DEFAULT_MAX_RUNTIME_S + ACTIVITY_SLACK_S, the activity-level ceiling that gates the workflow'sstart_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 intoFAILURE_STREAK_MIN_SPAN_MINUTESof continuous failure,FAILURE_STREAK_MIN_RUNSfloor, capped atFAILURE_STREAK_MAX_RUNS+ 1), withinterval_runs_in_tolerance_windowsizing the evenly spaced case — andAUTO_PAUSE_PROBE_INTERVAL_S(how long a paused lane holds before the coordinator dispatches one probe).team_limits.pySingle source of truth for a team's effective scout caps + metadata, resolved from thesignals-scoutflag 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 formax_enabled_scouts, the ceiling on how many scouts a project may have switched on, whichresolve_max_enabled_scouts/max_enabled_scouts_for_teamserve 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_idsmay 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 andskip_team_idsstill hard-excludes. The global per-tick ceiling is flag-tunable too (_resolve_global_max_runs_per_tick←max_runs_per_tick_global, defaultMAX_RUNS_PER_TICK).background_lanes(parse_background_lanes→ a tuple ofBackgroundEnrollment, 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 singlebackgroundblock parses as one lane with the default skillsignals-scout-general, and applies only whenbackground_lanesis absent. A lane is its skill: every background query below also filters onskill_name, so a lane never pauses, samples, budgets, or backs off another lane's configs. For each lane the coordinator creates onemanaged_by=backgroundconfig per listed team whose organization approved AI data processing, seeding only that skill, and pauses a background config withbackground_removedwhen 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 oneskill_name, parses the whole list toNone, 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, andwithheld_skillsapply to every lane.require_precheckmakes a lane's configs use the skill's default pre-check (scout-precheck-query) whateverprecheck_default_rolloutsays (precheck.resolve_effective_precheck). A lane whose skill ships no default dispatches nothing and logs it. A lane'sbandssample a percentage of each activity band on top of the hand-pickedteam_ids.background_bands.pywrites the bands once a day toSignalScoutBackgroundBand(therefresh_signal_scout_background_bandsCelery task), with anaudienceofnot_set_uporset_upper project, and a lane samples only the rows of its ownaudience. Eligibility, the band rules, and the one fleet-wide ClickHouse read are in its module docstring. A project in bandnis sampled whenbackground_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-generalkeeps the salt it had before lanes, so its cohort did not move. A sampled project gets its config through the same creation path andmax_new_teams_per_tickcap, with the band'sinterval_minutes, andSignalScoutConfig.background_bandrecords 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 existingbackground_removedpause applies, and amanaged_by=teamconfig never pauses. A malformed band entry counts as 0 percent for that band alone. A hand-picked team keeps no band. The runner stampsbackground_bandon the run metadata and on both lifecycle events, next tomanaged_by. A lane'sbackoff(enabled,factor,max_interval_minutes) slows down a background config that nobody engages with.SignalScoutConfig.background_backoff_levelcounts the runs in a row with no engagement, and the coordinator makes the config due atmin(run_interval_minutes × factor^level, max_interval_minutes), sorun_interval_minuteskeeps the nominal band cadence. The stamp moves the level when it dispatches a run: up by one when the previous dispatch created aSignalScoutRunand 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 aSignalReportActionrow 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 amanaged_by=teamconfig never backs off. The runner stampsbackground_backoff_levelandbackground_effective_interval_minutesnext tobackground_band; both describe the cadence after the run. A lane'sbudget(max_runs_per_day, optionalmax_runs_per_tick) caps the runs of that lane one region dispatches in a trailing 24h window. The coordinator counts theSignalScoutRunrows stamped with the background origin (BACKGROUND_RUN_METADATA), and each tick admits at mostmin(max_runs_per_day - runs_last_24h, max_runs_per_tick)due background runs, including breaker probes. Withoutmax_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.0stops background dispatch and keeps every config as it is. A missing or malformed block means no lane budget. Amanaged_by=teamconfig and a scout a person enabled never count against the budget. Each tick logs and captures onesignals_scout_background_tickper enabled lane withskill_name,due,dispatched,deferred,runs_last_24h,max_runs_per_day,never_run_due, andoldest_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-demandsyncendpoint seed the same launch posture.derived_metadata.pyComputes themetadata["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_improvementclassifies authored report titles throughtools/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_validationreads both follow-up mechanisms: a report check the run's task created or recorded a verdict on, or the run window against the skill-namespacedfollowup: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_closeoutcannot read the run window, becausenot-in-use:keys are not skill-namespaced and sibling scouts on one team run at the same time. The scratchpadrememberview instead counts eachnot-in-use:write on the run its sandbox token is bound to (metadata.not_in_use_writes), never the bodyrun_id, and finalize reads that counter plus the run's output columns.serializers.pyDRF serializers for the harness HTTP surface (runs, scratchpad, project profile). Annotated for drf-spectacular so the generated MCP tools have informative schemas.views.pySignalScoutRunViewSet,SignalScoutConfigViewSet,SignalScratchpadViewSet,SignalScoutNoteViewSet,SignalProjectProfileViewSet,SignalScoutMetadataViewSet,SignalScoutMembersViewSet,SignalScoutViewSet. Routed underproject_signals_scout_*basenames inproducts/signals/backend/routes.pyand exposed asscout-*MCP tools viaproducts/signals/mcp/tools.yaml. Authored Monitoring scouts submit throughscout-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.SignalScoutViewSetbacksscout-create: it creates a customsignals-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) withuser_uuid/email/github_loginso a report-channel scout can populatesuggested_reviewersat cold start. The roster is member PII the scout needs to route, gated on the internalsignal_scout_internalscope object (scope_object = "signal_scout_internal", defaultlist→signal_scout_internal:read, satisfied by the sandbox token's…:write) — so, likeemit-signal, it is reachable only inside a scout run and never enters a customer's public MCP catalog. (The narrowersignal_scout_reportscope was considered but is transient — kept only while emit-signal and emit-report coexist — so the durable tool stays onsignal_scout_internal.) Membership is resolved server-side viareport_generation/resolve_reviewers.list_project_members(throughTeam.all_users_with_access(), so private-project access control is honored), the project-nested path that the org-nestedorg-members-listtool (stripped + 403'd for a scoped-team token) can't provide. Each row also carries theteamsthat 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 anowners.yamlowner becomes reviewers (report_generation/team_membership.pyresolves 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. Asearchorteamcall that returns at mostMAX_MEMBERS_WITH_ACTIVITYrows also attaches each member'sactivity(headline, theme labels, and the type and name of the top owned and watched objects) throughactivity_summary/search.member_activities, behind the same enrollment andactivity-summary-searchflag gates asactivity-summary-search. The read is best effort: a failure logs and leavesactivitynull, so it can never take the roster down. It stays in the viewset, not inlist_project_members, soresolve_reviewersis unaffected. The config viewset remains the lower-level no-wait creation path:createregisters (upserts) a config for an already-authored skill with its schedule/emit posture in one call.listis strictly read-only (its MCP tool is annotatedreadOnly) — it never mints config rows. The metadata viewset is the read-onlyscout/metadata/current/endpoint that reports enrollment + banner + enforced limits viateam_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).SignalScoutRunis now a thin bridge to a TasksTaskRun— run status / timing / error live ontask_run, not on the bridge row. Single-flight is a best-effort app-layer guard:_has_running_runskips dispatch when a prior run for the same(team, skill_name)hastask_run.status = IN_PROGRESS. The oldWHERE status='running'partial unique index was dropped in the bridge simplification;_self_heal_stale_runsnow reaps the orphan case at the app layer (failing anyQUEUED/IN_PROGRESSrun older thanSTALE_RUN_CUTOFF_Sbefore the guard), so a worker crash no longer wedges a lane permanently. Atask_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 afailedrun — 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_counton 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 throughSignalScoutConfig.transition_status_by_system(status=paused_by_system,pause_reason=repeated_failures, which also syncsenabled=Falselike any pause). The threshold is per-lane, not fleet-wide:failure_streak_pause_thresholdsets it one failure past the runs the lane's own schedule fits intoFAILURE_STREAK_MIN_SPAN_MINUTESof 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-quantizedrun_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 onsignals_scout_config_auto_pausednext 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 perAUTO_PAUSE_PROBE_INTERVAL_Sto lanes paused withrepeated_failures(_collect_probe_runs, cooldown anchored onlast_run_atso 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 ownrepeated_failurespauses and can never touchpaused_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 (humanenabled=trueor a successful probe) always starts it clean, and the trip emitssignals_scout_config_auto_pausedonce. - 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
SignalScoutConfigrow (keyed on(team, skill_name)) whoseenabledflag,run_interval_minutes, and optional project-local cronrun_cron_schedulethe 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 ofmodel_selection.resolve_scout_model, honored only while thescouts-model-configdogfood 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 thescouts-model-selectionexperiment 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 sharedSIGNALS_REPORT_RESEARCHenv at the TasksTRUSTEDlevel (the platform trusted-domain allowlist), andfullprovisions a separateSIGNALS_SCOUT_FULL_NETWORKenv atFULL(unrestricted). The env split is load-bearing:upsert_internal_sandbox_envreasserts 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 markedinternaland 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 stampmetadata["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 futurecustommode (user-supplied allowlist) should mirror the TasksNetworkAccessLevelvocabulary. - Scout sandbox GitHub credentials are always read-only: the runner requests
github_read_accesson every scout run, so provisioning mints an ephemeral downscoped installation token (contents/metadata/pull_requestsread, team-level installs only, never persisted —get_readonly_github_tokenin 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 preinstalledghCLI viaGH_TOKEN/GITHUB_TOKEN. Separately, theghprompt guidance for code-derived reviewer evidence — commit history by path, cross-checked againstscout-members-list, cited in each reviewer'sreason— renders only for report-channel scouts whose team passes both thegithub_read_accessposture in thesignals-scoutflag payload (team_configs/default_team_config, resolved byteam_limits.github_read_access_for_team; default ON, an explicitfalseat 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 atgh. MultiTurnSession.start()creates a Tasks(Task, TaskRun)pair to drive the sandbox. The synchronousbefore_task_dispatchhook 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 toTaskRunthrough itsOneToOneFK (task_run), which powers thetask_urldeep-link and normal token/cost attribution. Status, errors, and execution state live onTaskRun. The bridge row does carry ametadataJSON 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_selectionalways 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, perbusiness_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'sallowed_toolscan be edited, a seeded canonical row flips tocustomthe 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_effortappear only when something overrode the agent-server default — aSignalScoutConfig.modelpin (honored while thescouts-model-configdogfood flag is on for the team, and the top layer ofmodel_selection.resolve_scout_model), thescouts-model-selectiongate, or a runtime pin — so their absence is meaningful.service_tier(the OpenAI queue a Codex run asked for:flex,priority, ordefault) 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 itsmodelin 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-flexandsolboth resolving togpt-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, andgithub_guidanceandbusiness_knowledge_maintainedare resolved inarun_signals_scoutrather than inside_spawn_and_runso the failure and cancellation paths can report them too. New runner-known run dimensions belong here, not grown as ad-hoc columns.run_noteis the one key that is neither a dimension nor runner-resolved: the one-off steering a person typed on theconfigs/<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 nestedderivedobject is written once at finalize byderived_metadata.pyand 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 prosesummary. 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-timestructured_output_schemasnapshot 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 missingderivedregion 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), andsignals_scout_run_reaped(a stranded orphan was reaped by_self_heal_stale_runs). They join onrun_id/task_run_idand are the event-derived (no-warehouse-lag) basis for throughput, stall, and worker-death alerting — astartedwith nofinishedis a run that died before finalize; a reaped run emits nofinished. When the model resolution (a config pin, thescouts-model-selectiongate, or a runtime pin) routes the run,startedandfinishedalso carrymodel/runtime_adapter(andservice_tierwhen 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. Afinishedrun that died at the per-turn poll wall also carries the turn-log diagnostics fromTurnPollTimeout.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_syncedis the fleet-level companion, emitted fromfleet_sync.pyon the request path rather than per run — see that module's bullet above.signals_scout_config_auto_pausedfires 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-unremarkablefailedruns. The report channel addssignals_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_propsintools/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 callemit_signal()withsource_product="signals_scout"andsource_type="cross_source_issue". From there the signal flows through the same emitter → buffer → grouping v2 path as any other source. weightis 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 toSCOUT_SIGNAL_WEIGHT = 1.0(tools/emit.py), so a fresh report'stotal_weightmeetsWEIGHT_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 bynormalize_tagsintools/emit.py. Tags persist in the signal'sextra.tags(queryable in the signal store) and on theSignalScoutEmissionrow. The vocabulary lives in the scout loop, not the harness: the base prompt's Tagging your findings section instructs each scout to maintain atags:<domain>:taxonomyscratchpad 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 throughscout_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 onsignals-scout-inbox-validationwhen it names none, which is the common case because most reports are pipeline-authored. It reusesrun_gatesin full, but stamps nolast_run_atand 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.pyandscout_scheduler.py. Polls everyCOORDINATOR_INTERVAL_MINUTES = 30; dispatches each scout whose per-scout schedule (run_interval_minutes, default every 24 hours, or an optional project-local cronrun_cron_schedulethat takes precedence) is due, most-overdue first, hard capMAX_RUNS_PER_TICKper tick (flag-tunable viamax_runs_per_tick_global),ScheduleOverlapPolicy.SKIPto drop ticks rather than queue them. Each tick capturessignals_scout_coordinator_tick(the global ceiling, dispatched and globally deferred runs) and onesignals_scout_capacity_tickper project with due runs (due,dispatched,deferred,deferred_reasonofper_tick,per_dayorglobal, 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 itslast_run_atstamped 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: falsein the flag payload reverts to wall-clock stamping. Cron scouts and breaker-paused lanes under probe keep the wall clock, because theirlast_run_atis 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 dispatchedDISPATCH_BATCH_INTERVAL_SECONDSapart across aDISPATCH_SMEAR_SECONDSwindow (flag-tunable viadispatch_smear_seconds,0disables), 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 itsexecution_timeoutat one interval, and any later edit toSignalsScoutCoordinatorWorkflow.runneeds aworkflow.patched()gate for executions in flight across the deploy.child_start_delay: truein the flag payload moves the spread into each child: the coordinator starts every child of the tick at once (in chunks ofCHILD_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 atCRON_START_DELAY_CAP_SECONDS, a config with no previous run gets none, and a child checks its config again after the sleep and skips withconfig_disabledwhen it is gone or disabled. With the key on, the tick cap stays underCHILD_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 fromsignals_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 theenabled=Truedispatch filter like any other pause; the coordinator additionally dispatches one probe perAUTO_PAUSE_PROBE_INTERVAL_Sto 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'ssource_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,SignalProjectProfilein../models.py. - Source variant —
SignalSourceConfig.SourceProduct.SIGNALS_SCOUTpaired withSourceType.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.mdfor the fleet convention. - Local commands —
run_signals_scout(one-shot run),run_scout_suggestions(one-shot suggestion scan / print the plan), andsync_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.pyorprompt.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_promptcloses 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.TestPromptCacheablePrefixpins 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_NUDGEinprompt.py, resolved per run by_project_has_governed_metricsinrunner.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 inrunner.pyviabusiness_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 readsis_maintained_for_teamrather than theis_available_for_teamthat 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 fromtools/__init__.py, and add a corresponding scope check on the viewset inviews.pyso 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 tosync_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 byMultiTurnSession— theSignalScoutRunbridge row carries no status of its own. ATaskRunstranded inIN_PROGRESS(worker SIGKILL before finalize) would block new runs for that(team, skill)via_has_running_run— so_self_heal_stale_runsfails any such run older thanSTALE_RUN_CUTOFF_Sbefore the guard, letting the lane recover within a tick or two instead of wedging until manual intervention. - Emit path goes through
emit_signal()and onlyemit_signal()— with one sanctioned carve-out: a scout that opts into the report-authoring channel (emit_report/edit_reportin its skill'sallowed_tools) writes a fullSignalReportdirectly. That write does NOT go through harness code touchingSignalReportor the embeddings pipeline itself — it goes through thescout_report/service (create_scout_report/update_scout_report), which owns the report row + the bounddocument_embeddingssignal write (the grouping substrate, minus the matcher). Harness/tool code calls that service; it still never touchesSignalReportor the embeddings pipeline directly. See../scout_report/persistence.pyand thescouts-emit-reportsspec. Both report-channel actions are tracked on the run as queryable columns:emit_reportappends toSignalScoutRun.emitted_report_ids(via_record_report_emit), andedit_reportappends — deduped — toedited_report_ids(viarecord_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_reportis retry-safe,edit_reportis not. Every emission is stored under a key (_emit_idempotency_key: the caller'sidempotency_key, else a digest of the report's content, run-scoped either way) held by a partial unique index onSignalReport.scout_idempotency_key, so a retry after a proxy timeout returns the first report withidempotent_replayset 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 asScoutReportAlreadyEmittedError. A replay never re-queues the Slack delivery or re-fires autostart, and books its ownidempotent_replayoutcome onsignals_scout_report_emittedso 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 + thereport:scratchpad pointer). - A project member can author through the same channel.
tools/report_author.pyholds twoReportAuthorimplementations:ScoutRunReportAuthorandUserReportAuthor, which backsPOST /signals/reports/(inbox-reports-create, behind theinbox-reports-create-mcpflag). 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) inpreflight_skip_reason, so a replay returns before the cap and the cap stops a call before the judge. The report is storeduser_authored, andauto_start.maybe_autostart_from_report_artefactsblocks it on every evaluation, because the endpoint needs onlyinbox:write. Its backing signals carry theuser_authoredsource product instead ofsignals_scout. - A report's routing is correctable in place.
edit_reporttakessuggested_reviewersandrepository, 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.repositorytakes the sameowner/repo/NO_REPOinputemit_reportdoes (_normalize_repository), and the selection it writes isautostart_eligiblebecause a scout naming a repository is a decision, not the reading of the prose that_refresh_inferred_repositorymay 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'srepositoryis 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_setalone 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_reporttakesactionability+actionability_explanation(+already_addressed) as one unit, andpriority+priority_explanation. Each replaces theactionability_judgment/priority_judgmentstatus 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_reportandedit_reporttakesource_issues(GitHub issue URLs only, at most five per call), stored as onesource_issueartefact 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_reportresult carrieswarnings: one entry per request field the edit did not apply, with the reason, while the rest of the edit landed.supersedes_implementationuses it today. - Report metrics are typed report content with a maximum of six entries.
metricsonemit_reportis the initial whole set. Onedit_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 liveInsightVizNode/TrendsQuerybuilt only fromEventsNodeorActionsNodesources. It rejects breakdown and compare mode and produces exactly one output series. Anaffected_usersmetric uses exactly one series withmath: dau. Anaffected_sessionsmetric uses exactly one series withmath: unique_session. Neither kind uses formulas or group math. Consumers deriveBoldNumberfor the whole-window value andActionsBarfor longitudinal buckets. List and detail responses omit legacy authored comparisons. Metrics default todate_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 asUSD. - If you add or rename a workflow/activity in
temporal/agentic/, updateposthog/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.