:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(signals): lead the project profile with the emit gate (#99726)
posthog[bot]8de9095ad241
diff --git a/products/signals/backend/scout_harness/prompt.py b/products/signals/backend/scout_harness/prompt.pyindex 17688394ce67..a3168aff6fc5 100644--- a/products/signals/backend/scout_harness/prompt.py+++ b/products/signals/backend/scout_harness/prompt.py@@ -1373,7 +1373,7 @@ Once you've read your skill, call:That returns a deterministic snapshot of this team, worth 4-5 discovery calls in one: products in use, connected integrations, warehouse sources, signal source configs (split enabled/disabled), the `scout_fleet` roster of which other scouts run here, and counts of existing inbox reports. It's computed from authoritative tables, so treat it as ground truth, as distinct from the scout-inferred notes in `scout-scratchpad-search`.-Check `emit_eligibility.can_emit` first: if it's `false`, nothing you emit this run can reach the inbox. The profile is cached for up to ~1h and an admin may have just fixed the gate, so re-fetch once with `force_refresh=true` before acting. If it's still `false`, read `emit_eligibility.remediation` for the reason and next step, note it in your run summary, and close out immediately rather than investigating findings that would be silently dropped.+Check `summary.emit_eligibility.can_emit` first: if it's `false`, nothing you emit this run can reach the inbox. `summary` is the compact envelope at the top of the response, repeating the gate and the inbox counts that also sit inside `payload.inventory`. Read it there, because the inventory is long enough that the response can be cut off before you reach the copy inside it. If the envelope is missing from what you received, call the tool again with `summary_only=true` rather than assuming you may emit. The profile is cached for up to ~1h and an admin may have just fixed the gate, so re-fetch once with `force_refresh=true` before acting. If it's still `false`, read `summary.emit_eligibility.remediation` for the reason and next step, note it in your run summary, and close out immediately rather than investigating findings that would be silently dropped.{tail}diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.pyindex f3332a1f22a1..2732ee09bac0 100644--- a/products/signals/backend/scout_harness/serializers.py+++ b/products/signals/backend/scout_harness/serializers.py@@ -2276,9 +2276,49 @@ class ProjectProfilePayloadSerializer(serializers.Serializer):inventory = ProjectProfileInventorySerializer(help_text="Deterministic snapshot of what's true about the project.")+class ProjectProfileSummarySerializer(serializers.Serializer):+ """The compact envelope returned ahead of the verbose `payload`.++ Both sections are repeated from `payload.inventory`. They lead the response because a+ client that truncates a long tool result keeps the prefix, and these are the two things a+ scout has to know before it does anything: whether its output can reach the inbox at all,+ and what is already there. Read `summary` rather than digging for the same keys inside+ `payload.inventory`, because it is the same data and it is guaranteed to be in the part you+ received.+ """++ emit_eligibility = EmitEligibilitySerializer(+ allow_null=True,+ help_text=(+ "The delivery gate: whether scout findings can reach the inbox for this team, with a "+ "one-line `remediation` when they cannot. Check `can_emit` before investigating "+ "anything, because when it is False every emit is silently dropped. Null only for a stored "+ "profile built before this section existed, which the caller should treat as unknown "+ "rather than as permission to emit."+ ),+ )+ existing_inbox_reports = ExistingInboxReportsSerializer(+ allow_null=True,+ help_text=(+ "Counts of reports already in the inbox, grouped by status, which is what a new finding "+ "would be deduped against. Null for a stored profile built before this section existed."+ ),+ )++class ProjectProfileQuerySerializer(serializers.Serializer):"""Query parameters for the `current` action on `SignalProjectProfileViewSet`."""+ summary_only = serializers.BooleanField(+ required=False,+ default=False,+ help_text=(+ "When true, respond with the cache metadata and the `summary` envelope only, and omit "+ "`payload` entirely. Use it when you need the emit gate and the inbox counts but not "+ "the full inventory. The full profile runs to tens of kilobytes, which a client can "+ "truncate. Costs nothing extra: the profile is read or built the same way either way."+ ),+ )force_refresh = serializers.BooleanField(required=False,default=False,@@ -2300,8 +2340,18 @@ class ProjectProfileSerializer(serializers.Serializer):is per-team with a soft TTL (`PROFILE_TTL`); the response always reflects either thelatest cached profile or a freshly-built one if the cache was stale or the caller passed`force_refresh=true`.++ `summary` leads the response and `payload` trails it: the inventory runs to tens of+ kilobytes, so a client that truncates a long tool result would otherwise cut off the emit+ gate the scout has to read before doing any work."""+ summary = ProjectProfileSummarySerializer(+ help_text=(+ "Compact envelope repeating the emit gate and the inbox report counts from "+ "`payload.inventory`. Declared first so it survives a truncated response."+ ),+ )profile_id = serializers.CharField(help_text="UUID of the `SignalProjectProfile` row.")computed_at = serializers.CharField(help_text="ISO-8601 timestamp the profile was built.")expires_at = serializers.CharField(help_text="ISO-8601 timestamp after which the profile is considered stale.")@@ -2309,7 +2359,8 @@ class ProjectProfileSerializer(serializers.Serializer):help_text="Schema version of the inventory builder. Bumps invalidate older cached rows.",)payload = ProjectProfilePayloadSerializer(- help_text="Structured profile content. v1 has `inventory` only.",+ required=False,+ help_text="Structured profile content. v1 has `inventory` only. Omitted when `summary_only=true`.",)diff --git a/products/signals/backend/scout_harness/tools/profile.py b/products/signals/backend/scout_harness/tools/profile.pyindex b438b1eb70df..64e029a65605 100644--- a/products/signals/backend/scout_harness/tools/profile.py+++ b/products/signals/backend/scout_harness/tools/profile.py@@ -50,6 +50,15 @@ PROFILE_KEEP_N = 10_PROFILE_LOCK_NAMESPACE = 0x5191A1A6 # "SIGNAL"-ish leetspeak; just needs to be unique enough.+# Inventory sections repeated in the response's compact `summary` envelope.+# `emit_eligibility` is the delivery gate the prompt tells every scout to read before it does+# any work, and `existing_inbox_reports` is what it dedupes against. Both sit deep inside+# an inventory large enough that a client can cut the response off before reaching them, so a+# scout that reads only the prefix cannot tell whether its output would go anywhere. Repeating+# them up front costs a few hundred bytes and keeps them ahead of any truncation point.+SUMMARY_SECTIONS = ("emit_eligibility", "existing_inbox_reports")++@dataclass(frozen=True)class ProjectProfile:"""Wire shape for a `SignalProjectProfile` row.@@ -67,8 +76,18 @@ class ProjectProfile:source_version: strpayload: dict[str, Any] = field(default_factory=dict)+ def summary(self) -> dict[str, Any]:+ """The `SUMMARY_SECTIONS` of the inventory, for the compact envelope.++ A missing section reads as `None` rather than raising: a stored row whose inventory+ predates a section would otherwise turn the whole orientation call into a 500, which+ is a worse failure than a gate the caller has to treat as unknown.+ """+ inventory = self.payload.get("inventory") or {}+ return {section: inventory.get(section) for section in SUMMARY_SECTIONS}+def as_dict(self) -> dict[str, Any]:- return asdict(self)+ return {**asdict(self), "summary": self.summary()}def get_project_profile(*, team_id: int, force_refresh: bool = False, lazy_build: bool = True) -> ProjectProfile | None:diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.pyindex aab3b9cc478e..dad15c930490 100644--- a/products/signals/backend/scout_harness/views.py+++ b/products/signals/backend/scout_harness/views.py@@ -1634,6 +1634,11 @@ class SignalProjectProfileViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSeburning 4-5 discovery calls. Lazy-recomputes on cache miss / TTL expiry / source-versionbump; the response is always either the latest cached profile or a freshly-built one.+ The response leads with the compact `summary` envelope and trails with `payload`, because+ the inventory is large enough that a client can truncate the result before the emit gate+ the scout has to read. `summary_only=true` drops `payload` for a caller that wants the+ gate alone.+Exposed as a `@action(detail=False, url_path="current")` rather than `list()` so theOpenAPI spec — and every generated client downstream of it (`api.ts`, MCP toolresponse shape, etc.) — types the response as a single `ProjectProfileApi` instead@@ -1673,12 +1678,15 @@ class SignalProjectProfileViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSe},summary="Get the current project profile",description=(- "Return the team's deterministic project profile. For the internal scout token the response "- "reflects the newest non-expired cached row or a freshly-built one (lazy compute on cache miss); "- "`force_refresh=true` skips the cache and rebuilds from authoritative sources. Public read callers "- "(session auth or a `signal_scout:read` PAK) get the newest cached profile, or 404 if none has been "- "built yet — they never trigger a rebuild. Read this at the start of a run to orient on the team's "- "product mix, integrations, warehouse sources, signal coverage, and existing inbox surface."+ "Return the team's deterministic project profile. The response opens with a compact `summary` "+ "envelope carrying the emit gate and the inbox report counts, then the full `payload`. The "+ "inventory runs to tens of kilobytes, so a client that truncates a long tool result still keeps "+ "the gate. Pass `summary_only=true` to omit `payload` entirely. For the internal scout token the "+ "response reflects the newest non-expired cached row or a freshly-built one (lazy compute on cache "+ "miss); `force_refresh=true` skips the cache and rebuilds from authoritative sources. Public read "+ "callers (session auth or a `signal_scout:read` PAK) get the newest cached profile, or 404 if none "+ "has been built yet — they never trigger a rebuild. Read this at the start of a run to orient on "+ "the team's product mix, integrations, warehouse sources, signal coverage, and existing inbox surface."),)@action(@@ -1715,7 +1723,12 @@ class SignalProjectProfileViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSe)if profile is None:raise exceptions.NotFound("No project profile has been built for this team yet.")- return Response(ProjectProfileSerializer(profile.as_dict()).data)+ body = profile.as_dict()+ if validated.get("summary_only", False):+ # `payload` is `required=False` on the serializer, so dropping the key here omits it+ # from the response rather than rendering it null.+ body.pop("payload", None)+ return Response(ProjectProfileSerializer(body).data)class SignalScoutMetadataViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.pyindex eaa99c83a7ac..69813d77a2e8 100644--- a/products/signals/backend/test/test_scout_harness_api.py+++ b/products/signals/backend/test/test_scout_harness_api.py@@ -1,5 +1,6 @@from __future__ import annotations+import jsonfrom datetime import UTC, datetime, timedeltafrom decimal import Decimalfrom typing import TYPE_CHECKING@@ -2179,6 +2180,10 @@ class TestAgentHarnessProjectProfileAPI(APIBaseTest):def _list_url(self) -> str:return f"/api/projects/{self.team.id}/signals/scout/project_profile/current/"+ # A client that truncates a long tool result keeps the prefix, so the emit gate has to sit+ # inside a small leading slice of the response however large the inventory grows.+ GATE_PREFIX_CHARS = 2000+def _seed_profile(self, *, team: Team | None = None) -> str:"""Persist a real, schema-valid profile via the build path so a later read hits thecache, and return its profile_id. Building here is fine — the behavior under test is@@ -2186,6 +2191,26 @@ class TestAgentHarnessProjectProfileAPI(APIBaseTest):"""return compute_project_profile(team=team or self.team).profile_id+ def _pad_stored_inventory(self, *, entries: int) -> None:+ """Inflate the cached profile with schema-valid `recent_dashboards` rows.++ Creating hundreds of real dashboards would buy a slow test for a property of the+ response shape; padding the stored payload produces the same oversized inventory.+ """+ row = SignalProjectProfile.objects.filter(team=self.team).order_by("-computed_at").first()+ assert row is not None+ row.payload["inventory"]["recent_dashboards"] = [+ {+ "id": index,+ "name": f"Dashboard {index} " + "long enough to add up " * 8,+ "last_accessed_at": "2026-01-01T00:00:00+00:00",+ "last_refresh": None,+ "created_at": "2026-01-01T00:00:00+00:00",+ }+ for index in range(entries)+ ]+ row.save(update_fields=["payload"])+# --- untrusted (session) callers: read-only, never build ---def test_session_read_returns_404_when_no_profile_exists(self) -> None:@@ -2203,7 +2228,7 @@ class TestAgentHarnessProjectProfileAPI(APIBaseTest):assert response.status_code == status.HTTP_200_OKbody = response.json()assert body["profile_id"] == seeded_id- assert {"profile_id", "computed_at", "expires_at", "source_version"} <= set(body.keys())+ assert {"summary", "profile_id", "computed_at", "expires_at", "source_version"} <= set(body.keys())assert "inventory" in body["payload"]# Read-only: no new row written.assert SignalProjectProfile.objects.filter(team=self.team).count() == 1@@ -2276,6 +2301,44 @@ class TestAgentHarnessProjectProfileAPI(APIBaseTest):"top_events",}+ def test_emit_gate_stays_in_the_response_prefix_for_a_large_profile(self) -> None:+ # The gate is the scout's first read and a long response can reach it truncated, so it+ # must arrive ahead of the inventory rather than buried behind it.+ _authenticate_as_scout(self)+ self._seed_profile()+ self._pad_stored_inventory(entries=500)++ response = self.client.get(self._list_url())++ assert response.status_code == status.HTTP_200_OK+ rendered = response.content.decode()+ assert len(rendered) > 20 * self.GATE_PREFIX_CHARS, "padding did not produce an oversized profile"+ body = response.json()+ # The envelope repeats the inventory rather than carrying a second, drifting copy.+ assert body["summary"]["emit_eligibility"] == body["payload"]["inventory"]["emit_eligibility"]+ assert body["summary"]["existing_inbox_reports"] == body["payload"]["inventory"]["existing_inbox_reports"]+ prefix = rendered[: self.GATE_PREFIX_CHARS]+ assert f'"can_emit":{json.dumps(body["summary"]["emit_eligibility"]["can_emit"])}' in prefix+ assert '"remediation"' in prefix+ assert '"existing_inbox_reports"' in prefix++ def test_summary_only_drops_the_payload_and_keeps_the_gate(self) -> None:+ _authenticate_as_scout(self)+ self._seed_profile()++ response = self.client.get(self._list_url(), {"summary_only": "true"})++ assert response.status_code == status.HTTP_200_OK+ body = response.json()+ assert "payload" not in body+ assert set(body["summary"]["emit_eligibility"]) == {+ "ai_processing_approved",+ "source_enabled",+ "can_emit",+ "remediation",+ }+ assert set(body["summary"]["existing_inbox_reports"]) == {"total", "by_status"}+class TestRunCronScheduleValidation(SimpleTestCase):@parameterized.expand(diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 89974dce8206..e316eefc9dca 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -3341,6 +3341,60 @@ export interface ScoutNoteCreateRequestApi {expires_at?: string | null}+/**+ * `inventory.emit_eligibility` — whether scout findings can reach the inbox for this team.+ */+export interface EmitEligibilityApi {+ /** Whether the organization has approved AI data processing (an org-level gate on all scout emits). */+ ai_processing_approved: boolean+ /** Whether the `signals_scout` signal source is enabled for this team. */+ source_enabled: boolean+ /** True only when both team/org-level gates pass, so scout findings (signal and report channels alike) actually reach the inbox. When False, every emit is silently dropped — quick-close instead of doing throwaway investigation. Does not account for a scout's own dry-run `emit` toggle, which is per-config, not team-wide. */+ can_emit: boolean+ /**+ * One-line next step to unblock emits when `can_emit` is False; null when emits can flow.+ * @nullable+ */+ remediation: string | null+}++/**+ * One bucket in `inventory.existing_inbox_reports.by_status`.+ */+export interface InboxReportStatusBucketApi {+ /** Report status (e.g. `potential`, `candidate`, `ready`). */+ status: string+ /** Number of reports in this status (excludes deleted/suppressed). */+ count: number+}++/**+ * `inventory.existing_inbox_reports` — what's already been surfaced to the inbox.+ */+export interface ExistingInboxReportsApi {+ /** Total non-deleted, non-suppressed reports for this team. */+ total: number+ /** Per-status breakdown of inbox reports. */+ by_status: InboxReportStatusBucketApi[]+}++/**+ * The compact envelope returned ahead of the verbose `payload`.+ *+ * Both sections are repeated from `payload.inventory`. They lead the response because a+ * client that truncates a long tool result keeps the prefix, and these are the two things a+ * scout has to know before it does anything: whether its output can reach the inbox at all,+ * and what is already there. Read `summary` rather than digging for the same keys inside+ * `payload.inventory`, because it is the same data and it is guaranteed to be in the part you+ * received.+ */+export interface ProjectProfileSummaryApi {+ /** The delivery gate: whether scout findings can reach the inbox for this team, with a one-line `remediation` when they cannot. Check `can_emit` before investigating anything, because when it is False every emit is silently dropped. Null only for a stored profile built before this section existed, which the caller should treat as unknown rather than as permission to emit. */+ emit_eligibility: EmitEligibilityApi | null+ /** Counts of reports already in the inbox, grouped by status, which is what a new finding would be deduped against. Null for a stored profile built before this section existed. */+ existing_inbox_reports: ExistingInboxReportsApi | null+}+/*** `inventory.project_context` — free-form orientation about the project's product.*/@@ -3432,23 +3486,6 @@ export interface SignalSourceConfigsBucketsApi {disabled: SignalSourceConfigEntryApi[]}-/**- * `inventory.emit_eligibility` — whether scout findings can reach the inbox for this team.- */-export interface EmitEligibilityApi {- /** Whether the organization has approved AI data processing (an org-level gate on all scout emits). */- ai_processing_approved: boolean- /** Whether the `signals_scout` signal source is enabled for this team. */- source_enabled: boolean- /** True only when both team/org-level gates pass, so scout findings (signal and report channels alike) actually reach the inbox. When False, every emit is silently dropped — quick-close instead of doing throwaway investigation. Does not account for a scout's own dry-run `emit` toggle, which is per-config, not team-wide. */- can_emit: boolean- /**- * One-line next step to unblock emits when `can_emit` is False; null when emits can flow.- * @nullable- */- remediation: string | null-}-/*** One scout in either bucket of `inventory.scout_fleet`.*/@@ -3498,26 +3535,6 @@ export interface ScoutFleetApi {emitted_lookback_days: number}-/**- * One bucket in `inventory.existing_inbox_reports.by_status`.- */-export interface InboxReportStatusBucketApi {- /** Report status (e.g. `potential`, `candidate`, `ready`). */- status: string- /** Number of reports in this status (excludes deleted/suppressed). */- count: number-}--/**- * `inventory.existing_inbox_reports` — what's already been surfaced to the inbox.- */-export interface ExistingInboxReportsApi {- /** Total non-deleted, non-suppressed reports for this team. */- total: number- /** Per-status breakdown of inbox reports. */- by_status: InboxReportStatusBucketApi[]-}-/*** One row in `inventory.recent_activity.by_scope`.*/@@ -3992,8 +4009,14 @@ export interface ProjectProfilePayloadApi {* is per-team with a soft TTL (`PROFILE_TTL`); the response always reflects either the* latest cached profile or a freshly-built one if the cache was stale or the caller passed* `force_refresh=true`.+ *+ * `summary` leads the response and `payload` trails it: the inventory runs to tens of+ * kilobytes, so a client that truncates a long tool result would otherwise cut off the emit+ * gate the scout has to read before doing any work.*/export interface ProjectProfileApi {+ /** Compact envelope repeating the emit gate and the inbox report counts from `payload.inventory`. Declared first so it survives a truncated response. */+ summary: ProjectProfileSummaryApi/** UUID of the `SignalProjectProfile` row. */profile_id: string/** ISO-8601 timestamp the profile was built. */@@ -4002,8 +4025,8 @@ export interface ProjectProfileApi {expires_at: string/** Schema version of the inventory builder. Bumps invalidate older cached rows. */source_version: string- /** Structured profile content. v1 has `inventory` only. */- payload: ProjectProfilePayloadApi+ /** Structured profile content. v1 has `inventory` only. Omitted when `summary_only=true`. */+ payload?: ProjectProfilePayloadApi}export type SignalScoutRunSummaryApiMetadataDerived = {@@ -5597,6 +5620,10 @@ export type SignalsScoutProjectProfileGetParams = {* When true, skip the cache and rebuild the profile from authoritative sources before responding. Use after seeding events, importing data, or any other change the caller knows just landed but hasn't surfaced through natural cache expiry yet. Honored only for the internal scout token — public read callers get the cached profile regardless. Concurrent forced rebuilds are serialized by the team-keyed advisory lock — at most one extra `build_inventory` per simultaneous request.*/force_refresh?: boolean+ /**+ * When true, respond with the cache metadata and the `summary` envelope only, and omit `payload` entirely. Use it when you need the emit gate and the inbox counts but not the full inventory. The full profile runs to tens of kilobytes, which a client can truncate. Costs nothing extra: the profile is read or built the same way either way.+ */+ summary_only?: boolean}export type SignalsScoutRunsListParams = {diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.tsindex f43d7af2121e..0ca04db66668 100644--- a/products/signals/frontend/generated/api.ts+++ b/products/signals/frontend/generated/api.ts@@ -1347,7 +1347,7 @@ export const getSignalsScoutProjectProfileGetUrl = (}/**- * Return the team's deterministic project profile. For the internal scout token the response reflects the newest non-expired cached row or a freshly-built one (lazy compute on cache miss); `force_refresh=true` skips the cache and rebuilds from authoritative sources. Public read callers (session auth or a `signal_scout:read` PAK) get the newest cached profile, or 404 if none has been built yet — they never trigger a rebuild. Read this at the start of a run to orient on the team's product mix, integrations, warehouse sources, signal coverage, and existing inbox surface.+ * Return the team's deterministic project profile. The response opens with a compact `summary` envelope carrying the emit gate and the inbox report counts, then the full `payload`. The inventory runs to tens of kilobytes, so a client that truncates a long tool result still keeps the gate. Pass `summary_only=true` to omit `payload` entirely. For the internal scout token the response reflects the newest non-expired cached row or a freshly-built one (lazy compute on cache miss); `force_refresh=true` skips the cache and rebuilds from authoritative sources. Public read callers (session auth or a `signal_scout:read` PAK) get the newest cached profile, or 404 if none has been built yet — they never trigger a rebuild. Read this at the start of a run to orient on the team's product mix, integrations, warehouse sources, signal coverage, and existing inbox surface.* @summary Get the current project profile*/export const signalsScoutProjectProfileGet = async (diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yamlindex c5fe177b406e..20a387bc9bd0 100644--- a/products/signals/mcp/tools.yaml+++ b/products/signals/mcp/tools.yaml@@ -742,9 +742,13 @@ tools:enabled/disabled), and existing inbox report counts. Singleton per team; the response reflects either thenewest non-expired cached profile or a freshly-built one. Read this once at the start of a run (right after`skill-get`) to orient on the team in one tool call instead of paginating through- `inbox-source-configs-list` / `inbox-reports-list` / `read-data-schema` / `advanced-activity-logs-list`.- Distinct from `scout-scratchpad-search`: profile is ground truth from authoritative tables; scratchpad is- the scout's inferred learnings.+ `inbox-source-configs-list` / `inbox-reports-list` / `read-data-schema` / `advanced-activity-logs-list`. The+ response opens with a compact `summary` envelope holding `emit_eligibility` (the gate deciding whether+ anything you emit reaches the inbox, with a one-line `remediation`) and the inbox report counts, then the+ full `payload.inventory`. Read the gate from `summary`, not from deep inside `payload`, because the+ inventory runs to tens of kilobytes and can be cut off before you reach it. Pass `summary_only=true` when+ you want the gate and the counts without the inventory. Distinct from `scout-scratchpad-search`: profile is+ ground truth from authoritative tables; scratchpad is the scout's inferred learnings.scout-record-output:operation: signals_scout_record_outputenabled: truediff --git a/products/signals/skills/authoring-scouts/references/scout-patterns.md b/products/signals/skills/authoring-scouts/references/scout-patterns.mdindex 6e2befa1876c..7071b61a08f2 100644--- a/products/signals/skills/authoring-scouts/references/scout-patterns.md+++ b/products/signals/skills/authoring-scouts/references/scout-patterns.md@@ -482,7 +482,7 @@ The scout is that instrument, run on a schedule.**The accepted schema is a subset of the draft**, so a schema that validates elsewhere can still be rejected at config-write time: no `pattern` or `patternProperties` (a pathological regex stalls validation with no way to interrupt it), references only in-document (`#/...`), and 20,000 bytes serialized at most.Express constraints with `enum`, `type`, length bounds, and numeric bounds instead.Two more project-level gates fail the record call closed the same way — the org's AI data-processing consent and the project's `signals_scout` source toggle — and since there is no dry run for records (below), a project failing either spends a real run writing nothing.- Read `scout-project-profile-get`'s `emit_eligibility.can_emit` before creating or first running a measurement scout, and act on its remediation line rather than discovering the gate on the first emit-on run.+ Read `scout-project-profile-get`'s `summary.emit_eligibility.can_emit` before creating or first running a measurement scout, and act on its remediation line rather than discovering the gate on the first emit-on run.A public read caller gets the newest _cached_ profile and never triggers a build, so this returns **404 when no scout run has built one yet** — exactly the state a project's first measurement scout is authored in.Treat a 404 as eligibility unknown rather than ineligible, and proceed instead of blocking on the profile.Only one of the two gates is readable that way: `inbox-source-configs-list` verifies the `signals_scout` source toggle, while the org's AI-processing consent has no MCP read at all (`organization-get` filters the field out), so ask an org admin to confirm it in Organization settings → AI service providers rather than pretending to check it.diff --git a/products/signals/skills/working-with-scouts/SKILL.md b/products/signals/skills/working-with-scouts/SKILL.mdindex 81b9c08ecc2d..f469fd26f622 100644--- a/products/signals/skills/working-with-scouts/SKILL.md+++ b/products/signals/skills/working-with-scouts/SKILL.md@@ -43,7 +43,7 @@ One access rule covers everything here: scout rows live on the project's **canon- **Enrolled, empty roster** — likely newly enrolled and awaiting the first coordinator tick (configs auto-register then); say so instead of re-sending the user through onboarding.- **Enrolled, rows exist** — note each scout's `enabled`, `emit` (`false` = dry-run: it runs but writes nothing), and `status` / `pause_reason`.A paused or dry-run scout explains most "scouts aren't doing anything" complaints before any deeper digging.- Also check `emit_eligibility` on `posthog:scout-project-profile-get`: when `can_emit` is false (the org hasn't approved AI processing, or the `signals_scout` source is disabled), every scout write is silently dropped even on an enabled `emit: true` scout — surface its `remediation` line before promising coverage.+ Also check `summary.emit_eligibility` on `posthog:scout-project-profile-get` (pass `summary_only=true` when the gate is all you need): when `can_emit` is false (the org hasn't approved AI processing, or the `signals_scout` source is disabled), every scout write is silently dropped even on an enabled `emit: true` scout — surface its `remediation` line before promising coverage.(For read callers the profile is a cached snapshot built by scout runs, so a 404 means no fresh profile exists — not ineligibility; fall back to checking the `signals_scout` source config via `posthog:inbox-source-configs-list` and treat eligibility as unknown rather than blocking on the profile.)The `description` on each row says what that scout watches — scan it to answer "which scout covers X?" without loading any skill bodies.diff --git a/products/signals/skills/working-with-scouts/references/delegation-recipes.md b/products/signals/skills/working-with-scouts/references/delegation-recipes.mdindex 086dd80d7540..e94c596ecd18 100644--- a/products/signals/skills/working-with-scouts/references/delegation-recipes.md+++ b/products/signals/skills/working-with-scouts/references/delegation-recipes.md@@ -18,7 +18,7 @@ A new custom event ("`checkout_v2_completed`", "`ai_summary_generated`") that noAlmost always already covered — the canonical fleet ships anomaly watchers for error tracking, logs, web analytics, and most other surfaces.-1. Find the specialist in `posthog:scout-config-list` and confirm it's `enabled` with `emit: true` — and that the project can emit at all (`emit_eligibility.can_emit` on `posthog:scout-project-profile-get`; when false, writes are silently dropped fleet-wide; a 404 just means no fresh cached profile, so fall back to `posthog:inbox-source-configs-list` and treat eligibility as unknown).+1. Find the specialist in `posthog:scout-config-list` and confirm it's `enabled` with `emit: true` — and that the project can emit at all (`summary.emit_eligibility.can_emit` on `posthog:scout-project-profile-get`; when false, writes are silently dropped fleet-wide; a 404 just means no fresh cached profile, so fall back to `posthog:inbox-source-configs-list` and treat eligibility as unknown).2. If the ask has a specific edge ("especially the checkout service", "only production"), leave the scout a **note** with that focus.3. Only escalate to a skill edit if the scout structurally can't see what you care about (wrong threshold, missing disqualifier) — and it keeps proving that across runs.diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 0cdcabe374ae..13ad9352f988 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -9965,7 +9965,7 @@}},"scout-project-profile-get": {- "description": "Return a deterministic snapshot of \"what's true about this project\" — products in use, product intents (stuck onboardings), connected integrations, warehouse sources, signal source configs (split enabled/disabled), and existing inbox report counts. Singleton per team; the response reflects either the newest non-expired cached profile or a freshly-built one. Read this once at the start of a run (right after `skill-get`) to orient on the team in one tool call instead of paginating through `inbox-source-configs-list` / `inbox-reports-list` / `read-data-schema` / `advanced-activity-logs-list`. Distinct from `scout-scratchpad-search`: profile is ground truth from authoritative tables; scratchpad is the scout's inferred learnings.",+ "description": "Return a deterministic snapshot of \"what's true about this project\" — products in use, product intents (stuck onboardings), connected integrations, warehouse sources, signal source configs (split enabled/disabled), and existing inbox report counts. Singleton per team; the response reflects either the newest non-expired cached profile or a freshly-built one. Read this once at the start of a run (right after `skill-get`) to orient on the team in one tool call instead of paginating through `inbox-source-configs-list` / `inbox-reports-list` / `read-data-schema` / `advanced-activity-logs-list`. The response opens with a compact `summary` envelope holding `emit_eligibility` (the gate deciding whether anything you emit reaches the inbox, with a one-line `remediation`) and the inbox report counts, then the full `payload.inventory`. Read the gate from `summary`, not from deep inside `payload`, because the inventory runs to tens of kilobytes and can be cut off before you reach it. Pass `summary_only=true` when you want the gate and the counts without the inventory. Distinct from `scout-scratchpad-search`: profile is ground truth from authoritative tables; scratchpad is the scout's inferred learnings.","category": "Signals","feature": "signals","summary": "Get the project profile",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 9f73270fcba5..bf59e9c6843f 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -10537,7 +10537,7 @@}},"scout-project-profile-get": {- "description": "Return a deterministic snapshot of \"what's true about this project\" — products in use, product intents (stuck onboardings), connected integrations, warehouse sources, signal source configs (split enabled/disabled), and existing inbox report counts. Singleton per team; the response reflects either the newest non-expired cached profile or a freshly-built one. Read this once at the start of a run (right after `skill-get`) to orient on the team in one tool call instead of paginating through `inbox-source-configs-list` / `inbox-reports-list` / `read-data-schema` / `advanced-activity-logs-list`. Distinct from `scout-scratchpad-search`: profile is ground truth from authoritative tables; scratchpad is the scout's inferred learnings.",+ "description": "Return a deterministic snapshot of \"what's true about this project\" — products in use, product intents (stuck onboardings), connected integrations, warehouse sources, signal source configs (split enabled/disabled), and existing inbox report counts. Singleton per team; the response reflects either the newest non-expired cached profile or a freshly-built one. Read this once at the start of a run (right after `skill-get`) to orient on the team in one tool call instead of paginating through `inbox-source-configs-list` / `inbox-reports-list` / `read-data-schema` / `advanced-activity-logs-list`. The response opens with a compact `summary` envelope holding `emit_eligibility` (the gate deciding whether anything you emit reaches the inbox, with a one-line `remediation`) and the inbox report counts, then the full `payload.inventory`. Read the gate from `summary`, not from deep inside `payload`, because the inventory runs to tens of kilobytes and can be cut off before you reach it. Pass `summary_only=true` when you want the gate and the counts without the inventory. Distinct from `scout-scratchpad-search`: profile is ground truth from authoritative tables; scratchpad is the scout's inferred learnings.","category": "Signals","feature": "signals","summary": "Get the project profile",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 207499950771..40163bcc0f5f 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -73999,6 +73999,23 @@ export namespace Schemas {app_urls: string[];}+ /**+ * The compact envelope returned ahead of the verbose `payload`.+ *+ * Both sections are repeated from `payload.inventory`. They lead the response because a+ * client that truncates a long tool result keeps the prefix, and these are the two things a+ * scout has to know before it does anything: whether its output can reach the inbox at all,+ * and what is already there. Read `summary` rather than digging for the same keys inside+ * `payload.inventory`, because it is the same data and it is guaranteed to be in the part you+ * received.+ */+ export interface ProjectProfileSummary {+ /** The delivery gate: whether scout findings can reach the inbox for this team, with a one-line `remediation` when they cannot. Check `can_emit` before investigating anything, because when it is False every emit is silently dropped. Null only for a stored profile built before this section existed, which the caller should treat as unknown rather than as permission to emit. */+ emit_eligibility: EmitEligibility | null;+ /** Counts of reports already in the inbox, grouped by status, which is what a new finding would be deduped against. Null for a stored profile built before this section existed. */+ existing_inbox_reports: ExistingInboxReports | null;+ }+/*** One row in either bucket of `inventory.signal_source_configs`.*/@@ -74542,8 +74559,14 @@ export namespace Schemas {* is per-team with a soft TTL (`PROFILE_TTL`); the response always reflects either the* latest cached profile or a freshly-built one if the cache was stale or the caller passed* `force_refresh=true`.+ *+ * `summary` leads the response and `payload` trails it: the inventory runs to tens of+ * kilobytes, so a client that truncates a long tool result would otherwise cut off the emit+ * gate the scout has to read before doing any work.*/export interface ProjectProfile {+ /** Compact envelope repeating the emit gate and the inbox report counts from `payload.inventory`. Declared first so it survives a truncated response. */+ summary: ProjectProfileSummary;/** UUID of the `SignalProjectProfile` row. */profile_id: string;/** ISO-8601 timestamp the profile was built. */@@ -74552,8 +74575,8 @@ export namespace Schemas {expires_at: string;/** Schema version of the inventory builder. Bumps invalidate older cached rows. */source_version: string;- /** Structured profile content. v1 has `inventory` only. */- payload: ProjectProfilePayload;+ /** Structured profile content. v1 has `inventory` only. Omitted when `summary_only=true`. */+ payload?: ProjectProfilePayload;}export interface Property {@@ -104783,6 +104806,10 @@ export namespace Schemas {* When true, skip the cache and rebuild the profile from authoritative sources before responding. Use after seeding events, importing data, or any other change the caller knows just landed but hasn't surfaced through natural cache expiry yet. Honored only for the internal scout token — public read callers get the cached profile regardless. Concurrent forced rebuilds are serialized by the team-keyed advisory lock — at most one extra `build_inventory` per simultaneous request.*/force_refresh?: boolean;+ /**+ * When true, respond with the cache metadata and the `summary` envelope only, and omit `payload` entirely. Use it when you need the emit gate and the inbox counts but not the full inventory. The full profile runs to tens of kilobytes, which a client can truncate. Costs nothing extra: the profile is read or built the same way either way.+ */+ summary_only?: boolean;};export type SignalsScoutRunsListParams = {diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex b19b19e138fb..d8be26e30a2a 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -1390,7 +1390,7 @@ export const SignalsScoutNotesDestroyParams = () => zod.object({})/**- * Return the team's deterministic project profile. For the internal scout token the response reflects the newest non-expired cached row or a freshly-built one (lazy compute on cache miss); `force_refresh=true` skips the cache and rebuilds from authoritative sources. Public read callers (session auth or a `signal_scout:read` PAK) get the newest cached profile, or 404 if none has been built yet — they never trigger a rebuild. Read this at the start of a run to orient on the team's product mix, integrations, warehouse sources, signal coverage, and existing inbox surface.+ * Return the team's deterministic project profile. The response opens with a compact `summary` envelope carrying the emit gate and the inbox report counts, then the full `payload`. The inventory runs to tens of kilobytes, so a client that truncates a long tool result still keeps the gate. Pass `summary_only=true` to omit `payload` entirely. For the internal scout token the response reflects the newest non-expired cached row or a freshly-built one (lazy compute on cache miss); `force_refresh=true` skips the cache and rebuilds from authoritative sources. Public read callers (session auth or a `signal_scout:read` PAK) get the newest cached profile, or 404 if none has been built yet — they never trigger a rebuild. Read this at the start of a run to orient on the team's product mix, integrations, warehouse sources, signal coverage, and existing inbox surface.* @summary Get the current project profile*/export const SignalsScoutProjectProfileGetParams = () => zod.object({@@ -1402,6 +1402,7 @@ export const SignalsScoutProjectProfileGetParams = () => zod.object({})export const signalsScoutProjectProfileGetQueryForceRefreshDefault = false+export const signalsScoutProjectProfileGetQuerySummaryOnlyDefault = falseexport const SignalsScoutProjectProfileGetQueryParams = () => zod.object({force_refresh: zod@@ -1410,6 +1411,12 @@ export const SignalsScoutProjectProfileGetQueryParams = () => zod.object({.describe("When true, skip the cache and rebuild the profile from authoritative sources before responding. Use after seeding events, importing data, or any other change the caller knows just landed but hasn't surfaced through natural cache expiry yet. Honored only for the internal scout token — public read callers get the cached profile regardless. Concurrent forced rebuilds are serialized by the team-keyed advisory lock — at most one extra `build_inventory` per simultaneous request."),+ summary_only: zod+ .boolean()+ .default(signalsScoutProjectProfileGetQuerySummaryOnlyDefault)+ .describe(+ 'When true, respond with the cache metadata and the `summary` envelope only, and omit `payload` entirely. Use it when you need the emit gate and the inbox counts but not the full inventory. The full profile runs to tens of kilobytes, which a client can truncate. Costs nothing extra: the profile is read or built the same way either way.'+ ),})/**diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex 1b5e584ec0c1..652b77702dd1 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -1120,6 +1120,7 @@ const scoutProjectProfileGet = (): ToolBase<path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/project_profile/current/`,query: {force_refresh: params.force_refresh,+ summary_only: params.summary_only,},})return result@@ -1796,6 +1797,7 @@ const signalsScoutProjectProfileGet = (): ToolBase<path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/project_profile/current/`,query: {force_refresh: params.force_refresh,+ summary_only: params.summary_only,},})return resultdiff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-project-profile-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-project-profile-get.jsonindex 697da7354e57..35e58d5fd394 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-project-profile-get.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-project-profile-get.json@@ -5,6 +5,11 @@"default": false,"description": "When true, skip the cache and rebuild the profile from authoritative sources before responding. Use after seeding events, importing data, or any other change the caller knows just landed but hasn't surfaced through natural cache expiry yet. Honored only for the internal scout token — public read callers get the cached profile regardless. Concurrent forced rebuilds are serialized by the team-keyed advisory lock — at most one extra `build_inventory` per simultaneous request.","type": "boolean"+ },+ "summary_only": {+ "default": false,+ "description": "When true, respond with the cache metadata and the `summary` envelope only, and omit `payload` entirely. Use it when you need the emit gate and the inbox counts but not the full inventory. The full profile runs to tens of kilobytes, which a client can truncate. Costs nothing extra: the profile is read or built the same way either way.",+ "type": "boolean"}},"type": "object"diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-project-profile-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-project-profile-get.jsonindex 697da7354e57..35e58d5fd394 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-project-profile-get.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-project-profile-get.json@@ -5,6 +5,11 @@"default": false,"description": "When true, skip the cache and rebuild the profile from authoritative sources before responding. Use after seeding events, importing data, or any other change the caller knows just landed but hasn't surfaced through natural cache expiry yet. Honored only for the internal scout token — public read callers get the cached profile regardless. Concurrent forced rebuilds are serialized by the team-keyed advisory lock — at most one extra `build_inventory` per simultaneous request.","type": "boolean"+ },+ "summary_only": {+ "default": false,+ "description": "When true, respond with the cache metadata and the `summary` envelope only, and omit `payload` entirely. Use it when you need the emit gate and the inbox counts but not the full inventory. The full profile runs to tens of kilobytes, which a client can truncate. Costs nothing extra: the profile is read or built the same way either way.",+ "type": "boolean"}},"type": "object"