Ever left Claude Code running overnight, only to discover that one task consumed a huge chunk of your weekly usage limit? Meet Budget Fence, a free, open-source Claude Code mod that lets you control how long your AI coding agents run and how much of your usage budget they consume. Created by Ishu Agrawal, Budget Fence adds configurable execution limits to Claude Code. Instead of giving your agent unlimited room to keep working, you decide when it should pause and ask for permission. WHAT CAN BUDGET FENCE DO? • Time limits: automatically pause a prompt after a specified amount of working time. • Token limits: set a maximum token budget for individual prompts, including input, cache writes, and output tokens. • Session limits: restrict how much of your five-hour Claude usage allowance a task can consume. • Weekly usage limits: prevent a single long-running task from using too much of your weekly allowance. • Background agent protection: configure separate limits for autonomous agents running in the background. • Live monitoring: view execution time, token consumption, and progress toward your configured limits. • Human approval: when a limit is reached, decide whether to continue, increase the limit, or stop execution. • Persistent preferences: new sessions can reuse your previously configured limits. • Free and open source: available under the MIT license. HOW TO INSTALL Install Budget Fence from the Claude Code plugin marketplace: /plugin install budget-fence --marketplace ishuagrawal/claude-code-mods Then open its settings: /fence Enable the fence and configure your limits. EXAMPLE COMMANDS Limit a prompt to 20 minutes: /fence time 20m Set a 500,000-token budget: /fence tokens 500k Limit a task to 2% of your weekly usage: /fence weekly 2% Set background agents to 10 minutes and 200,000 tokens: /fence background time 10m tokens 200k WHY IS THIS USEFUL? Autonomous AI coding agents are becoming increasingly capable of working for hours without human intervention. But there's a downside. One difficult debugging task, an unexpected loop, or a poorly planned implementation can consume an enormous amount of your available usage. And you might not notice until the next morning. Budget Fence adds a human-controlled boundary around that process. The interesting design choice is that Claude isn't instructed to reduce quality or rush the work because of the budget. The mod monitors execution externally and pauses the next tool call when a configured threshold is reached. IMPORTANT LIMITATIONS Budget Fence is not a guaranteed billing hard cap. It checks limits at tool-call boundaries, so a request may consume additional resources before the pause takes effect. Usage percentages may also be estimated, and cached-read tokens are excluded from the mod's token counter. The fence is disabled by default and must be enabled manually. It's also a new third-party mod, so test it on a small task before relying on it for long unattended sessions. Still, this is exactly the kind of practical control autonomous coding tools need. More AI autonomy is useful. But predictable resource consumption is even better. GitHub: https://github.com/ishuagrawal/claude-code-mods Budget Fence documentation: https://github.com/ishuagrawal/claude-code-mods/tree/main/plugins/budget-fence Would you rather give AI agents unlimited time to finish a task or set strict execution budgets? #ClaudeCode #AICoding #AIAgents