____ ____ ____ _____ ____
/ ___/ __ \| __ )| ____| _ \
\___ \ | | | _ \| _| | |_) |
___) | |_| | |_) | |___| _ <
|____/\____/|____/|_____|_| \_\
The Vibe Coding Hangover Cure
Audit, sanitize, and proofread AI-generated code before pushing to production. Zero bloat. Maximum Flow.- β‘ The Problem: The Vibe Coding Hangover
- π What is Sober?
- π Core Detection Pillars
- β‘ Quick Start Guide
- π» CLI Usage & Commands
- π Real-Time Live Watcher (
sober watch) - π€ Agent Self-Healing Remediation (
sober explain) - βοΈ Configuration (
sober.toml) - π‘οΈ Native Git Hooks & CI/CD SARIF
- ποΈ Architecture
- π€ Contributing
You just spent 3 hours vibe-coding with Claude Code, Cursor, Windsurf, or Copilot. Your prototype spins up blindingly fast, but you have that familiar, sinking feeling:
- Did the AI hallucinate a typosquatted package like
reqeustsornummpythat leaves you vulnerable to slopsquatting supply-chain malware? - Did it invoke
requests.get()orfetch()without a timeout, causing production processes to hang forever on network stalls? - Did it generate authentication tokens using insecure
random.randint()orMath.random()? - Did it directly interpolate untrusted user strings into LLM prompt templates (
f"...{user_msg}..."), opening prompt injection vulnerabilities? - Did it leave 15 leftover
print(f"DEBUG: ..."),console.log("HERE"), markdown code fences, anddebugger;statements in production files? - Did it embed conversational assistant comments like
// Certainly! Here is the updated code...in source files? - Did it silently swallow fatal database errors with
except: passor emptycatch {}blocks? - Did it commit a live OpenAI, Anthropic, Gemini, Groq, Supabase, Stripe, or Hugging Face API key directly into your git history?
- Did it disable TLS certificates (
verify=False) or introduce unsafe deserialization vectors? - Did it re-invent helper functions that already existed in your repository three folders away?
Standard git diff was built for humans reviewing 5-line editsβnot humans auditing 500-line multi-file AI rewrites.
Enter sober.
sober is an ultra-fast, zero-config CLI that audits your uncommitted git changes, branches, or entire repositories in <200ms. It detects AI-introduced hallucinations, slopsquatting, reliability antipatterns, conversational chatter, slop residue, silent error swallows, duplicate logic, and secret leaks, providing a crystal-clear Sober Score (0β100%) before you push to production.
| Pillar | Detection Engine | Severity |
|---|---|---|
| π§ͺ Hallucination & Slopsquatting | Cross-references new imports against local manifests, live PyPI/npm registries, and Damerau-Levenshtein similarity to popular libraries (e.g. reqeusts vs requests). |
CRITICAL |
| π‘οΈ Dangerous AI Antipatterns | Catches omitted HTTP timeouts (requests.get, fetch), insecure pseudo-random tokens (random.choice), prompt injection vectors (f"...{user_input}..."), and client-side system prompt leakage. |
HIGH / CRITICAL |
| π Secrets & Leaks | Catches hardcoded OpenAI, Anthropic, Gemini, Groq, Supabase, Hugging Face, GitHub PATs, AWS, Stripe Live, Pinecone, Slack, Discord, SendGrid, and trivial default passwords. | CRITICAL |
| π‘οΈ Vulnerability Vectors | Detects raw SQL string formatting, shell=True command injection, disabled TLS/SSL (verify=False), unsafe pickle/YAML deserialization, and trivial JWT secrets. |
HIGH |
| π» Ghost Code & Error Swallows | Flags blank except: pass, empty catch {} blocks, empty promise catches, and dangling debugger; breakpoints. |
HIGH |
| π€ AI Conversational Chatter | Detects assistant prompt leakage and conversational text (Certainly! Here is..., As an AI language model..., Let me know if you need adjustments). |
LOW (Auto-Cureable) |
| π§© AST Duplication | Catches AI agents re-inventing existing project helper utilities across files instead of importing them. | MEDIUM |
| π§Ή Debug Debris & Fences | Finds temporary print(f"DEBUG..."), console.log("here"), lingering breakpoints, and stray markdown code fences. |
LOW (Auto-Cureable) |
Install directly via pip from GitHub:
pip install "git+https://github.com/shenald-dev/sober.git"Or install the pre-built wheel directly from the latest GitHub Release:
pip install https://github.com/shenald-dev/sober/releases/download/v2.0.0/sober-2.0.0-py3-none-any.whlOr run directly with pipx or uv:
pipx install "git+https://github.com/shenald-dev/sober.git"
# or
uv tool install "git+https://github.com/shenald-dev/sober.git"Audit your staged and uncommitted git changes instantly:
sober scanPerform zero-network audits verifying dependencies strictly against local manifests and disk cache:
sober scan --offlineAutomatically strip leftover debug print statements, console logs, dangling debuggers, stray markdown fences, and AI chatter comments:
sober scan --cure
# or via standalone cure command:
sober cureAudit changes introduced across a PR branch or commit range:
# Audit changes between main and current branch
sober diff main..HEAD
# Audit the last commit
sober diff HEAD~1Scan all files in the project instead of just git diff changes:
sober scan --allFails with exit code 1 if your Sober Score is below threshold (default: 95%) or if any critical issues are found:
sober scan --strict
# Custom threshold:
sober scan --strict --min-score 90Generate SARIF 2.1.0 for GitHub Code Scanning or Markdown summary tables for automated PR review comments:
# Output SARIF format for GitHub Security tab
sober scan --sarif > sober-results.sarif
# Output GitHub Markdown table for PR comments
sober scan --markdownInstall an automated pre-commit hook directly into .git/hooks/pre-commit:
# Install hook
sober hook install
# Check hook status
sober hook status
# Remove hook
sober hook uninstallBootstrap .github/workflows/sober-guard.yml in one command:
sober ci initGenerate a starter sober.toml configuration file:
sober initKeep a live HUD open alongside your editor while vibe-coding with Cursor, Windsurf, or Claude Code:
sober watch
# Custom polling interval:
sober watch --interval 0.5
# Auto-cure debris on save:
sober watch --cureWhenever files are saved, sober immediately re-audits the project and updates your sobriety score in real-time.
Feed diagnostic audit context directly back to your AI coding agent (Claude Code, Cursor Agent, Copilot Workspace, Aider, Devin):
sober explain
# Or pipe directly to clipboard / agent:
sober explain | your-agent-fixerOutputs a high-density, zero-hallucination directive containing exact file locations, code snippets, and unambiguous surgical instructions to fix every defect.
Configure sober on a workspace or project level using sober.toml or pyproject.toml ([tool.sober]):
# sober.toml (v2.0)
[sober]
min_score = 95.0
fail_on_critical = true
max_workers = 10
offline_mode = false
# Paths to ignore during audits
ignore_paths = [
"tests/*",
"docs/*",
"migrations/*",
]
# Allowed internal or proprietary packages that should never trigger hallucination alerts
allowed_packages = [
"@my-org/*",
"internal_company_sdk",
]
# Disable specific detectors if needed
# disabled_detectors = ["duplicates"]
# Custom proprietary secret regex patterns
# [[sober.custom_secret_patterns]]
# name = "Company Internal API Token"
# pattern = "comp_[A-Za-z0-9]{32}"Install sober directly into your repository with zero third-party dependencies:
sober hook installNow, every git commit automatically triggers sober scan --strict, preventing AI slop or accidental credential leaks from ever entering git history!
sober ci initGenerates .github/workflows/sober-guard.yml:
name: SOBER Code Sobriety Radar
on:
pull_request:
branches: [main, master]
push:
branches: [main, master]
jobs:
sober-audit:
name: AI Hangover & Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install SOBER
run: pip install git+https://github.com/shenald-dev/sober.git
- name: Run SOBER Audit (SARIF & Markdown)
run: |
sober scan --all --sarif > sober.sarif
sober scan --all --markdown > sober-summary.md
cat sober-summary.md >> $GITHUB_STEP_SUMMARY
continue-on-error: true
- name: Upload SARIF to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: sober.sarif
category: sober-hangover-guard
- name: Strict Sobriety Gate
run: sober scan --all --strict --min-score 90ββββββββββββββββββββββββ π SOBRIETY HEALTH TELEMETRY βββββββββββββββββββββββββ
β β
β Sober Score: 100% [A+] β
β State: π§ Crystal Sober (Production Ready) β
β β
β β’ Critical Issues: 0 β’ High: 0 β’ Medium: 0 β’ Low (Debris): 0 β
β β’ Auto-Fixable with --cure: 0 β
β β
β Scanned 18 files in 0.11s. β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- 95% β 100% β
π§ Crystal Sober: Production ready, strictly typed, pristine flow. - 80% β 94% β
β Mild Buzz: Minor debug debris or unaddressed stubs detected. - 60% β 79% β
πΈ Noticeable Hangover: Review required. High-risk patterns found. - < 60% β
π¨ Complete Blackout: Critical security vulnerabilities or hallucinated dependencies. Do NOT deploy.
βββββββββββββββββββββββββββ
β Git Workspace / Targetβ
βββββββββββββ¬ββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββ
β Scanner & Diff Engine β (Uncommitted changes,
β (git status & ranges) β commit diffs, or all)
βββββββββββββ¬ββββββββββββββ
β
ββββββββββββββββββΌβββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββββββ
β Manifest Inspector β β Disk Registry β β Config Engine β
β (package.json/pyproj)β β Cache (TTL) β β (sober.toml loader) β
ββββββββββββ¬ββββββββββββ βββββββββ¬βββββββββ ββββββββββββ¬ββββββββββββ
β β β
ββββββββββββββββββ¬βββββ΄ββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββ
β Detection Pillar Pool β
β β’ Slopsquatting / PyPI β
β β’ Dangerous Antipatternsβ
β β’ Secrets & Webhooks β
β β’ AI Chatter & Fences β
β β’ Silent Error Swallows β
β β’ AST Duplication β
βββββββββββββ¬ββββββββββββββ
β
ββββββββββββββββββββββββΌβββββββββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
β Sobriety Radar β β Live Vibe Watch β β Agent Remediationβ
β β’ Terminal HUD β β β’ File monitor β β β’ sober explain β
β β’ SARIF 2.1.0 β β β’ Real-time HUD β β β’ Self-healing β
β β’ Markdown PR β β β’ Auto-cure β β directive β
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
Contributions are welcome! Please open an issue or PR on GitHub.
git clone https://github.com/shenald-dev/sober.git
cd sober
pip install -e ".[dev]"
pytest
ruff check .MIT License. Designed and built with β€οΈ by shenald-dev.