AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Oct 6, 2026, 22:00 JST

jq script lists every file Claude Code read

jq script lists every file Claude Code read

3 Key Points

  1. What happened

    A developer published a jq script that reads Claude Code's jsonl conversation logs and sorts each file into read, edited, or stale, with a demo log showing 5 assistant and 4 user entries.

  2. Why it matters

    The three labels tell a manager or reviewer whether Claude actually saw a given file, and whether an early read survived later compression or was reduced to a summary, so 'did it have the file in front of it' stops being guesswork.

  3. What to watch

    The counts depend on what the script deliberately excludes, so results hinge on whether subagent activity and rewound branches are filtered out. Watch whether such a view gets built into the tool itself.

WHO IT HITSDevelopers and technical leads auditing AI coding sessions get a concrete record of which files the assistant read, wrote, or lost to compression, instead of relying on memory of the session.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

Claude Code, Anthropic's coding assistant, leaves a jsonl log for every conversation, with each line a JSON record whose type separates a person's message, Claude's reply, an attachment the tool added, or a system notice. That structure is what makes the script possible: tool calls sit inside an assistant reply, tool results sit in rows typed as user, and attachments carry things like pasted-in files or change notices. The script walks these rows, marks files read when Claude calls Read, marks them edited on Edit, MultiEdit, Write, or NotebookEdit, and flips everything to stale when a compact_boundary row shows the conversation was compressed.

The sample run shows two behaviors that matter for anyone trusting the output. A file read before compression and never touched again stays stale, because only a summary remains in context, while a file edited before compression and re-read afterward returns to read. The author also excludes rows flagged isSidechain, since a subagent's reading never reaches the main Claude's context. Rewinding with /rewind or pressing Esc splits the parentUuid chain, and because the script reads every row, files from abandoned branches still appear.

The same rules power the file-tree markings in tanacode, the author's macOS app for watching Claude Code work, which reads logs incrementally with fs.watch and keeps a file edited marker even after a later read. The open question is how much of this a reader should treat as ground truth: the markings reflect what the log recorded, and the author notes that a running session may have a last row that is still being written, so a snapshot taken mid-turn could miss the newest activity.

FAQ
What do the read, edited, and stale labels mean?
Read means Claude opened the file, and edited means Claude wrote to it. Stale means the file was read but later replaced by a summary during compression.
Why don't files read by subagents show up?
Rows marked isSidechain belong to subagent conversations, and files a subagent read never enter the main Claude's context, so the script excludes them.
Why does a file look like it was read again after being edited?
The edited mark is kept even if the file is read later, but a re-read after compression moves it back to read. In the sample log, a.ts was edited before compression and re-read after, so it shows as read.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleSwarmchasers: 400+ track AI agents' online traces