Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(signals): expose rubric and trial workflows through mcp (#115048)

Alex Lebedev4080902d5253
diff --git a/docs/internal/scout-online-evals-devbox.md b/docs/internal/scout-online-evals-devbox.md
index 13a42718788a..bdc60e55af78 100644
--- a/docs/internal/scout-online-evals-devbox.md
+++ b/docs/internal/scout-online-evals-devbox.md
@@ -25,7 +25,7 @@ AI_GATEWAY_URL=http://localhost:8080/v1
SCOUT_LIVE_TRIALS_PRIVATE_CAPTURE=true
```
-Enable the `scout-trials` feature flag for the `project` group with `id = 2`. A missing or unreadable flag blocks new work. Trials also require private capture and the gateway configuration above. The team-2 and staff restrictions still apply even if the flag targets another project. Production MCP also hides trial tools until the flag is enabled.
+Enable the `scout-trials` feature flag for the `project` group with `id = 2`. A missing or unreadable flag blocks new work. Trials also require private capture and the gateway configuration above. The team-2 and staff restrictions still apply even if the flag targets another project. Production MCP also hides rubric and trial tools until the flag is enabled.
Switching the flag off blocks new trials, resumes, queued scout work and new judge dispatch. Judges already dispatched to Tasks can finish, even if their sandbox has not started yet. Saved results remain readable.
@@ -37,6 +37,19 @@ This setting also installs the private-trial analytics filter when backend and w
Deploy the backend, scout orchestration worker and Tasks worker from the same code revision before enabling trials; use `TEMPORAL_DISABLE_HOT_RELOAD=1` during paid runs. The scout worker uses the video-export queue. The Tasks worker provisions the sandboxes. Removing the old Tasks validation does not change the ordinary judge path, but new scout launches require the updated Tasks worker.
Revoke or expire private tokens before rolling the gateway back to a version without private capture support.
+## Run through MCP
+
+1. Find an existing scout with `scout-config-list`, or create an idea to test with `scout-create` and `config.enabled=false` so scheduling does not interfere.
+2. Call `scout-trial-setup` for readiness, source version, and supported model/effort choices.
+3. Read `scout-rubric-get`. If generation is needed, call `scout-rubric-generate` and poll `scout-rubric-get`; inspect the suggestions, summary, and captured `generation.reference_context`.
+4. Use `scout-rubric-save` with the latest `revision` and complete selected criteria, retaining all default IDs. Set `adopt_generation_id` to the current completed `generation.id` to adopt its reference; generation alone does not save or adopt it.
+5. Call `scout-trial-start` with a baseline and variants, stable comparison/variant/launch UUIDs, and `expected_skill_version`. Each variant can replace its `skill_body`; the optional `note` steers every run. Retain the exact request for retries.
+6. Poll `scout-trial-report` through execution and judging, then inspect criterion evidence, failures, coverage, and cost before drawing conclusions.
+
+`scout-trial-list` returns progress and IDs; fetch judgments with `scout-trial-report`. Use `scout-trial-resume` to recover an interrupted plan and `scout-trial-archive` to hide or restore finished trials.
+The lower-level `scout-trial-create` / `scout-trial-get` pair runs a single private scout without automatic judging. A trial does not apply a candidate or enable scheduling; agents can do that with `skill-update` and `scout-config-update` when part of the requested work.
+See the [scout authoring reference](../../products/signals/skills/authoring-scouts/references/lifecycle-and-testing.md#private-trials-with-a-saved-rubric) for selection, adoption, and comparison details.
+
## Run one trial
1. Open `/project/2/inbox/scout-trials`, search for and select the scout, then select **New trial**. Resolve any setup blocker shown. The picker lists scouts by display name; the old `/project/2/scout-trials` address redirects here. Trials have a separate path so existing scout names remain valid.
diff --git a/posthog/test/repo_invariants/signals_scout_tool_citations_baseline.txt b/posthog/test/repo_invariants/signals_scout_tool_citations_baseline.txt
index dc5c2d5b71df..4699d78e1921 100644
--- a/posthog/test/repo_invariants/signals_scout_tool_citations_baseline.txt
+++ b/posthog/test/repo_invariants/signals_scout_tool_citations_baseline.txt
@@ -43,6 +43,8 @@ scout-emit-report
scout-lighthouse-audit
scout-record-output
scout-run-now
+scout-trial-report
+scout-trial-start
survey-stats
surveys-global-stats
view-run-history
diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yaml
index d13944bfb12f..474c720c6da0 100644
--- a/products/signals/mcp/tools.yaml
+++ b/products/signals/mcp/tools.yaml
@@ -1056,6 +1056,71 @@ tools:
description:
'DEPRECATED: renamed to scout-report-check-list. This alias forwards to the same endpoint and will be
removed. Call scout-report-check-list directly with the same arguments.'
+ scout-rubric-generate:
+ operation: signals_scout_rubrics_generate
+ enabled: true
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: false
+ title: Generate scout rubric suggestions
+ description: >
+ Start background rubric generation for a scout. Optional context explains what you want to evaluate;
+ suggestions still cover the scout's full assignment. Poll scout-rubric-get until generation finishes.
+ Generation does not replace saved criteria or adopt the captured scout reference. Review the suggestions,
+ summary, and generation.reference_context, then select criteria with scout-rubric-save. Requires access to
+ scout rubrics and approved AI data processing.
+ feature_flag: scout-trials
+ scout-rubric-get:
+ operation: signals_scout_rubrics_retrieve
+ enabled: true
+ title: Read a scout's rubric and suggestions
+ description: >
+ Read saved criteria, their revision and adopted scout reference, plus the latest generation's status,
+ suggestions, summary, and captured reference. Use this to poll generation and review criteria before saving.
+ A generation can finish without its reference being adopted. For a judged trial, save enabled criteria and
+ adopt a complete reference with scout-rubric-save. Use fields to poll generation.status and generation.error
+ or read criteria, suggestions, and reference sections separately. Omit fields for the full document.
+ Requires access to scout rubrics.
+ feature_flag: scout-trials
+ response:
+ include:
+ - config_id
+ - skill_name
+ - revision
+ - criteria
+ - generation
+ - reference_context
+ - reference_generation_id
+ - generation.id
+ - generation.status
+ - generation.error
+ - generation.summary
+ - generation.suggestions
+ - generation.reference_context
+ - generation.reference_context.instructions
+ - generation.reference_context.report_disposition_instructions
+ - generation.reference_context.reference_texts
+ - reference_context.instructions
+ - reference_context.report_disposition_instructions
+ - reference_context.reference_texts
+ selectable: true
+ scout-rubric-save:
+ operation: signals_scout_rubrics_update
+ enabled: true
+ annotations:
+ readOnly: false
+ destructive: true
+ idempotent: true
+ title: Save a scout's rubric
+ description: >
+ Save the complete selected criterion set using the revision from scout-rubric-get; a stale revision returns
+ 409, so reread before editing again. Keep all six default criteria and disable any that do not apply. Keep
+ selected suggestions' identifiers and source; new custom criteria need custom- identifiers. At most 30
+ criteria are allowed. Pass adopt_generation_id to use the current completed generation's reviewed scout
+ instructions and references for judging the whole rubric. Omit it to retain the saved reference across
+ prompt iterations. This changes grading criteria, not the scout's instructions or schedule.
+ feature_flag: scout-trials
scout-run-now:
operation: signals_scout_config_run
enabled: true
@@ -1236,6 +1301,25 @@ tools:
`keys_only=true` to scan which memories exist without pulling their (potentially large) bodies, or
`content_max_chars` to cap each `content` to a preview — both keep a wide orientation/dedupe scan from
returning every entry's full prose. Results capped at 1000.
+ scout-trial-archive:
+ operation: signals_scout_config_trial_comparison_archive
+ enabled: true
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: true
+ title: Archive or restore a scout trial
+ description: >
+ Set archived=true to hide a finished trial from history, or false to restore it. Results are retained and no
+ scouts or judges are started. Use the source scout config id and the trial's comparison_id.
+ feature_flag: scout-trials
+ response:
+ include:
+ - comparison_id
+ - config_id
+ - status
+ - archived
+ - error
scout-trial-create:
operation: signals_scout_config_trial
enabled: true
@@ -1246,13 +1330,14 @@ tools:
readOnly: false
destructive: false
idempotent: true
- title: Run a private scout variant
+ title: Run one private scout variant without judging
description: >
- Launch one prompt, model, or effort variant of an existing scout against live data. Memory changes and
- authored reports stay private to the run. The source scout is unchanged. Requires a deployment configured
- for private trial capture and skill editor access. Reuse launch_id only to retry the exact same request.
- Reuse the returned context_id for other variants and repetitions so their initial memory, notes, and source
- settings match. Poll scout-trial-get for results. Unsupported write actions invalidate the comparison.
+ Launch one unjudged prompt, model, or effort variant. For a full trial comparing variants with automatic
+ rubric judging, use scout-trial-start instead. This tool runs against live data. Memory changes and authored
+ reports stay private to the run. The source scout is unchanged. Requires a deployment configured for private
+ trial capture and skill editor access. Reuse launch_id only to retry the exact same request. Reuse the
+ returned context_id for other variants and repetitions so their initial memory, notes, and source settings
+ match. Poll scout-trial-get for results. Unsupported write actions invalidate the comparison.
feature_flag: scout-trials
scout-trial-get:
operation: signals_scout_config_trial_result
@@ -1264,12 +1349,106 @@ tools:
readOnly: true
destructive: false
idempotent: true
- title: Read a private scout result
+ title: Read one private scout run's output
description: >
- Read an operator-owned trial's status, privately captured report payloads, proposed edits, and memory
+ Read one operator-owned run's status, privately captured report payloads, proposed edits, and memory
changes. These combine saved context with protected execution state and are available only through this API,
not SQL. A null cost means unknown. Sandbox agents cannot use this tool to inspect trials. Use the returned
- task and run IDs with ordinary log tools.
+ task and run IDs with ordinary log tools. Use scout-trial-report for the judged comparison across variants.
+ feature_flag: scout-trials
+ scout-trial-list:
+ operation: signals_scout_config_trial_comparison_history
+ enabled: true
+ title: List your scout trials
+ description: >
+ List this operator's saved trials for one scout, including progress. Use scout-trial-report with a returned
+ comparison_id to read its judge report. Pass include_archived=true to include archived trials. Preserve and
+ pass next_cursor to read the next page; has_more indicates additional history. Reading history starts no
+ scouts or judges.
+ feature_flag: scout-trials
+ scout-trial-report:
+ operation: signals_scout_config_trial_comparison_retrieve
+ enabled: true
+ title: Read a scout trial's progress and judge report
+ description: >
+ Poll a trial started with scout-trial-start using its source scout config id and comparison_id. Returns
+ progress and the saved evaluation, including per-variant results, run failures, and criterion verdicts with
+ evidence. Read failures and unjudged criteria before claiming a winner; cost and speed are separate from
+ rubric quality. Reading starts no scouts or judges. Only the operator who created the trial can read it;
+ sandbox agents cannot inspect operator trials. Use fields for status polling or to read evaluation.report
+ summary, outcome, variants, runs, and evidence separately. Omit fields for the full response.
+ feature_flag: scout-trials
+ response:
+ include:
+ - comparison_id
+ - config_id
+ - context_id
+ - created_at
+ - baseline_variant_id
+ - rubric_revision
+ - variants
+ - status
+ - archived
+ - error
+ - evaluation
+ - evaluation.status
+ - evaluation.error
+ - evaluation.report
+ - evaluation.report.summary
+ - evaluation.report.outcome
+ - evaluation.report.variants
+ - evaluation.report.runs
+ - evaluation.report.evidence
+ - evaluation.report.criteria
+ - evaluation.report.rubric_reference_context
+ - evaluation.report.limitations
+ selectable: true
+ scout-trial-resume:
+ operation: signals_scout_config_trial_comparison_resume
+ enabled: true
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: true
+ title: Resume an interrupted scout trial
+ description: >
+ Resume the same saved trial without repeating saved scout runs or judge attempts. Read scout-trial-report
+ first. This continues the saved plan; it does not create new variants or retry completed judge failures.
+ Restore an archived trial before resuming. If the saved plan uses an outdated judge, start a new trial.
+ feature_flag: scout-trials
+ scout-trial-setup:
+ operation: signals_scout_config_trial_setup
+ enabled: true
+ title: Inspect scout trial readiness and model choices
+ description: >
+ Read the source scout's instructions and version, available models with their supported reasoning efforts,
+ and runtime readiness or blocked_reason. Use the returned choices instead of guessing model identifiers.
+ Read scout-rubric-get separately: runtime readiness does not mean a complete rubric reference is saved.
+ Optional context_id inspects a previously captured starting context. This starts no runs.
+ feature_flag: scout-trials
+ scout-trial-start:
+ operation: signals_scout_config_trial_comparison_create
+ enabled: true
+ annotations:
+ readOnly: false
+ destructive: false
+ idempotent: true
+ title: Run and judge scout variants
+ description: >
+ Start a full private trial with automatic rubric judging. First read scout-trial-setup and save a complete
+ rubric with scout-rubric-save. Supply up to 20 variants, each with its own model, supported
+ reasoning_effort, optional replacement skill_body, and launch_ids for repetitions. Omit skill_body to use
+ the source prompt. Generate UUIDs for comparison_id, every variant id, and every launch_id;
+ baseline_variant_id must identify one supplied variant. Reuse these IDs only for an exact request retry.
+ Pass expected_skill_version from setup to detect source edits. All variants share a captured starting
+ context and fixed rubric; their reports and memory stay private, and the source scout is unchanged. Poll
+ scout-trial-report through running and judging until it completes. Sandbox agents cannot start or inspect
+ operator trials.
+ param_overrides:
+ note:
+ description: >
+ Steering instructions shared by every run in this trial, matching the trial UI's "Instructions for
+ every run" field. Up to 1000 characters. Does not edit the saved scout's instructions.
feature_flag: scout-trials
signals-scout-config-create:
operation: signals_scout_config_create
diff --git a/products/signals/skills/authoring-scouts/SKILL.md b/products/signals/skills/authoring-scouts/SKILL.md
index cd18eb76ff9f..cc9e01013a4b 100644
--- a/products/signals/skills/authoring-scouts/SKILL.md
+++ b/products/signals/skills/authoring-scouts/SKILL.md
@@ -7,10 +7,10 @@ description: >
from scheduled LLM scoring; or give feedback through notes. Covers SKILL.md structure,
report requirements, follow-up report checks, structured output, duplicate detection,
scratchpad memory, scout notes, per-team skills-store and canonical repository edits,
- and testing. Trigger on
+ and private prompt trials with saved rubrics. Trigger on
"write/edit/customize a signals scout", "new scout for X", "tune my scout schedule",
"make a scout that watches <event>", "score/judge/measure X with a scout",
- "structured output from a scout", "scout output to Slack",
+ "test/compare scout prompts", "generate scout rubrics", "structured output from a scout", "scout output to Slack",
"leave a note for / give feedback to a scout".
metadata:
owner_team: signals
@@ -59,6 +59,7 @@ There are two independent decisions: **what** you're building, and **where** it
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| A canonical scout is close but too broad / too noisy / missing a disqualifier for this project | **Adapt** it — narrow the scope, add disqualifiers, retune thresholds. |
| You want a surface no canonical scout covers (a custom event, a product-specific funnel) | **New scout from scratch** — copy the closest canonical scout as scaffolding, replace the domain discriminator + explore patterns. |
+| You want to compare prompts, models, or reasoning efforts before applying a change | **Private trial** — keep the saved scout intact, review its rubric, and compare variants through the Test loop below. |
| You only want to change _when_ / _whether_ a scout runs | **No authoring** — just tune the config (see Run posture). |
| You have one-off feedback, a pointer, or short-lived context for a scout | **No authoring** — leave a note (see Steering with notes). |
@@ -125,6 +126,7 @@ If the project has an approved metric for that measure (`metric-list` shows what
A scout's schedule and emit behavior live on its `SignalScoutConfig`, separate from the skill body.
For a **brand-new scout**, pass these settings in the nested `config` object of the `posthog:scout-create` call, including creating it disabled or in dry-run **before it ever runs**.
+When creating a scout to test an idea, set `config.enabled=false` so scheduled runs cannot interfere with the trial.
The endpoint creates the skill and config atomically, always opts the scout into the report channel, and safely re-applies config fields when the same definition is retried.
Otherwise the coordinator auto-registers an enabled config on the default every-24-hours schedule on its next tick (up to ~30 min).
For an **existing scout**, tune with `posthog:scout-config-update` (find the `id` via `-config-list`):
@@ -138,9 +140,8 @@ For an **existing scout**, tune with `posthog:scout-config-update` (find the `id
Reach for it when the run should land at a wall-clock time: a digest before standup, a weekday-only watch.
- `enabled` — `false` pauses the scout entirely (coordinator skips it).
- `emit` — defaults to **`true`**: the scout writes its reports straight to the inbox.
- The standard flow is to make a scout and let it write — seeing what actually lands is the fastest way to calibrate it.
- Set **`emit=false` (dry-run)** only when you want to be extra careful: the scout still runs and logs its reasoning but writes nothing to the inbox.
- Reach for dry-run on a scout you expect to be chatty, expensive, or high-stakes; for most scouts, just writing and watching the inbox is the better loop.
+ Set **`emit=false` (dry-run)** to inspect an ordinary run's reasoning without publishing reports to the inbox.
+ Private trials capture reports and memory separately and work while the source scout is paused or has `emit=false`.
- `network_access` — defaults to **`trusted`**: the scout's sandbox can only reach the platform's trusted-domain allowlist (PostHog, GitHub, common package registries), which covers the MCP loop and `gh` but blocks everything else.
Set **`full`** for a scout whose skill needs to read arbitrary external sites, e.g. documentation, papers on arxiv.org, or a vendor status page.
Applies from the scout's next run, and changes are activity-logged.
@@ -240,29 +241,43 @@ It needs the run's `run_id`, it is restricted to an allowlist of public pages (t
So: treat it as available only once a run's own call succeeds, never write a body whose finding depends on it, and keep lab and field evidence labelled apart — one throttled cold load explains a finding, and the field percentile over real users is what establishes there is one.
Then check the first real run's transcript for the call and what it returned, the same way you would check a query you could not run by hand.
-Only once you're happy with the body do you spend an actual run.
-`posthog:scout-run-now {"id": <config_id>}` dispatches one run of the scout immediately, regardless of its schedule (find the `id` via `-config-list`).
-This is the **initial real run** — the scout executing end-to-end in the harness, writing scratchpad memory and (with the default `emit=true`) writing reports to the inbox.
-The run is **asynchronous**: the call returns a workflow id right away, so poll `-runs-list` / `-runs-retrieve` for the result.
-A few things to know:
-
-- A **disabled** scout can still be run this way — you can test it before ever enabling it.
-- A manual run does **not** change the scout's schedule or `last_run_at`.
-- It inherits every guard the scheduled path has: 403 if scouts aren't enabled for the project, 429 if the project is over its Signals credits quota or daily run budget, 409 if a run for this scout is already in progress.
-- It draws from the **same daily run budget** as scheduled runs — and a dry-run (`emit=false`) still consumes a run.
- There's no free test run: every `-run-now` spends the project's daily scout-run allowance, so firing the same scout repeatedly in a short window burns through the budget (and can leave the project's scheduled scouts unable to run that day).
- **Don't use `-run-now` as your iteration loop** — it's slow (async, one run per call) and metered.
- Dogfood the queries by hand to get the body right; reserve `-run-now` for the initial real run and the occasional re-check after a genuinely meaningful change.
-
-The standard loop is **dogfood → run once ready → inspect**:
-
-1. Dogfood the discriminator + explore patterns yourself against the live project (above).
- Refine the body until the logic holds on real data — this is the cheap, iterable part.
-2. Create the scout and its config together via `posthog:scout-create` (schedule and the default `emit=true` go in the nested `config`; bundled reference files go in `files`), then spend one `-run-now` to watch the whole scout execute end-to-end.
- Pass a `note` on that call to point the run at the case you dogfooded ("focus on the checkout drop from Tuesday") so the first real run exercises the path you care about.
- Leave `run_interval_minutes` at a sustainable value — you no longer need a short interval to force an early run.
-3. After the run finishes, read what it did: `posthog:inbox-reports-list` (the reports it actually wrote), `posthog:scout-runs-list` (run summaries), `-runs-retrieve` (full reasoning for one run), and `-scratchpad-search` (the durable memory it wrote).
-4. If it needs work, go back to dogfooding the queries by hand for the iteration — only spend another `-run-now` once you've batched a meaningful change worth a fresh end-to-end run.
+### Compare variants privately
+
+The rubric and private-trial MCP tools currently require staff access and the `scout-trials` feature flag.
+Use this path when the user wants to test an existing scout, try an idea, or compare several prompts, models, or reasoning efforts.
+The trial runs real scouts against project data, captures their reports and memory privately, judges them against one saved rubric, and saves a comparison report.
+Generation, scout runs, and judging spend model usage; choose the number of variants and repeats within the requested budget.
+
+1. **Choose the source.** For an existing scout, get its config from `posthog:scout-config-list` and read its instructions with `posthog:skill-get`.
+ For a new idea, create the complete scout with `posthog:scout-create`, including `config: {"enabled": false}` and any bundled `files`.
+ Then call `posthog:scout-trial-setup` with the config `id` to check readiness and discover supported models and efforts.
+2. **Review and save the rubric.** Read `posthog:scout-rubric-get`.
+ If it needs generation, use `posthog:scout-rubric-generate`, then poll `posthog:scout-rubric-get` until generation finishes.
+ Review the suggestions and captured source, select criteria that measure the intended job, and use `posthog:scout-rubric-save` with the current `revision`, complete criteria list, and `adopt_generation_id` when adopting that generation's source.
+ If suggestions are poor, edit the criteria directly: enable or disable any check, revise its wording, add custom checks, or remove unwanted custom/generated checks from the saved list. Keep the six built-in defaults, disabling them when unwanted; omit `adopt_generation_id` to preserve the saved reference.
+ Generation alone does not save or adopt anything; the saved rubric needs an adopted source before a trial can start.
+3. **Start the comparison.** Use `posthog:scout-trial-start` with a baseline and the requested variants, keeping model and effort fixed when comparing prompt changes.
+ Each candidate supplies its full `skill_body`; the saved source remains unchanged.
+ A request for 5–10 prompts fits one comparison; use distinct hypotheses and avoid multiplying repeats without a reason.
+4. **Read the result.** Poll `posthog:scout-trial-report` for the saved comparison, including criterion evidence, failures, applicability, and cost.
+ Resume an interrupted trial with `posthog:scout-trial-resume` when its error permits it; use `posthog:scout-trial-list` to find saved trials.
+ Read the evidence behind a score before recommending or applying a candidate.
+
+Read [`references/lifecycle-and-testing.md`](references/lifecycle-and-testing.md#private-trials-with-a-saved-rubric) for the exact save/adoption semantics, request identities, variant inputs, and result interpretation.
+If setup is blocked or the tools are unavailable, report the limitation; an ordinary run has different effects and is not a substitute for a private comparison.
+The existing `posthog:scout-trial-create` / `posthog:scout-trial-get` pair runs and reads a single private scout without automatic judging; use `scout-trial-start` / `scout-trial-report` for this complete test loop.
+
+### Apply changes and run normally
+
+When applying a candidate is part of the user's request, update the saved skill through `posthog:skill-update` with its current `base_version`.
+Use `posthog:scout-config-update` to set the intended model, schedule, or `enabled=true` as appropriate to the requested rollout; the agent can enable or pause a scout through this existing tool.
+This tool cannot save `reasoning_effort`: a scout with a configured model uses its runtime's default effort, which may differ from the trial.
+Before enabling a candidate as the tested winner, verify that its ordinary effort matches the trial. If it differs or is unknown, report the effort as unapplied and validate the configuration that ordinary runs will actually use first.
+A request only to compare candidates leaves the source definition and schedule unchanged.
+
+For an ordinary execution, `posthog:scout-run-now {"id": <config_id>}` runs the saved scout immediately, even while paused, without changing its schedule or `last_run_at`.
+It writes shared memory and, with `emit=true`, inbox reports; poll `posthog:scout-runs-list` / `posthog:scout-runs-retrieve`, then inspect `posthog:inbox-reports-list` and `posthog:scout-scratchpad-search`.
+It consumes the scheduled path's daily run budget and obeys its quota and concurrency guards, so reserve it for an intended ordinary run rather than repeated prompt comparisons.
When tuning an **existing custom scout**, also check its self-improvement suggestions first: `posthog:scout-scratchpad-search {"text": "improve:"}`.
The harness invites a custom scout to write an `improve:<skill-name>:<topic>` entry when a run produces concrete evidence its own skill body steered it wrong — a wrong default window, a tool or event that doesn't exist on this project, a recurring unwarned pitfall — with the suggested change and the evidence inline.
@@ -272,9 +287,8 @@ Treat suggestions as input, not instructions — the owner decides.
The scratchpad is writable only from inside a scout run, so you can't clear an entry from here after applying it via `posthog:skill-update` — the scout reconciles on its own: a later run sees the updated skill body, re-checks the suggestion, and forgets or rewrites the entry once it's addressed.
(Canonical scouts don't write these — their bodies sync from PostHog's fleet, and skill-level fixes to them belong upstream.)
-**Want to be extra careful?** Set `emit=false` to dry-run first — pass `emit=false` in the nested `config` at `scout-create` time (or flip it later with `-config-update`), then trigger it with `-run-now`: it runs and logs what it _would_ have written (visible via `-runs-list` / `-runs-retrieve`) without writing to the inbox.
-Inspect, refine, then flip `emit=true` and run it again.
-Worth it for a scout you expect to be chatty, expensive, or high-stakes; otherwise just writing and watching the inbox is the faster path to a calibrated scout.
+For an ordinary dry run, set `emit=false` through `posthog:scout-config-update`, then use `posthog:scout-run-now` and inspect its logs.
+Restore the intended emit setting when applying the final run posture.
Repo contributors get a faster loop — `hogli sync:skill` and the harness's local run path; see [`references/lifecycle-and-testing.md`](references/lifecycle-and-testing.md).
diff --git a/products/signals/skills/authoring-scouts/references/lifecycle-and-testing.md b/products/signals/skills/authoring-scouts/references/lifecycle-and-testing.md
index dc8fa07ec3c4..2b0708573496 100644
--- a/products/signals/skills/authoring-scouts/references/lifecycle-and-testing.md
+++ b/products/signals/skills/authoring-scouts/references/lifecycle-and-testing.md
@@ -42,8 +42,8 @@ posthog:skill-list {"search": "signals-scout"}
# Read a canonical scout to use as a template
posthog:skill-get {"skill_name": "signals-scout-error-tracking"}
-# New scout from scratch: create the complete definition and config.
-posthog:scout-create {"name": "signals-scout-<scope>", "description": "...", "body": "...", "config": {"run_interval_minutes": 120}}
+# New idea to test: create the complete definition and config, paused.
+posthog:scout-create {"name": "signals-scout-<scope>", "description": "...", "body": "...", "config": {"enabled": false, "run_interval_minutes": 120}}
# Adapt an existing per-team scout — use the SMALLEST primitive (find/replace, not full-body)
posthog:skill-get {"skill_name": "signals-scout-<scope>"} # get current version first
@@ -88,27 +88,107 @@ Authoring a new canonical scout is just creating `signals-scout-<scope>/SKILL.md
**Dogfood the scout yourself first — before spending any real run.** The authoring agent has the same PostHog MCP tools a scout uses at runtime (`execute-sql`, `read-data-schema`, the per-product list tools, `scout-project-profile-get`), so the cheapest iteration is to walk the scout's own logic against the live project by hand: confirm the watched entity exists and has the assumed shape, run the **discriminator** to check it separates signal from noise on this project's data, and run each **explore pattern**'s queries.
Free and instant — refine the body, re-run the queries, repeat, until the logic holds on real data.
-Only once you're happy do you spend a real run.
-`posthog:scout-run-now {"id": <config_id>}` dispatches one run of the scout immediately, regardless of its schedule (get the `id` from `-config-list`) — the **initial real run**, the scout executing end-to-end in the harness.
-An optional `note` steers that run alone (read next to the durable notes and never delivered to a later run as a note, though it stays visible in that run's metadata; needs `llm_skill:write` and skill-editor access, like a durable note), so you can aim the first run at the case you dogfooded.
-The run is **asynchronous**: the call returns a workflow id right away; poll `-runs-list` (pass `skill_name` to scope to this scout) / `-runs-retrieve` for the result.
-A disabled scout can still be run this way (test before enabling), and a manual run doesn't touch the schedule or `last_run_at`.
-It inherits the scheduled path's guards (403 not enabled, 429 over quota / daily run budget, 409 a run already in progress) and draws from the **same daily run budget** as scheduled runs — a dry-run (`emit=false`) counts too.
-There's no free test run, and it's slow (async, one run per call): firing the same scout repeatedly in a short window burns the project's daily allowance (and can starve its scheduled scouts).
-**Don't iterate via `-run-now`** — dogfood the queries by hand to get the body right, and reserve `-run-now` for the initial real run and the odd re-check after a genuinely meaningful change.
-The loop is **dogfood → run once ready → inspect**:
-
-1. Dogfood the discriminator + explore patterns yourself against the live project (above), refining the body until the logic holds — the cheap, iterable part.
-2. Create the scout and its config together via `posthog:scout-create` (the default `emit=true` goes in the nested `config`), leaving `run_interval_minutes` at a sustainable value — no short-interval trick needed.
- Then spend one `-run-now` to watch the whole scout execute end-to-end, and inspect once it finishes:
- - `posthog:inbox-reports-list` — the reports it actually wrote.
- - `posthog:scout-runs-list` — run summaries.
- - `posthog:scout-runs-retrieve` — the full reasoning for one run.
- - `posthog:scout-scratchpad-search` — the durable memory it wrote.
-3. If it needs work, go back to dogfooding the queries by hand for the iteration, re-edit via `skill-update`, and spend another `-run-now` only once you've batched a meaningful change.
-
-**Extra-careful variant — dry-run first.** For a scout you expect to be chatty, expensive, or high-stakes, set `emit=false` so it runs and logs what it _would_ have written (visible in `-runs-list` / `-runs-retrieve`) without writing to the inbox.
-Trigger it with `-run-now`, inspect, refine, then `scout-config-update` to `emit=true`.
-For most scouts, writing straight away and watching the inbox is the faster calibration.
+### Private trials with a saved rubric
+
+Use `posthog:scout-trial-start` to run variants and automatically judge them against the same saved rubric.
+The rubric and private-trial MCP tools currently require staff access and the `scout-trials` feature flag.
+This keeps the source skill, shared memory, and live inbox reports unchanged, while still reading live project data.
+Each run gets its own private report and memory changes from a shared starting context; live analytics queries can still return different data as time passes.
+The tools and source scout must be eligible: `posthog:scout-trial-setup` returns `ready`, `blocked_reason`, the current `skill_body` / `skill_version`, and supported `models` with their `reasoning_efforts`.
+Use those choices rather than guessing a model or effort.
+If setup is blocked, resolve the stated cause or report it; do not silently replace the requested private trial with `scout-run-now`.
+
+For an **existing scout**, find its config with `posthog:scout-config-list`, read the skill and relevant bundled files, then call setup with that config `id`.
+For a **new idea**, use `posthog:scout-create` with the full body and files and `config.enabled=false`, then use the returned `config.id` for the same path.
+Pausing prevents scheduled runs during development; it does not prevent private trials.
+The scout can keep its intended emit setting because trial outputs stay private.
+
+#### Generate, select, and save criteria
+
+1. Read `posthog:scout-rubric-get {"id": "<config_id>", "fields": ["revision", "criteria", "reference_generation_id", "generation.id", "generation.status"]}`.
+ Omit `fields` for the full document, including the adopted `reference_context` and latest `generation`.
+ Revision `0` means the defaults have not been saved yet.
+ Reuse a suitable saved rubric and source; generate when the user requests fresh suggestions or the rubric lacks a usable reference.
+2. Call `posthog:scout-rubric-generate {"id": "<config_id>", "context": "<optional priorities>"}`.
+ `context` is at most 2,000 characters and supplements the scout's full job; it is not a replacement prompt.
+ Generation is paid and asynchronous. Poll `posthog:scout-rubric-get` with `fields: ["revision", "generation.id", "generation.status", "generation.error"]` until generation is `completed` or `failed`, rather than starting another generation while one is running.
+3. Review `generation.suggestions`, `generation.summary`, and `generation.reference_context`.
+ Request these with `fields`, together or separately; the reference's `instructions`, `report_disposition_instructions`, and `reference_texts` can also be selected separately.
+ The reference contains the captured instructions, report-disposition rules, bundled reference texts, source version, and omission/truncation indicators.
+ Check that it represents the intended job and that each selected criterion has an observable pass condition and sensible applicability.
+ Required checks should still apply when a candidate skips the required work; otherwise skipping can make the comparison inconclusive instead of failing the check.
+ Do not resolve contradictory source requirements by quietly choosing one, or turn optional work into a mandatory criterion.
+ A missing or truncated saved reference cannot support a trial; address the source size/completeness issue and generate again.
+4. Save with `posthog:scout-rubric-save`, passing `id`, the latest `revision`, the **complete** desired `criteria` array, and `adopt_generation_id: generation.id` to adopt that completed generation's reference for the whole rubric.
+ Merge selected suggestions into the existing criteria by ID, preserve all six default IDs and their `source`, and disable a default with `enabled=false` instead of deleting it.
+ Custom IDs must start with `custom-`; the full list has at most 30 criteria.
+ Generation does not save suggestions or adopt their source automatically. Omitting `adopt_generation_id` preserves the already adopted source.
+ On a stale-revision `409`, reread the rubric and reconcile with the latest edits before saving again.
+5. Check the saved response's new revision, selected criteria, and adopted reference.
+ Starting a trial freezes that saved rubric for all variants; later saves do not rewrite an existing trial's judgments.
+
+Poor generated criteria can be corrected through the same `posthog:scout-rubric-save` call without generating again:
+
+- **Enable or disable** any criterion with `enabled=true` or `false`; **edit** its `title`, `description`, `pass_condition`, or `applicability` while retaining its ID and source.
+- **Add** a check with a unique `custom-` ID, `source="custom"`, the four text fields above, and an explicit `enabled` value.
+- **Delete** a custom check, including a selected generated suggestion, by omitting it from the complete saved array. Suggestions that were never selected need not be added.
+- Keep `default-evidence`, `default-clarity`, `default-actionability`, `default-priority`, `default-instructions`, and `default-memory` with `source="default"`; disable unwanted defaults instead of removing them.
+
+Read the latest `revision` first and send every criterion you intend to retain, up to 30 in total; this replaces the saved set rather than patching one check.
+Omit `adopt_generation_id` when only editing criteria so the adopted reference stays fixed. Regenerate and adopt a new reference only when that source needs refreshing.
+
+#### Compare prompts, models, or efforts
+
+Choose a baseline and label each candidate by the change it tests.
+For 5–10 prompts, use one comparison with the requested number of variants, including a baseline; each variant needs an `id`, `label`, explicit supported `model` and `reasoning_effort`, and one or more `launch_ids`.
+Omit the baseline's `skill_body` to use the saved instructions, and send each candidate's complete replacement body in `skill_body`.
+This overrides only the trial body; it does not edit the saved skill or its bundled files.
+Keep model and effort fixed for a prompt comparison, or keep the body fixed to compare runtimes.
+
+`posthog:scout-trial-start` takes the config `id`, a fresh `comparison_id`, `baseline_variant_id`, the `variants` array, and preferably `expected_skill_version` from setup.
+An optional `note` applies to every run in the comparison.
+Use unique UUIDs for each comparison, variant, and launch; retain the exact request so a transport retry can reuse those IDs without launching duplicate work.
+Changing a prompt, rubric, runtime, or variant selection calls for a new comparison.
+The API supports up to 20 variants and 20 runs per variant; these are limits, not a suggested spend.
+Start with the requested count and enough repeats to answer the question, using the same repeat count for every variant; unequal counts make the comparison inconclusive.
+Generation, scout execution, and judging all spend usage, so account for all three within the user's budget.
+
+#### Read, resume, and apply
+
+Poll `posthog:scout-trial-report {"id": "<config_id>", "comparison_id": "<comparison_id>", "fields": ["status", "error", "evaluation.status", "evaluation.error"]}` through startup, scout execution, and judging.
+Once complete, the saved comparison is available under `evaluation.report`.
+Read `evaluation.report.summary`, `evaluation.report.outcome`, `evaluation.report.variants`, and `evaluation.report.limitations` first via `fields`, then fetch `evaluation.report.runs` for verdicts and `evaluation.report.evidence` for their sources.
+Review criterion verdicts and cited evidence, rubric coverage, run failures, and costs alongside the winner/tie/provisional/inconclusive summary.
+`unknown` means the criterion could not be assessed; `not_applicable` means it did not apply.
+Both are excluded from pass rates, while `unknown` reduces rubric coverage; neither is a pass.
+An execution failure is distinct from a valid run that failed quality criteria, and missing cost is unknown rather than zero.
+Small comparisons are descriptive, so report what the observed runs support and what remains uncertain.
+
+Both read tools return the full response when `fields` is omitted; selection reduces output but does not guarantee a size limit.
+If the host clips even one selected reference or report section, capture the full JSON through an already configured PostHog CLI (`posthog-cli api call --json <tool> '<input>' > result.json`) or programmatic MCP client and inspect the saved file.
+Host clipping does not mean the stored source is truncated, and does not require another paid generation.
+
+Use `posthog:scout-trial-list` to rediscover saved comparisons, following its cursor for more results.
+Use `posthog:scout-trial-resume` with the same `comparison_id` when the saved error permits resuming; a stale judge version requires a new comparison.
+`posthog:scout-trial-archive` with `archived=true` hides a finished comparison from default history; `archived=false` restores it without rerunning anything.
+The lower-level `posthog:scout-trial-create` / `posthog:scout-trial-get` tools expose a single private run without automatic rubric judging, so prefer `scout-trial-start` / `scout-trial-report` for scored comparisons.
+
+When the user asked to apply a successful candidate, reread the saved skill and use `posthog:skill-update` with its current `base_version` to apply the intended change.
+Use `posthog:scout-config-update` for the desired model, schedule, and `enabled` state, including enabling the scout when that is part of the requested work.
+It cannot save `reasoning_effort`. When a scout has a configured model, ordinary runs use that runtime's default effort; setting the winning model does not apply the trial's effort.
+Check that default before enabling the candidate as the tested winner. If it differs, test the candidate at the ordinary effort first. If the default is unknown, validate the ordinary configuration before relying on the trial result, and report that the effort change remains unapplied.
+Testing alone does not apply a winner or change the scout's schedule.
+
+### Ordinary runs
+
+`posthog:scout-run-now {"id": "<config_id>"}` dispatches one execution of the saved scout immediately, including while paused, without changing its schedule or `last_run_at`.
+An optional `note` steers that run alone and needs `llm_skill:write` plus skill-editor access.
+This is an ordinary run: it writes shared scratchpad memory and, with `emit=true`, live inbox reports and configured deliveries.
+Poll `posthog:scout-runs-list` / `posthog:scout-runs-retrieve`, then inspect `posthog:inbox-reports-list` and `posthog:scout-scratchpad-search`.
+It obeys the scheduled path's access, quota, concurrency, and daily run-budget guards; `emit=false` still spends a run.
+Use it for an intended ordinary execution rather than a loop of prompt comparisons.
+
+To inspect an ordinary run without publishing inbox reports, set `emit=false` through `posthog:scout-config-update` and use `posthog:scout-run-now`.
+Inspect the logs and restore the intended emit setting when applying the final run posture.
Repo contributors additionally get `hogli sync:skill` to run the scout against the local harness for a tighter loop before merging.
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index db7391e4a1d7..b2ce68a1c54d 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -11496,6 +11496,51 @@
"readOnlyHint": true
}
},
+ "scout-rubric-generate": {
+ "description": "Start background rubric generation for a scout. Optional context explains what you want to evaluate; suggestions still cover the scout's full assignment. Poll scout-rubric-get until generation finishes. Generation does not replace saved criteria or adopt the captured scout reference. Review the suggestions, summary, and generation.reference_context, then select criteria with scout-rubric-save. Requires access to scout rubrics and approved AI data processing.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Generate scout rubric suggestions",
+ "title": "Generate scout rubric suggestions",
+ "required_scopes": ["signal_scout:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-rubric-get": {
+ "description": "Read saved criteria, their revision and adopted scout reference, plus the latest generation's status, suggestions, summary, and captured reference. Use this to poll generation and review criteria before saving. A generation can finish without its reference being adopted. For a judged trial, save enabled criteria and adopt a complete reference with scout-rubric-save. Use fields to poll generation.status and generation.error or read criteria, suggestions, and reference sections separately. Omit fields for the full document. Requires access to scout rubrics.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Read a scout's rubric and suggestions",
+ "title": "Read a scout's rubric and suggestions",
+ "required_scopes": ["signal_scout:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-rubric-save": {
+ "description": "Save the complete selected criterion set using the revision from scout-rubric-get; a stale revision returns 409, so reread before editing again. Keep all six default criteria and disable any that do not apply. Keep selected suggestions' identifiers and source; new custom criteria need custom- identifiers. At most 30 criteria are allowed. Pass adopt_generation_id to use the current completed generation's reviewed scout instructions and references for judging the whole rubric. Omit it to retain the saved reference across prompt iterations. This changes grading criteria, not the scout's instructions or schedule.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Save a scout's rubric",
+ "title": "Save a scout's rubric",
+ "required_scopes": ["signal_scout:write"],
+ "annotations": {
+ "destructiveHint": true,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "scout-trials"
+ },
"scout-run-now": {
"description": "Dispatch one on-demand run of a scout by its config `id`, regardless of its schedule — useful to test a scout right after authoring it, or to refresh its findings on demand. The run executes asynchronously and inherits the scheduled path's guards: it returns 429 if the project is over its Signals credits quota or its daily scout-run budget, and 409 if a run for this scout is already in progress. A manual run counts against the same daily run budget the scheduled runs draw from, so avoid triggering repeated runs of the same scout in a short window — each one consumes the project's scout-run allowance for the day. A manual run does not change the scout's schedule, and a disabled scout can still be run this way (to test before enabling). Pass an optional `note` to steer this run alone (\"focus on the checkout regression\"): the agent reads it next to the scout's durable notes and weighs it the same way, and it is never read by another run — use it instead of `scout-notes-create`, which would also steer every later scheduled run. A run carrying a note needs `llm_skill:write` as well, since the agent reads the note verbatim while holding privileged tools. Returns the workflow id immediately — poll `scout-runs-list` for the resulting run and its findings.",
"category": "Signals",
@@ -11622,12 +11667,27 @@
"readOnlyHint": true
}
},
+ "scout-trial-archive": {
+ "description": "Set archived=true to hide a finished trial from history, or false to restore it. Results are retained and no scouts or judges are started. Use the source scout config id and the trial's comparison_id.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Archive or restore a scout trial",
+ "title": "Archive or restore a scout trial",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "scout-trials"
+ },
"scout-trial-create": {
- "description": "Launch one prompt, model, or effort variant of an existing scout against live data. Memory changes and authored reports stay private to the run. The source scout is unchanged. Requires a deployment configured for private trial capture and skill editor access. Reuse launch_id only to retry the exact same request. Reuse the returned context_id for other variants and repetitions so their initial memory, notes, and source settings match. Poll scout-trial-get for results. Unsupported write actions invalidate the comparison.",
+ "description": "Launch one unjudged prompt, model, or effort variant. For a full trial comparing variants with automatic rubric judging, use scout-trial-start instead. This tool runs against live data. Memory changes and authored reports stay private to the run. The source scout is unchanged. Requires a deployment configured for private trial capture and skill editor access. Reuse launch_id only to retry the exact same request. Reuse the returned context_id for other variants and repetitions so their initial memory, notes, and source settings match. Poll scout-trial-get for results. Unsupported write actions invalidate the comparison.",
"category": "Signals",
"feature": "signals",
- "summary": "Run a private scout variant",
- "title": "Run a private scout variant",
+ "summary": "Run one private scout variant without judging",
+ "title": "Run one private scout variant without judging",
"required_scopes": ["signal_scout:write", "llm_skill:write"],
"annotations": {
"destructiveHint": false,
@@ -11638,11 +11698,11 @@
"feature_flag": "scout-trials"
},
"scout-trial-get": {
- "description": "Read an operator-owned trial's status, privately captured report payloads, proposed edits, and memory changes. These combine saved context with protected execution state and are available only through this API, not SQL. A null cost means unknown. Sandbox agents cannot use this tool to inspect trials. Use the returned task and run IDs with ordinary log tools.",
+ "description": "Read one operator-owned run's status, privately captured report payloads, proposed edits, and memory changes. These combine saved context with protected execution state and are available only through this API, not SQL. A null cost means unknown. Sandbox agents cannot use this tool to inspect trials. Use the returned task and run IDs with ordinary log tools. Use scout-trial-report for the judged comparison across variants.",
"category": "Signals",
"feature": "signals",
- "summary": "Read a private scout result",
- "title": "Read a private scout result",
+ "summary": "Read one private scout run's output",
+ "title": "Read one private scout run's output",
"required_scopes": ["signal_scout:write", "llm_skill:write"],
"annotations": {
"destructiveHint": false,
@@ -11652,6 +11712,81 @@
},
"feature_flag": "scout-trials"
},
+ "scout-trial-list": {
+ "description": "List this operator's saved trials for one scout, including progress. Use scout-trial-report with a returned comparison_id to read its judge report. Pass include_archived=true to include archived trials. Preserve and pass next_cursor to read the next page; has_more indicates additional history. Reading history starts no scouts or judges.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "List your scout trials",
+ "title": "List your scout trials",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-trial-report": {
+ "description": "Poll a trial started with scout-trial-start using its source scout config id and comparison_id. Returns progress and the saved evaluation, including per-variant results, run failures, and criterion verdicts with evidence. Read failures and unjudged criteria before claiming a winner; cost and speed are separate from rubric quality. Reading starts no scouts or judges. Only the operator who created the trial can read it; sandbox agents cannot inspect operator trials. Use fields for status polling or to read evaluation.report summary, outcome, variants, runs, and evidence separately. Omit fields for the full response.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Read a scout trial's progress and judge report",
+ "title": "Read a scout trial's progress and judge report",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-trial-resume": {
+ "description": "Resume the same saved trial without repeating saved scout runs or judge attempts. Read scout-trial-report first. This continues the saved plan; it does not create new variants or retry completed judge failures. Restore an archived trial before resuming. If the saved plan uses an outdated judge, start a new trial.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Resume an interrupted scout trial",
+ "title": "Resume an interrupted scout trial",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-trial-setup": {
+ "description": "Read the source scout's instructions and version, available models with their supported reasoning efforts, and runtime readiness or blocked_reason. Use the returned choices instead of guessing model identifiers. Read scout-rubric-get separately: runtime readiness does not mean a complete rubric reference is saved. Optional context_id inspects a previously captured starting context. This starts no runs.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Inspect scout trial readiness and model choices",
+ "title": "Inspect scout trial readiness and model choices",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-trial-start": {
+ "description": "Start a full private trial with automatic rubric judging. First read scout-trial-setup and save a complete rubric with scout-rubric-save. Supply up to 20 variants, each with its own model, supported reasoning_effort, optional replacement skill_body, and launch_ids for repetitions. Omit skill_body to use the source prompt. Generate UUIDs for comparison_id, every variant id, and every launch_id; baseline_variant_id must identify one supplied variant. Reuse these IDs only for an exact request retry. Pass expected_skill_version from setup to detect source edits. All variants share a captured starting context and fixed rubric; their reports and memory stay private, and the source scout is unchanged. Poll scout-trial-report through running and judging until it completes. Sandbox agents cannot start or inspect operator trials.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Run and judge scout variants",
+ "title": "Run and judge scout variants",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "scout-trials"
+ },
"session-recording-bulk-delete": {
"description": "Delete a batch of session recordings by session ID, up to 100 per call. Deletion is permanent and cannot be undone — confirm with the user before deleting. Prefer this over `session-recording-delete` whenever more than one recording needs deleting: find the target IDs with `query-session-recordings-list`, then delete in batches. Pass `date_from` (e.g. '-30d') when the recordings' age is known — it makes the lookup much faster. IDs with no matching recording are skipped, so a `deleted_count` below `total_requested` is normal when some recordings were already deleted or never existed.",
"category": "Session replays",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 30eac0a91148..d423f901c9fa 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -12101,6 +12101,51 @@
"readOnlyHint": true
}
},
+ "scout-rubric-generate": {
+ "description": "Start background rubric generation for a scout. Optional context explains what you want to evaluate; suggestions still cover the scout's full assignment. Poll scout-rubric-get until generation finishes. Generation does not replace saved criteria or adopt the captured scout reference. Review the suggestions, summary, and generation.reference_context, then select criteria with scout-rubric-save. Requires access to scout rubrics and approved AI data processing.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Generate scout rubric suggestions",
+ "title": "Generate scout rubric suggestions",
+ "required_scopes": ["signal_scout:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": false,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-rubric-get": {
+ "description": "Read saved criteria, their revision and adopted scout reference, plus the latest generation's status, suggestions, summary, and captured reference. Use this to poll generation and review criteria before saving. A generation can finish without its reference being adopted. For a judged trial, save enabled criteria and adopt a complete reference with scout-rubric-save. Use fields to poll generation.status and generation.error or read criteria, suggestions, and reference sections separately. Omit fields for the full document. Requires access to scout rubrics.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Read a scout's rubric and suggestions",
+ "title": "Read a scout's rubric and suggestions",
+ "required_scopes": ["signal_scout:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-rubric-save": {
+ "description": "Save the complete selected criterion set using the revision from scout-rubric-get; a stale revision returns 409, so reread before editing again. Keep all six default criteria and disable any that do not apply. Keep selected suggestions' identifiers and source; new custom criteria need custom- identifiers. At most 30 criteria are allowed. Pass adopt_generation_id to use the current completed generation's reviewed scout instructions and references for judging the whole rubric. Omit it to retain the saved reference across prompt iterations. This changes grading criteria, not the scout's instructions or schedule.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Save a scout's rubric",
+ "title": "Save a scout's rubric",
+ "required_scopes": ["signal_scout:write"],
+ "annotations": {
+ "destructiveHint": true,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "scout-trials"
+ },
"scout-run-now": {
"description": "Dispatch one on-demand run of a scout by its config `id`, regardless of its schedule — useful to test a scout right after authoring it, or to refresh its findings on demand. The run executes asynchronously and inherits the scheduled path's guards: it returns 429 if the project is over its Signals credits quota or its daily scout-run budget, and 409 if a run for this scout is already in progress. A manual run counts against the same daily run budget the scheduled runs draw from, so avoid triggering repeated runs of the same scout in a short window — each one consumes the project's scout-run allowance for the day. A manual run does not change the scout's schedule, and a disabled scout can still be run this way (to test before enabling). Pass an optional `note` to steer this run alone (\"focus on the checkout regression\"): the agent reads it next to the scout's durable notes and weighs it the same way, and it is never read by another run — use it instead of `scout-notes-create`, which would also steer every later scheduled run. A run carrying a note needs `llm_skill:write` as well, since the agent reads the note verbatim while holding privileged tools. Returns the workflow id immediately — poll `scout-runs-list` for the resulting run and its findings.",
"category": "Signals",
@@ -12227,12 +12272,27 @@
"readOnlyHint": true
}
},
+ "scout-trial-archive": {
+ "description": "Set archived=true to hide a finished trial from history, or false to restore it. Results are retained and no scouts or judges are started. Use the source scout config id and the trial's comparison_id.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Archive or restore a scout trial",
+ "title": "Archive or restore a scout trial",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "scout-trials"
+ },
"scout-trial-create": {
- "description": "Launch one prompt, model, or effort variant of an existing scout against live data. Memory changes and authored reports stay private to the run. The source scout is unchanged. Requires a deployment configured for private trial capture and skill editor access. Reuse launch_id only to retry the exact same request. Reuse the returned context_id for other variants and repetitions so their initial memory, notes, and source settings match. Poll scout-trial-get for results. Unsupported write actions invalidate the comparison.",
+ "description": "Launch one unjudged prompt, model, or effort variant. For a full trial comparing variants with automatic rubric judging, use scout-trial-start instead. This tool runs against live data. Memory changes and authored reports stay private to the run. The source scout is unchanged. Requires a deployment configured for private trial capture and skill editor access. Reuse launch_id only to retry the exact same request. Reuse the returned context_id for other variants and repetitions so their initial memory, notes, and source settings match. Poll scout-trial-get for results. Unsupported write actions invalidate the comparison.",
"category": "Signals",
"feature": "signals",
- "summary": "Run a private scout variant",
- "title": "Run a private scout variant",
+ "summary": "Run one private scout variant without judging",
+ "title": "Run one private scout variant without judging",
"required_scopes": ["signal_scout:write", "llm_skill:write"],
"annotations": {
"destructiveHint": false,
@@ -12243,11 +12303,11 @@
"feature_flag": "scout-trials"
},
"scout-trial-get": {
- "description": "Read an operator-owned trial's status, privately captured report payloads, proposed edits, and memory changes. These combine saved context with protected execution state and are available only through this API, not SQL. A null cost means unknown. Sandbox agents cannot use this tool to inspect trials. Use the returned task and run IDs with ordinary log tools.",
+ "description": "Read one operator-owned run's status, privately captured report payloads, proposed edits, and memory changes. These combine saved context with protected execution state and are available only through this API, not SQL. A null cost means unknown. Sandbox agents cannot use this tool to inspect trials. Use the returned task and run IDs with ordinary log tools. Use scout-trial-report for the judged comparison across variants.",
"category": "Signals",
"feature": "signals",
- "summary": "Read a private scout result",
- "title": "Read a private scout result",
+ "summary": "Read one private scout run's output",
+ "title": "Read one private scout run's output",
"required_scopes": ["signal_scout:write", "llm_skill:write"],
"annotations": {
"destructiveHint": false,
@@ -12257,6 +12317,81 @@
},
"feature_flag": "scout-trials"
},
+ "scout-trial-list": {
+ "description": "List this operator's saved trials for one scout, including progress. Use scout-trial-report with a returned comparison_id to read its judge report. Pass include_archived=true to include archived trials. Preserve and pass next_cursor to read the next page; has_more indicates additional history. Reading history starts no scouts or judges.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "List your scout trials",
+ "title": "List your scout trials",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-trial-report": {
+ "description": "Poll a trial started with scout-trial-start using its source scout config id and comparison_id. Returns progress and the saved evaluation, including per-variant results, run failures, and criterion verdicts with evidence. Read failures and unjudged criteria before claiming a winner; cost and speed are separate from rubric quality. Reading starts no scouts or judges. Only the operator who created the trial can read it; sandbox agents cannot inspect operator trials. Use fields for status polling or to read evaluation.report summary, outcome, variants, runs, and evidence separately. Omit fields for the full response.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Read a scout trial's progress and judge report",
+ "title": "Read a scout trial's progress and judge report",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-trial-resume": {
+ "description": "Resume the same saved trial without repeating saved scout runs or judge attempts. Read scout-trial-report first. This continues the saved plan; it does not create new variants or retry completed judge failures. Restore an archived trial before resuming. If the saved plan uses an outdated judge, start a new trial.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Resume an interrupted scout trial",
+ "title": "Resume an interrupted scout trial",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-trial-setup": {
+ "description": "Read the source scout's instructions and version, available models with their supported reasoning efforts, and runtime readiness or blocked_reason. Use the returned choices instead of guessing model identifiers. Read scout-rubric-get separately: runtime readiness does not mean a complete rubric reference is saved. Optional context_id inspects a previously captured starting context. This starts no runs.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Inspect scout trial readiness and model choices",
+ "title": "Inspect scout trial readiness and model choices",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "scout-trials"
+ },
+ "scout-trial-start": {
+ "description": "Start a full private trial with automatic rubric judging. First read scout-trial-setup and save a complete rubric with scout-rubric-save. Supply up to 20 variants, each with its own model, supported reasoning_effort, optional replacement skill_body, and launch_ids for repetitions. Omit skill_body to use the source prompt. Generate UUIDs for comparison_id, every variant id, and every launch_id; baseline_variant_id must identify one supplied variant. Reuse these IDs only for an exact request retry. Pass expected_skill_version from setup to detect source edits. All variants share a captured starting context and fixed rubric; their reports and memory stay private, and the source scout is unchanged. Poll scout-trial-report through running and judging until it completes. Sandbox agents cannot start or inspect operator trials.",
+ "category": "Signals",
+ "feature": "signals",
+ "summary": "Run and judge scout variants",
+ "title": "Run and judge scout variants",
+ "required_scopes": ["signal_scout:write", "llm_skill:write"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": false
+ },
+ "feature_flag": "scout-trials"
+ },
"session-recording-bulk-delete": {
"description": "Delete a batch of session recordings by session ID, up to 100 per call. Deletion is permanent and cannot be undone — confirm with the user before deleting. Prefer this over `session-recording-delete` whenever more than one recording needs deleting: find the target IDs with `query-session-recordings-list`, then delete in batches. Pass `date_from` (e.g. '-30d') when the recordings' age is known — it makes the lookup much faster. IDs with no matching recording are skipped, so a `deleted_count` below `total_requested` is normal when some recordings were already deleted or never existed.",
"category": "Session replays",
diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.ts
index 8332528ec60f..df4d7856d277 100644
--- a/services/mcp/src/generated/signals/api.ts
+++ b/services/mcp/src/generated/signals/api.ts
@@ -3,7 +3,7 @@
* MCP service uses these Zod schemas for generated tool handlers.
* To regenerate: hogli build:openapi
*
- * PostHog API - MCP 54 enabled ops
+ * PostHog API - MCP 63 enabled ops
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
@@ -1626,6 +1626,164 @@ export const SignalsScoutConfigTrialBody = () => zod.object({
.describe('Common investigation note, saved before applying any variant overrides.'),
})
+/**
+ * Freeze variants and the reviewed rubric, then run scouts and judge their results in the background.
+ * @summary Run and judge a private scout comparison
+ */
+export const SignalsScoutConfigTrialComparisonCreateParams = () => zod.object({
+ id: zod.string().describe('A UUID string identifying this Signal scout config.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const signalsScoutConfigTrialComparisonCreateBodyVariantsItemLabelMax = 100
+
+export const signalsScoutConfigTrialComparisonCreateBodyVariantsItemLaunchIdsMax = 20
+
+export const signalsScoutConfigTrialComparisonCreateBodyVariantsItemModelMax = 200
+
+export const signalsScoutConfigTrialComparisonCreateBodyVariantsItemReasoningEffortMax = 20
+
+export const signalsScoutConfigTrialComparisonCreateBodyVariantsItemSkillBodyMax = 100000
+
+export const signalsScoutConfigTrialComparisonCreateBodyNoteMax = 1000
+
+export const SignalsScoutConfigTrialComparisonCreateBody = () => zod.object({
+ comparison_id: zod.string().describe('Stable comparison ID. Reuse for an exact request retry.'),
+ baseline_variant_id: zod.string().describe('Variant used as the comparison baseline.'),
+ variants: zod
+ .array(
+ zod.object({
+ id: zod.string().describe('Stable variant identity within this comparison.'),
+ label: zod
+ .string()
+ .max(signalsScoutConfigTrialComparisonCreateBodyVariantsItemLabelMax)
+ .describe('Variant name shown in the report.'),
+ launch_ids: zod
+ .array(zod.string())
+ .min(1)
+ .max(signalsScoutConfigTrialComparisonCreateBodyVariantsItemLaunchIdsMax)
+ .describe("Stable run IDs for this variant's repeats."),
+ model: zod
+ .string()
+ .max(signalsScoutConfigTrialComparisonCreateBodyVariantsItemModelMax)
+ .describe('Scout model to run.'),
+ reasoning_effort: zod
+ .string()
+ .max(signalsScoutConfigTrialComparisonCreateBodyVariantsItemReasoningEffortMax)
+ .describe('Reasoning effort supported by this model.'),
+ skill_body: zod
+ .string()
+ .max(signalsScoutConfigTrialComparisonCreateBodyVariantsItemSkillBodyMax)
+ .optional()
+ .describe('Replacement scout instructions. Omit to use the saved source instructions.'),
+ })
+ )
+ .describe('Up to 20 variants, each with up to 20 scout runs.'),
+ note: zod
+ .string()
+ .max(signalsScoutConfigTrialComparisonCreateBodyNoteMax)
+ .optional()
+ .describe('Shared investigation note.'),
+ expected_skill_version: zod
+ .number()
+ .min(1)
+ .optional()
+ .describe('Source version shown in the editor. Refuse a new trial if the instructions changed since setup.'),
+})
+
+/**
+ * Hide a finished trial from history or restore it without deleting results or starting any work.
+ * @summary Archive or restore a saved scout trial
+ */
+export const SignalsScoutConfigTrialComparisonArchiveParams = () => zod.object({
+ id: zod.string().describe('A UUID string identifying this Signal scout config.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const SignalsScoutConfigTrialComparisonArchiveBody = () => zod.object({
+ comparison_id: zod.string().describe('Saved comparison identity.'),
+ archived: zod.boolean().describe('Hide a finished trial from history, or restore it without rerunning it.'),
+})
+
+/**
+ * Read recent comparisons, including those saved before any scout run started.
+ * @summary List your saved scout comparisons
+ */
+export const SignalsScoutConfigTrialComparisonHistoryParams = () => zod.object({
+ id: zod.string().describe('A UUID string identifying this Signal scout config.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const signalsScoutConfigTrialComparisonHistoryQueryCursorRegExp = new RegExp('^[0-9]{19}-[0-9a-f-]{36}\\.json$')
+export const signalsScoutConfigTrialComparisonHistoryQueryIncludeArchivedDefault = false
+export const signalsScoutConfigTrialComparisonHistoryQueryLimitDefault = 30
+export const signalsScoutConfigTrialComparisonHistoryQueryLimitMax = 100
+
+export const SignalsScoutConfigTrialComparisonHistoryQueryParams = () => zod.object({
+ cursor: zod
+ .string()
+ .min(1)
+ .regex(signalsScoutConfigTrialComparisonHistoryQueryCursorRegExp)
+ .optional()
+ .describe('Cursor returned by the previous history page. Omit to read the newest trials.'),
+ include_archived: zod
+ .boolean()
+ .default(signalsScoutConfigTrialComparisonHistoryQueryIncludeArchivedDefault)
+ .describe('Include archived trials in the history.'),
+ limit: zod
+ .number()
+ .min(1)
+ .max(signalsScoutConfigTrialComparisonHistoryQueryLimitMax)
+ .default(signalsScoutConfigTrialComparisonHistoryQueryLimitDefault)
+ .describe('Maximum number of recent private runs to return.'),
+})
+
+/**
+ * Read comparison progress and its saved report without starting any scout or judge calls.
+ * @summary Read a saved scout comparison
+ */
+export const SignalsScoutConfigTrialComparisonRetrieveParams = () => zod.object({
+ id: zod.string().describe('A UUID string identifying this Signal scout config.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const SignalsScoutConfigTrialComparisonRetrieveQueryParams = () => zod.object({
+ comparison_id: zod.string().describe('Saved comparison identity.'),
+})
+
+/**
+ * Recover the same comparison without repeating saved scout runs or judge attempts.
+ * @summary Resume a saved scout comparison
+ */
+export const SignalsScoutConfigTrialComparisonResumeParams = () => zod.object({
+ id: zod.string().describe('A UUID string identifying this Signal scout config.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const SignalsScoutConfigTrialComparisonResumeBody = () => zod.object({
+ comparison_id: zod.string().describe('Saved comparison identity.'),
+})
+
/**
* Read a trial's existing run status and its privately captured reports and memory changes.
* @summary Read a private scout trial result
@@ -1643,6 +1801,26 @@ export const SignalsScoutConfigTrialResultQueryParams = () => zod.object({
launch_id: zod.string().describe('Launch identity returned by the trial action.'),
})
+/**
+ * Read comparison readiness and source settings for the internal comparison editor.
+ * @summary Inspect a private scout comparison
+ */
+export const SignalsScoutConfigTrialSetupParams = () => zod.object({
+ id: zod.string().describe('A UUID string identifying this Signal scout config.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const SignalsScoutConfigTrialSetupQueryParams = () => zod.object({
+ context_id: zod
+ .string()
+ .optional()
+ .describe('Saved comparison context to inspect instead of the current source skill.'),
+})
+
/**
* Materialize the scout fleet for this project on demand (idempotent): seed the canonical `signals-scout-*` skills, create a default-schedule config for any scout lacking one, retire the skills whose canonical scout no longer ships, and return all scout configs. Normally the Temporal coordinator does this on its next tick; this action exists so the scout UIs and setup flows (e.g. the wizard's self-driving program) can hand the user a tunable fleet immediately.
* @summary Sync scout configs
@@ -1865,6 +2043,104 @@ export const SignalsScoutProjectProfileGetQueryParams = () => zod.object({
),
})
+export const SignalsScoutRubricsRetrieveParams = () => zod.object({
+ id: zod.string().describe('A UUID string identifying this Signal scout config.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const SignalsScoutRubricsUpdateParams = () => zod.object({
+ id: zod.string().describe('A UUID string identifying this Signal scout config.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const signalsScoutRubricsUpdateBodyRevisionMin = 0
+
+export const signalsScoutRubricsUpdateBodyCriteriaItemIdMax = 80
+
+export const signalsScoutRubricsUpdateBodyCriteriaItemIdRegExp = new RegExp('^[a-z][a-z0-9_-]{0,79}$')
+export const signalsScoutRubricsUpdateBodyCriteriaItemTitleMax = 120
+
+export const signalsScoutRubricsUpdateBodyCriteriaItemDescriptionMax = 1000
+
+export const signalsScoutRubricsUpdateBodyCriteriaItemPassConditionMax = 2000
+
+export const signalsScoutRubricsUpdateBodyCriteriaItemApplicabilityMax = 1000
+
+export const SignalsScoutRubricsUpdateBody = () => zod.object({
+ revision: zod
+ .number()
+ .min(signalsScoutRubricsUpdateBodyRevisionMin)
+ .describe('Revision read by the editor; stale saves return 409.'),
+ criteria: zod
+ .array(
+ zod.object({
+ id: zod
+ .string()
+ .max(signalsScoutRubricsUpdateBodyCriteriaItemIdMax)
+ .regex(signalsScoutRubricsUpdateBodyCriteriaItemIdRegExp)
+ .describe('Stable criterion identifier.'),
+ title: zod
+ .string()
+ .max(signalsScoutRubricsUpdateBodyCriteriaItemTitleMax)
+ .describe('Short name for the criterion.'),
+ description: zod
+ .string()
+ .max(signalsScoutRubricsUpdateBodyCriteriaItemDescriptionMax)
+ .describe('What this criterion measures.'),
+ pass_condition: zod
+ .string()
+ .max(signalsScoutRubricsUpdateBodyCriteriaItemPassConditionMax)
+ .describe('The evidence needed to pass this criterion.'),
+ applicability: zod
+ .string()
+ .max(signalsScoutRubricsUpdateBodyCriteriaItemApplicabilityMax)
+ .describe('When this criterion applies or cannot be assessed.'),
+ enabled: zod.boolean().describe('Whether future evaluations should use this criterion.'),
+ source: zod
+ .enum(['default', 'custom'])
+ .describe('\* `default` - Default\n\* `custom` - Custom')
+ .describe(
+ 'Shared default or scout-specific criterion.\n\n\* `default` - Default\n\* `custom` - Custom'
+ ),
+ })
+ )
+ .describe('Complete set of criteria to save.'),
+ adopt_generation_id: zod
+ .string()
+ .nullish()
+ .describe(
+ "Use this completed generation's governing source for the whole saved rubric. Omit to keep its source."
+ ),
+})
+
+export const SignalsScoutRubricsGenerateParams = () => zod.object({
+ id: zod.string().describe('A UUID string identifying this Signal scout config.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to \/api\/projects\/."
+ ),
+})
+
+export const signalsScoutRubricsGenerateBodyContextDefault = ``
+export const signalsScoutRubricsGenerateBodyContextMax = 2000
+
+export const SignalsScoutRubricsGenerateBody = () => zod.object({
+ context: zod
+ .string()
+ .max(signalsScoutRubricsGenerateBodyContextMax)
+ .default(signalsScoutRubricsGenerateBodyContextDefault)
+ .describe("Optional priorities for this generation. Suggestions still cover the scout's full job."),
+})
+
/**
* Return the most recent `SignalScoutRun` summaries for this project, newest first. Used by the headless scout to dedupe against work other runs already covered. ILIKE matches on `summary`. `date_from` / `date_to` are a half-open window on `created_at` (`>= date_from`, `< date_to`); pass `date_to` on subsequent calls to walk past the 100-row cap. Pass `emitted=true` to see only runs that surfaced at least one finding. Pass `skill_name` (optionally with `skill_version`) to scope to a single scout. Results capped at 100.
* @summary Search recent agent runs
diff --git a/services/mcp/src/lib/tool-privacy.ts b/services/mcp/src/lib/tool-privacy.ts
index e88cc00e79b8..b89aa3c29dde 100644
--- a/services/mcp/src/lib/tool-privacy.ts
+++ b/services/mcp/src/lib/tool-privacy.ts
@@ -1,3 +1,3 @@
export function isPrivateScoutTrialTool(toolName: unknown): boolean {
- return toolName === 'scout-trial-create' || toolName === 'scout-trial-get'
+ return typeof toolName === 'string' && (toolName.startsWith('scout-trial-') || toolName.startsWith('scout-rubric-'))
}
diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.ts
index 2350105c2b1a..ac5f9f97fc1b 100644
--- a/services/mcp/src/tools/generated/signals.ts
+++ b/services/mcp/src/tools/generated/signals.ts
@@ -1641,6 +1641,134 @@ const scoutReportChecksList = (): ToolBase<
},
})
+const ScoutRubricGenerateSchema = () => {
+ const SignalsScoutRubricsGenerateBody = orvalSchemas.SignalsScoutRubricsGenerateBody()
+ const SignalsScoutRubricsGenerateParams = orvalSchemas.SignalsScoutRubricsGenerateParams()
+ return SignalsScoutRubricsGenerateParams.omit({ project_id: true }).extend(SignalsScoutRubricsGenerateBody.shape)
+}
+
+const scoutRubricGenerate = (): ToolBase<ReturnType<typeof ScoutRubricGenerateSchema>, unknown> => ({
+ name: 'scout-rubric-generate',
+ schema: ScoutRubricGenerateSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof ScoutRubricGenerateSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.context !== undefined) {
+ body['context'] = params.context
+ }
+ const result = await context.api.request<unknown>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/rubrics/${encodeURIComponent(String(params.id))}/generate/`,
+ body,
+ })
+ return result
+ },
+})
+
+const ScoutRubricGetSchema = () => {
+ const SignalsScoutRubricsRetrieveParams = orvalSchemas.SignalsScoutRubricsRetrieveParams()
+ return SignalsScoutRubricsRetrieveParams.omit({ project_id: true }).extend({
+ fields: z
+ .array(
+ z.enum([
+ 'config_id',
+ 'skill_name',
+ 'revision',
+ 'criteria',
+ 'generation',
+ 'reference_context',
+ 'reference_generation_id',
+ 'generation.id',
+ 'generation.status',
+ 'generation.error',
+ 'generation.summary',
+ 'generation.suggestions',
+ 'generation.reference_context',
+ 'generation.reference_context.instructions',
+ 'generation.reference_context.report_disposition_instructions',
+ 'generation.reference_context.reference_texts',
+ 'reference_context.instructions',
+ 'reference_context.report_disposition_instructions',
+ 'reference_context.reference_texts',
+ ])
+ )
+ .min(1)
+ .optional()
+ .describe(
+ 'Optional subset of response fields to return, each a dot-path from the allowlist. Omit to return all fields. Request only the fields your task needs to keep responses small.'
+ ),
+ })
+}
+
+const scoutRubricGet = (): ToolBase<ReturnType<typeof ScoutRubricGetSchema>, Schemas.ScoutRubricDocument> => ({
+ name: 'scout-rubric-get',
+ schema: ScoutRubricGetSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof ScoutRubricGetSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.ScoutRubricDocument>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/rubrics/${encodeURIComponent(String(params.id))}/`,
+ })
+ const filtered = pickResponseFields(
+ result,
+ params.fields?.length
+ ? params.fields
+ : [
+ 'config_id',
+ 'skill_name',
+ 'revision',
+ 'criteria',
+ 'generation',
+ 'reference_context',
+ 'reference_generation_id',
+ 'generation.id',
+ 'generation.status',
+ 'generation.error',
+ 'generation.summary',
+ 'generation.suggestions',
+ 'generation.reference_context',
+ 'generation.reference_context.instructions',
+ 'generation.reference_context.report_disposition_instructions',
+ 'generation.reference_context.reference_texts',
+ 'reference_context.instructions',
+ 'reference_context.report_disposition_instructions',
+ 'reference_context.reference_texts',
+ ]
+ ) as typeof result
+ return filtered
+ },
+})
+
+const ScoutRubricSaveSchema = () => {
+ const SignalsScoutRubricsUpdateBody = orvalSchemas.SignalsScoutRubricsUpdateBody()
+ const SignalsScoutRubricsUpdateParams = orvalSchemas.SignalsScoutRubricsUpdateParams()
+ return SignalsScoutRubricsUpdateParams.omit({ project_id: true }).extend(SignalsScoutRubricsUpdateBody.shape)
+}
+
+const scoutRubricSave = (): ToolBase<ReturnType<typeof ScoutRubricSaveSchema>, Schemas.ScoutRubricDocument> => ({
+ name: 'scout-rubric-save',
+ schema: ScoutRubricSaveSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof ScoutRubricSaveSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.revision !== undefined) {
+ body['revision'] = params.revision
+ }
+ if (params.criteria !== undefined) {
+ body['criteria'] = params.criteria
+ }
+ if (params.adopt_generation_id !== undefined) {
+ body['adopt_generation_id'] = params.adopt_generation_id
+ }
+ const result = await context.api.request<Schemas.ScoutRubricDocument>({
+ method: 'PUT',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/rubrics/${encodeURIComponent(String(params.id))}/`,
+ body,
+ })
+ return result
+ },
+})
+
const ScoutRunNowSchema = () => {
const SignalsScoutConfigRunBody = orvalSchemas.SignalsScoutConfigRunBody()
const SignalsScoutConfigRunParams = orvalSchemas.SignalsScoutConfigRunParams()
@@ -1871,6 +1999,42 @@ const scoutScratchpadSearch = (): ToolBase<
},
})
+const ScoutTrialArchiveSchema = () => {
+ const SignalsScoutConfigTrialComparisonArchiveBody = orvalSchemas.SignalsScoutConfigTrialComparisonArchiveBody()
+ const SignalsScoutConfigTrialComparisonArchiveParams = orvalSchemas.SignalsScoutConfigTrialComparisonArchiveParams()
+ return SignalsScoutConfigTrialComparisonArchiveParams.omit({ project_id: true }).extend(
+ SignalsScoutConfigTrialComparisonArchiveBody.shape
+ )
+}
+
+const scoutTrialArchive = (): ToolBase<ReturnType<typeof ScoutTrialArchiveSchema>, Schemas.ScoutTrialComparison> => ({
+ name: 'scout-trial-archive',
+ schema: ScoutTrialArchiveSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof ScoutTrialArchiveSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.comparison_id !== undefined) {
+ body['comparison_id'] = params.comparison_id
+ }
+ if (params.archived !== undefined) {
+ body['archived'] = params.archived
+ }
+ const result = await context.api.request<Schemas.ScoutTrialComparison>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/trial_comparison_archive/`,
+ body,
+ })
+ const filtered = pickResponseFields(result, [
+ 'comparison_id',
+ 'config_id',
+ 'status',
+ 'archived',
+ 'error',
+ ]) as typeof result
+ return filtered
+ },
+})
+
const ScoutTrialCreateSchema = () => {
const SignalsScoutConfigTrialBody = orvalSchemas.SignalsScoutConfigTrialBody()
const SignalsScoutConfigTrialParams = orvalSchemas.SignalsScoutConfigTrialParams()
@@ -1937,6 +2101,213 @@ const scoutTrialGet = (): ToolBase<ReturnType<typeof ScoutTrialGetSchema>, Schem
},
})
+const ScoutTrialListSchema = () => {
+ const SignalsScoutConfigTrialComparisonHistoryParams = orvalSchemas.SignalsScoutConfigTrialComparisonHistoryParams()
+ const SignalsScoutConfigTrialComparisonHistoryQueryParams =
+ orvalSchemas.SignalsScoutConfigTrialComparisonHistoryQueryParams()
+ return SignalsScoutConfigTrialComparisonHistoryParams.omit({ project_id: true }).extend(
+ SignalsScoutConfigTrialComparisonHistoryQueryParams.shape
+ )
+}
+
+const scoutTrialList = (): ToolBase<ReturnType<typeof ScoutTrialListSchema>, Schemas.ScoutTrialComparisonHistory> => ({
+ name: 'scout-trial-list',
+ schema: ScoutTrialListSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof ScoutTrialListSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.ScoutTrialComparisonHistory>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/trial_comparison_history/`,
+ query: {
+ cursor: params.cursor,
+ include_archived: params.include_archived,
+ limit: params.limit,
+ },
+ })
+ return result
+ },
+})
+
+const ScoutTrialReportSchema = () => {
+ const SignalsScoutConfigTrialComparisonRetrieveParams =
+ orvalSchemas.SignalsScoutConfigTrialComparisonRetrieveParams()
+ const SignalsScoutConfigTrialComparisonRetrieveQueryParams =
+ orvalSchemas.SignalsScoutConfigTrialComparisonRetrieveQueryParams()
+ return SignalsScoutConfigTrialComparisonRetrieveParams.omit({ project_id: true })
+ .extend(SignalsScoutConfigTrialComparisonRetrieveQueryParams.shape)
+ .extend({
+ fields: z
+ .array(
+ z.enum([
+ 'comparison_id',
+ 'config_id',
+ 'context_id',
+ 'created_at',
+ 'baseline_variant_id',
+ 'rubric_revision',
+ 'variants',
+ 'status',
+ 'archived',
+ 'error',
+ 'evaluation',
+ 'evaluation.status',
+ 'evaluation.error',
+ 'evaluation.report',
+ 'evaluation.report.summary',
+ 'evaluation.report.outcome',
+ 'evaluation.report.variants',
+ 'evaluation.report.runs',
+ 'evaluation.report.evidence',
+ 'evaluation.report.criteria',
+ 'evaluation.report.rubric_reference_context',
+ 'evaluation.report.limitations',
+ ])
+ )
+ .min(1)
+ .optional()
+ .describe(
+ 'Optional subset of response fields to return, each a dot-path from the allowlist. Omit to return all fields. Request only the fields your task needs to keep responses small.'
+ ),
+ })
+}
+
+const scoutTrialReport = (): ToolBase<ReturnType<typeof ScoutTrialReportSchema>, Schemas.ScoutTrialComparison> => ({
+ name: 'scout-trial-report',
+ schema: ScoutTrialReportSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof ScoutTrialReportSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.ScoutTrialComparison>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/trial_comparison_result/`,
+ query: {
+ comparison_id: params.comparison_id,
+ },
+ })
+ const filtered = pickResponseFields(
+ result,
+ params.fields?.length
+ ? params.fields
+ : [
+ 'comparison_id',
+ 'config_id',
+ 'context_id',
+ 'created_at',
+ 'baseline_variant_id',
+ 'rubric_revision',
+ 'variants',
+ 'status',
+ 'archived',
+ 'error',
+ 'evaluation',
+ 'evaluation.status',
+ 'evaluation.error',
+ 'evaluation.report',
+ 'evaluation.report.summary',
+ 'evaluation.report.outcome',
+ 'evaluation.report.variants',
+ 'evaluation.report.runs',
+ 'evaluation.report.evidence',
+ 'evaluation.report.criteria',
+ 'evaluation.report.rubric_reference_context',
+ 'evaluation.report.limitations',
+ ]
+ ) as typeof result
+ return filtered
+ },
+})
+
+const ScoutTrialResumeSchema = () => {
+ const SignalsScoutConfigTrialComparisonResumeBody = orvalSchemas.SignalsScoutConfigTrialComparisonResumeBody()
+ const SignalsScoutConfigTrialComparisonResumeParams = orvalSchemas.SignalsScoutConfigTrialComparisonResumeParams()
+ return SignalsScoutConfigTrialComparisonResumeParams.omit({ project_id: true }).extend(
+ SignalsScoutConfigTrialComparisonResumeBody.shape
+ )
+}
+
+const scoutTrialResume = (): ToolBase<ReturnType<typeof ScoutTrialResumeSchema>, unknown> => ({
+ name: 'scout-trial-resume',
+ schema: ScoutTrialResumeSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof ScoutTrialResumeSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.comparison_id !== undefined) {
+ body['comparison_id'] = params.comparison_id
+ }
+ const result = await context.api.request<unknown>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/trial_comparison_resume/`,
+ body,
+ })
+ return result
+ },
+})
+
+const ScoutTrialSetupSchema = () => {
+ const SignalsScoutConfigTrialSetupParams = orvalSchemas.SignalsScoutConfigTrialSetupParams()
+ const SignalsScoutConfigTrialSetupQueryParams = orvalSchemas.SignalsScoutConfigTrialSetupQueryParams()
+ return SignalsScoutConfigTrialSetupParams.omit({ project_id: true }).extend(
+ SignalsScoutConfigTrialSetupQueryParams.shape
+ )
+}
+
+const scoutTrialSetup = (): ToolBase<ReturnType<typeof ScoutTrialSetupSchema>, Schemas.ScoutTrialSetup> => ({
+ name: 'scout-trial-setup',
+ schema: ScoutTrialSetupSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof ScoutTrialSetupSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.ScoutTrialSetup>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/trial_setup/`,
+ query: {
+ context_id: params.context_id,
+ },
+ })
+ return result
+ },
+})
+
+const ScoutTrialStartSchema = () => {
+ const SignalsScoutConfigTrialComparisonCreateBody = orvalSchemas.SignalsScoutConfigTrialComparisonCreateBody()
+ const SignalsScoutConfigTrialComparisonCreateParams = orvalSchemas.SignalsScoutConfigTrialComparisonCreateParams()
+ return SignalsScoutConfigTrialComparisonCreateParams.omit({ project_id: true })
+ .extend(SignalsScoutConfigTrialComparisonCreateBody.shape)
+ .extend({
+ note: SignalsScoutConfigTrialComparisonCreateBody.shape['note'].describe(
+ 'Steering instructions shared by every run in this trial, matching the trial UI\'s "Instructions for every run" field. Up to 1000 characters. Does not edit the saved scout\'s instructions.'
+ ),
+ })
+}
+
+const scoutTrialStart = (): ToolBase<ReturnType<typeof ScoutTrialStartSchema>, unknown> => ({
+ name: 'scout-trial-start',
+ schema: ScoutTrialStartSchema(),
+ handler: async (context: Context, params: z.infer<ReturnType<typeof ScoutTrialStartSchema>>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.comparison_id !== undefined) {
+ body['comparison_id'] = params.comparison_id
+ }
+ if (params.baseline_variant_id !== undefined) {
+ body['baseline_variant_id'] = params.baseline_variant_id
+ }
+ if (params.variants !== undefined) {
+ body['variants'] = params.variants
+ }
+ if (params.note !== undefined) {
+ body['note'] = params.note
+ }
+ if (params.expected_skill_version !== undefined) {
+ body['expected_skill_version'] = params.expected_skill_version
+ }
+ const result = await context.api.request<unknown>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/trial_comparison/`,
+ body,
+ })
+ return result
+ },
+})
+
const SignalsScoutConfigCreateSchema = () => {
const SignalsScoutConfigCreateBody = orvalSchemas.SignalsScoutConfigCreateBody()
return SignalsScoutConfigCreateBody
@@ -2698,6 +3069,9 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'scout-report-check-create': scoutReportCheckCreate,
'scout-report-check-list': scoutReportCheckList,
'scout-report-checks-list': scoutReportChecksList,
+ 'scout-rubric-generate': scoutRubricGenerate,
+ 'scout-rubric-get': scoutRubricGet,
+ 'scout-rubric-save': scoutRubricSave,
'scout-run-now': scoutRunNow,
'scout-runs-emission-reports': scoutRunsEmissionReports,
'scout-runs-emissions-list': scoutRunsEmissionsList,
@@ -2707,8 +3081,14 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'scout-scratchpad-forget': scoutScratchpadForget,
'scout-scratchpad-remember': scoutScratchpadRemember,
'scout-scratchpad-search': scoutScratchpadSearch,
+ 'scout-trial-archive': scoutTrialArchive,
'scout-trial-create': scoutTrialCreate,
'scout-trial-get': scoutTrialGet,
+ 'scout-trial-list': scoutTrialList,
+ 'scout-trial-report': scoutTrialReport,
+ 'scout-trial-resume': scoutTrialResume,
+ 'scout-trial-setup': scoutTrialSetup,
+ 'scout-trial-start': scoutTrialStart,
'signals-scout-config-create': signalsScoutConfigCreate,
'signals-scout-config-delete': signalsScoutConfigDelete,
'signals-scout-config-list': signalsScoutConfigList,
diff --git a/services/mcp/tests/cli/tool-call-tracking.test.ts b/services/mcp/tests/cli/tool-call-tracking.test.ts
index 66606fa789f3..de151dfa9424 100644
--- a/services/mcp/tests/cli/tool-call-tracking.test.ts
+++ b/services/mcp/tests/cli/tool-call-tracking.test.ts
@@ -7,21 +7,32 @@ import type { ExecInnerCallProperties } from '@/tools/exec'
describe('trackCliToolCall', () => {
const properties: ExecInnerCallProperties = { duration_ms: 42, success: true, output_format: 'text' }
- it.each([
- ['scout-trial-create', true],
- ['scout-trial-get', false],
- ])('drops %s calls with success=%s, as the hosted server does', (toolName, success) => {
+ it.each(
+ [
+ 'scout-trial-create',
+ 'scout-trial-get',
+ 'scout-trial-start',
+ 'scout-trial-report',
+ 'scout-trial-list',
+ 'scout-trial-resume',
+ 'scout-trial-archive',
+ 'scout-trial-setup',
+ 'scout-rubric-generate',
+ 'scout-rubric-get',
+ 'scout-rubric-save',
+ ].flatMap((toolName) => [false, true].map((success) => ({ toolName, success })))
+ )('drops $toolName calls with success=$success, as the hosted server does', ({ toolName, success }) => {
const trackEvent = vi.fn(async () => {})
trackCliToolCall({ trackEvent }, toolName, { ...properties, success })
expect(trackEvent).not.toHaveBeenCalled()
})
- it('records other inner calls as $mcp_tool_call', () => {
+ it.each([false, true])('records other inner calls as $mcp_tool_call with success=%s', (success) => {
const trackEvent = vi.fn(async () => {})
- trackCliToolCall({ trackEvent }, 'feature-flag-get-all', properties)
+ trackCliToolCall({ trackEvent }, 'feature-flag-get-all', { ...properties, success })
expect(trackEvent).toHaveBeenCalledExactlyOnceWith(
AnalyticsEvent.MCP_TOOL_CALL,
- buildToolCallProperties('feature-flag-get-all', properties)
+ buildToolCallProperties('feature-flag-get-all', { ...properties, success })
)
})
})
diff --git a/services/mcp/tests/hono/analytics.test.ts b/services/mcp/tests/hono/analytics.test.ts
index ba9ed2904970..a4ff8b46197b 100644
--- a/services/mcp/tests/hono/analytics.test.ts
+++ b/services/mcp/tests/hono/analytics.test.ts
@@ -101,22 +101,31 @@ describe('Hono MCP analytics contexts', () => {
expect(mockCapture).not.toHaveBeenCalled()
})
- it.each(['scout-trial-create', 'scout-trial-get'])(
- 'excludes exec discovery metadata for %s with ordinary operator credentials',
- async (targetTool) => {
- await trackToolCall(
- 'exec',
- 12,
- false,
- makeState({ suppressAnalytics: false }),
- { $mcp_exec_verb: 'info', $mcp_exec_target_tool: targetTool },
- { intent: 'Compare synthetic scout variants' }
- )
+ it.each([
+ 'scout-trial-create',
+ 'scout-trial-get',
+ 'scout-trial-start',
+ 'scout-trial-report',
+ 'scout-trial-list',
+ 'scout-trial-resume',
+ 'scout-trial-archive',
+ 'scout-trial-setup',
+ 'scout-rubric-generate',
+ 'scout-rubric-get',
+ 'scout-rubric-save',
+ ])('excludes exec discovery metadata for %s with ordinary operator credentials', async (targetTool) => {
+ await trackToolCall(
+ 'exec',
+ 12,
+ false,
+ makeState({ suppressAnalytics: false }),
+ { $mcp_exec_verb: 'info', $mcp_exec_target_tool: targetTool },
+ { intent: 'Compare synthetic scout variants' }
+ )
- expect(mockCaptureToolCall).not.toHaveBeenCalled()
- expect(mockCapture).not.toHaveBeenCalled()
- }
- )
+ expect(mockCaptureToolCall).not.toHaveBeenCalled()
+ expect(mockCapture).not.toHaveBeenCalled()
+ })
it.each([
{ impersonated: true, isError: false },
diff --git a/services/mcp/tests/hono/tool-executor-intent.test.ts b/services/mcp/tests/hono/tool-executor-intent.test.ts
index 1b7963d83208..2249d2e03184 100644
--- a/services/mcp/tests/hono/tool-executor-intent.test.ts
+++ b/services/mcp/tests/hono/tool-executor-intent.test.ts
@@ -58,6 +58,15 @@ describe('ToolExecutor analytics capture', () => {
[
['scout-trial-create', 'private'],
['scout-trial-get', 'private'],
+ ['scout-trial-start', 'private'],
+ ['scout-trial-report', 'private'],
+ ['scout-trial-list', 'private'],
+ ['scout-trial-resume', 'private'],
+ ['scout-trial-archive', 'private'],
+ ['scout-trial-setup', 'private'],
+ ['scout-rubric-generate', 'private'],
+ ['scout-rubric-get', 'private'],
+ ['scout-rubric-save', 'private'],
['scout-runs-retrieve', 'ordinary'],
['signals-scout-runs-retrieve', 'ordinary'],
['tasks-list', 'ordinary'],
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-rubric-generate.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-rubric-generate.json
new file mode 100644
index 000000000000..b6ae7b78aa27
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-rubric-generate.json
@@ -0,0 +1,17 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "context": {
+ "default": "",
+ "description": "Optional priorities for this generation. Suggestions still cover the scout's full job.",
+ "maxLength": 2000,
+ "type": "string"
+ },
+ "id": {
+ "description": "A UUID string identifying this Signal scout config.",
+ "type": "string"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-rubric-get.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-rubric-get.json
new file mode 100644
index 000000000000..766b716bb9c8
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-rubric-get.json
@@ -0,0 +1,40 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "fields": {
+ "description": "Optional subset of response fields to return, each a dot-path from the allowlist. Omit to return all fields. Request only the fields your task needs to keep responses small.",
+ "items": {
+ "enum": [
+ "config_id",
+ "skill_name",
+ "revision",
+ "criteria",
+ "generation",
+ "reference_context",
+ "reference_generation_id",
+ "generation.id",
+ "generation.status",
+ "generation.error",
+ "generation.summary",
+ "generation.suggestions",
+ "generation.reference_context",
+ "generation.reference_context.instructions",
+ "generation.reference_context.report_disposition_instructions",
+ "generation.reference_context.reference_texts",
+ "reference_context.instructions",
+ "reference_context.report_disposition_instructions",
+ "reference_context.reference_texts"
+ ],
+ "type": "string"
+ },
+ "minItems": 1,
+ "type": "array"
+ },
+ "id": {
+ "description": "A UUID string identifying this Signal scout config.",
+ "type": "string"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-rubric-save.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-rubric-save.json
new file mode 100644
index 000000000000..0434f44972ba
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-rubric-save.json
@@ -0,0 +1,72 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "adopt_generation_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Use this completed generation's governing source for the whole saved rubric. Omit to keep its source."
+ },
+ "criteria": {
+ "description": "Complete set of criteria to save.",
+ "items": {
+ "properties": {
+ "applicability": {
+ "description": "When this criterion applies or cannot be assessed.",
+ "maxLength": 1000,
+ "type": "string"
+ },
+ "description": {
+ "description": "What this criterion measures.",
+ "maxLength": 1000,
+ "type": "string"
+ },
+ "enabled": {
+ "description": "Whether future evaluations should use this criterion.",
+ "type": "boolean"
+ },
+ "id": {
+ "description": "Stable criterion identifier.",
+ "maxLength": 80,
+ "pattern": "^[a-z][a-z0-9_-]{0,79}$",
+ "type": "string"
+ },
+ "pass_condition": {
+ "description": "The evidence needed to pass this criterion.",
+ "maxLength": 2000,
+ "type": "string"
+ },
+ "source": {
+ "description": "Shared default or scout-specific criterion.\n\n* `default` - Default\n* `custom` - Custom",
+ "enum": ["default", "custom"],
+ "type": "string"
+ },
+ "title": {
+ "description": "Short name for the criterion.",
+ "maxLength": 120,
+ "type": "string"
+ }
+ },
+ "required": ["id", "title", "description", "pass_condition", "applicability", "enabled", "source"],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "id": {
+ "description": "A UUID string identifying this Signal scout config.",
+ "type": "string"
+ },
+ "revision": {
+ "description": "Revision read by the editor; stale saves return 409.",
+ "minimum": 0,
+ "type": "number"
+ }
+ },
+ "required": ["id", "revision", "criteria"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-archive.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-archive.json
new file mode 100644
index 000000000000..e79723a6cd92
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-archive.json
@@ -0,0 +1,19 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "archived": {
+ "description": "Hide a finished trial from history, or restore it without rerunning it.",
+ "type": "boolean"
+ },
+ "comparison_id": {
+ "description": "Saved comparison identity.",
+ "type": "string"
+ },
+ "id": {
+ "description": "A UUID string identifying this Signal scout config.",
+ "type": "string"
+ }
+ },
+ "required": ["id", "comparison_id", "archived"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-list.json
new file mode 100644
index 000000000000..50f71de699e5
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-list.json
@@ -0,0 +1,29 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "cursor": {
+ "description": "Cursor returned by the previous history page. Omit to read the newest trials.",
+ "minLength": 1,
+ "pattern": "^[0-9]{19}-[0-9a-f-]{36}\\.json$",
+ "type": "string"
+ },
+ "id": {
+ "description": "A UUID string identifying this Signal scout config.",
+ "type": "string"
+ },
+ "include_archived": {
+ "default": false,
+ "description": "Include archived trials in the history.",
+ "type": "boolean"
+ },
+ "limit": {
+ "default": 30,
+ "description": "Maximum number of recent private runs to return.",
+ "maximum": 100,
+ "minimum": 1,
+ "type": "number"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-report.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-report.json
new file mode 100644
index 000000000000..642eb559538d
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-report.json
@@ -0,0 +1,47 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "comparison_id": {
+ "description": "Saved comparison identity.",
+ "type": "string"
+ },
+ "fields": {
+ "description": "Optional subset of response fields to return, each a dot-path from the allowlist. Omit to return all fields. Request only the fields your task needs to keep responses small.",
+ "items": {
+ "enum": [
+ "comparison_id",
+ "config_id",
+ "context_id",
+ "created_at",
+ "baseline_variant_id",
+ "rubric_revision",
+ "variants",
+ "status",
+ "archived",
+ "error",
+ "evaluation",
+ "evaluation.status",
+ "evaluation.error",
+ "evaluation.report",
+ "evaluation.report.summary",
+ "evaluation.report.outcome",
+ "evaluation.report.variants",
+ "evaluation.report.runs",
+ "evaluation.report.evidence",
+ "evaluation.report.criteria",
+ "evaluation.report.rubric_reference_context",
+ "evaluation.report.limitations"
+ ],
+ "type": "string"
+ },
+ "minItems": 1,
+ "type": "array"
+ },
+ "id": {
+ "description": "A UUID string identifying this Signal scout config.",
+ "type": "string"
+ }
+ },
+ "required": ["id", "comparison_id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-resume.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-resume.json
new file mode 100644
index 000000000000..2d256d9d576a
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-resume.json
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "comparison_id": {
+ "description": "Saved comparison identity.",
+ "type": "string"
+ },
+ "id": {
+ "description": "A UUID string identifying this Signal scout config.",
+ "type": "string"
+ }
+ },
+ "required": ["id", "comparison_id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-setup.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-setup.json
new file mode 100644
index 000000000000..3fdfae926814
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-setup.json
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "context_id": {
+ "description": "Saved comparison context to inspect instead of the current source skill.",
+ "type": "string"
+ },
+ "id": {
+ "description": "A UUID string identifying this Signal scout config.",
+ "type": "string"
+ }
+ },
+ "required": ["id"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-start.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-start.json
new file mode 100644
index 000000000000..ee66e8b3229a
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-trial-start.json
@@ -0,0 +1,72 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "baseline_variant_id": {
+ "description": "Variant used as the comparison baseline.",
+ "type": "string"
+ },
+ "comparison_id": {
+ "description": "Stable comparison ID. Reuse for an exact request retry.",
+ "type": "string"
+ },
+ "expected_skill_version": {
+ "description": "Source version shown in the editor. Refuse a new trial if the instructions changed since setup.",
+ "minimum": 1,
+ "type": "number"
+ },
+ "id": {
+ "description": "A UUID string identifying this Signal scout config.",
+ "type": "string"
+ },
+ "note": {
+ "description": "Steering instructions shared by every run in this trial, matching the trial UI's \"Instructions for every run\" field. Up to 1000 characters. Does not edit the saved scout's instructions.",
+ "maxLength": 1000,
+ "type": "string"
+ },
+ "variants": {
+ "description": "Up to 20 variants, each with up to 20 scout runs.",
+ "items": {
+ "properties": {
+ "id": {
+ "description": "Stable variant identity within this comparison.",
+ "type": "string"
+ },
+ "label": {
+ "description": "Variant name shown in the report.",
+ "maxLength": 100,
+ "type": "string"
+ },
+ "launch_ids": {
+ "description": "Stable run IDs for this variant's repeats.",
+ "items": {
+ "type": "string"
+ },
+ "maxItems": 20,
+ "minItems": 1,
+ "type": "array"
+ },
+ "model": {
+ "description": "Scout model to run.",
+ "maxLength": 200,
+ "type": "string"
+ },
+ "reasoning_effort": {
+ "description": "Reasoning effort supported by this model.",
+ "maxLength": 20,
+ "type": "string"
+ },
+ "skill_body": {
+ "description": "Replacement scout instructions. Omit to use the saved source instructions.",
+ "maxLength": 100000,
+ "type": "string"
+ }
+ },
+ "required": ["id", "label", "launch_ids", "model", "reasoning_effort"],
+ "type": "object"
+ },
+ "type": "array"
+ }
+ },
+ "required": ["id", "comparison_id", "baseline_variant_id", "variants"],
+ "type": "object"
+}
diff --git a/services/mcp/tests/unit/scout-trials-generated.test.ts b/services/mcp/tests/unit/scout-trials-generated.test.ts
new file mode 100644
index 000000000000..ab8ddf8eea2a
--- /dev/null
+++ b/services/mcp/tests/unit/scout-trials-generated.test.ts
@@ -0,0 +1,311 @@
+import { describe, expect, it, vi } from 'vitest'
+
+import { GENERATED_TOOLS } from '@/tools/generated/signals'
+import type { Context } from '@/tools/types'
+
+const scoutId = '00000000-0000-4000-8000-000000000001'
+const comparisonId = '00000000-0000-4000-8000-000000000002'
+const baselineId = '00000000-0000-4000-8000-000000000003'
+const candidateId = '00000000-0000-4000-8000-000000000004'
+const generationId = '00000000-0000-4000-8000-000000000005'
+const launchId = '00000000-0000-4000-8000-000000000006'
+const contextId = '00000000-0000-4000-8000-000000000007'
+const configPath = `/api/projects/2/signals/scout/configs/${scoutId}`
+const rubricPath = `/api/projects/2/signals/scout/rubrics/${scoutId}`
+
+function createContext(response: unknown): { context: Context; request: ReturnType<typeof vi.fn> } {
+ const request = vi.fn().mockResolvedValue(response)
+ const context = {
+ api: { request },
+ stateManager: { getProjectId: async () => '2' },
+ } as unknown as Context
+ return { context, request }
+}
+
+describe('Generated scout trial workflow tools', () => {
+ it('returns the source prompt and per-model efforts from the requested saved context', async () => {
+ const setup = {
+ config_id: scoutId,
+ skill_version: 3,
+ skill_body: 'Inspect the synthetic inventory before updating the report.\n',
+ ready: true,
+ blocked_reason: null,
+ models: [
+ { model: 'gpt-6-luna', reasoning_efforts: ['low', 'medium'] },
+ { model: 'gpt-6-sol', reasoning_efforts: ['medium', 'high'] },
+ ],
+ }
+ const { context, request } = createContext(setup)
+ const tool = GENERATED_TOOLS['scout-trial-setup']!()
+
+ expect(await tool.handler(context, tool.schema.parse({ id: scoutId, context_id: contextId }))).toEqual(setup)
+ expect(request).toHaveBeenCalledWith({
+ method: 'GET',
+ path: `${configPath}/trial_setup/`,
+ query: { context_id: contextId },
+ })
+ })
+
+ it('starts the automatic comparison with unchanged prompts, model choices, repeats and retry IDs', async () => {
+ const body = {
+ comparison_id: comparisonId,
+ baseline_variant_id: baselineId,
+ expected_skill_version: 3,
+ note: 'Compare the inventory review approaches.',
+ variants: [
+ {
+ id: baselineId,
+ label: 'Original instructions',
+ launch_ids: [launchId, '00000000-0000-4000-8000-000000000008'],
+ model: 'gpt-6-luna',
+ reasoning_effort: 'low',
+ },
+ {
+ id: candidateId,
+ label: 'Verify first',
+ launch_ids: ['00000000-0000-4000-8000-000000000009'],
+ model: 'gpt-6-sol',
+ reasoning_effort: 'high',
+ skill_body: '\nInspect the synthetic inventory.\n Verify counts before editing.\n',
+ },
+ ],
+ }
+ const response = { comparison_id: comparisonId, status: 'starting', evaluation: null }
+ const { context, request } = createContext(response)
+ const tool = GENERATED_TOOLS['scout-trial-start']!()
+
+ for (let attempt = 0; attempt < 2; attempt++) {
+ expect(await tool.handler(context, tool.schema.parse({ id: scoutId, ...body }))).toEqual(response)
+ }
+
+ expect(request.mock.calls.map(([call]) => call)).toEqual([
+ { method: 'POST', path: `${configPath}/trial_comparison/`, body },
+ { method: 'POST', path: `${configPath}/trial_comparison/`, body },
+ ])
+ })
+
+ it('adopts a reviewed rubric and forwards later full-set edits without replacing its reference', async () => {
+ const criteria = ['evidence', 'clarity', 'actionability', 'priority', 'instructions', 'memory'].map((key) => ({
+ id: `default-${key}`,
+ title: `Check ${key}`,
+ description: `Review ${key} in the inventory audit.`,
+ pass_condition: 'The recorded evidence supports the finding.',
+ applicability: 'When the audit produces a finding.',
+ enabled: key !== 'actionability',
+ source: 'default',
+ }))
+ criteria.push({
+ id: 'custom-generated-counts',
+ title: 'Support inventory counts',
+ description: 'Ground inventory totals in the recorded query result.',
+ pass_condition: 'The summary cites the verified inventory totals.',
+ applicability: 'When the scout reports inventory totals.',
+ enabled: true,
+ source: 'custom',
+ })
+ const body = { revision: 4, criteria, adopt_generation_id: generationId }
+ const response = { config_id: scoutId, revision: 5, criteria, reference_generation_id: generationId }
+ const { context, request } = createContext(response)
+ const tool = GENERATED_TOOLS['scout-rubric-save']!()
+
+ expect(await tool.handler(context, tool.schema.parse({ id: scoutId, ...body }))).toEqual(response)
+ expect(request).toHaveBeenCalledWith({ method: 'PUT', path: `${rubricPath}/`, body })
+
+ const added = [
+ ...criteria.map((criterion) =>
+ criterion.id === 'default-evidence' ? { ...criterion, enabled: false } : criterion
+ ),
+ {
+ id: 'custom-inventory-order',
+ title: 'Verify before editing',
+ description: 'Check inventory counts before changing the report.',
+ pass_condition: 'A count verification precedes the edit.',
+ applicability: 'When the scout edits a report.',
+ enabled: true,
+ source: 'custom',
+ },
+ ]
+ const edited = added.map((criterion) => {
+ if (criterion.id === 'default-evidence') {
+ return { ...criterion, enabled: true }
+ }
+ if (criterion.id === 'custom-inventory-order') {
+ return {
+ ...criterion,
+ description: 'Independently verify counts before changing the report.',
+ pass_condition: 'A successful query result arrives before the first edit is submitted.',
+ }
+ }
+ return criterion
+ })
+ const defaultsOnly = edited.filter((criterion) => criterion.source === 'default')
+
+ for (const [index, completeSet] of [added, edited, defaultsOnly].entries()) {
+ const edit = { revision: 5 + index, criteria: completeSet }
+ const saved = { ...response, revision: edit.revision + 1, criteria: completeSet }
+ request.mockResolvedValueOnce(saved)
+
+ expect(await tool.handler(context, tool.schema.parse({ id: scoutId, ...edit }))).toEqual(saved)
+ expect(request).toHaveBeenNthCalledWith(index + 2, { method: 'PUT', path: `${rubricPath}/`, body: edit })
+ }
+ })
+
+ it('starts suggestions without adopting them and reads the captured reference alongside the saved one', async () => {
+ const response = {
+ config_id: scoutId,
+ revision: 4,
+ reference_generation_id: null,
+ reference_context: null,
+ generation: {
+ id: generationId,
+ status: 'completed',
+ error: null,
+ summary: 'Two source instructions disagree about the optional inventory appendix.',
+ reference_context: { instructions: 'Verify inventory counts before editing the report.' },
+ suggestions: [],
+ },
+ }
+ const { context, request } = createContext(response)
+ const generate = GENERATED_TOOLS['scout-rubric-generate']!()
+ const get = GENERATED_TOOLS['scout-rubric-get']!()
+
+ await generate.handler(
+ context,
+ generate.schema.parse({ id: scoutId, context: 'Check the required order and optional appendix.' })
+ )
+ expect(request).toHaveBeenNthCalledWith(1, {
+ method: 'POST',
+ path: `${rubricPath}/generate/`,
+ body: { context: 'Check the required order and optional appendix.' },
+ })
+ expect(await get.handler(context, get.schema.parse({ id: scoutId }))).toEqual(response)
+ expect(request).toHaveBeenNthCalledWith(2, { method: 'GET', path: `${rubricPath}/` })
+
+ const poll = get.schema.parse({ id: scoutId, fields: ['revision', 'generation.status', 'generation.error'] })
+ expect(await get.handler(context, poll)).toEqual({
+ revision: 4,
+ generation: { status: 'completed', error: null },
+ })
+ expect(request).toHaveBeenLastCalledWith({ method: 'GET', path: `${rubricPath}/` })
+
+ const beforeGeneration = { ...response, generation: null }
+ request.mockResolvedValue(beforeGeneration)
+ expect(await get.handler(context, poll)).toEqual({ revision: 4 })
+ expect(await get.handler(context, get.schema.parse({ id: scoutId }))).toEqual(beforeGeneration)
+ })
+
+ it('keeps judgment reasons, evidence, unknown results and ranking limitations in the report', async () => {
+ const response = {
+ comparison_id: comparisonId,
+ status: 'completed',
+ error: null,
+ evaluation: {
+ status: 'completed',
+ error: null,
+ report: {
+ outcome: { status: 'inconclusive', variant_ids: [], summary: 'Too few runs could be judged.' },
+ variants: [{ variant_id: candidateId, score: null, coverage: 0, judge_errors: 1 }],
+ runs: [
+ {
+ launch_id: launchId,
+ variant_id: baselineId,
+ status: 'judged',
+ score: null,
+ criteria: [
+ {
+ criterion_id: 'custom-inventory-order',
+ verdict: 'unknown',
+ reason: 'The tool response does not establish when the verification finished.',
+ confidence: 'low',
+ evidence: [{ source_id: 'trace-1', quote: 'Verification is still pending.' }],
+ },
+ ],
+ },
+ { variant_id: candidateId, status: 'judge_error', error: 'Judge did not return a result.' },
+ ],
+ limitations: ['Missing evidence must not be counted as a failed criterion.'],
+ },
+ },
+ }
+ const { context, request } = createContext(response)
+ const tool = GENERATED_TOOLS['scout-trial-report']!()
+
+ expect(await tool.handler(context, tool.schema.parse({ id: scoutId, comparison_id: comparisonId }))).toEqual(
+ response
+ )
+ expect(request).toHaveBeenCalledWith({
+ method: 'GET',
+ path: `${configPath}/trial_comparison_result/`,
+ query: { comparison_id: comparisonId },
+ })
+
+ const poll = tool.schema.parse({
+ id: scoutId,
+ comparison_id: comparisonId,
+ fields: ['status', 'error', 'evaluation.status', 'evaluation.report.outcome'],
+ })
+ expect(await tool.handler(context, poll)).toEqual({
+ status: 'completed',
+ error: null,
+ evaluation: { status: 'completed', report: { outcome: response.evaluation.report.outcome } },
+ })
+ expect(request).toHaveBeenLastCalledWith({
+ method: 'GET',
+ path: `${configPath}/trial_comparison_result/`,
+ query: { comparison_id: comparisonId },
+ })
+
+ const beforeEvaluation = { ...response, status: 'running', evaluation: null }
+ request.mockResolvedValue(beforeEvaluation)
+ expect(await tool.handler(context, poll)).toEqual({ status: 'running', error: null })
+ expect(await tool.handler(context, tool.schema.parse({ id: scoutId, comparison_id: comparisonId }))).toEqual(
+ beforeEvaluation
+ )
+ })
+
+ it('preserves archived-history filters and the cursor envelope', async () => {
+ const cursor = `0000000000000000001-${comparisonId}.json`
+ const response = {
+ results: [{ comparison_id: comparisonId, archived: true }],
+ has_more: true,
+ next_cursor: cursor,
+ }
+ const { context, request } = createContext(response)
+ const tool = GENERATED_TOOLS['scout-trial-list']!()
+ const query = { include_archived: true, limit: 2, cursor }
+
+ expect(await tool.handler(context, tool.schema.parse({ id: scoutId, ...query }))).toEqual(response)
+ expect(request).toHaveBeenCalledWith({ method: 'GET', path: `${configPath}/trial_comparison_history/`, query })
+ })
+
+ it.each([
+ { name: 'scout-trial-resume', action: 'trial_comparison_resume', body: { comparison_id: comparisonId } },
+ {
+ name: 'scout-trial-archive',
+ action: 'trial_comparison_archive',
+ body: { comparison_id: comparisonId, archived: true },
+ },
+ {
+ name: 'scout-trial-archive',
+ action: 'trial_comparison_archive',
+ body: { comparison_id: comparisonId, archived: false },
+ },
+ ])('$name addresses the existing trial: $body', async ({ name, action, body }) => {
+ const acknowledgment = {
+ comparison_id: comparisonId,
+ config_id: scoutId,
+ status: 'completed',
+ ...('archived' in body ? { archived: body.archived } : {}),
+ error: null,
+ }
+ const response = { ...acknowledgment, evaluation: { report: { evidence: ['saved judge evidence'] } } }
+ const { context, request } = createContext(response)
+ const tool = GENERATED_TOOLS[name]!()
+
+ expect(await tool.handler(context, tool.schema.parse({ id: scoutId, ...body }))).toEqual(
+ name === 'scout-trial-archive' ? acknowledgment : response
+ )
+
+ expect(request).toHaveBeenCalledWith({ method: 'POST', path: `${configPath}/${action}/`, body })
+ })
+})
diff --git a/services/mcp/tests/unit/tool-filtering.test.ts b/services/mcp/tests/unit/tool-filtering.test.ts
index ab60d6d08225..5d1fc34e2337 100644
--- a/services/mcp/tests/unit/tool-filtering.test.ts
+++ b/services/mcp/tests/unit/tool-filtering.test.ts
@@ -917,11 +917,24 @@ describe('Tool Filtering - Read-Only Mode', () => {
})
describe('Tool Filtering - Feature Flags', () => {
- it.each([undefined, false, true])('gates private trial tools on scout-trials: %s', (enabled) => {
+ it.each([undefined, false, true])('gates rubric and private trial tools on scout-trials: %s', (enabled) => {
const tools = getToolsForFeatures({ featureFlags: { 'scout-trials': enabled } })
expect(tools).toContain('scout-runs-list')
- expect(tools.includes('scout-trial-create')).toBe(enabled === true)
- expect(tools.includes('scout-trial-get')).toBe(enabled === true)
+ for (const name of [
+ 'scout-rubric-generate',
+ 'scout-rubric-get',
+ 'scout-rubric-save',
+ 'scout-trial-create',
+ 'scout-trial-get',
+ 'scout-trial-setup',
+ 'scout-trial-start',
+ 'scout-trial-report',
+ 'scout-trial-resume',
+ 'scout-trial-list',
+ 'scout-trial-archive',
+ ]) {
+ expect(tools.includes(name), name).toBe(enabled === true)
+ }
})
const baseAnnotations = {