← Reddit

I built a local mission control for Claude Code — it auto-stops when you hit your budget

Reddit · mahsin09 · May 31, 2026
AgentFleet is a local web UI that wraps Claude Code and Codex with features including live terminal streaming, automatic session stops when USD or token budgets are reached, and session history persisted to local SQLite. The tool runs entirely locally without requiring cloud services or accounts and works with any shell command. The MVP implementation has limitations such as estimated token counts, but the budget enforcement functionality has proven effective in preventing runaway sessions.

Detailed Analysis

A developer identified as akhilsinghcodes has built and released AgentFleet, an open-source local web interface designed to address a significant practical gap in Claude Code's native tooling: the absence of hard budget limits and real-time cost visibility during agentic coding sessions. The tool wraps Claude Code — Anthropic's terminal-based autonomous coding agent — as well as OpenAI's Codex, providing live terminal streaming through xterm.js in the browser, automatic session termination when a user-defined USD or token threshold is reached, and persistent session history stored in a local SQLite database. The project is available on GitHub and, notably, operates entirely on the user's local machine with no external data transmission or account requirements.

The problem AgentFleet addresses is a well-documented friction point among power users of Claude Code. Agentic AI coding tools, by design, can execute long chains of autonomous actions — writing files, running commands, iterating on code — and these sessions can consume substantial API tokens before a user realizes the cost has escalated. Without a native mechanism to set a hard stop at a defined budget, developers are exposed to runaway expenses that are only visible after the fact. The developer explicitly notes that the tool has already intervened to prevent multiple uncontrolled sessions, suggesting the problem is frequent enough to justify building infrastructure around it.

From a technical standpoint, AgentFleet's architecture reflects a pragmatic approach to the challenge. PTY (pseudo-terminal) session management is used to capture and stream terminal output to the browser in real time, though the developer acknowledges this approach cannot cleanly separate stdout from stderr. Token counting is estimated rather than exact, a limitation inherent to working outside the official API token-counting pipeline — Claude Code's direct terminal execution makes precise token introspection difficult without deeper integration with Anthropic's underlying API responses. These are honest trade-offs for an MVP built to solve an immediate practical need.

The emergence of community-built tooling like AgentFleet reflects a broader pattern in the agentic AI ecosystem: as AI coding agents become capable enough for sustained autonomous use, the operational and financial management layer around them becomes its own engineering problem. Anthropic's Claude Code, released in its current form in early 2025, has rapidly attracted a developer community that is now building observability, cost governance, and session management tools independently — areas that enterprise software has long addressed but that consumer and developer AI tooling largely leaves to the user. This mirrors the early trajectory of cloud infrastructure, where visibility and cost control tools emerged from the community before becoming standard platform features.

AgentFleet also illustrates the growing demand for local-first AI tooling. By keeping all data on-device and requiring no accounts or cloud services, the project positions itself for developers who prioritize privacy and control — a recurring concern as AI agents gain broader filesystem and shell access. Whether Anthropic will eventually incorporate native budget controls and session observability directly into Claude Code remains an open question, but projects like AgentFleet effectively demonstrate user demand and provide working reference implementations for what those features might look like.

Read original article →