AI agents that won't break your code.
How It Works • Quick Start • Architecture • Safety • Status
Badger is a safety-first agentic coding system. It wraps AI coding agents in a protective layer of checkpoints, verification, and automatic rollback — so your codebase stays intact even when an agent makes a mistake.
Every file modification is checkpointed before it happens, verified after it lands, and auto-reverted if anything breaks. No exceptions. No "the change is too small."
You: $badger "Add user authentication with JWT"
Badger:
1. GUARDRAIL CHECK → Is the target file protected?
2. BLAST RADIUS → How many files depend on it?
3. CHECKPOINT → Snapshot the repo state
4. EXECUTE → Make the change
5. VERIFY → Build · Test · Lint · Typecheck
6. RESULT → Pass? Commit. Fail? Rollback.
If verification fails, Badger never tries to "fix forward." It rolls back to the last known-good state, logs what went wrong, and tells you exactly what happened.
# Clone
git clone https://github.com/AniketPatel148/badger.git
cd badger
# Install dependencies
bun install
# Run
bun run dev| Command | Description |
|---|---|
$badger "<task>" |
Start a safety-first agentic coding task |
$badger-status |
View checkpoints, rollback history, and safety state |
$badger-rollback |
Manually rollback to any checkpoint |
Badger uses a 3-tier prompt architecture with strict role separation:
┌─────────────────────────────────────────────┐
│ Tier 1: System Rules │
│ Constitution · Safety Protocol · Comms │
├─────────────────────────────────────────────┤
│ Tier 2: Agent Roles │
│ Manager · Architect · Executor · Reviewer │
├─────────────────────────────────────────────┤
│ Tier 3: Skills │
│ $badger · $badger-status · $badger-rollback│
└─────────────────────────────────────────────┘
| Agent | Role | Boundary |
|---|---|---|
| Manager | Orchestrates tasks, communicates with user | Cannot write code |
| Architect | Designs systems, plans file structures | Cannot write code |
| Executor | Implements features, writes code | Cannot skip checkpoints or change architecture |
| Reviewer | Reviews code quality and security | Cannot write code |
Agents communicate only through the Manager — no direct agent-to-agent calls. This ensures the safety protocol is enforced at every handoff.
A git checkpoint is created before every file modification. These form a LIFO stack that can be unwound at any point.
After every change, Badger runs: Build → Test → Lint → Typecheck. Commands are auto-detected from your project config.
If any verification check fails: revert → log → notify. Always.
Before touching a file, Badger scans its dependency graph and assigns a risk level:
| Risk | Dependents | Action |
|---|---|---|
| Low | 0–1 | Proceed |
| Medium | 2–5 | Proceed with caution |
| High | 6–15 | Warn and proceed carefully |
| Critical | 16+ or config/entry | Stop and ask user |
.env, credentials, certificates, API keys — auto-detected and protected by default. Agents cannot read, modify, or reference them.
🚧 Badger is under active development. Core safety primitives are being built out. Not yet ready for production use.
- TypeScript + Bun
- Targets: Claude Code and OpenAI Codex
MIT
Built by Aniket Patel
