Last active
November 24, 2026 01:29
-
-
Save bguiz/28c5ecbed0fa051d2878e89db41f4aea to your computer and use it in GitHub Desktop.
export user and LLM message only from claude code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # cd into your project's root dir | |
| claude_raw_chats_dir=~/.claude/projects/"${PWD//\//-}" | |
| ls -lat ${claude_raw_chats_dir}/*.jsonl | |
| # pick one of those files | |
| target_chat=/path/to/projects/dce7c3b8-034a-42c5-866c-25b810bb4181.jsonl | |
| # use jq to filter out tool calls (and anything else that isn't your prompts or Ai responses) | |
| # write to file ./tmp/claude_chat_(…timestamp).txt | |
| mkdir -p ${PWD}/tmp/ | |
| output_filename=${PWD}/tmp/claude_chat_$(date +"%Y%m%d-%H%M").txt | |
| jq -r ' | |
| select(.type=="user" or .type=="assistant") | | |
| "[" + .type + "]\n" + | |
| (.message.content // .content | if type=="string" then . else .[]? | select(.type=="text") | .text end) + | |
| "\n" | |
| ' ${target_chat} > ${output_filename} | |
| # use this file similar to a handoff in another chat | |
| echo "${output_filename}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment