#Why does heartbeat need the whole session context?

1 messages · Page 1 of 1 (latest)

dim quest
#

I'm confused about the heartbeat. Why does it need the whole context it if it's supposed to not "infer or repeat old tasks from prior chats"

flint notchBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> âś… Mark Solution

short tokenBOT
minor otterBOT
#

Short version: because heartbeat needs state, not because it should keep reviving old chats.

By default, heartbeat runs in the agent’s main session, so it can:

  • see ongoing session state,
  • notice completed background/system events,
  • avoid duplicate nudges,
  • and know where target: "last" should deliver.

But that line, “Do not infer or repeat old tasks from prior chats”, is a behavior rule, not a hard memory wipe. In other words, “you can see context, but don’t resurrect stale stuff just because it’s in the transcript.”

A couple important details:

  • OpenClaw already filters out no-op heartbeat prompt/HEARTBEAT_OK pairs from history, so heartbeat noise is not supposed to pile up.
  • If you want a much more stateless/cheap heartbeat, use:
    • heartbeat.isolatedSession: true = fresh session, no prior conversation history
    • heartbeat.lightContext: true = tiny bootstrap, basically just HEARTBEAT.md
dim quest
#

I don't agree. I don't use the main session at all but use a direct chat, the main session is just filled with HEARTBEAT_OK. It just takes so much time to process the useless context in the LLM. The heartbeat contains just a few standalone tasks

minor otterBOT
#

Yeah, that’s a fair complaint. For standalone heartbeat tasks, I agree the shared-session default is kind of wasteful.

What’s happening today is:

  • heartbeat turns still get stored in the transcript,
  • HEARTBEAT_OK pairs are filtered when building model context,
  • but the prompt line “do not infer or repeat old tasks” is still only a behavior hint, not a hard isolation boundary.

So if your heartbeat is just “run these few tasks”, the real fix is not the prompt text, it’s:

{
  agents: {
    defaults: {
      heartbeat: {
        every: "30m",
#
        isolatedSession: true,
        lightContext: true,
        target: "last"
      }
    }
  }
}

And if the destination is fixed, even better, use explicit target + to instead of last.

So bluntly: you’re right. That sentence does not solve token waste.
isolatedSession: true is the knob that actually stops heartbeat from dragging chat history along.

Docs: