John Polacek

Agentic Software Development, Camping/Cooking Tips and more...

Staff Software Engineer at VEG

Having Claude Read Its Own Coding Sessions

The transcript audit prompt for Claude Code, with 176 sessions and 717 searches that never ran.

Claude Code keeps a transcript of every session in ~/.claude/projects. Every command it ran and everything that came back. I had Claude read through its own, looking for wasted work.

Turns out of my last 176 sessions, 717 searches never ran. My shell is zsh, and zsh rejects an unquoted grep --include=*.ts before grep even starts. Most of the time the command didn't even look like it failed. It just came back empty, so Claude never noticed.

It found a bunch of other stuff too:

  • 57 clicks on a blank Chrome tab.
  • Python scripts reaching for libraries I don't have installed.
  • Throwaway scripts that couldn't import the project's own packages.
  • Deploy commands that auto mode blocks, which it should hand to me instead.

Each one became a line in my agent instructions, so it doesn't happen again.

I'd run it every week or two. Here's the prompt, paste it into Claude Code:

Code
Read my session transcripts in ~/.claude/projects. Find tool calls that failed, came back empty, or hid an error in normal output. Group the waste by cause, and suggest CLAUDE.md lines to prevent it.