Skip to main content
   ____ ____  ____  _____ ____  
  / ___/ __ \| __ )| ____|  _ \ 
  \___ \ | | |  _ \|  _| | |_) |
   ___) | |_| | |_) | |___|  _ < 
  |____/\____/|____/|_____|_| \_\

๐Ÿธ sober

The Vibe Coding Hangover Cure

Audit, sanitize, and proofread AI-generated code before pushing to production. Zero bloat. Maximum Flow.



PyPI version Release Python License: MIT CI Status Zero Bloat


๐Ÿ“‘ Table of Contents


โšก The Problem: The Vibe Coding Hangover

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 reqeusts or nummpy that leaves you vulnerable to slopsquatting supply-chain malware?
  • Did it invoke requests.get() or fetch() without a timeout, causing production processes to hang forever on network stalls?
  • Did it generate authentication tokens using insecure random.randint() or Math.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, and debugger; 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: pass or empty catch {} 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.


๐ŸŒŸ What is 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.


๐Ÿš€ Core Detection Pillars

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)

โšก Quick Start Guide

Installation

Install directly via pip:

pip install sober-audit

Or run directly with pipx or uv:

pipx install sober-audit
# or
uv tool install sober-audit

๐Ÿ’ป CLI Usage & Commands

1. Default Working Tree Audit

Audit your staged and uncommitted git changes instantly:

sober scan

2. Air-Gapped Offline Audit (--offline)

Perform zero-network audits verifying dependencies strictly against local manifests and disk cache:

sober scan --offline

3. Auto-Cure AI Residue & Chatter

Automatically 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 cure

4. Git Commit Range & PR Branch Auditing (diff)

Audit 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~1

5. Full Repository Scan

Scan all files in the project instead of just git diff changes:

sober scan --all

6. Strict Mode (Pre-Commit / CI)

Fails 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 90

7. GitHub Security SARIF & PR Markdown Export

Generate 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 --markdown

8. Native Zero-Dependency Git Hook Manager

Install 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 uninstall

9. Automated GitHub Actions CI Workflow Setup

Bootstrap .github/workflows/sober-guard.yml in one command:

sober ci init

10. Project Configuration Initialization

Generate a starter sober.toml configuration file:

sober init

๐Ÿ‘€ Real-Time Live Watcher (sober watch)

Keep 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 --cure

Whenever files are saved, sober immediately re-audits the project and updates your sobriety score in real-time.


๐Ÿค– Agent Self-Healing Remediation (sober explain)

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-fixer

Outputs a high-density, zero-hallucination directive containing exact file locations, code snippets, and unambiguous surgical instructions to fix every defect.


โš™๏ธ Configuration (sober.toml)

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}"

๐Ÿ›ก๏ธ Native Git Hooks & CI/CD SARIF

Native Pre-Commit Hook

Install sober directly into your repository with zero third-party dependencies:

sober hook install

Now, every git commit automatically triggers sober scan --strict, preventing AI slop or accidental credential leaks from ever entering git history!

One-Command GitHub Actions CI Generator

sober ci init

Generates .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

๐Ÿ“Š Telemetry & The Sober Score

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ๐Ÿ“Š 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.

๐Ÿ—๏ธ Architecture

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   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      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿค Contributing

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 .

๐Ÿ“œ License

MIT License. Designed and built with โค๏ธ by shenald-dev.

Metadata

Release files for sober-audit 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sober-audit 2.0.0
File Size Uploaded Provenance Actions
sober_audit-2.0.0.tar.gz 55.7 kB Without provenance Details for sober_audit-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sober-audit 2.0.0
File Interpreter ABI Platform Actions
sober_audit-2.0.0-py3-none-any.whl Python 3 none any Details for sober_audit-2.0.0-py3-none-any.whl

Total release size: 103.9 kB

Release files / sober_audit-2.0.0.tar.gz

Download URL sober_audit-2.0.0.tar.gz
Size 55.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b2d87dfc3cf3123ce56badbb0681afcdfa6a85416578ca6ebaf64800f47ac2b9
BLAKE2b-256 checksum
How to use checksums
cabae6e1789c6fb403b37b935a59a84be353286454d8f1a95a5dc414cf9957a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Release files / sober_audit-2.0.0-py3-none-any.whl

Download URL sober_audit-2.0.0-py3-none-any.whl
Size 48.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dfc5d7eccfaf8aa1827b0c6f9e94d578d3ff865986f6bc992d7ab0d6d9344fcc
BLAKE2b-256 checksum
How to use checksums
cae94128fc7f7332b8a93024aabdf19d6466df3c05fe5ac0ebe4254170da0568
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Security for sober-audit 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page