#New Session vs Compaction?

1 messages · Page 1 of 1 (latest)

next salmon
#

What is the main difference between starting a new session and compacting the current one? What are the pros and cons of each? If I understand it correctly, compaction forces the model to summarize chat logs, and it would still eventually make the current session hit the context window? What about new session?

primal moatBOT
#

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

terse groveBOT
#

Starting a new session (/new / /reset) and compacting (/compact) solve different problems:

1) What changes

/compact = same session, rewritten “what the model sees”

  • OpenClaw summarizes older turns into a persisted compaction summary and keeps the most recent messages intact.
  • Future turns see: (compaction summary) + (recent messages after the cutoff).
  • The full transcript still exists on disk, but the model won’t get the full raw history every turn anymore.
    Docs: https://docs.openclaw.ai/concepts/compaction

/new / /reset = new session id, fresh context

  • OpenClaw starts a brand new sessionId/transcript for that same chat/thread.
  • The model no longer has the old conversation in-context (unless you paste it in again or it’s in durable “memory” files).
    Docs: https://docs.openclaw.ai/concepts/session

2) Pros / cons

#

Compaction pros

  • Keeps continuity (decisions, constraints, current goal) without you re-explaining.
  • Designed specifically to prevent context overflow in long-running sessions.
  • Can be triggered automatically when near/over the context window.

Compaction cons

  • It’s lossy: details can be dropped or slightly distorted.
  • If the summary is wrong, it can “poison” the session until corrected.
  • Costs an extra summarization turn (time + tokens).

New session pros

  • True clean slate: avoids stale assumptions and summary drift.
  • Often best when switching topics or after a “messy” debugging spiral.
  • Immediately drops context usage back near-zero.

New session cons

  • You lose in-context continuity; you’ll need to restate key facts (or rely on durable memory notes).
#
  • Easy to forget open TODOs/decisions unless you summarize them first.

3) “Won’t compaction still hit the context window eventually?”

Yes in the sense that new messages keep accumulating, but compaction is meant to be repeatable: when the “recent messages since last compaction” grow too large, OpenClaw can compact again. So you can keep a session going a long time, but the preserved history becomes increasingly “summary-shaped”.

A new session just resets the counter entirely by starting with no prior chat turns in context.

If you want the best of both worlds: do a quick “current state / decisions / TODOs” note (or /compact with instructions like “focus on decisions + next steps”), then /new when you’re switching topics.

next salmon
#

So when does it make sense to use compaction, and what about new session?

terse groveBOT
#

Use compaction when you want to keep working on the same thing, but the session is getting heavy.

When /compact makes sense

  • Same project/task continues (you still need prior decisions, constraints, partial results).
  • The agent starts feeling “slower / forgetful” because there’s too much history.
  • You’re nearing the context window (check /status → context tokens / compactions).
  • You want to “clean up” the conversation into a canonical state (decisions + current plan), but stay in the same session.

Tip: give it instructions when you care about what survives:
/compact Keep: requirements, decisions, current hypothesis, next steps; drop: dead ends and logs

When /new (or /reset) makes sense

  • Topic switch (new problem, new project, new customer, etc.).
  • You want a fresh attempt without the model anchoring on earlier wrong assumptions.
  • The session history is “contaminated” (lots of speculation, changing goals, conflicting constraints).
  • You don’t actually need continuity—re-stating a short brief is cheaper/safer than summarizing a huge transcript.
#

Practical rule of thumb

  • Need continuity? /compact
  • Need clean slate? /new

And if you want both: do a quick /compact (or write a short “here’s the state” message), then /new so the new session starts from a tight, accurate brief.

next salmon
#

I see, so if I'm just casually chatting with the model, which would you recommend?

terse groveBOT
#

For casual chatting, I’d mostly not think about it:

  • Do nothing and let auto-compaction kick in if the chat gets long. That’s the “default nice experience”.
  • Use /new when you feel the conversation has switched topics, or you want a clean slate / less baggage. For casual use, this is usually the better manual move.

I’d only reach for /compact manually in casual chat if:

  • you’re in the middle of one ongoing thread (story/roleplay/long planning), and
  • you want to keep that continuity without restarting, and
  • you notice the agent starting to drop details due to length.

So: casual = /new whenever you want; /compact rarely (or just let it happen automatically).

next salmon
#

Should I consider using a new session if it's compacting after every message?

terse groveBOT
#

If it’s auto-compacting after basically every message, that’s usually a sign something’s off — and starting a new session might help, but it depends on why it’s happening.

When /new will help

If the trigger is simply “this session has gotten huge”, then /new drops the accumulated chat history to ~zero and compaction should stop (at least for a while).

