Skip to content

Instantly share code, notes, and snippets.

@karlbunch
Created April 6, 2026 22:31
Show Gist options
  • Select an option

  • Save karlbunch/d52b538e6838f232d0a7977e7f6ba954 to your computer and use it in GitHub Desktop.

Select an option

Save karlbunch/d52b538e6838f232d0a7977e7f6ba954 to your computer and use it in GitHub Desktop.
Audit Claude Code CLI stops for "interesting" phrases
#!/bin/bash
#
# Check claude sessions on this machine for "intersting" indications it's trying to stop early.
#
# Requires jq and ripgrep, might want to pipe through less -R if you want to see the colors
#
# Borrowed search strings from https://gist.github.com/benvanik/ee00bd1b6c9154d6545c63e06a317080
#
# NOTE: This is just a gentle hack, YMMV
#
for i in ~/.claude/projects/*/*.jsonl
do
jq -Sc '.["@src"] = "'"$i"'" | select(.type == "assistant")|select(.message.stop_reason == "end_turn")|.' -- "$i" | rg --color always "pre-existing|not from my changes|not my change|not caused by my|not introduced by my|already existed before|before my changes|prior to my changes|unrelated to my changes|an existing issue|existing bug|known limitation|known issue|future work|left as an exercise|session length|session depth|given the length of this|continue in a new session|good place to stop|good stopping point|good checkpoint given|natural stopping|logical stopping|this session has gotten long|session has been long|getting long|lengthy session|want to continue.*or |or save it for|should I continue|shall I continue|shall I proceed|would you like me to continue|would you like to continue|want me to keep going|want me to continue|should I keep going|save it for next time|in the next session|next session|next conversation|pick this up later|come back to this|continue in a follow-up|pause here|stop here for now|wrap up for now|call it here"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment