You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
hook-guard search: nudge repeats on every call — apply the once-per-session claim the strict arm already has #3756
graphify hook-guard search prints _SEARCH_NUDGE on every search-shaped Bash command and every Grep call, with no per-session check. The strict read arm already fires "at most once per session" through _mark_session_denied (O_EXCL marker in graphify-out/cache/hook_sessions/), but the search arm has no equivalent. Checked in 0.9.56 (installed) and v0.9.65 (graphify/cli.py, the kind == "search" branch that ends in sys.stdout.write(_SEARCH_NUDGE)).
Measured impact (one repo, Claude Code, 250 sessions over 18 days)
metric
value
search nudges injected
12,094
repeats inside the same session
99% (median 34 per session, max 968)
estimated context cost
~600k tokens (~33k/day)
The first nudge in a session is useful. The rest repeat a sentence the agent already has in context.
Proposal
Apply the rule the strict arm already uses to the search arm: claim a per-session marker (for example <session_id>.nudged next to <session_id>.denied, with the same normalisation, O_EXCL claim and 24h GC), and stay silent on later search calls in that session.
Two details we hit while doing this in a local wrapper:
Subagents. A Claude Code subagent inherits the parent's session_id but starts with an empty context. Keying on session_id alone means a subagent never sees the nudge. Keying on session_id + agent_id (present in the hook payload for subagent calls) gives each agent one nudge. This includes agent_type: "fork": sharing the parent's marker let a fork that searched first silence a parent that never saw the line.
Claim after printing, on exit 0 only. The matcher is Bash|Grep, so the arm runs on every Bash call. Claiming before deciding would let git status spend the nudge. Claude Code parses hook stdout only on exit 0.
We can open a PR if this direction works for you. It would also let our local wrapper go away.
Activity