Cohort scanners: cross-transcript analysis#7
Draft
trentshaines wants to merge 1 commit into
Draft
Conversation
Cohort scanners analyze a *group* of related transcripts together — e.g. the same task across models or epochs — so an agent can root-cause why some attempts succeeded and others failed and identify the chokepoints where they diverged. This realizes the latent `Sequence[Transcript]` scanner input from design/scout.qmd. The change is additive: existing per-transcript scanners are unchanged. A cohort scanner is declared `@scanner(group_by=[...])` and receives a single `Cohort` (members + grouping key + an `upstream` accessor for future dependencies), one composable input type for every cohort kind. Scope is configurable per-scanner in a scan job / scout.yaml (presets: same_task_across_models / same_task_in_sample / same_task_across_agents), so one scanner can run at multiple scopes via distinct keys. Engine (single-process for this release): - Grouping freezes cohort membership into ScanSpec.cohorts (resume-safe); a stable cohort_id slug + members_digest detect drift (re-scan + warn). - A phase-B executor runs each cohort scanner once per cohort, reading members lazily; the per-transcript pipeline is untouched. - Cohort results reuse the scanner=<key>/<cohort_id>.parquet recorder layout, so compaction / discovery / scan_results_df need no changes. - Degraded runs (a member can't be read) record an honest members_digest over the members actually scanned (+ missing_members), so they re-run when the member arrives rather than caching a partial result. - Reference.transcript_id (nullable) + Error.cohort_id added; cohort scanners are rejected from as_scorer and per-sample metrics. Built-in `llm_cohort_scanner` + `transcripts_as_str` provide the comparison agent with namespaced [T#:M#] citations that carry transcript_id. Tests: cohort grouping, mixed per-transcript+cohort scans, per-scanner scope override, Cohort input shape, degraded/honest-digest re-run, resume + drift, as_scorer rejection, llm_cohort_scanner e2e. openapi.json + generated.ts regenerated (cohort-only, additive).
trentshaines
force-pushed
the
cohort-scanners
branch
from
June 29, 2026 10:06
531c23b to
b4ae61d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cohort scanners: cross-transcript analysis
Adds cohort scanners — scanners whose input is a group of related transcripts (
Sequence[Transcript]) rather than a single one — so an agent can root-cause why some attempts at the same task succeeded and others failed, and identify the chokepoints where they diverged, by comparing transcripts.This realizes the latent
Sequence[Transcript]scanner input described indesign/scout.qmdthat was never implemented. The change is additive — existing per-transcript scanners are unchanged.Authoring
Or use the built-in comparison agent:
Differing scopes (configurable)
One scanner can run at multiple scopes via distinct keys (
scout.yaml):Presets:
same_task_across_models,same_task_in_sample,same_task_across_agents. Grouping dimensions are existingTranscriptInfofields (task_set,task_id,task_repeat,model,agent,source_id).How it works
_cohort.py): groups the transcript index into cohorts with a stablecohort_id+members_digest; the plan is frozen intoScanSpec.cohortsso resume rebuilds the same groups. On resume, recorded cohorts skip; drifted membership re-scans with a warning._scan_cohorts.py): a phase-B executor runs each cohort scanner once per cohort, reading members lazily (bounded concurrency). The per-transcript pipeline is untouched.scanner=<key>/<cohort_id>.parquetbuffer layout, so compaction/discovery/scan_results_dfneed no changes.Referencegained a nullabletranscript_id(so[T1:M3]vs[T2:M3]disambiguate);Errorgainedcohort_id; cohort scanners are rejected fromas_scorerand per-sample metrics.Tests / verification
transcripts_as_strrenderer,llm_cohort_scannere2e with cross-transcript references.mypyandruffclean on all new/changed files.openapi.json+generated.tsregenerated (cohort-only, additive). Frontendpnpm typecheckpasses.Notes for review
meridianlabs-ai/inspect_scout) PR after review.dist/was not rebuilt here (this PR adds no frontend runtime code; a fresh-envpnpm buildwould only introduce build-tool version churn). Rebuild in the canonical env before merge if desired.