: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
feat(signals): scout report authoring contract + docs (3/3) (#66132)
Andrew Maguire12279536aa90
diff --git a/products/signals/skills/authoring-signals-scouts/SKILL.md b/products/signals/skills/authoring-signals-scouts/SKILL.mdindex 3705f8f112bd..2b83b4fcffc8 100644--- a/products/signals/skills/authoring-signals-scouts/SKILL.md+++ b/products/signals/skills/authoring-signals-scouts/SKILL.md@@ -112,6 +112,18 @@ Two craft references the whole fleet reasons in terms of — a good scout's **Descratchpad key-prefix vocabulary, and the cross-project noise patterns. This is how yourscout avoids re-emitting and learns across runs.+Most scouts emit weak findings the pipeline consolidates. A scout that has _already done the+research and knows the exact report it wants to file_ can opt into the **report channel** and+author a full report directly:++- [`references/report-contract.md`](references/report-contract.md) — the `emit_report` /+ `edit_report` tools (dedup against existing reports via the vanilla `inbox-reports-list` /+ `inbox-reports-retrieve`), when to author a report vs. `emit-signal`, the+ dedup-via-`report_id` discipline (the channel isn't idempotent), and the accepted caveat that+ the pipeline may later rewrite an authored title/summary. Opt a scout in by listing the tools+ in its frontmatter `allowed_tools`. Only reach for this when the scout's natural output is one+ well-formed report.+The single most important design decision in any scout is its **signal-vs-noisediscriminator** — the cheap profile-shape read that separates "worth investigating" from"baseline". For error tracking it's the `count` vs `distinct_users` ratio; for CSP it'sdiff --git a/products/signals/skills/authoring-signals-scouts/references/dedupe-and-memory.md b/products/signals/skills/authoring-signals-scouts/references/dedupe-and-memory.mdindex 968aaf168c08..c3e9f778bff1 100644--- a/products/signals/skills/authoring-signals-scouts/references/dedupe-and-memory.md+++ b/products/signals/skills/authoring-signals-scouts/references/dedupe-and-memory.md@@ -31,15 +31,16 @@ category is encoded in the key prefix** so a future run finds an entry with a sisearch. Re-using a key rewrites the entry in place (the idempotent refresh — use it toconfirm a quiet observation without duplicating entries).-| Prefix | Use for |-| ------------- | --------------------------------------------------------------------------- |-| `pattern:` | Durable observation about how this team's data normally shapes (baselines). |-| `noise:` | Patterns to ignore (single-user, dev-only, recurring with no fix path). |-| `addressed:` | Team-confirmed fix shipped, or topic the team has moved on from. |-| `dedupe:` | Gates future emits on a specific issue / fingerprint / finding id. |-| `allowlist:` | Vetted entities the scout should never re-surface. |-| `not-in-use:` | Close-out memo for "product/surface not in use on this team". |-| `mcp-gap:` | Scout-noticed gap in the MCP surface worth raising later. |+| Prefix | Use for |+| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `pattern:` | Durable observation about how this team's data normally shapes (baselines). |+| `noise:` | Patterns to ignore (single-user, dev-only, recurring with no fix path). |+| `addressed:` | Team-confirmed fix shipped, or topic the team has moved on from. |+| `dedupe:` | Gates future emits on a specific issue / fingerprint / finding id. |+| `allowlist:` | Vetted entities the scout should never re-surface. |+| `not-in-use:` | Close-out memo for "product/surface not in use on this team". |+| `mcp-gap:` | Scout-noticed gap in the MCP surface worth raising later. |+| `report:` | A report this scout authored via the report channel — stores the `report_id` so the next run edits/dedups against it instead of re-filing. See [`report-contract.md`](report-contract.md). |Format: `<prefix>:<domain>:<entity>` — e.g. `pattern:error_tracking:baseline`,`noise:logs:rabbitmq-deploy-window`, `dedupe:csp_violations:a1b2c3d4`. Each canonicaldiff --git a/products/signals/skills/authoring-signals-scouts/references/report-contract.md b/products/signals/skills/authoring-signals-scouts/references/report-contract.mdnew file mode 100644index 000000000000..3f97920edcb5--- /dev/null+++ b/products/signals/skills/authoring-signals-scouts/references/report-contract.md@@ -0,0 +1,165 @@+# The report channel: `emit_report` / `edit_report`++Most scouts have one output: `emit-signal`, a weak finding the pipeline clusters, dedupes,+and may or may not promote into a `SignalReport`. A scout that has **already done the+research and knows the exact report it wants to file** can skip the pipeline and author the+report directly — the **report channel**. This reference is the contract for that channel:+the tools, their fields, when to reach for them over `emit-signal`, and the two behaviors+that make this channel different (it isn't idempotent, and the pipeline may later rewrite+what you authored).++This is **opt-in**. A scout gets these tools only if its skill's frontmatter+`allowed_tools` lists them — see [Opting a scout in](#opting-a-scout-in). Don't add them to a+scout whose findings are genuinely "weak observations the pipeline should consolidate" —+that's exactly what `emit-signal` is for.++> **Tool names vs. opt-in strings.** The callable MCP tools are+> **`signals-scout-emit-report`** and **`signals-scout-edit-report`** (same `signals-scout-*`+> prefix as `signals-scout-emit-signal`) — those are the names you invoke. The bare+> `emit_report` / `edit_report` (underscored) used throughout this doc and below are the **opt-in+> strings** you list under `allowed_tools`; they are not callable tool names. And like every+> `signals-scout-*` tool, **both report tools require the current `run_id`** (the run you're+> executing in) on every call — omitting it fails validation.++## When to use which channel++| You have… | Use |+| ------------------------------------------------------------------------------------------------------------------ | ------------- |+| A weak/partial observation; the value is in the pipeline grouping it with other signals. | `emit-signal` |+| A finished, well-formed finding you want filed **1:1** as a report — no clustering, full control of title/summary. | `emit_report` |+| New information about a report that already exists (one you authored last run, or a pipeline report). | `edit_report` |++The discriminator is **fidelity vs. consolidation**. `emit-signal` trades 1:1 control for the+pipeline's ability to merge many weak signals into one report; `emit_report` keeps the control+and skips the merge. A scout whose natural unit of output is "one well-framed report" (a+bundled health-check cluster, a single observability-gap recommendation) is a report-channel+fit. A scout that surfaces many small correlated observations is not — let the pipeline do its+job.++Reporting is a **higher bar than emitting**, not a shortcut around the confidence gate. Author a+report only when you'd stand behind it as a standalone inbox item a human will act on.++## `emit_report` — author a full report++Judges the report for safety, then persists it at the judged status.++| Field | Type | Notes |+| --------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `run_id` | string, required | The current run's id — the run you're executing in, same as every `signals-scout-*` tool. |+| `title` | string, ≤300, non-empty | The inbox headline. One specific, quantified line. |+| `summary` | string | The report body prose — the same description-prose discipline as a finding (hook → pattern → hypothesis → recommendation). |+| `evidence` | list, 1–50 | Each `{description, source_id}`. Becomes a bound signal row backing the report. `source_id` is the citable entity id. Hard cap of **50** — summarize/trim before calling; a longer list fails validation before the report is judged or persisted. |+| `actionability_explanation` | string | One sentence justifying the actionability call below. |+| `actionability` | enum | `immediately_actionable` / `requires_human_input` / `not_actionable`. You make this call — the channel does not re-research it. |+| `already_addressed` | bool, default `false` | Set when the underlying issue is already handled and you're filing for the record. |++**Status is decided for you, from safety × actionability:**++| Safety judge | `actionability` | Resulting status | Surfaces in inbox? |+| ------------ | ------------------------ | ---------------- | ------------------ |+| safe | `immediately_actionable` | `READY` | yes |+| safe | `requires_human_input` | `PENDING_INPUT` | yes |+| safe | `not_actionable` | `SUPPRESSED` | no |+| unsafe | (any) | `SUPPRESSED` | no |++The result tells you what happened: `report_id` (always set when a report was persisted —+**even when suppressed**, so you can edit or dedup against it), `report_status` (the birth status —+`ready` / `pending_input` / `suppressed` — the field is named `report_status` in the response, not+`status`), `emitted` (true only when it actually surfaced — `READY` / `PENDING_INPUT`),+`safety_explanation`, and+`skipped_reason` (set only when a preflight gate stopped the call before any report was+created — the same AI-data-processing / source-enabled gates that govern `emit-signal`).++### Opening a draft PR (autostart)++A surfaced, immediately-actionable report can open a draft PR automatically — the same autostart+path the pipeline uses. It's opt-in per report via three more `emit_report` fields; supply them only+when the report is a concrete, fixable issue you'd want a PR for:++| Field | Type | Notes |+| ---------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `repository` | string | `"owner/repo"` targets that repo; the `NO_REPO` sentinel opts out; **omitting it** falls back to free-form selection across the team's repos — the slow path on a many-repo team (it spawns a selection sandbox), so pass `owner/repo` when you know it. |+| `priority` | `P0`-`P4` | Required for a PR. Pair with `priority_explanation`. |+| `priority_explanation` | string | Required when `priority` is set. |+| `suggested_reviewers` | list of str | GitHub logins to consider. A PR opens only if at least one clears their autonomy threshold. |++Repo selection only runs when you signal PR intent — an explicit `repository`, or both `priority`+and `suggested_reviewers`. A report that supplies none of these just surfaces in the inbox (no repo+sandbox, no PR). Autostart itself still no-ops unless the report is `immediately_actionable`, has a+repo + priority, and a reviewer qualifies — so these fields are safe to omit for an informational+report.++## `edit_report` — update an existing report++Rewrite `title`/`summary` and/or append a note to a report that already exists. Pass `run_id`+(the current run) and `report_id`, plus at least one of `title`, `summary`, `append_note`.++`edit_report` can target **any** of the team's inbox reports — not just ones a scout authored.+That makes it the right tool when a later run learns something about a report the pipeline (or+another scout) created. Two rules of good behavior:++- **Prefer `append_note` over rewriting** `title`/`summary` on a report you didn't author. A+ note is additive and audit-friendly (it carries your scout as the author); a rewrite+ silently overwrites a human- or pipeline-authored headline.+- **Don't fight an in-flight pipeline.** A report the summary/research workflow is mid-run on+ can have its fields overwritten under you. If a report is actively being worked, append a+ note rather than rewriting.++## Finding "the report I made last time"++There is no scout-specific report search — use the **vanilla inbox tools** the scout already+has. Before authoring, list the team's existing reports so you reconcile against one instead of+filing a duplicate:++- `inbox-reports-list` — filter by title/summary free-text (`search`), `status`, `source_product`,+ or your own `task_id`; newest-updated first.+- `inbox-reports-retrieve` — fetch a single report by id (use the `report_id` you stashed in the+ scratchpad last run).++## Dedup: the channel is NOT idempotent++`emit_report` is **not idempotent** — a retried call authors a _second_ report. There is no+server-side dedup key. The dedup story is two-sided and the scout owns it:++1. **Before authoring**, `inbox-reports-list` for a prior report on the same topic. Found+ one? `edit_report` it instead of authoring a new one.+2. **After authoring**, write a `report:<domain>:<entity>` scratchpad entry recording the+ `report_id` so the next run finds it (via `inbox-reports-retrieve`) without a title-search+ guess. (This is the report-channel member of the scratchpad key-prefix vocabulary — see+ [`dedupe-and-memory.md`](dedupe-and-memory.md).)++**Never retry an `emit_report` / `edit_report` call that may have succeeded** — a transport+error after the write commits, retried, double-files. If you're unsure whether a call landed,+`inbox-reports-list` to check before retrying.++## The pipeline may rewrite what you authored (accepted)++An authored report is a first-class `SignalReport` that coexists with pipeline reports. When+future signals consolidate around the same topic, the pipeline may **re-promote and re-research+the report, overwriting your authored `title`/`summary`**. This is accepted behavior, not a+bug — there is no pin. Don't author a report assuming your exact prose is immutable; author the+finding, and let the inbox stay the source of truth for how it's currently framed. Your+durable record of "I filed this" is the `report:` scratchpad entry and the `report_id`, not the+title text.++## Opting a scout in++In the scout's `SKILL.md` frontmatter, list the report tools under `allowed_tools`:++```yaml+allowed_tools:+ - emit_report+ - edit_report+```++A scout with no `allowed_tools` (or one that omits these) runs on the `emit-signal`-only+contract — the report channel is invisible to it. No canonical scout enables the channel yet —+`signals-scout-health-checks` and `signals-scout-observability-gaps` are its intended first+adopters (a bundled health-check cluster and a single observability-gap recommendation are both+natural 1:1 reports). Add a short body section telling the scout _when_ to reach for the channel.+Keep it lean — the field-level detail lives here, not in the body.++**Rollout posture:** start a newly opted-in scout in **dry-run** (`emit=false` on its+`SignalScoutConfig`) so it runs and logs what it _would_ author without writing to the inbox.+Inspect via `signals-scout-runs-retrieve`, calibrate, then flip `emit=true`. The report channel+files a full inbox item on the first hit, so the cautious loop is worth it here.diff --git a/products/signals/skills/signals-scout-general/references/conventions.md b/products/signals/skills/signals-scout-general/references/conventions.mdindex 713b5f9fbc60..31a166f6129e 100644--- a/products/signals/skills/signals-scout-general/references/conventions.md+++ b/products/signals/skills/signals-scout-general/references/conventions.md@@ -33,15 +33,16 @@ emitting:The scratchpad has no tags. Encode the category in the **key prefix** so futureruns can find an entry with a single `text=` search:-| Prefix | Use for |-| ------------- | -------------------------------------------------------------------------------- |-| `pattern:` | Durable observation about how this team's data normally shapes (baselines, etc). |-| `noise:` | Patterns to ignore (single-user, dev-only, recurring with no fix path). |-| `addressed:` | Team-confirmed fix shipped or topic the team has moved on from. |-| `dedupe:` | Gates future emits on a specific issue / fingerprint / finding id. |-| `allowlist:` | Vetted entities the scout should never re-surface. |-| `not-in-use:` | Close-out memo for "product not in use on this team". |-| `mcp-gap:` | Scout-noticed gap in the MCP surface worth raising in a future review. |+| Prefix | Use for |+| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `pattern:` | Durable observation about how this team's data normally shapes (baselines, etc). |+| `noise:` | Patterns to ignore (single-user, dev-only, recurring with no fix path). |+| `addressed:` | Team-confirmed fix shipped or topic the team has moved on from. |+| `dedupe:` | Gates future emits on a specific issue / fingerprint / finding id. |+| `allowlist:` | Vetted entities the scout should never re-surface. |+| `not-in-use:` | Close-out memo for "product not in use on this team". |+| `mcp-gap:` | Scout-noticed gap in the MCP surface worth raising in a future review. |+| `report:` | A report this scout authored via the report channel — stores the `report_id` so the next run edits/dedups against it instead of re-filing (opt-in scouts only). |Format: `<prefix>:<domain>:<entity>` (e.g. `pattern:error_tracking:baseline`,`noise:logs:rabbitmq-deploy-window`, `dedupe:csp_violations:a1b2c3d4`).