Built with Claude Code Agent SDK

Your codebase
heals itself.

A local agent that polls GitHub issues, investigates bugs by spawning Claude Code instances, and autonomously creates fix PRs—or explains why it’s not a bug.

5 issues triaged
$1.69 total cost
< 5 min per issue
0 config needed
agent — triage cycle
$ npx tsx src/index.ts [19:14:13] === Triage Agent started === [19:14:13] Found 5 unprocessed issues [19:14:13] Processing issue #100: Where do I see my progress dashboard? [19:15:25] Investigation complete (cost: $0.48) [19:15:25] Issue #100: isValidBug=false, confidence=high [19:15:28] Commented, labeled not-a-bug, closed [19:16:23] Issue #101: isValidBug=false (already fixed in recent commit) [19:17:21] Issue #103: isValidBug=false [19:18:09] Issue #105: isValidBug=false [19:19:12] Issue #106: confidence=low → needs-review [19:19:14] Results posted to server (5 issues) [19:19:14] === Triage complete: 5 issues processed ===

From issue to resolution,
fully autonomous.

The agent runs as a macOS launchd job. Every hour it polls, investigates, decides, and acts—then exits. No long-running process.

1. Poll GitHub Issues

Fetches open issues labeled bug + student-report without triage-processed. Oldest first.

2. Parse structured bug report

Extracts lesson ID, description, terminal history, validation rules, filesystem state, reporter info from the markdown body.

3. Investigate with Claude Code

Spawns a read-only Claude Code instance via the Agent SDK. It reads CLAUDE.md, lesson JSONs, component code, validation logic, and recent git history.

const result = await query({ prompt: investigationPrompt, options: { allowedTools: ['Read', 'Glob', 'Grep', 'Bash(git log *)'], model: 'sonnet', } });

4. Three-way decision

Based on the investigation, the agent takes one of three paths:

auto-fix

Valid bug, high confidence, auto-fixable. Spawns Claude Code with write+git tools. Creates branch, fixes, commits, pushes. Orchestrator opens draft PR.

needs-review

Valid bug, but low confidence or too complex. Comments investigation findings on issue. Adds needs-human-review label.

not-a-bug

User misunderstanding or already fixed. Comments explanation, adds not-a-bug label, closes issue.

5. Report & notify

POSTs results to the server API. Server stores in PostgreSQL, sends reporter emails, and delivers admin digest. Agent exits. launchd relaunches next hour.

Local agent, remote server,
GitHub glue.

The agent runs on your Mac. The server on Render. They share a single secret: the GitHub PAT.

💻 Local Agent

Your Mac · launchd · hourly

Polls issues, spawns Claude Code for investigation + fix, pushes branches, creates draft PRs via Octokit. POSTs results to server.

☁️ Render Server

Express + PostgreSQL

Receives triage results via authenticated POST. Stores runs + issues in DB. Sends reporter emails via Resend. Serves admin dashboard API.

📊 Admin Dashboard

/admin/triage

Stats, decision breakdown, run history with expandable issue details. Links to GitHub issues and PRs. Real-time cost tracking.

Agent file structure

agent/ src/ index.ts # Entry point — single poll cycle config.ts # Auto-detects token, repo, project root github.ts # Octokit: issues, labels, comments, PRs issueParser.ts # Parse markdown → ParsedBugReport claudeAgent.ts # Agent SDK: investigate + fix reportResults.ts # POST results to server logger.ts # Daily rotating file + console types.ts # TriageResult, InvestigationResult, ... package.json tsconfig.json com.zero2claude.triage-agent.plist

Full visibility into every decision.

The admin dashboard shows aggregate stats, decision breakdowns, and expandable run details with per-issue cost tracking.

/admin/triage
Total Runs
1
Issues Processed
5
Needs Review
1
Total Cost
$1.69
Decision Breakdown
Auto-fixed (0)
Needs review (1)
Not a bug (4)
Run Details — Mar 8, 2026, 9:14 PM
Issue Title Decision Confidence Cost
#100 Where do I see my progress dashboard? not a bug high $0.48
#101 I don't see the end result of this question not a bug high $0.25
#103 Doesn't bring me back to dashboard not a bug high $0.42
#105 Passed these stages yesterday, doesn't show not a bug high $0.28
#106 Finished challenge but didn't advance needs review low $0.27

Batteries included, guardrails built in.

Zero config

Auto-detects GitHub token from gh auth token, repo from git remote, Claude auth from local installation. No .env file required for basic operation.

🔍

Two-phase investigation

Phase 1: read-only Claude Code instance for investigation. Phase 2: write+git instance only if the bug is valid, high confidence, and auto-fixable.

🛡️

Draft PRs only

Never auto-merges. All fixes go through draft PRs for human review. Low-confidence bugs are always routed to manual review.

🧪

Dry run mode

DRY_RUN=true logs every decision without executing any GitHub actions. Safe testing before going live.

📝

Git history awareness

Checks recent commits before investigating. If a bug was already fixed in a recent commit, it's classified as not-a-bug automatically.

📧

Email notifications

Server sends terminal-noir themed emails to reporters (fix created / confirmed / not a bug) and admin digest after each cycle.

Minimal dependencies, maximum leverage.

Claude Code Agent SDK TypeScript Node.js Octokit Zod macOS launchd Express PostgreSQL Drizzle ORM Resend React Tailwind CSS