October 11, 2026

10 thoughts on “How to Stop Your AI Agent from Wasting Tokens Overnight”

  1. How do I actually set the heartbeat to use a cheaper model? Which config setting controls this?

    1. In your openclaw.json, look for the agents section and add a heartbeat subsection with a model key. Something like: agents.heartbeat.model set to openai/gpt-5.4-nano. That is the cheapest option right now and handles heartbeat checks perfectly well since those tasks are simple. If you want to restrict heartbeat to active hours too (which cuts overnight polling entirely), add agents.heartbeat.activeHours with your preferred window, like 08:00-23:00 with your timezone. Combined, those two changes dramatically reduce background token spend. The nano model costs a fraction of Sonnet or GPT-5.4 and you genuinely cannot tell the difference on basic monitoring tasks.

    1. Sessions persist their transcript until you manually start a new one or one is created automatically. A long-running session accumulates context: every message, every tool call, every response gets added to the transcript. By the time you have had a session running for 24 hours with heartbeat pings every 30 minutes, that context can be enormous. Every subsequent heartbeat then pays to send all that accumulated context to the model, even if 95% of it is irrelevant. A daily session reset at 4am clears that accumulated context and starts fresh, so heartbeats are always working with a lean context window. Set it via agents.session.dailyReset in your config with a time in your timezone.

  2. How can I check how many tokens my current session is actually using? I want to audit it before making changes.

    1. Type /status in your chat. It shows current session stats including context usage, token counts for the session, cost estimate, and model. That is the fastest way. If you want more detail, openclaw sessions from the CLI lists all active sessions with their token totals. For a historical view, the session transcripts in your OpenClaw data directory log each turn with token counts if you have logging enabled. Start with /status though, it tells you everything you need to decide if the session has bloated.

    1. Set active hours in your heartbeat config. In openclaw.json add agents.heartbeat.activeHours with your window and timezone, something like 08:00-23:00 and America/Vancouver. Outside those hours, the heartbeat skips its poll entirely. Your agent is still reachable and will respond to direct messages, it just stops proactively checking things in the background. This alone can cut your overnight token spend to near zero since there is nothing running to accumulate context or make API calls. Definitely worth setting if you do not need proactive monitoring while you sleep.

    1. Each heartbeat sends your entire system prompt plus the accumulated session transcript to the model, then asks it to check things and respond. The system prompt alone can be several thousand tokens if you have SOUL.md, MEMORY.md, AGENTS.md, and skill files all loading. Add a long-running session transcript and you might be sending 20,000 to 50,000 tokens per ping without realizing it, 48 times a day if it runs every 30 minutes around the clock. The fix is threefold: use a cheap model for heartbeats, restrict to active hours, and do daily session resets. Each change helps independently but together they make a real difference.

Leave a Reply

Your email address will not be published. Required fields are marked *