Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

hookbrake

Latest version: v0.1.0

Overview

Last scanned
28 Nov 2026
Published
28 Nov 2026
PyPI package Publisher: Appu2712
0 Stars
0 Forks
1 Versions
Python Repo language

Scan summary

hookbrake was last scanned on 28 Nov 2026 at version 0.1.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: First and only release on 28 Nov 2026.
  • Findings: No rules fired in version 0.1.0.

Versions

1 version published
Versions and the rules that fired in each
VersionPublishedStatus
0.1.0 LATEST 28 Nov 2026 No rules fired

No rules fired in 0.1.0

Findings

Findings for v0.1.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.1.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

HookBrake

Git-aware loop circuit-breaker, PostToolUse secret vault, lossless-pointer test/diff compactor, and local session waste auditor for AI coding agents.

CI License: MIT Python 3.10+


Why HookBrake exists

Autonomous coding agents (Claude Code, OpenAI Codex CLI, Gemini CLI, Cursor) regularly hit four failure modes at the tool-execution boundary:

  1. Zero-progress retry loops: An agent runs the same failing pytest command or re-reads the exact same unchanged file 5 times in a row, burning quota without changing a single byte on disk.
  2. Test/lockfile context flooding: A single pytest traceback dump, cargo test run, or git diff package-lock.json injects 30,000+ chars into context, forcing premature compaction loops.
  3. Secrets leaking via tool stdout: PreToolUse command checks miss secrets printed at runtime (cat output, verbose env traces, debug HTTP responses), writing raw tokens straight into cloud LLM context and .jsonl transcripts.
  4. Silent cache invalidations: One volatile prefix change breaks prompt caching across turns, multiplying input costs invisibly.

Instead of shipping another static token counter or regex one-liner, HookBrake handles both retroactive proof (hookbrake audit) and real-time runtime interception (hookbrake hook) in one pure-stdlib Python CLI (<30ms per hook call, zero external dependencies).


Quickstart

1. Audit your existing local sessions first (read-only)

Before enabling any hook, measure how much waste happened in your past Claude Code, Codex CLI, or Gemini CLI transcripts:

pip install -e .
hookbrake audit
=== HookBrake Session Waste Audit ===
  Sessions scanned:       14
  Tool calls scanned:     612
  Oversized outputs:      19
  Compaction savings:     184,320 chars (~46,080 tokens)
  Secrets exposed:        2
    Breakdown:            {'GITHUB_PAT': 1, 'OPENAI_KEY': 1}
  Stalled loops detected: 5
    - Bash repeated 4x in session-a18f.jsonl
  Cache-break events:     3
    - Turn 19 (session-a18f.jsonl): cache_read dropped 42,100 -> 1,800 while cache_creation spiked to 41,200
2. Install hooks for your coding agent
# Claude Code (~/.claude/settings.json)
hookbrake install --claude

# Gemini CLI (~/.gemini/settings.json) and Cursor (~/.cursor/hooks.json)
hookbrake install --claude --gemini --cursor

(Backups are automatically saved to `.hookbrake.bak. Remove cleanly anytime withhookbrake install --claude --uninstall`.)*


What Happens at Runtime

PreToolUse — Git-Aware Loop Breaker & Firewall
  • Real TDD vs. Thrashing: HookBrake hashes (tool_name, args, git_state_hash) in SQLite (~/.hookbrake/state.db), including mtime/size of dirty files. Editing code and re-running pytest is allowed; re-running the identical failing command 3 times with zero file edits trips the breaker (exit code 2) and prompts the agent to change strategy.
  • Read-thrash & Ping-Pong detection: Catches repeated reads of unchanged files and alternating A -> B -> A -> B non-edit cycles.
  • Blast-radius & exfiltration rules: Blocks rm -rf /|~, curl | bash, git push --force main|master, .env/SSH key exfiltration, and tampering with hook config files.
  • Test-integrity check: Warns (or hard-blocks with --strict-tests) if an agent writes @pytest.mark.skip, it.skip, assert True, or except Exception: pass into test files.
PostToolUse — Secret Vault & Lossless-Pointer Diet
  • Secret Redactor: Scrubs OpenAI, Anthropic, AWS, GitHub PAT, PyPI, Stripe, Slack, Google API keys, Bearer tokens, and PEM private keys into deterministic <REDACTED:TYPE:sha6> markers before tool output enters LLM context.
  • Structured Output Compactor:
    • Collapses lockfile hunks (package-lock.json, poetry.lock, uv.lock, Cargo.lock) inside git diff while leaving source code diffs untouched.
    • Strips verbose passing test dots/lines from pytest, unittest, jest, cargo test, and go test while preserving failing assertions and tracebacks.
    • Saves the complete untouched log to ~/.hookbrake/artifacts/<sha>.log and appends the exact path so nothing is lost.

CLI Commands

hookbrake audit [path] [--agent all|claude|codex|gemini] [--json]
hookbrake compact <file|-> [--threshold 4000] [--save-artifacts] [--json]
hookbrake redact <file|-> [--json]
hookbrake install [--claude] [--gemini] [--cursor] [--uninstall]
hookbrake stats [--json]

Configuration (hookbrake.toml)

Optional overrides in project root (hookbrake.toml) or ~/.hookbrake/config.toml:

max_identical_retries = 3
max_unchanged_rereads = 3
max_ping_pong_cycles = 4
compact_threshold_chars = 4000
redact_secrets = true
block_destructive_commands = true
block_exfiltration = true
check_test_tampering = true
strict_tests = false

How HookBrake Compares

Focus Existing Single-Purpose Scripts HookBrake
Loop Detection Naive consecutive command counting SQLite + git status/mtime state fingerprint (allows real TDD edits)
PostToolUse Diet Truncation cuts off bottom tracebacks Lockfile-aware + test-failure-preserving + raw log artifact pointer
Secret Safety Blocks cat .env in PreToolUse only Scrubs leaked tokens inside runtime tool stdout in PostToolUse
Harness Scope Single agent (usually Claude-only) Normalized adapters for Claude Code, Gemini CLI, Cursor, generic JSON
Audit Before Install Separate log viewer script Built-in hookbrake audit across Claude, Codex, and Gemini logs

License

MIT

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases hookbrake

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Frame 2085668439 (1)
Group 1261154229