r/ClaudeCode • • 5d ago

Discussion I counted every big paste I made into Claude Code since 25 Oct. 72% of the text was flutter run logs, and 1.6% of those lines mentioned an error.

I went through my Claude Code logs and pulled every prompt where I pasted more than 20k characters. Since 25 Oct there were 117 of them, about 22 million characters in total.

87 of the 117 were raw flutter run output copied straight from the terminal. Those alone were 72% of everything I pasted. The biggest one was 1.86 million characters.

Then I looked at what was actually in them. Across 132,478 lines of flutter run output, 2,115 lines mentioned an exception, an error or a failure. That's 1.6% of the lines. The rest was hot restart output, device logs and similar noise.

A paste also doesn't get read just once. It stays in the context and rides along with every request after it until the session compacts. One 505k character paste was carried through 95 more requests.

Limits: this is one person, mostly Flutter on a physical Android phone, and my error filter is a plain keyword match, so it misses some useful lines and counts some junk.

Writing the run output to a file and letting the agent grep it seems like the obvious fix. For people doing mobile work with Claude Code, how do you get device logs to it?

0 Upvotes

10 comments sorted by

•

u/AutoModerator 5d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

4

u/Far_Reindeer8428 5d ago

we stopped pasting logs too, the agent greps the file now. 72% for one command is about what we saw with browser console output

1

u/Ok_Gur_9033 5d ago

Funny that it was browser console for you. My agent drives a browser a lot, over 6,000 browser tool calls since 25 Oct, and only 19 of those results went over 20k characters. The big stuff was always something I pasted.

Was the console output getting pasted by hand on your side, or was the agent pulling it in?

2

u/Far_Reindeer8428 5d ago

by hand at first, then i gave the agent a command to run and copied the tail. the paste count dropped because i stopped narrating errors

1

u/Ok_Gur_9033 1d ago

Mine went the other way. Since 25 Oct only 38 of my prompts had a short error typed or pasted in, and 79 carried the error inside a paste over 20k characters. So I barely narrated anything, I just dumped the whole log around it. Having the agent run the command and copying the tail is the middle step I skipped.

How long a tail do you usually grab?

2

u/KingYF1 5d ago

Writing the log to a file and grepping it is the right fix, but I'd go one step further and never let the raw flutter run stream into the prompt at all.

What I do on mobile work:

  • flutter run 2>&1 | tee /tmp/flutter-run.log, then point the agent at that path. First command should be a grep for Exception|Error|FAILURE and the last 80 lines, not a full read.
  • For device noise, adb logcat -d -t 300 *:E (or a tag filter for the app) into a second file. The verbose I/V lines are almost never useful on the first pass.
  • If I already know the crash, I crop to the last stack plus about 40 lines before it and save that as /tmp/flutter-crash.txt. That's usually a few kilobytes instead of hundreds.

The expensive part in your numbers isn't even the first paste. It's the 505k character blob riding along for 95 later turns. Even with prompt cache you still pay a fraction of that on every request until compact, and compact itself has to read it again.

I also added a one-liner to CLAUDE.md: if a command's stdout is large, write it to a file and search it; never echo the whole thing back into the conversation. That stops the agent from "helpfully" dumping the log after it runs the command itself.

1

u/Ok_Gur_9033 5d ago

The CLAUDE.md line made me look at what the agent dumped on its own. Since 25 Oct its Bash calls returned 266 results over 20k characters, about 6.4M in total, and only 9 of those were flutter commands. None went past 29,932 characters, so the harness seems to cut Bash output around 30k anyway. Most of the big ones were cat on whole files.

My hand pastes were 22M in the same stretch. The tee into a file is the habit I was missing.

2

u/KingYF1 3d ago

The 30k cap you measured is why `cat` is worse than it looks. The model sees the first 30k, guesses the rest, then edits the wrong region. And that truncated blob still sits in context for later turns.

I'd treat `cat` of source files as a bug, not a habit. I have a line in CLAUDE.md: never `cat`, `head`, or `tail` a source file; use the Read tool with an offset and limit, or `rg`. If a file is more than a couple of hundred lines, search first and read only the section you need.

The CLAUDE.md line isn't enough on its own — the agent will still "just quickly cat it." I also use a PreToolUse hook that denies Bash when the command is `cat`/`head`/`tail` of a source file and tells it to use Read instead. That's the only thing that reliably stops it.

The 22M of hand pastes is still the bigger number. For code I almost never paste now — I give the path and a line range, or a 15–20 line excerpt if I need to point at something. Paste is for things that aren't already in the repo.

After a fat read or paste does slip through, I compact or start a new session before I ask it to edit. Leaving a 30k truncated file in the window is how a cheap `cat` turns into a long bill.

1

u/Ok_Gur_9033 1d ago

Your hook made me count how often mine does this. Since 25 Oct my agent ran cat, head or tail on a source file 2,421 times in my main sessions, against about 3,000 Read calls. Only 40 of those came back over 20k characters, so the truncated edit you describe is rare for me. The volume is what surprised me. Most of them were quick peeks at Dart files that Read with an offset would have done just as well.

Does your hook still let head through with a line count, or does it deny all three?

1

u/KingYF1 20h ago

I deny all three on source files, including head -n 40 or tail -n. A line count doesn't fix the two problems I care about: Bash output still gets capped around 30k, and whatever came back stays in the session. The 40 truncated cases are the scary ones, but 2,400 peeks are how a session quietly fills up.

The hook looks at the executable after any bash -c / sh -c, and at the file path. .dart, .ts, .py and the rest of the source tree are a hard deny, and the error text tells it to use Read with offset/limit. I do let tail -n through on log files, with a size cap, because that's actually what tail is for.

head -n as a special case just becomes the next thing it tries after cat is blocked. If you allow it, cap the line count in the hook, not in the prompt.