Auto-Fix System Uses Claude Code Headless to Detect and Fix Production Errors

✍️ OpenClawRadar📅 Published: March 8, 2026🔗 Source
Auto-Fix System Uses Claude Code Headless to Detect and Fix Production Errors
Ad

How the Auto-Fix System Works

A developer has built an automated system that detects and fixes production errors using Claude Code CLI in headless mode. The system has been running for several weeks and is described as free and open source, requiring only a Claude subscription.

System Architecture

The workflow follows this sequence:

  • Production logs are monitored
  • A watcher fingerprints errors, groups duplicates, and classifies severity
  • 30-second settle window
  • Critical/High error detection triggers the system
  • Git worktree created (isolated branch that never touches main)
  • Claude Code launched headless, scoped to the specific error
  • Telegram notification: "New Error — Approve Fix?" with Approve/Skip options
  • PR created automatically if approved

Key Implementation Details

The developer identified git worktrees as a critical component — each error gets its own isolated copy of the repository. Claude can read, edit, run tests, and perform other operations within this isolated environment. If a fix is unsatisfactory, the worktree can be deleted without affecting the main branch.

Claude sessions receive focused prompts containing:

  • Error message
  • Stack trace
  • Affected path
  • Severity level

The headless session runs with scoped tools: Read, Write, Edit, Glob, Grep, and Bash. An example prompt provided: "Fix this production error in the LevProductAdvisor codebase. Error: MongoServerError: connection pool closed. Stack: at MongoClient.connect (mongo-client.ts:88). Path: POST /api/products/list. Severity: CRITICAL."

Ad

Results and Performance

According to the developer:

  • Critical infrastructure errors (database connection, authentication): Claude fixes 70-80% correctly
  • Logic bugs with clear stack traces: Solid performance
  • Vague errors without good stack traces: Hit or miss, usually skipped

The system handles straightforward issues like missing null checks or bad query logic effectively, often nailing them on the first attempt.

Additional Features

The developer built an interactive Telegram dashboard for monitoring:

  • Queue Status
  • Recent Errors
  • System Status
  • Refresh capability

The /errors view pulls from MongoDB and displays status information like "fixing • 5m ago," "detected • 12m ago," or "fixed • 2h ago."

Technical Stack

The system uses TypeScript, Express, MongoDB, node-telegram-bot-api, and Claude Code CLI. The developer notes that using the headless CLI avoids API costs, requiring only a Claude subscription running locally. Each session is scoped and isolated in a worktree, minimizing risk.

The developer plans to publish the repository on GitHub, describing it as generic — users point the watcher at their log files and configure severity patterns.

📖 Read the full source: r/ClaudeAI

Ad

👀 See Also

OCTO-VEC: Open-source virtual software company with 24 AI agents
Tools

OCTO-VEC: Open-source virtual software company with 24 AI agents

OCTO-VEC is an open-source TypeScript/SQLite project that simulates a software company with 9 default AI agents and 15 hirable specialists. It includes automated security scanning, per-agent git identities, and supports 22+ LLM providers.

OpenClawRadar
SIDJUA v0.9.7: Open Source Multi-Agent AI with Pre-Action Governance Enforcement
Tools

SIDJUA v0.9.7: Open Source Multi-Agent AI with Pre-Action Governance Enforcement

SIDJUA v0.9.7 is a self-hosted, open source multi-agent AI framework that enforces governance rules before agents act, blocking unauthorized actions like budget overruns or scope violations. It supports multiple LLM providers, runs on 4GB RAM, and includes a desktop GUI built with Tauri v2.

OpenClawRadar
OpenClaw Local Agent Implementation with TurboQuant Caching for Mid-Range Hardware
Tools

OpenClaw Local Agent Implementation with TurboQuant Caching for Mid-Range Hardware

A one-click app for OpenClaw with local models now runs on mid-range devices like MacBook Air with 16GB RAM using TurboQuant caching and context warming. The implementation patches llama.cpp for reliable tool calling and achieves 10-15 tokens per second with Gemma 4 and QWEN 3.5.

OpenClawRadar
Transloadit MCP Server Connects AI Agents to Media Processing Pipeline
Tools

Transloadit MCP Server Connects AI Agents to Media Processing Pipeline

Transloadit built an MCP server that connects Claude and other AI agents to their media processing pipeline with 86 Robots for video, audio, image, and document processing. Setup in Claude Code requires one line: npx -y @transloadit/mcp-server stdio with TRANSLOADIT_KEY and TRANSLOADIT_SECRET environment variables.

OpenClawRadar