Why I Stopped Letting Claude Code Count Things Directly

Published

I stopped asking Claude Code to count characters. Not because it's incapable of counting in theory, because it's wrong often enough on exact counts that trusting the estimate cost me real time this week alone. Twice, in fact, on the same kind of check: whether a draft fit under X's 280 character limit.

Where This Actually Bit Me

Both times, the agent looked at a post, said it fit comfortably under the limit, and it didn't. X's composer rejected it, the draft sat stuck, and I had to trim it and repost.

Small cost each time, but the pattern was the same both times, which is what made me stop trusting the check.

The same thing happens with word counts for paragraph density and with checking whether a name already exists somewhere in a growing list. Anywhere a task needs an exact number, not a rough sense of one, the agent's own estimate is the wrong tool for the job.

Why This Happens

A model asked "is this under 280 characters" pattern-matches against text that looks similar in length to things it's seen before, rather than actually counting characters the way a person would with a finger on each one.

That's close enough most of the time, and wrong exactly often enough to matter.

That's not a criticism of the model. Language understanding and exact counting are different operations, and an agent is built for the first one. Expecting it to also nail the second one every time is asking a tool to do a job it wasn't built for.

The Fix I Actually Use

Whenever a task needs an exact count or a threshold check, I write the check as real code, usually a one-line Python script, and run it. Not ask the agent to eyeball it, actually execute something that counts.

`len(text)` for a character limit. `len(text.split())` for a word count. A direct membership check against a list for dedup. None of this is sophisticated.

That's the point: boring, deterministic code doing the one job it's actually reliable at, instead of asking a language model to approximate it.

Where This Matters Most

Anything with a hard limit that fails silently if you're wrong. A platform's character cap doesn't warn you in advance, it just rejects the post once you hit submit.

A paragraph word-density rule doesn't flag itself, it just reads as a wall of text to whoever's actually consuming the output.

That failure mode is confidently wrong, published or submitted, and caught only after the fact, if at all. Worse than an obvious error, since nothing about the process flags it as risky in the moment.

The Broader Principle

Know which parts of a task are language understanding, where the model is genuinely strong, versus verification, where code is the better tool. Don't blur the two just because both steps happen to live in the same agent turn.

A scheduled agent that reports success while doing nothing is the same underlying lesson from a different angle: the parts of a system that look fine on the surface are exactly the parts worth checking with something more reliable than a glance.

Exact counts are a small, easy example of the same discipline.

I run this check habitually now, on every hard limit I hit in a pipeline, not just the ones that already burned me once.

Running an AI agent pipeline that could use a reliability check?

I build and audit multi-step AI automation, the kind where a silent wrong count or a false success signal costs more than an obvious crash.