Operational Self-Healing: When Your System Fixes Itself Before You Notice
A health evolution lane that detects sustained degradation, attempts bounded auto-remediation, and logs honest outcomes.
The Concept
Most production systems fail quietly. Latency creeps up. Error rates drift. A daemon stops heartbeating. Nobody notices until a customer emails or a pager fires at 3am.
Operational self-healing flips that sequence. Instead of waiting for a human to discover degradation, the system watches its own health signals on a schedule, opens structured findings when metrics cross sustained thresholds, attempts automated remediation when safe, and logs every outcome — including failures — on a dashboard you can review over coffee.
Think of it like a clinic that runs nightly blood work. You don't wait until you feel sick. The lab flags elevated markers, tries standard interventions (rest, hydration, a known prescription), and only escalates to the doctor when auto-treatment didn't clear the reading. Some results come back resolved on their own. Others stay open until a human decides what to do. Both outcomes are visible.
This is not "AI that never breaks." It is honest telemetry plus bounded auto-fix attempts. The goal is to shrink the gap between "something degraded" and "someone looked at it" — ideally with the system already having tried the boring fixes.
When to apply
- You run long-lived background jobs (daemons, workers, cron) where silent failure is expensive
- You already collect metrics and assessment scores but review them manually
- Degradations are often repeatable (timeouts, stale heartbeats, cost spikes) with known fix patterns
- You want a slow feedback loop that complements fast agentic coding loops
Common pitfalls
- Treating every failure as shameful. A 30% auto-fix success rate with full visibility beats 0% with silent breakage. Publish the failure count.
- Auto-fixing without guardrails. Cap concurrent remediation attempts, require notify-only for critical paths, and never auto-merge destructive changes without human approval.
- Missing the "sustained" qualifier. One bad hour is noise. Three consecutive assessment cycles below baseline is a finding.
- No closure criteria. Define what "self_healed" means (metric recovered for N cycles) or findings linger forever.
Quick Win: Claude Skill
Paste this prompt when you want to design or audit a self-healing health lane for an existing system:
You are a staff engineer designing an operational self-healing lane for a production system.
I will paste:
1) A list of metrics we already collect (latency, error rate, cost, heartbeat freshness, assessment scores)
2) Recent incidents or degradations we handled manually
Your job:
- Propose a HealthFinding lifecycle (statuses, transitions, closure rules)
- Classify each metric into: notify-only vs auto-fixable vs requires code change
- Define "sustained degradation" thresholds (not one-off spikes)
- Draft a 5-row findings table example with realistic open/self_healed/failed outcomes
- List 3 guardrails that prevent runaway auto-remediation
Output format:
## Finding lifecycle
## Metric classification table
## Example findings dashboard (markdown table)
## Guardrails
## MVP vs v1 scope split
Constraints:
- No vendor-specific product names
- Prefer notify-only when business judgment is required
- Auto-fix only for reversible, low-blast-radius actions (retry, cache clear, toggle feature flag, reschedule job)
Example input to paste:
Metrics: p95 enrich latency, HTTP LLM timeout rate, weekly quality score (0-100), brain cycle duration, PM2 heartbeat age
Recent manual fixes: restarted stale daemon, rolled back model routing change, increased poll interval after cost spike
Expected output: A lifecycle diagram in prose, a table mapping each metric to remediation tier, and a realistic dashboard showing 2 open + 4 self_healed findings.
Iteration tips:
- If the model over-automates, add: "Default 80% of findings to notify-only for MVP."
- If thresholds feel vague, ask: "Give numeric examples for each sustained threshold."
Full System Specification
Problem statement
Engineering teams operating agentic or multi-daemon systems accumulate health metrics faster than they review them. Manual dashboard checks do not scale. The system needs a health evolution lane: ingest assessment results, materialize findings, route to notify/auto-fix/code-change paths, and close the loop when metrics recover.
Architecture overview
| Component | Responsibility | |-----------|----------------| | Metric collector | Aggregates latency, error, cost, heartbeat, quality scores on a fixed cadence | | Assessment engine | Compares current window vs baseline; emits sustained degradation signals | | Findings store | Durable queue of open/resolved findings with severity and codifiability | | Remediation router | Maps finding type → notify, auto-fix script, or evolution/code queue | | Effectiveness tracker | Records resolution method, time-to-close, success rate for calibration | | Dashboard | Human review surface: open findings, recently self-healed, attempt/failure counts |
Metrics → Assessment → Finding (open) → Router
├─ notify only → dashboard
├─ auto-fix → attempt → self_healed | retry | open
└─ code EU → worktree → PR → merged
Data model
type FindingStatus = 'open' | 'investigating' | 'enqueued' | 'merged' | 'dismissed' | 'self_healed';
type Codifiability = 'notify' | 'code' | 'none';
type Severity = 'watch' | 'degraded' | 'critical';
interface HealthFinding {
id: string;
metric: string; // e.g. enrich_latency_p95, llm_http_timeout_rate
source: string; // assessment | heartbeat | cost_governance
severity: Severity;
status: FindingStatus;
codifiable: Codifiability;
summary: string;
openedAt: string;
resolvedAt?: string;
dismissReason?: string; // assessment_cleared | manual | stale
attemptCount: number;
lastAttemptAt?: string;
}
interface HealthEvolutionEffectiveness {
findingId: string;
resolution: FindingStatus;
durationHours: number;
costDeltaUsd?: number;
recordedAt: string;
}
Phased rollout
MVP (week 1–2)
- Ingest 3–5 key metrics from existing logs
- Create findings on sustained breach only
- Notify-only — dashboard + daily digest, no auto-fix
- Track open vs self_healed manually when humans fix issues
v1 (week 3–6)
- Add remediation router with 2–3 safe auto-fix actions (retry, reschedule, cache invalidate)
- Define closure rules: metric below threshold for 2 consecutive cycles →
self_healed - Publish success/failure counts on dashboard (transparency beat)
v2 (month 2+)
- Route codifiable findings to automated code-change queue with PR + test gate
- Effectiveness scoring: which finding types actually benefit from auto-fix vs notify-only
- Cap weekly auto-merge budget; critical findings always notify-only
Technology recommendations
- Storage: Postgres or key-value store for findings queue; time-series DB or metric logs for source data
- Scheduler: Cron or daemon tick (15min–6h) for assessment passes
- Notifications: Slack/GChat for open critical findings; dashboard for everything else
- Auto-fix: Idempotent scripts invoked with finding context; never destructive without approval
- Observability: Log every state transition; metric
health_findings_open,health_self_healed_total,health_auto_fix_failure_total