#! /usr/bin/bash #requires https://gist.github.com/krlohnes/4b25c05c896378937b842d8ba81777ac if ! "$(command -v jq &>/dev/null;)": then echo "jq must be installed for this script to work" exit 1 fi if ! command -v sponge &>/dev/null; then echo "sponge must be installed for this script to work" exit 1 fi PROJECT_DIR=$(echo "$PWD" | sed -E "s#[/\.]#-#g") echo "Fixing tool uses in $PROJECT_DIR" pushd "$HOME/.claude/projects/$PROJECT_DIR" || exit for file in *.jsonl do echo "Fixing $file" filter_tool_messages.jq "$file" | sponge "$file" done echo "Done fixing tool uses. Restart claude and resume from where you left off." popd || exit