Operant Studio
OPER-212

OPER-QA-4 Autonomous triage agent (dedupe + classify + enrich + risk-score)

Suggested
Justin Cooke

Body

---
feature_id: FEAT-studio-qa
size: L
module: intake
write_sets:
  - packages/triage/src
  - apps/jobs/src/triage-worker.ts
phi_in_scope: true
has_migration: false
verification_cmd: pnpm --filter @operant/triage test
---

## Context

Ratified [REDACTED-DOB] via PDT. Child of OPER-211. See project wiki `concepts/signal-triage-primitive.md`.

On every new Signal row, the triage agent runs: dedupe against existing Signals -> classify (BUG_FIX / MINOR_IMPROVEMENT / NEW_FEATURE / NEW_MODULE / NEW_PROBLEM / NOT_FEATURE_SHAPED) -> enrich (related signals, tickets, feature ownership, current strategy alignment) -> risk-score into typed RiskFactors -> compute Tier -> write TriageResult -> dispatch fate.

## Acceptance Criteria

- Triage agent implemented as a worker in apps/jobs subscribing to Signal-created events
- Tier 1 gate is machine-checkable and reads all seven RiskFactors booleans + classification in (BUG_FIX, MINOR_IMPROVEMENT) + strategy_fit_score >= config threshold
- phi_touched defaults true on any classifier uncertainty (Marisol mitigation, non-negotiable)
- Tier 1 output during shadow mode: writes TriageResult + creates Build ticket with human-approval-required flag; does NOT auto-dispatch until 30-day shadow window ends
- Tier 2 output: writes TriageResult + creates DecisionTask assigned to Justin (default decider per approval)
- Tier 3 output: writes TriageResult + creates Discovery task with attached memo
- NOT_FEATURE_SHAPED output: routes to answer/close/dedupe path (no downstream ticket)
- strategy_fit_score reads from a per-project goals list in config (JSON), NOT from a parsed goals doc (Jordan mitigation for launch scope)
- If Build rejects a Tier-1 promotion for authority reasons, auto-flip the signal to Tier 2 (Ren mitigation)
- Weekly PHI audit job: compare auto-promoted signals against actual PR diffs, flag any PR touching @PHI-annotated fields despite phi_touched=false (Marisol mitigation, must ship before shadow window ends)
- Tests cover: dedupe hits, each classification path, each RiskFactor gate individually failing, Tier 1/2/3 dispatch, shadow-mode behavior, Build-authority auto-demotion

---
<!-- admission-passed-on-patch -->
**Admission re-checked on PATCH: PASS** -- feature FEAT-studio-qa admitted to product studio

---
<!-- planner-rescope: phi_no_reviewer -->
**Planner rescope (phi_no_reviewer):** Task has phiInScope=true but no PHI-eligible reviewer is available. Register a reviewer worker advertising the `phi` capability before admitting PHI work.

Attachments

Loading attachments…

Comments

Loading comments…