Long-Lived Sessions Finally Catch Up: Compaction Now Always Rebuilds the System Prompt


Your “forever session” has been running for months: a Bot Mode persistent chat, a gateway work channel, doing its job every day. But here’s the thing you may not have realized — the system prompt in its head is still the one from the day it was born. Tools refresh from the live registry at every compaction, but the system prompt was restored byte-for-byte from the session snapshot: the guidance diets the maintainers shipped, new prompt blocks (like the two-line clock that shows the current time), renamed tool descriptions — it knows none of them. A change merged on August 30 (PR #98426) finally fixes this: the compaction commit now always rebuilds the system prompt with the live builder. The change is on main, not yet in a release.

Why prompts stayed frozen at birth

Hermes handles over-long contexts by compacting: condensing history into a summary and freeing room to continue. Previously, tools were rebuilt from the live registry, but the system prompt was restored byte-for-byte from the session snapshot — two different code paths. So prompt content went stale: guidance from months ago, no new feature blocks, tool descriptions using old names. In the maintainer’s words: “a forever-chat would carry its birth prompt for months while its tools array moved on.”

The fix: no update detector — the rebuild IS the detector

The maintainers explicitly rejected an “update detector.” The approach is more thorough: every compaction commit runs the live builder, then compares bytes:

  • Output byte-equal to the stored prompt → keep the ORIGINAL string object (object identity preserved, so KV/prefix caches keyed on it stay valid; the common case costs one string compare);
  • Output differs → the rebuilt prompt wins, and a drift log records it (shape: Compaction rebuilt a drifted system prompt (session=..., N -> M chars)).

The rebuild is effectively free because the prefix cache is already dead at a compaction commit — which is exactly the maintainer’s answer to “why would we not update the system prompt at compaction?” Plugin sections follow the same path: invalidation clears the frozen snapshot, rebuild re-renders through the same path as session start; if a plugin’s render raises, it falls back to its last good section (fail-open, not a freeze).

What this changes for you

  • Long-lived sessions converge on the current prompt at their next compaction: memory saved mid-life finally appears in the prompt, dieted guidance replaces stale text, and future renames stop presenting old-name guidance next to new-name tools.
  • The “Conversation started” clock got smarter: compacted/rotated sessions resolve their start time through the session-lineage ROOT — a Bot Mode forever-chat knows when it was first born.
  • No mid-conversation cache breaks: the only rebuild point is the already-sanctioned compaction boundary, never a random point mid-turn.

For more on how compression works, see our lean-tail compression default guide and context usage anchoring guide; practical tips for managing long sessions are in the session resume guide.

When you can use it

PR #98426 merged on August 30 and is not in v0.20.6 (tagged August 27). To see it in action: pull latest main, keep a long session open, then run /compress once — the session picks up the latest prompt afterwards. For the full compression configuration picture (trigger thresholds, tail strategy), see our context token optimization guide.

Bottom line: long-lived sessions can finally keep up with the times. Instead of carrying a birth prompt for months, every compaction is now a quiet self-update — at effectively zero performance cost.