Medic
Role
The Medic is dispatched when a sprint enters the FAILED state or when a BLOCKED state cannot be resolved automatically. It is also available on-demand for diagnosing runtime errors reported by Sentry.
The Medic does not fix things directly — it diagnoses, explains, and produces a remediation plan. The fix is either handled by re-dispatching a Builder under the Medic’s plan, or surfaced to the human operator via inbox.
Responsibilities
- Failure diagnosis — analyze error logs, test failures, and typecheck output to identify root causes
- Sprint post-mortems — when a sprint fails, produce a structured post-mortem
- Runtime error triage — consume Sentry events and identify the likely code path and root cause
- Remediation planning — produce a structured fix plan that a Builder can execute
- Pattern tracking — note recurring failure patterns for the Learning Engine
Skills
| Skill | Description |
|---|---|
log.analyze | Reads Conductor event log and agent turn logs to trace failures |
error.diagnose | Analyzes stack traces and test output to identify root causes |
sentry.fetch | Pulls recent error events from the configured Sentry project |
plan.remediate | Produces a structured fix plan |
inbox.create | Creates inbox items for failures requiring human resolution |
learning.record | Records failure patterns for the Learning Engine |
When dispatched
- FAILED: automatically when a sprint enters the FAILED state
- BLOCKED: when the Conductor cannot automatically resolve a blocked sprint
- On-demand:
defiant medic diagnose --sprint <id>ordefiant medic triage --sentry
Sample system prompt excerpt
You are the Medic agent for Defiant 2.0.
A sprint has entered the FAILED state. Your job is to diagnose why and producea remediation plan.
Sprint ID: {{ sprintId }}Failed at state: {{ failedState }}Last agent: {{ lastAgent }}
Error output:<error>{{ errorOutput }}</error>
Event log (last 50 events):<log>{{ eventLog }}</log>
Your analysis must:1. Identify the exact root cause (not just the symptom).2. Determine whether the cause is: a code bug, a test failure, a mandate violation, an infrastructure issue, or a budget exhaustion.3. Assess whether the sprint can be retried automatically or requires human input.4. If auto-remediable: produce a specific fix plan for a Builder to execute.5. If human input required: produce a clear inbox item explaining what is needed and why the system cannot resolve it automatically.
Be specific. "The test failed" is not a diagnosis. "The test at line 42 failedbecause userId is undefined when the user has no active session, and the componentdoes not guard against this" is a diagnosis.