← BlogContact

My AI Agents Cannot See Their Own Limits. So I Built Them a Window.

Tower Usage Limits page showing 5-hour and weekly usage, reset countdowns and plans for Claude, Codex and agy
The Usage Limits page shows the 5-hour and weekly readings with reset countdowns and plans. A stale Codex reading is marked "33 min old" so staleness is visible, not hidden.

Two invisible walls stop agent work

I followed a public discussion on the Claude Code GitHub repo, issue #81691: an agentic coding tool cannot see its own limits. I run AI coding agents on long tasks and hit both walls.

The first wall: it hits the 5-hour or weekly usage limit mid-task and just stops; it cannot see it coming.

The second wall: context fills and auto-compacts mid-edit, losing the thread.

It cannot see either wall coming, and cannot compact itself: a request for agent-initiated compaction was closed upstream as not planned.

Context: compact early and rebuild the rules

I set auto-compaction to fire early, at 450,000 tokens.

A hook rebuilds the rules from files on disk after every compaction, so the rules never depend on what survived the summary.

Each unit of work ends by writing a handoff file plus a one-word signal file; the session exits, and a loop script starts a fresh session that begins by reading the handoff.

Quota: real readings, real stops

The statusline receives real 5-hour and 7-day usage percentages and reset times from the client; a small script writes them to a local file.

A prompt hook injects one short line only when usage is 60% or more. At 85%, the prompt recommends avoiding new parallel agents. At 95%, the prompt recommends writing the handoff. The loop script independently waits until the 5-hour window resets, so the pause never depends on the model obeying. A missing number is UNKNOWN, never shown as 0%.

The Tower: a window into the limits

I built a monitor called Tower to surface what was hidden. Reading Claude and Codex limits costs zero model tokens because it reads local files; agy's reading is a quota lookup, cached 15 minutes, and two calls 20 seconds apart returned identical percentages.

The Agents > Usage Limits tab shows Claude, Codex and agy: 5-hour and weekly usage, reset countdown, and plan. Claude Max 5x and Codex Plus plans read automatically; agy does not expose its plan, so the plan is a manual entry, labelled "manual". A terminal command prints the same table.

The numbers, at capture time

On 2026-09-30 around 13:22 IST, this is what Tower saw.

60 projects in the factory. The issue tracker held 1,456 total issues: 195 open, 198 parked, 1,008 closed. Other states make up the remainder.

Live CLI tools: 7 of 11 working. 5 Claude Code sessions and 2 Codex sessions running. Command Code, OpenCode, Kimi, and Antigravity were offline.

The separate issue register (Pehredaar) held 254 total: 172 resolved, 82 parked, 0 open.

One Codex reading was marked "stale (33 min old)". Tower shows age so stale readings do not pass as fresh.

Testing on the real machine revealed what the unit tests hid

Two bugs passed every unit test and showed only on a live run.

The first: a hook printed nothing in production. A clock default raised an error, but a broad except swallowed it. Every unit test set the override, so the tests never ran the production path.

The second: the Claude reading showed "unknown". The code was looking in macOS's per-user temp folder instead of the shared temp folder where the statusline writes the file. Both now have regression tests.

What is still not solved

The system now sees the 5-hour limit coming. The loop script guards the reset. Context auto-compacts at 450,000 tokens and rebuilds the rules.

Model-specific weekly limits are not exposed by the client; a low number never proves it is safe. The prompt line is advisory; only the loop script is a hard control. I cannot exclude that agy's quota lookup itself costs below 1% of quota.

I have not yet seen the hook fire in a live prompt; it stays quiet below 60%. Until it fires for real, it is tested, not proven.

The walls are still there. Now I can see them, and the part that has to work does not depend on the model.

Meharban Singh

Meharban Singh

AI systems / delivery architect. I build software with AI agents governed by rules, hooks, gates and independent review.