Skip to main content

Overview

The Quality Harness is V5’s self-improvement loop. It automatically samples tool call traces, evaluates them with three independent LLM judges, and surfaces regressions before they affect production. Agents can also send feedback directly via submit_feedback.

How grading works

Every tool call that passes the sampling threshold is evaluated by a tri-judge panel: All three judges run in parallel and evaluate the same trace against the same rubric. Their verdicts are stored in the grader_verdicts D1 table. Disagreements surface router errors — if judges disagree on the domain category, the categorical router has a bug.

Verdict schema

Each judge emits a structured verdict via tool-use (never free text):

Quality scale

Domain categories

All 12 V5 domains that tool calls route through: crm_read · crm_write · ads_read · ads_mutate · analytics_report · content_generate · email_send · calendar_op · search_query · data_query · agent_orchestration · error_recovery

Issue taxonomy

A trace can have 0–9 issues flagged:

The submit_feedback tool

Any connected AI tool (Claude, Cursor, ChatGPT, Codex, Hermes) can call submit_feedback when it encounters a blocker. This is the direct line from the wild back to the V5 roadmap.
Feedback is written to the agent_feedback D1 table. Mishaal triages weekly via GET /admin/feedback. Patterns become product features.

Severity levels

Risk gate

Traces that score quality ≤ 2 or flag unsafe_action trigger an alert to SLACK_WEBHOOK_URL. Three consecutive quality ≤ 2 verdicts on the same tool path open an automatic incident in the error_ledger.

Sampling rate

Not every tool call is graded — the harness samples based on:
  • Tool category (higher sampling for mutations: crm_write, ads_mutate, email_send)
  • Tenant tier (higher sampling for production tenants)
  • Recent quality trend (higher sampling after quality degradation)
The sampling configuration is in src/grader/sampling.ts. Adjust via GRADER_SAMPLE_RATE KV key (0.0–1.0, default 0.1 = 10%).

Viewing grader output