Back to feed
Dev.to
Dev.to
7/24/2026
A Weekly Self-Audit Script for Claude Code: Detecting Degradation and Auto-Repairing CLAUDE.md

A Weekly Self-Audit Script for Claude Code: Detecting Degradation and Auto-Repairing CLAUDE.md

Original: When Claude Detects "Why Isn't This Fixed Yet?" and Repairs Its Own CLAUDE.md: A Self-Improvement Loop Driven by Frustration Signals in Transcripts

Short summary

A detailed walkthrough of a weekly launchd script that audits Claude Code transcripts for degradation signals — inject byte size, agent count, stop-hook spam, user frustration phrases, and tool errors. When thresholds are breached, Claude Code (sonnet) automatically repairs the environment, re-measures independently, and reports to Discord. The author discovered 99 stale agents, a 228KB CLAUDE.md, and excessive stop-hook firings, then built a self-healing loop to prevent recurrence.

  • Weekly launchd script collects 5 metrics from Claude Code transcripts and auto-repairs when thresholds breach
  • Detects frustration via Japanese regex patterns in user-only messages, excluding meta blocks
  • Claude Code sonnet fixes issues, re-measures independently, and reports to Discord — self-reports are not trusted

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more