A Claude Code mod

Compact
smartly. — context compaction for Claude Code

You keep working.
Compactly finds the moment to lighten your session, with a handoff for what comes next.
An open-source Claude Code mod for context compaction, task handoffs, and a cost and cache panel.

Free and open source · Apache-2.0

compactly v0.7.0 · Works with Claude Code ≥2.1.295

Claude Code~/orders-api
A task finishes. You keep going.

Illustrative session · costs vary by model and context.

See Compactly in action

THE LAUNCH FILM / 01:19 · Full watch page
Compactly running in Claude Code, with the cost and cache panel open Play film A little less context.
A lot less to carry.
The handoff, the cache clock, and the cost panel.
79 SECONDS

Why Compactly?

One less thing
to remember.

You finish a change. Commit it. Send the next prompt. Managing context is rarely the next thing on your mind.

Claude Code gives you /compact, including custom instructions for what to keep. Compactly handles the timing and prepares those instructions around the work you’re doing.

THE MOMENT BETWEEN TASKS

  1. 01You finish a task.

    A natural break appears in the work.

  2. 02Your next prompt waits.

    The judge checks the session digest and what comes next.

  3. 03A handoff takes shape.

    Decisions, their reasons, files, and unfinished work carry forward.

  4. 04Your prompt resumes.

    The same prompt runs in the same session, with less context to carry.

The work carries forward

Less history.
More continuity.

Compactly uses Claude Code’s compaction engine with instructions written for the next task. Open work, decisions, and file paths go into the handoff.

A TASK BOUNDARY, IN MOTION

Illustrative task handoff

  1. Your next prompt waits. Compactly holds it while checking for a natural break.
  2. A tailored handoff keeps the thread. Decisions, open work, and useful file names carry forward.
  3. Your prompt resumes in the same session. The context is smaller, and the work continues.

Example only. Context and costs vary by model and session.

The interactive illustration loads as you reach this section. Watch the launch film.

Illustrative session · the work carries forward on a smaller context.

01 / NOTICE

A break between tasks.

The judge considers your next prompt and a digest of the session before deciding.

02 / HAND OFF

Prepare what comes next.

Keep open work, decisions with their reasons, and the files you’ll need.

03 / CONTINUE

Your prompt picks up.

The held prompt runs in the same session, on the compacted context.

The judge can get a boundary wrong. Rate it, or use suggest mode to keep the decision yours.

Before the cache goes cold

Go for lunch.
Come back lighter.

A long session can be cheap to revisit while its context is cached. When that cache expires, the next prompt has to rebuild the context it carries.

With auto mode and the judge enabled, a configured task-boundary signal on a sufficiently large context can arm an idle timer if no new prompt arrives. The session continues with a smaller handoff.

TASK FINISHED

A good place to pause.

An eligible configured boundary can arm the idle check.

1H CACHE · 5 MIN LEFT

Compactly checks first.

If the checks pass, Compactly prepares a focused handoff.

WHEN YOU RETURN

Pick up the thread.

Continue with the compacted context.

Four checks before an idle compact.

The idle path uses these signals as a heuristic before it compacts.

  • 01A task-boundary signal
  • 02Enough context to justify compaction
  • 03No recent sign of paused or blocked work
  • 04No new prompt or active turn

With a 1-hour cache, the idle timer fires 55 minutes after an eligible boundary; with a 5-minute cache, it fires after 4 minutes. The Claude Code session must stay open. A new prompt cancels the timer and goes to the judge if context meets your threshold.

Your session. Your call.

Quietly helpful.
Still in your hands.

Run automatically, switch to suggestions, or turn it off. Rate a boundary when Compactly gets it wrong.

Explore the settings
Does this replace Claude Code’s compaction?

Compactly uses Claude Code’s compaction engine. It adds a decision about when to compact, tailored handoff instructions, and automatic resend of the held prompt.

See the full comparison →

What happens to unfinished work?

The handoff includes open work, decisions with their reasons, and relevant file paths. Recent wording that suggests paused or blocked work suppresses signal-triggered compaction; this is a heuristic.

Does it keep the cache warm?

Compaction reduces the context a later turn needs to rebuild. It does not extend the cache lifetime.

What does the judge see?

At or above your context threshold, it receives a short digest: the opening task context, recent prompts, edited file names, the start of the latest answer, and your next prompt. Claude Code sends this digest to the selected model. Ratings and savings are stored in Claude Code’s local plugin store; digest examples are reused only in the project where you rated them.

Can I review the decision myself?

Compactly checks at or above your context threshold (150K by default). If context is below it or the judge is not confident a break has happened, your prompt continues without compaction. Switch to suggest mode for boundary notifications instead; the threshold and judge settings are configurable.

Two commands. Then get back to it.

A lighter session starts here.

Add the marketplace, install Compactly, then start a new session. Claude Code 2.1.295 or later.

/plugin marketplace add swapnildahiphale/compactly /plugin install compactly@compactly

Inside Claude Code · Installation guide →

Install Compactly

Run these two commands inside Claude Code, then start a new session.
Requires Claude Code 2.1.295 or later.

/plugin marketplace add swapnildahiphale/compactly /plugin install compactly@compactly

Full installation guide

Compactly · The launch film

The approved 79-second cut, reused as supplied. Interactive page demos are illustrations of the mechanism.