Nothing to try yetTier: how much it should matter to you
3Useful: my rating, 1 to 5
3Signal: worth watching, 1 to 5
SDKArea: what it touches
In DevelopmentKind: in v2.1.267,
In DevelopmentSection of the release
What
Headless sessions, meaning ones run with -p or through the SDK without the interactive terminal interface, now expose a compact() method, but calling it currently always fails with an explanatory error. That's because compaction in headless mode currently only happens inside a turn, triggered by a /compact prompt, not through a separate method call.
Why
This gives headless and SDK users a clear, catchable error explaining that compact() isn't available yet in that mode, instead of it failing silently or behaving unpredictably, so they know to work around it for now.
How sure we are
One source agreesOne thing we can check says the same as this entry.
Anthropic's release notes agreeFixed resuming a session after /compact or another slash command ran via -p --resume: a spurious "Continue from where you left off." turn is…