| description | Autonomous production error resolution system - analyzes, prioritizes, and fixes errors from Sentry or error logs |
|---|---|
| argument-hint | [mode | error keywords | error number] |
- /troubleshoot - Autonomous continuous mode (default)
- /troubleshoot auto 5 - Fix top 5 bugs in parallel worktrees
- /troubleshoot watch - Monitor and auto-fix critical errors as they occur
- /troubleshoot analyze - Pattern analysis without fixes
- /troubleshoot 3 - Fix the 3rd error in priority order
- /troubleshoot csrf token - Find and fix error matching keywords
If no monitoring service available, explain what's needed and how to connect one.
Intelligent Prioritization: Trust Sentry/HoneyBadger's default sorting. Recognize when multiple errors share a root cause and prioritize those clusters.Parallel Execution: Work on multiple independent bugs simultaneously in separate git worktrees. Typically 3-5 concurrent worktrees is optimal.
Root Cause Over Symptoms: Investigate why errors happen. Review recent commits, check for related errors, understand data flow. Find the actual problem, not just where it manifested.
Pattern Recognition: Identify common causes across multiple files or components. One strategic fix can prevent many future errors.
Know When Not to Fix: Skip errors that aren't worth fixing: rate limiting (429 errors), external service failures, user-caused errors, flaky/intermittent issues, deprecated code paths, low-value cosmetic issues, monitoring noise. Mark these as ignored in the monitoring service with brief explanation.
Autonomous Decision Making: Create worktree, debug, write fix, add tests, submit PR. Use your judgment on what to fix and what to ignore. Follow project cursor rules, run validation, invoke code review agents if available.
Learning System: After fixes deploy, check if error rate dropped. Adjust approach based on outcomes.
Trust the executing model's intelligence - you can determine the best approach for each situation.
Autonomous Continuous (default): Fix highest priority error. While PR is in CI, start next one in parallel worktree. Continue until all critical errors resolved.Parallel Batch (auto N): Identify top N independent errors and fix simultaneously in separate worktrees. Submit all PRs at once.
Watch Mode: Monitor for new critical errors (priority score >85). Auto-create worktree, fix, submit PR tagged [HOTFIX]. Queue non-critical errors for batch processing.
Analysis Mode: Fetch last 500 errors (including resolved), identify patterns and common root causes, generate insights about error-prone areas, suggest preventive refactorings.
Keyword Search: Search errors for matches in messages, types, file paths, stack traces, function names. Use fuzzy matching. If multiple matches, show ranked by relevance. If one clear match, fix immediately.
Service Detection: Identify available error monitoring tools. If multiple, ask user preference.Error Intelligence: Fetch unresolved errors in default sort order. Identify clusters sharing root causes. Triage aggressively - skip external failures, rate limiting, user mistakes, rare flukes. Mark ignored errors in monitoring service with explanation.
Root Cause Analysis: Review git history for affected files, examine code context, look for related errors, check deployment timelines. Generate hypotheses about actual problems.
Git Worktree Workflow: Each bug fix in isolated worktree. Read
.cursor/rules/git-worktree-task.mdc for full workflow. Clean up worktrees after PRs
merge.
Fixing Process: Gather full context from error monitoring (stack traces, request data, timelines). Read failing code and context. Identify root cause. Implement fix handling edge cases with improved error messages. Add tests when appropriate. Run validation. Use code review agents if available. Create descriptive commits. Submit PRs with error links, occurrence counts, root cause analysis, monitoring plans.
Verification: After PR deploys, check if error rates dropped. Mark errors as resolved once confirmed. If errors persist, create follow-up fix.
Preventive Work: Notice patterns (missing error boundaries, inadequate input validation). Suggest broader refactorings. Create optional PRs for improvements.
Write tests when they add value - logic errors, edge cases, regressions. Use judgment on when tests are appropriate versus overhead. Follow project cursor rules for code style, commit messages, workflows. Run complete validation before submitting PRs. Link to error monitoring issue in commits and PRs. Create detailed PR descriptions with root cause analysis and monitoring plans.Balance immediate critical fixes with systematic cleanup of minor issues.
Show clear summaries when starting:🔍 Connected to Sentry
📊 Found 47 unresolved issues
🎯 AI Analysis - Top Clusters:
1. ⭐ Auth null checks (8 errors → 1 root cause)
💥 847 occurrences (last 2 hours)
📍 src/middleware/auth.ts + 3 files
💡 Missing null checks after session validation
⏭️ Ignoring (not worth fixing):
• Stripe API timeout - external service, 23 occurrences
• Rate limit 429 - expected behavior, 45 occurrences
Starting with auth cluster...
For keyword search, show matches ranked by relevance or fix immediately if one clear match.
Provide updates as you complete each fix.
Production error count decreases over time. Errors don't recur after fixes. Related errors fixed together through root cause analysis. Preventive refactorings reduce new error introduction. Tests prevent regressions. No new errors introduced by changes. Low-value errors intelligently triaged and ignored.Track outcomes and adjust approach based on what works. Good triage (knowing what NOT to fix) is as valuable as good fixes.