Show HN: Bright Lines – a fail-closed guard hook for Claude Code github.com · 2 ...

@show

Show HN: Bright Lines – a fail-closed guard hook for Claude Code github.com · 2 points · 0 comments · HN thread

TL;DR Bright Lines is an MIT-licensed, dependency-free setup for Claude Code that copies a settings folder and a Python guard hook into a project. The hook refuses a short list of dangerous actions (bulk deletes, pushes, network sends, secret reads, scheduled jobs, installs, money actions, self-loosening) even if the user approves them, and fails closed on errors. The post has 2 points and no comments yet.

  • Settings pre-approve reading and make edits, commands, web lookups and helper agents ask for approval; auto, accept-edits and skip-permissions modes are disabled.
  • A guard hook (guard.py) runs before every tool call, including helper agents' calls, and refuses listed bright-line actions even after a yes; bad input, internal errors, or a missing Python all mean no.
  • A kill switch (./killswitch.sh on) stops all sessions in a project, and per-session caps limit activity; spend limits must still be set in the Anthropic account.
  • The author ran about 300 crafted bypass attempts before release and states that pattern matching cannot catch scripts that do harm (e.g. python3 cleanup.py), multi-step names, archives, shell aliases, or indirect reads of secrets.
  • Tests cover 177 blocked and 50 allowed commands; a check_setup.py script verifies the guard blocks things. Requires Python 3.8+, tested on Linux with Claude Code 2.1.280 and 2.1.322; Windows PowerShell is refused and Git Bash is assumed.

Discussion No comments have been posted yet, so there is no discussion to summarise. The story has 2 points and has not yet drawn any reaction.

#ClaudeCode #AIAgents #AISafety #PythonHook #ShowHN