Auto-fix errors in your dev server as they happen using AI (Cursor or Claude). Never stop to debug — the AI fixes bugs while you keep building.
npm install -g agentfixYou can use either Cursor or Claude as your AI provider.
Get a Cursor API key from the Cursor Dashboard, then:
export CURSOR_API_KEY="your_key"Get an Anthropic API key from the Anthropic Console, then:
export ANTHROPIC_API_KEY="your_key"Wrap any dev command with agentfix:
agentfix npm run dev
agentfix npx next dev
agentfix "node --watch server.js"Tip: Use
node --watch(Node 18+) for automatic server restart when files change. Frameworks like Next.js and Vite have hot reload built-in.
┌──────────────────────────────────────────────────────────────┐
│ Terminal │
│ │
│ $ agentfix npm run dev │
│ │
│ 🔧 AgentFix │
│ Starting: npm run dev │
│ Using provider: Cursor │
│ Monitoring for errors... │
│ │
│ Demo server running at http://localhost:3000 │
│ │
│ TypeError: Cannot read properties of undefined │
│ (reading 'toUpperCase') │
│ at server.js:35:43 │
│ │
│ [agentfix] 🔍 Error detected! │
│ Type: TypeError │
│ Message: Cannot read properties of undefined │
│ (reading 'toUpperCase') │
│ File: server.js:35 │
│ │
│ [agentfix] 🔧 Fixing... │
│ I'll help you fix this TypeError. Let me first examine │
│ the server.js file to understand the context around │
│ line 35. │
│ │
│ [agentfix] 🔧 read: Reading server.js │
│ │
│ I can see the issue clearly. On line 35, there's a typo: │
│ `u.nmee` should be `u.name`. The property `nmee` doesn't │
│ exist on the user objects, so it returns `undefined`, and │
│ calling `toUpperCase()` on `undefined` causes the │
│ TypeError. │
│ │
│ [agentfix] 🔧 edit: Editing server.js │
│ [agentfix] ✅ Modified: server.js │
│ │
│ Restarting 'server.js' │
│ Demo server running at http://localhost:3000 │
│ │
│ The error has been fixed. The issue was a simple typo on │
│ line 35 where `u.nmee` should have been `u.name`. │
│ │
│ [agentfix] ✅ Fixed server.js │
│ Hot reload should kick in shortly... │
│ │
│└──────────────────────────────────────────────────────────────┘
- Wraps your dev server as a child process
- Monitors stdout/stderr for error patterns
- Detects errors and extracts file/line info from stack traces
- Analyzes the code and explains the root cause
- Fixes the code using AI agent (Cursor or Claude)
- Hot reload picks up the changes automatically
agentfix --help # Show help
agentfix --dry-run ... # Detect errors without fixing- Node.js 18+
CURSOR_API_KEYorANTHROPIC_API_KEYenvironment variable
# Start a Next.js app with agentfix
agentfix npm run dev
# Navigate to a buggy page
# Watch the error appear and get fixed automatically!See CHANGELOG.md for release history.
MIT