Skip to content

anupmaster/scalpel

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

21 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Scalpel

Surgical AI for Your Codebase

12-dimension diagnostic. Adaptive surgical teams. Zero side effects.

Stars Release MIT License 7 Agents

Created by Anup Karanjkar ยท 12+ years building digital products


scalpel-16x9.mp4

The Problem
AI agents write code without understanding your project.
They guess your stack, your patterns, your conventions.
Guessing at scale = bugs at scale.
The Solution
Scalpel gives any AI agent deep project intelligence
before it writes a single line of code.
Plug in. Diagnose. Operate. Unplug.

# 30 seconds to surgical precision
cd your-project
git clone https://github.com/anupmaster/scalpel.git .scalpel && .scalpel/install.sh

# Then in any AI agent:
> Hi Scalpel, start work

๐Ÿ” Instant Codebase Health Check โ€” Zero AI Required

Run the standalone scanner. No subscription. No API keys. No tokens. Pure bash.

./scanner.sh                    # Pretty terminal output
./scanner.sh --json             # Machine-readable JSON
./scanner.sh --ci               # GitHub Actions annotations
./scanner.sh --markdown         # Markdown report for PRs
./scanner.sh --score-only       # Just the number: "83"
  โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
  โ•‘  SCALPEL โ€” Codebase Vitals                                  โ•‘
  โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ
  โ•‘                                                              โ•‘
  โ•‘  Project    : acme-dashboard                                 โ•‘
  โ•‘  Stack      : Next.js 14 ยท TypeScript ยท Tailwind ยท Prisma   โ•‘
  โ•‘  Database   : PostgreSQL via Supabase (23 tables)            โ•‘
  โ•‘  Auth       : Auth.js v5                                     โ•‘
  โ•‘  Deploy     : Vercel (CI: GitHub Actions)                    โ•‘
  โ•‘  Tests      : 0 files CRITICAL (None)                        โ•‘
  โ•‘  Tech Debt  : 47 TODOs ยท 12 FIXMEs ยท 3 HACKs               โ•‘
  โ•‘  Git Health : 1247 commits ยท 5 branches ยท 3 contributors    โ•‘
  โ•‘  Bundle     : 284MB node_modules ยท 12MB dist                  โ•‘
  โ•‘  Security   : 2 issues found                                 โ•‘
  โ•‘                                                              โ•‘
  โ•‘  HEALTH SCORE: 64/100 โ€” Needs Improvement                   โ•‘
  โ•‘  [###############---------]                                  โ•‘
  โ•‘                                                              โ•‘
  โ•‘  Top 3 Priorities:                                           โ•‘
  โ•‘  1. Add test infrastructure (0% coverage)                    โ•‘
  โ•‘  2. Fix 2 security vulnerabilities in dependencies           โ•‘
  โ•‘  3. Reduce bundle size (tree-shake unused imports)           โ•‘
  โ•‘                                                              โ•‘
  โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

This report alone is worth the install. Screenshot it. Share it. Put it in your README.


๐Ÿฉบ What Happens When You Say "Hi Scalpel"

 PHASE 0 โ€” PRE-FLIGHT
 Reads previous session memory. Loads your config.
 "Returning to acme-dashboard. Last session: health 48 โ†’ 74."

 PHASE 1 โ€” DIAGNOSE  (2 min, fully autonomous)
 Scans 12 dimensions: stack, architecture, git forensics,
 database, auth, infra, tests, security, and more.
 Outputs the Codebase Vitals report.

 PHASE 2 โ€” CONSULT
 Asks 5-7 surgical questions that only YOU can answer.
 Memory-aware: skips what was already addressed.

 PHASE 3 โ€” ASSEMBLE
 Designs a custom surgical team for YOUR project.
 Not a template. Adaptive specialists with file jurisdiction.

 PHASE 4 โ€” OPERATE
 Spawns parallel agents in isolated git worktrees.
 Monitors quality. Scores each agent. Terminates drift.

 PHASE 5 โ€” CLOSE
 Delivery report. Session memory saved.
 "Monitor for regressions? Debrief a surgeon? Done?"

๐Ÿ”ช Adaptive Surgical Teams

Scalpel doesn't use templates. It reads your project and designs the right team:

 Your Project                          Your Surgical Team
 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€                 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
 DB + API + Frontend                โ†’  Data Layer ยท API ยท Frontend ยท Guardian
 Frontend-heavy SaaS                โ†’  Components ยท State ยท Performance ยท Guardian
 Drowning in tech debt              โ†’  Debt Liquidator ยท Tests ยท Deps ยท Guardian
 Early-stage prototype              โ†’  Foundation ยท Test Infra ยท CI/CD ยท Guardian
 Bug investigation                  โ†’  3 Hypothesis Investigators ยท Guardian

Each surgeon gets file jurisdiction (no merge conflicts), worktree isolation (parallel work), and a quality score starting at 100. Score drops below 50? Terminated and work redistributed.


๐Ÿ—๏ธ The 12-Dimension Diagnostic

# Dimension What It Discovers
1 Project DNA Framework, language, dependencies, versions, monorepo structure
2 Architecture Entry points, routing, data flow, state management, styling
3 Git Forensics Commit velocity, branching strategy, deleted files, abandoned work
4 Infrastructure Docker, CI/CD, deployment target, reverse proxy, IaC
5 Database ORM, schema, migrations history, seed data, table count
6 Testing Runner, coverage, E2E scenarios, test health
7 Auth & Security Provider, protected routes, RBAC, exposed secrets scan
8 Integrations Payments, email, storage, analytics, monitoring
9 Agent Ecosystem Existing CLAUDE.md, agents, commands, MCP servers, hooks
10 Code Quality Linting, formatting, pre-commit hooks, strict mode, TODO count
11 Performance Bundle size, image optimization, caching, rendering strategy
12 Documentation README quality, API docs, JSDoc coverage, ADRs

๐Ÿ”ฌ Works With Every AI Agent

Agent Status How to Install
Claude Code โœ… ./install.sh --claude โ†’ .claude/agents/scalpel.md
Codex CLI โœ… ./install.sh --codex โ†’ AGENTS.md
Gemini CLI โœ… ./install.sh --gemini โ†’ GEMINI.md
Cursor โœ… ./install.sh --cursor โ†’ .cursorrules
Windsurf โœ… ./install.sh --windsurf โ†’ .windsurfrules
Aider โœ… ./install.sh --aider โ†’ conventions file
OpenCode โœ… ./install.sh --opencode โ†’ agent config
./install.sh          # Auto-detects your agent
./install.sh --all    # Install for everything

โšก Quick Start

Option 1: Clone and plug in

git clone https://github.com/anupmaster/scalpel.git ~/scalpel
cd your-project && ~/scalpel/install.sh

Option 2: Global install (available everywhere)

mkdir -p ~/.claude/agents
curl -fsSL https://raw.githubusercontent.com/anupmaster/scalpel/main/src/scalpel.md \
  -o ~/.claude/agents/scalpel.md

Option 3: Just the scanner

curl -fsSL https://raw.githubusercontent.com/anupmaster/scalpel/main/src/scanner.sh \
  -o scanner.sh && chmod +x scanner.sh
./scanner.sh /path/to/any/project

Then:

claude    # or codex, gemini, cursor, windsurf, aider, opencode
> Hi Scalpel, start work

๐Ÿ”„ GitHub Action โ€” PR Health Gate

Block unhealthy code from merging. Automatically.

# .github/workflows/scalpel.yml
name: Scalpel Health Check
on: [pull_request]
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: anupmaster/scalpel@v2
        with:
          fail-below: 60    # Block merge if health drops below 60
          comment: true      # Post Vitals as PR comment

Every PR gets a before/after health score comparison posted as a comment. Set your threshold. Enforce it.


๐Ÿงฎ Agent Scoring System

Scalpel monitors every teammate in real-time:

Violation Points
Removed or downgraded existing functionality -25
Simplified output/UI below original quality -25
Introduced a regression (existing tests fail) -20
Broke the build -15
Modified file outside jurisdiction -10
Used any type or skipped error handling -10
Ignored established project patterns -10
Left console.log in production code -5

Score < 70 โ€” Scalpel re-issues instructions with corrections.
Score < 50 โ€” Agent terminated. Work redistributed.

The harshest penalties are for quality downgrades, not build breaks. A broken build is obvious. A silent feature removal ships unnoticed and erodes trust.


๐Ÿ”Œ The Pendrive Principle

Scalpel is designed like a forensic USB toolkit:

 Plug in   โ†’ install.sh (auto-detects your agent)
 Do work   โ†’ Diagnose, assemble team, operate
 Plug out  โ†’ uninstall.sh --purge
 Zero trace โ€” your git history never shows Scalpel was there

What Scalpel NEVER touches: your CLAUDE.md, your agents, your package.json, your git history.
What Scalpel leaves behind: improved code. That's it.


๐Ÿ†• What's New in v2

Feature Impact
Standalone Scanner 12-dimension diagnostic from terminal. Zero AI, zero tokens.
60% Fewer Tokens Scanner + effort-level routing = massive cost reduction
Session Memory .scalpel/memory.jsonl โ€” Scalpel learns across sessions
7 Agent Adapters Claude Code, Codex, Gemini, Cursor, Windsurf, Aider, OpenCode
Continuous Monitoring /loop regression detection during long sessions
Post-Surgery Q&A Ask any surgeon about their decisions after delivery
GitHub Action Automated PR health checks with merge gating
Extensible Config scalpel.config.json โ€” custom dimensions, roles, scoring
Anti-Regression System Agents can never silently remove or downgrade features. Mandatory before/after verification.

๐Ÿ“‚ Project Structure

scalpel/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ scalpel.md                # Agent brain โ€” orchestration prompt
โ”‚   โ”œโ”€โ”€ scanner.sh                # Standalone scanner (pure bash, zero deps)
โ”‚   โ””โ”€โ”€ adapters/                 # 6 agent-specific adapters
โ”‚       โ”œโ”€โ”€ codex.md
โ”‚       โ”œโ”€โ”€ gemini.md
โ”‚       โ”œโ”€โ”€ cursor.cursorrules
โ”‚       โ”œโ”€โ”€ windsurf.md
โ”‚       โ”œโ”€โ”€ aider.md
โ”‚       โ””โ”€โ”€ opencode.md
โ”œโ”€โ”€ schemas/
โ”‚   โ””โ”€โ”€ config.schema.json        # Config validation schema
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ scanner/                  # 36-assertion test suite
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ SPECIFICATION.md          # Technical specification
โ”‚   โ”œโ”€โ”€ CONFIGURATION.md          # Config customization guide
โ”‚   โ””โ”€โ”€ BLUEPRINT-V2.md           # Development blueprint
โ”œโ”€โ”€ examples/                     # Real-world usage examples
โ”‚   โ”œโ”€โ”€ nextjs-ecommerce.md
โ”‚   โ”œโ”€โ”€ parallel-debugging.md
โ”‚   โ””โ”€โ”€ scan-only-health-check.md
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ scalpel-scan.yml      # Example CI workflow
โ”œโ”€โ”€ action.yml                    # GitHub Action definition
โ”œโ”€โ”€ scalpel.config.json           # Default extensible config
โ”œโ”€โ”€ install.sh                    # One-command plug-in (auto-detects agent)
โ”œโ”€โ”€ uninstall.sh                  # Zero-trace removal
โ”œโ”€โ”€ NOTICE                        # Authorship declaration
โ”œโ”€โ”€ CHANGELOG.md                  # Version history
โ”œโ”€โ”€ CONTRIBUTING.md               # Contribution guide
โ”œโ”€โ”€ LICENSE                       # MIT
โ””โ”€โ”€ README.md

โš™๏ธ Configuration

Customize every aspect of Scalpel with scalpel.config.json:

{
  "scan": {
    "custom": [{ "name": "a11y-audit", "command": "npx axe-linter src/", "scoring": { "pass": 5 } }]
  },
  "team": {
    "custom_roles": [{ "name": "i18n-specialist", "trigger": "i18n/ directory exists" }]
  },
  "scoring": {
    "custom_rules": [{ "name": "no-console", "check": "grep -rn console src/components/", "deduction": -5 }]
  }
}

Full reference: docs/CONFIGURATION.md


๐Ÿค Contributing

Scalpel is open source and built for the community. Contributions welcome:

  • New scan dimensions โ€” accessibility, i18n, GraphQL, mobile
  • Stack-specific configs โ€” Next.js, Django, Rails, Rust, Flutter, Laravel
  • Adapter improvements โ€” better Cursor, Windsurf, Aider support
  • Scoring rules โ€” new quality violations to catch
  • Community configs โ€” share your scalpel.config.json in awesome-scalpel

See CONTRIBUTING.md for the full guide.


๐Ÿ“œ License

MIT โ€” Use it however you want.


๐Ÿ’ก Philosophy

"Understand everything before touching anything."

The biggest failure mode in AI-assisted development isn't bad code generation โ€” it's good code generation without context. An AI that writes perfect TypeScript but doesn't know you use Zustand instead of Redux, or deploys to Railway instead of Vercel, or follows conventional commits instead of squash merges, will create technically correct code that's architecturally wrong.

Scalpel makes project intelligence the first step, not an afterthought.


๐Ÿงต Also By Anup Karanjkar

Sutures โ€” Breakpoints for AI Agents

The first open-source, framework-agnostic visual debugger with live intervention for multi-agent systems. Pause any agent, see what it sees, inject fixes, fork reality.

Scalpel cuts into your codebase. Sutures traces how everything connects.


If Scalpel saved you time, consider giving it a star.
It helps other developers find this tool.

Star

Created by Anup Karanjkar ยท anupkaranjkar.com