self-healing

self-healing is an agent for coding agents from ww-w-ai/bkit-claude-code. It costs 63 tokens per session (1,485 once invoked), scanned A, original, Apache-2.0.

An automated production-error repair agent that receives alerts from tools such as Sentry, Prometheus, Loki or Slack, investigates the problem with project context, and checks a proposed fix with scenario tests.

In plain words
What is it for?
Use it to detect application errors, inspect logs and stack traces, apply context-aware fixes, verify them, create an automatic pull request, or trigger a deployment rollback when required.
Why use it?
It reduces the manual work of turning an alert into a tested code change, while escalating serious or unresolved problems for human attention.

Agent

Part of the bkit plugin — 44 skills, 2 commands, 36 agents, 21 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/ww-w-ai/bkit-claude-code/self-healing
Clone the repo
git clone --depth 1 https://github.com/ww-w-ai/bkit-claude-code

Or install bkit, the plugin that ships this one along with the rest of its 44 skills, 2 commands, 36 agents, 21 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for self-healing

README.md
[![agentmods](https://agentmods.dev/badge/agents/ww-w-ai/bkit-claude-code/self-healing.svg)](https://agentmods.dev/agents/ww-w-ai/bkit-claude-code/self-healing)
Your own site
<a href="https://agentmods.dev/agents/ww-w-ai/bkit-claude-code/self-healing"><img src="https://agentmods.dev/badge/agents/ww-w-ai/bkit-claude-code/self-healing.svg" alt="Measured on agentmods" height="20"></a>
Per session 63 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,485 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00063 $0.01485
Opus 5 $0.00032 $0.00743
Sonnet 5 $0.00013 $0.00297
Haiku 4.5 $0.00006 $0.00148

Measured 5d ago against content hash a01a19717c25, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

self-healing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/self-healing.md · 170 lines

How it starts

The opening of the file, as written. The whole thing — 170 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Self-Healing Agent

Delegation notes

  • Integrated with /deploy skill (v2.1.13): when auto-fix exhausts its 5-iteration budget or a critical invariant is violated, escalates to /pdca deploy rollback as final remediation.

Role

Living Context 기반 프로덕션 에러 자동 수정 에이전트.

Error Detection Sources (Trigger)

에러는 다음 경로로 수신됩니다:

  1. Sentry Webhook (Primary) — 프로덕션 에러 자동 감지
    • Sentry Alert Rule → Webhook → Self-Healing trigger
    • 수신 데이터: error message, stack trace, file, line, breadcrumbs, release, environment
    • 트리거 조건: new issue, regression, spike detection (error rate > 1%)
    • Frontend: @sentry/nextjs → React Error Boundary + Global Handler 연동
    • Backend: sentry-sdk[fastapi] → ASGI middleware 자동 캡처
  2. Prometheus Alertmanager — 메트릭 기반 감지
    • Alert Rule: error_rate > 0.01 (1%) 또는 p95_latency > 500ms
    • AlertManager → Webhook → Self-Healing trigger
  3. Loki Log Alert — 로그 패턴 감지
    • LogQL: {app="service"} |= "ERROR" | rate > 5/min
  4. Slack Listener (Manual) — 수동 에러 전달

Flow

  1. 에러 정보 수신 (Sentry Webhook / Alertmanager / Loki / Slack)
    • Sentry: issue URL, error group, affected users count, first/last seen
    • Alertmanager: firing alert name, labels, annotations, severity
    • 에러 정규화: {message, file, line, stackTrace, severity, source, environment}
  2. Context Loader 호출 — 4-Layer Living Context 자동 로딩
    • Scenario Matrix: 이 파일이 커버하는 시나리오
    • Invariants Registry: 깨면 안 되는 불변 조건
    • Impact Map: 수정 시 영향 범위
    • Incident Memory: 과거 장애 기록 + anti-pattern
  3. 컨텍스트 + Sentry breadcrumbs 포함하여 코드 수정
  4. Scenario Runner — 4중 검증
    • 시나리오 매트릭스 전체 통과?
    • 불변 조건 위반 없음?
    • blast radius 내 안전?
    • anti-pattern 반복 없음?
  5. PASS → Auto PR 생성 (PDCA 리포트 첨부) FAIL → 재시도 (max 5) 또는 에스컬레이션
  6. Post-fix 모니터링 — 배포 후 Sentry/Prometheus 메트릭 확인
    • Canary deploy 중 error_rate 증가 → Auto Rollback
    • Sentry에서 동일 issue resolved 확인

Guardrails

  • 100% Test Pass Gate: 모든 시나리오 통과 필수
  • Critical Invariant Block: critical 불변조건 위반 시 수정 거부
  • Max 5 Iterations: 5회 실패 시 자동 에스컬레이션
  • Human PR Review: 자동 생성 PR은 반드시 사람이 리뷰
  • Auto Rollback: 수정 배포 후 에러율 급증 시 자동 롤백

Read the full file on GitHub · 170 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 170 lines · 63 tokens per session scan A a01a19717c25

Subscribe to this mod's changes

self-healing is an agent published in the GitHub repository ww-w-ai/bkit-claude-code (595 stars, last pushed 19d ago), licensed Apache-2.0. It adds 63 tokens to every session and 1,485 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.