Critic

Self-correction

A separate LLM role that grades the plan AND the synthesized answer on groundedness, scope match, citation quality, completeness. On reject (approve=false), forces a single corrective revision.

After every plan + every answeron-demand

What this agent actually does, step by step.

  1. 01

    Called by app/lib/agent.ts:criticize() at two hooks: post-plan, post-synth

  2. 02

    Returns { score: 0..1, issues: string[], approve: boolean }

  3. 03

    On approve=false, the orchestrator re-runs the failed phase ONCE with the critic's issues injected as corrective system prompt

  4. 04

    Caps revisions at 1 per phase to bound latency

  5. 05

    Emits SSE 'critique' event (score + approve + issues) and 'revising' if revision triggered

Inputs & outputs.

Inputs

  • · plan_or_answer: object
  • · query: string
  • · context: object

Outputs

  • · { score, issues, approve } + SSE critique/revising events

Where this agent lives in the codebase.

app/lib/agent.ts

criticize() function

app/api/agent/route.ts

Hooks the critic into the loop

Last 0 runs that touched this agent.

auto-refresh 60s

No recent runs touched Critic yet.