When /new won’t help much

If it’s compacting even when the conversation is short, the problem is often:

  • you’re on a small context-window model, and/or
  • your base context (system prompt + injected workspace files/memory) is already too large, and/or
  • compaction thresholds/headroom (reserveTokens etc.) are effectively forcing compaction constantly.

In that case, a new session still has the same base context, so it can keep compacting.

What I’d do to diagnose quickly

  1. Send /status and look at context usage + compaction count.
  2. Send /context detail to see what’s eating the window (often a big injected file or repeated large tool output).
  3. If you’re on a small-window model, switch to a bigger-context one (often the simplest fix).
next salmon
#
🦞 OpenClaw 2026.3.8 (3caab92)
🧠 Model: ollama/openclaw-64k:latest · 🔑 api-key (models.json)
🧮 Tokens: 46k in / 1.1k out · 💵 Cost: $0.0000
📚 Context: 46k/66k (71%) · 🧹 Compactions: 9
🧵 Session: agent:main:discord:direct:780273912818565120 • updated just now
⚙️ Runtime: direct · Think: minimal · verbose
🪢 Queue: collect (depth 0)

context detail:

đź§  Context breakdown (detailed)
Workspace: /home/dominic/.openclaw/workspace
Bootstrap max/file: 20,000 chars
Bootstrap max/total: 150,000 chars
Sandbox: mode=off sandboxed=false
System prompt (run): 33,881 chars (~8,471 tok) (Project Context 20,149 chars (~5,038 tok))
Injected workspace files:

    AGENTS.md: OK | raw 7,804 chars (~1,951 tok) | injected 7,804 chars (~1,951 tok)
    SOUL.md: OK | raw 2,145 chars (~537 tok) | injected 2,145 chars (~537 tok)
    TOOLS.md: OK | raw 4,007 chars (~1,002 tok) | injected 4,007 chars (~1,002 tok)
    IDENTITY.md: OK | raw 872 chars (~218 tok) | injected 872 chars (~218 tok)
    USER.md: OK | raw 1,647 chars (~412 tok) | injected 1,647 chars (~412 tok)
    HEARTBEAT.md: OK | raw 1,784 chars (~446 tok) | injected 1,784 chars (~446 tok)
    BOOTSTRAP.md: MISSING | raw 0 | injected 0
    MEMORY.md: OK | raw 1,211 chars (~303 tok) | injected 1,211 chars (~303 tok)

Skills list (system prompt text): 3,073 chars (~769 tok) (8 skills)
Skills: discord, healthcheck, nano-pdf, skill-creator, songsee, weather, find-skills, hotel-finder
... (and a lot more, omitted)

Session tokens (cached): 46,225 total / ctx=65536
sage sinew
#

I'll add also that compaction can also fail sometimes with different models. I notice that it fails more with GPT 5.4 than it did with Claude Sonnet/Opus 4.6. Just something to keep in mind because /new will always give you a fresh context without failure, if that's what you're looking for.

terse groveBOT
#

Yeah — with the numbers you pasted, what you’re seeing makes sense.

You’re at 46k / 66k context (71%). OpenClaw/Pi tries to keep a big headroom buffer (reserveTokens) so the next turn still has room for tool calls + a real answer. With the default safety floor (agents.defaults.compaction.reserveTokensFloor, often ~20k–24k), the “compact now” threshold is roughly:

contextWindow - reserveTokensFloor → 66k - 20k..24k → ~42k–46k

So you’re basically sitting right on the threshold, and each new message pushes you over → it compacts again.

What to do

If you’re just chatting casually: use /new. It’ll drop you back to mostly the base prompt (~8k–15k in your breakdown) and compactions should stop for a long while.

If you want to keep this session’s continuity: either accept frequent compactions, or reduce the headroom so it doesn’t trigger constantly:

If this is a long-running “forever session” goal: consider a larger-context model (more slack) or keep the session but periodically /new with a short “state of the world” summary pasted in.

#

If you paste your current agents.defaults.compaction config block (sanitized), I can suggest a safe reserveTokensFloor range for your usage.

#

Good call. One extra lever here (so you don’t have to rely on /new) is that compaction can run on a different model than your main session:

  • agents.defaults.compaction.model lets you pick a “known reliable summarizer” just for compaction, even if you’re chatting with a different/cheaper/more finicky model most of the time.
  • Also worth trying agents.defaults.compaction.mode: "safeguard" (chunked summarization) if you have very long histories.

Docs:

And yep: if you’re hitting compaction errors mid-convo and just want to get unstuck immediately, /new is the blunt instrument that always works.