"Don't just log the error. Fix it."
CodeAutopsy is an intelligent AI Agent that monitors your CI/CD pipelines. When a build fails, it doesn't just send an alertโit diagnoses the root cause, reads your source code, and automatically opens a Pull Request with the fix.
Unlike basic tools that only read error logs, CodeAutopsy uses GenAI Vision to:
- Scout: Identify exactly which file caused the crash.
- Retrieve: Download the actual source code from the repository.
- Analyze: detailed comparison of the code vs. the error log to generate a precise surgical fix.
Works out-of-the-box with:
- โ๏ธ React / Next.js (Syntax errors, missing components)
- ๐ Python / Django (Indentation errors, typos)
- ๐ณ Docker / Shell (Misconfigured build steps)
- ๐ฆ Rust, Go, Java, and more...
Includes a Recursion Guard that detects if its own fixes fail. It automatically stops operation to prevent spamming your repository with bad Pull Requests.
Receive rich, actionable alerts directly in Discord or Slack the moment a fix is deployed.
[Github Webhook] --> [Motia Server] --> [Gemini AI Analysis] --> [Octokit Surgeon] --> [Pull Request]
- Listener: Intercepts
workflow_job.failurewebhooks from GitHub. - The Scout: Gemini Flash scans logs to identify the broken file path.
- The Retriever: Fetches the current file content via GitHub API.
- The Surgeon: Gemini generates a corrected version of the code.
- The Operator: Opens a new branch (e.g.,
autopsy/fix-123) and creates a PR. - The Broadcaster: Sends a "Fix Deployed" card to Discord.
- Node.js v18+
- A GitHub Repository (to monitor)
- Google Gemini API Key
- Discord Webhook URL
-
Clone the repo
git clone https://github.com/kaushik0010/code-autopsy.git cd code-autopsy npm install -
Configure Environment Create a
.envfile:GITHUB_TOKEN=ghp_your_token_here GEMINI_API_KEY=your_gemini_key_here DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
-
Start the Agent
npm run dev
-
Expose to Internet Use ngrok to make your local server reachable by GitHub:
ngrok http 3000
-
Connect GitHub
- Go to your target repo -> Settings -> Webhooks.
- Add Payload URL:
https://<your-ngrok-url>/webhooks/github - Select events: Workflow jobs.
- Error:
SyntaxError: '(' was never closed - Agent Action: Detects
src/app.py, identifies missing parenthesis, pushes fix.
- Error:
Module not found: Can't resolve './Headre' - Agent Action: Detects typo in
import, corrects it to./Header.
CodeAutopsy operates on a Bring Your Own Key (BYOK) model. This ensures infinite scalability with near-zero overhead.
- Open Source (Free): Developers use their own Gemini API Keys. We provide the "Scout & Surgeon" architecture for free on public repositories.
- Pro Tier: Adds "Team Features" like Discord/Slack integration, Private Repo support, and Custom Linting Rules.
- Enterprise: Self-hosted docker containers for VPC deployment (Banks/Healthcare) with centralized billing and Audit Logs.
- Auto-Merge: Automatically merge high-confidence fixes (e.g., typos, formatting) without human review.
- Preventative Medicine: Analyze code before it is pushed to predict potential CI failures.
- CTO Dashboard: An analytics frontend to track "Developer Hours Saved" and "Most Frequent Bugs."
Built for the Motia Backend Reloaded Hackathon 2025.