feat: implement Crosscheck Work experiment

Add the 'Crosscheck Work' experiment to the Agents settings. When enabled,
a reviewer sub-agent is spawned after the main agent finishes a turn (with
no pending tool calls). The reviewer critiques the output using a dedicated
system prompt focused on correctness, simplicity, and code quality. If the
reviewer does not respond with 'LGTM!', its feedback is injected as a
synthetic user query back to the main agent, which must address it. This
loop continues until the reviewer approves or max iterations is reached.

Components:
- Feature flag: CrosscheckWork (enabled in DOGFOOD_FLAGS)
- Settings: agents.experiments.crosscheck_enabled,
  agents.experiments.crosscheck_model_id,
  agents.experiments.crosscheck_max_iterations
- Settings UI: new 'Experiments' subpage under Agents
- Crosscheck module: app/src/ai/crosscheck/ with prompt, reviewer model
- Controller integration: hooks into AfterStreamFinished when no actions
  are queued, triggers reviewer, handles feedback injection
- Provider support: OpenAI-compatible and Bedrock direct invocation
- Safety: max iteration guard, error handling, reset on new user query
This commit is contained in:
Ryan Ward
2026-07-22 15:58:55 -05:00
parent ca2cf6f8d6
commit e5062ae432
9 changed files with 912 additions and 7 deletions
+16
View File
@@ -0,0 +1,16 @@
//! Crosscheck Work Experiment
//!
//! This module implements the "Crosscheck Work" experiment: after the main
//! agent finishes a turn (no pending tool calls), a reviewer sub-agent is
//! spawned to critique the output. If the reviewer does not respond with
//! "LGTM!", its feedback is injected as a synthetic user query to the main
//! agent, which must act on it. This loop continues until the reviewer is
//! satisfied or the maximum iteration count is reached.
//!
//! The reviewer is a lightweight, no-tool agent that only receives the
//! conversation context and produces text feedback.
mod prompt;
mod reviewer;
pub use reviewer::{CrosscheckReviewer, CrosscheckReviewerEvent, ReviewOutcome};