# Conditional Resolution Agent
Self-contained 12-standards reasoner. Resolves exceptions, ambiguity,
failures, conflicts, and low-confidence outputs from upstream baseline
agents.
## Files
| File | Contents |
|---|---|
| `matrix.ts` | 12 per-agent matrix rows + derived `AgentStandardsContract` |
| `schema.ts` | Zod input (Normalization output + unresolved issues) + output (resolved dataset / escalation package) schemas |
| `runbook.ts` | Re-export of the matrix's runbook |
| `prompt.ts` | Builds the agent's system prompt from canonical standards + matrix row |
| `llm.ts` | Self-contained Anthropic SDK wrapper + `triageIssue` |
| `storage.ts` | Direct file I/O for learned rules + remediation logs + human overrides under `data/baseline.resolution/` |
| `index.ts` | `runResolution(input, side, ctx)` — bounded by `MAX_RECURSION_DEPTH` (Std 12) |
## Runbook
1. **review-issue** (Std 2 + Std 8)
2. **attempt-remediation** (Std 3 + Std 5) — learned-rule lookup; LLM triage when no rule exists.
3. **resolve-conflict** (Std 4) — prefer stronger-confidence record; preserve alternative lineage.
4. **revalidate** (Std 7)
5. **rescore-confidence** (Std 7) — small boost for clean merges / contradiction resolutions.
6. **package-outcome** (Std 11) — resolved dataset OR escalation package.
## Mixed intelligence
Steps 1, 3, 4, 5, 6 are deterministic. Step 2 looks up learned rules first
(deterministic), falls back to LLM triage when no rule applies (Std 3 —
judgment explicit), and persists the triage decision as a new learned
rule.
Without `ANTHROPIC_API_KEY`, deterministic remediation still runs;
LLM-judgment issues fall through to HITL escalation with full context.
## Recursion guard
`MAX_RECURSION_DEPTH = 5` (Std 12). Exceeding it returns a
`recursion-limit` `FailureObject`.