Dev builds PreToolUse hook that makes Claude Code ask before git push --force

OkPermission1689 · reddit · 2026-11-14

A developer running multiple parallel Claude Code sessions shares a PreToolUse hook setup: each session points via --settings to a hook that sends every Bash command over a local socket (with a per-session token) to a desktop app, which returns allow/block/ask — with a banner or phone notification on "ask". Key lesson: raw command-string checks aren't enough, since agents emit bash -c, eval, $(...), a && b and obfuscated strings, so commands get unwrapped and every part checked; staged diffs are also scanned for secrets before git commit. The companion app OpenCognit runs Claude Code and other CLIs side by side with an orchestrator, free tier of 4 agents.

Original post →

More from coding & agent

coding & agent channel →