| name | side-compact |
| description | Summarise the CURRENT Claude Code session with a cheaper model (Sonnet 5 by default) and write it to a file, so you can start a fresh session seeded from it. A cheap, model-configurable alternative to /compact. Use when the user wants to compact, summarise, or hand off this conversation cheaply, or asks to "compact with a cheaper model". |
| allowed-tools | Bash |
side-compact
Summarise the session this skill is running in, using a cheaper model, and write
the summary to a file. Native /compact always runs on the main session model;
this runs the summarisation on a model the user chooses.
How it works
The running session's transcript is identified by the CLAUDE_CODE_SESSION_ID
environment variable, which summarise_session.py reads automatically. Do NOT
guess the transcript or pick the "latest" file: the script resolves the exact
JSONL for this thread from that variable. It then renders the transcript to
plain text, prefixes each turn with a [L<n>] marker pointing back to the
source JSONL line, and summarises it with claude -p, fully isolated
(--tools "", a summariser-only system prompt, a throwaway working directory)
so the summarisation call cannot load a project's CLAUDE.md or act on the
transcript.
The written summary opens with a header naming the source JSONL and a
## Chapters table of contents. Each chapter cites a (lines X-Y) range in
that JSONL, so a fresh session that wants more detail than the prose gives can
Read the transcript at those offsets directly.
Steps
-
Run the script. It auto-targets this session and prints the summary path:
python3 ~/.claude/scripts/summarise_session.py \
--detail detailed \
--out-dir ~/.claude/session-summaries
- Default model is
sonnet (the alias resolves to Sonnet 5). If the user
named a cheaper/different model, pass --model <model> (e.g. --model haiku).
- For a shorter summary, pass
--detail brief.
- Run it verbatim with no other flags:
--cwd and the session id default
correctly inside a live session.
-
Tell the user the summary path that was printed.
-
Explain the next step: a skill runs inside the session and cannot clear or
relaunch it. To actually free up context, the user starts a fresh session
seeded from the summary, e.g.
claude "Read the session summary at <path> and continue from where it leaves off."
or run side-compact in their terminal, which does this in one step.
Notes
- If the script reports no transcript,
CLAUDE_CODE_SESSION_ID was not set
(e.g. invoked outside a normal session); fall back to --transcript <path>.
- Do not paste the summary contents into the conversation unless asked; the point
is to keep this session's context small.