Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By karlkfiv0.11.0MITIn 1 marketplace
Blocks Bash calls that would poll in the foreground, like gh run watch or tail -f, and returns a non-blocking rewrite instead. Runs automatically on every Bash call; it says it works locally with no network.
Trending plugins
7-day copy clicks
You run one by typing its /name in Claude Code.
2 cautions to review before installing
A hook runs when Claude uses the Bash tool
A command runs shell commands (! syntax) when you invoke it
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Main-thread time guard rails for Claude Code Bash commands.

The main thread is the one you're talking to. Don't let it sit and watch paint dry — and don't let a 10-minute test run get killed at minute 2.
Agents foreground-poll instead of backgrounding.
In one repo's two-week transcript sample, ~130 Bash calls were blocking polls — gh pr checks --watch, gh run watch, tail -f, sleep-loops — each one parking the session's main thread until something killed it.
In the same sample, 36 slow runs (envtest suites, e2e runs, -race builds) were killed by the Bash tool's default 2-minute timeout, wasting the entire run each time.
Repos carry prose rules in CLAUDE.md to prevent this ("never watch in the foreground", "always set timeout on make test-race") — and agents still do it.
A hook enforces the rule mechanically and teaches the fix in the denial message at the exact moment of violation.
foreground-guard is a PreToolUse hook for Bash that catches two classes of main-thread time-wasters:
gh run watch, kubectl logs -f, tail -f, watch ...), shell loops that poll with sleep, chained repeat-with-sleep sequences, and bare sleep N waits at or above a configurable floor.Both classes deny, and the reason carries the rewrite.
That is a routing decision, not a severity one: what is at stake is the session's own main thread, so a human at the prompt holds no fact the agent lacks, and every finding has a fix the agent can apply on its own.
Set "action": "ask" to watch the guard work instead (see Configuration).
Everything else passes through silently, so your normal permissions apply.
allowThe hook produces one of three outcomes per Bash call:
gh pr checks <n> without --watch, tail -n 100 instead of tail -f), arm a Monitor whose script exits when the condition flips, or bound the wait explicitly with timeout N ... (a loop goes inside it as timeout N bash -c '<loop>').
The timeout form is also the way through when another hook refuses the Monitor: a hook registered on a bare Bash matcher sees a Monitor as a foreground Bash call.
Backgrounding is not among them — a detached poll blocks too, so a Class A reason that offered it would be routing the agent into a second block.
Class B names the exact minimum: "set timeout: 600000 on this Bash call, or run it in the background."
Cleared for one call with a FOREGROUND_GUARD_OVERRIDE=<reason> prefix."action": "ask" on a class: the supervised posture, for someone building trust in the guard.
In an unattended permission mode it reverts to a deny, because no one is there to answer it.allow (see Soundness).Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub karlkfi/claude-bouncer --plugin foreground-guardPlugins from other owners that cover similar ground