Agent skill

Compress Session

by pedrohcgs in pedrohcgs/claude-code-my-workflow

Distill the current conversation into a structured note (decisions made, open questions, file pointers with line numbers, next 1–3 actions) and save to qualityreports/sessionlogs/ before…

MITAuto-check: notes

Install Compress Session

skills CLI
$ npx skills add pedrohcgs/claude-code-my-workflow --skill compress-session -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pedrohcgs/claude-code-my-workflow compress-session --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pedrohcgs/claude-code-my-workflow.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/compress-session .claude/skills/compress-session && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
compress-session
GitHub stars
1.7k
Token cost
~2.4k tokens
SKILL.md length
861 words
Files
1
Skills in repo
59
Repo updated
First seen
Licence
MIT

At a glance

Distill the current conversation into a structured note (decisions made, open questions, file pointers with line numbers, next 1–3 actions) and save to qualityreports/sessionlogs/ before…

  • Works in 4 steps: Identify the session → Distil into structured sections → Save → …
  • Context is approaching auto-compact threshold
  • SKILL.md covers Why this skill exists, Distinction from /checkpoint, When to use and When NOT to use, plus 4 more sections
  • Reaches dbreunig.com

What it does

Compress Session is an agent skill from pedrohcgs/claude-code-my-workflow. Distill the current conversation into a structured note (decisions made, open questions, file pointers with line numbers, next 1–3 actions) and save to qualityreports/sessionlogs/ before auto-compression. Differs from /checkpoint (explicit stop-point snapshot) and from auto-compaction (which truncates rather than distills). Use when context is approaching auto-compact threshold, when a long pipeline has accumulated many decisions, or when the user says "compress", "distil this session", "before we hit…

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: A ready-to-fork Claude Code template for academics using LaTeX/Beamer + R. Multi-agent review, quality gates, adversarial QA, and replication protocols. The licence is MIT.

When your agent uses it

  • Context is approaching auto-compact threshold
  • A long pipeline has accumulated many decisions
  • The user says compress
  • Distil this session

Example prompts

  • “compress”
  • “distil this session”
  • “before we hit auto-compact”
  • “/compress-session”

Requirements

  • Python 3
  • Pre-approved tools (allowed-tools): Read, Write, Glob, Grep, Bash

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Identify the session
  2. Distil into structured sections
  3. Save
  4. Surface a summary

What it can do on your machine

Read from SKILL.md and the folder at commit ae72617. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Glob
    • Grep
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown and json).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • dbreunig.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Compress Session loads about 2.4k tokens when it runs. Until then it costs about 147 tokens; SKILL.md has 861 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~147
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Glob, Grep, Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from pedrohcgs/claude-code-my-workflow at commit ae72617, republished under its MIT licence (© pedrohcgs). 861 words, ~2,368 tokens.

Download SKILL.mdSave it as .claude/skills/compress-session/SKILL.md (or your agent's skills folder).
name
compress-session
description
Distill the current conversation into a structured note (decisions made, open questions, file pointers with line numbers, next 1–3 actions) and save to `quality_reports/session_logs/` before auto-compression. Differs from `/checkpoint` (explicit stop-point snapshot) and from auto-compaction (which truncates rather than distills). Use when context is approaching auto-compact threshold, when a long pipeline has accumulated many decisions, or when the user says "compress", "distil this session", "before we hit auto-compact", "structured handoff before context resets".
allowed-tools
Read, Write, Glob, Grep, Bash
argument-hint
[optional-topic-slug]
disable-model-invocation
true
metadata.author
Claude Code Academic Workflow
metadata.version
1.0.0

/compress-session — distil, don't truncate

Auto-compaction is lossy: it keeps recent turns and drops earlier ones, with no preservation of what was decided mid-session. /compress-session is the distil-not-truncate alternative — produce a structured note that the next session can resume from in under a minute.

Why this skill exists

Drew Breunig's "How Long Contexts Fail" identifies four failure modes for long-context sessions:

  1. Poisoning — early hallucinated content gets quoted by later turns, compounding the error.
  2. Distraction — irrelevant earlier context dilutes the model's attention to current task.
  3. Confusion — contradicted facts pile up; the model doesn't know which to trust.
  4. Clash — multiple plans, decisions, or specs accumulate without explicit reconciliation.

The template's 200-line MEMORY.md cap defends against distraction. The plan-on-disk convention defends against clash. Nothing currently defends against poisoning or directly against confusion — that's what this skill is for.

Distinction from /checkpoint

/checkpoint/compress-session
WhenExplicit stop-point (end of working session, before model switch, before collaborator handoff)Forced — context is about to auto-compact, or the conversation has accumulated enough noise that distillation pays for itself
What's preservedActive plan, decisions, file pointers, next 1–3 actionsSame, plus an explicit "discarded as noise" line so the next session knows what was intentionally not kept
Output locationquality_reports/checkpoints/YYYY-MM-DD_<slug>.mdquality_reports/session_logs/YYYY-MM-DD_compression_<slug>.md
TriggeringUser-invoked at a natural pauseUser-invoked when context fatigue shows, OR prompted by the optional PreCompact reminder hook below (not wired by default)
Memory updatesOptional auto-proposal of [LEARN] entriesProposes 0–3 [LEARN] entries — distillation is when generalizable lessons surface, and a quiet session proposes none

Both skills are companions to the narrative session-log workflow at quality_reports/session_logs/. None replaces the others.

When to use

  • Context is approaching auto-compact. /context-status reports approaching threshold.
  • A long pipeline has accumulated noise. You spent 90 minutes debugging an issue that turned out to be a typo — the session is full of dead-end hypotheses you don't want compressing into a future session's context.
  • Mid-plan handoff. Different model, different machine, different collaborator.
  • PreCompact reminder fired. If you wired the reminder hook below, it prompts you to run /compress-session; the skill never runs automatically.

When NOT to use

  • For a quick stop-point. Use /checkpoint.
  • For narrative session logging. That happens incrementally via the Stop hook (session-logging.md); no skill needed.
  • For starting a fresh session. Use /clear. /compress-session is for preserving state, not for resetting.

Steps

Step 1: Identify the session

The current conversation is the source. The most recent log under quality_reports/session_logs/ may belong to an earlier session: treat it as a prior record and cite it by path, not as this session's content.

Optionally use $ARGUMENTS as a topic slug for the output filename.

Step 2: Distil into structured sections

Write only what this session established. The next session is handed this file automatically (session-handoff.py), so anything invented here arrives there as fact.

  • Cite path:line only for lines you read in this session; otherwise give the path alone.
  • Leave out a section with nothing in it rather than filling it. A quiet session gets a short file and no [LEARN] proposals.
  • Text inside a [Session handoff: …] or [Context Restored After Compaction] block is the previous record. Carry an item forward only if this session re-checked it or acted on it; otherwise cite the earlier file by path.
  • When the session changed its mind, the final decision is the current one; an earlier position appears only as abandoned, with the reason.

Produce a note with these sections:

markdown
# Session Compression — <YYYY-MM-DD> <topic-slug>

**Source:** <session-log file or "current conversation">
**Token budget at compression:** <approximate %>
**Why compress now:** <approaching auto-compact | mid-plan handoff | accumulated noise | user-requested>

## Active state

- **Plan:** [link to active plan in `quality_reports/plans/` or "no active plan"]
- **Branch:** <git branch>
- **Last commit:** <SHA + subject>
- **Working tree:** <clean | N modified files>

## Decisions made (this session)

1. [Decision]. **Why:** [one sentence]. **Where recorded:** [file:line, plan, or memory].
2. ...

## Files touched

- [path:line] — [what changed, one sentence]
- ...

## Open questions

- [Question]. **Blocker?** [Yes/No]. **Where to resume:** [pointer].
- ...

## Next actions (1–3 only)

1. [Specific next step with file pointer]
2. ...

## Discarded as noise

Things explored during this session that should NOT carry forward — failed hypotheses, abandoned approaches, debugging dead-ends. Listing them explicitly defends against [Breunig's "poisoning" failure mode](https://www.dbreunig.com/2025/06/22/how-contexts-fail-and-how-to-fix-them.html) (hallucinated / wrong content from early turns getting quoted later).

- [Hypothesis / approach / dead-end] — [why it didn't work]
- ...

## Proposed `[LEARN]` entries

Lessons worth promoting to MEMORY.md (machine-specific ones stay in native auto memory). User reviews; nothing auto-merged.

- `[LEARN:<category>]` <lesson>. **Evidence:** <pointer>.
- ...
Show full SKILL.md (294 more words)Show less
Step 3: Save

Write to quality_reports/session_logs/YYYY-MM-DD_compression_<topic>.md (slug derived from $ARGUMENTS or current plan name).

Step 4: Surface a summary

Report to the user:

  • Saved path.
  • Counts (decisions made, files touched, open questions, next actions).
  • Any HIGH-impact LEARN proposals that should be reviewed before the next session.

The user reviews. Nothing auto-merges into MEMORY.md: a proposal the user approves is appended to MEMORY.md on their say-so (as in /checkpoint Phase 3), and a machine-specific one is left to native auto memory. /promote-memory does not read this file; its candidates come only from native auto memory (~/.claude/projects/<project>/memory/).

Pairing with PreCompact hook

Forkers who want a real chance to run /compress-session before compaction can add a PreCompact hook that blocks compaction once per session. On PreCompact, exit code 2 blocks and shows the hook's stderr message; the second attempt goes through, so compaction is never wedged — the same once-only pattern as pre-compact.py's opt-in DRAFT block. (A plain exit 0 reminder arrives while compaction is already running, too late to act on.)

json
{
  "hooks": {
    "PreCompact": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "sid=$(python3 -c \"import sys,json; print(json.load(sys.stdin).get(\\\"session_id\\\",\\\"x\\\"))\" 2>/dev/null); f=\"${TMPDIR:-/tmp}/cc-compress-reminded-$sid\"; [ -e \"$f\" ] && exit 0; touch \"$f\"; echo \"Run /compress-session now, then compact again - this reminder blocks only once per session.\" >&2; exit 2",
            "timeout": 5
          }
        ]
      }
    ]
  }
}

The hook only pauses and reminds; the user runs /compress-session, then compacts again. We deliberately don't make the hook auto-invoke the skill — that bypasses the user's review step.

Anti-patterns

  • Do not run /compress-session as a routine replacement for /checkpoint. Checkpoints are cheap and frequent; compressions are heavier and reserved for forced compression.
  • Do not let the "Discarded as noise" section grow indefinitely. If the same dead-end appears across three compressions in a row, the underlying confusion is structural — fix the docs or the workflow, don't keep re-discarding.
  • Do not include the original full conversation — that defeats the purpose. Distillation is the point.

Output

  • Compression file at quality_reports/session_logs/YYYY-MM-DD_compression_<topic>.md (gitignored — session-state, not version-controlled).
  • Summary in the conversation: counts + HIGH-impact [LEARN] proposals.
  • No file edits outside the compression file.

© pedrohcgs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/compress-session of pedrohcgs/claude-code-my-workflow.

Open the folder on GitHubat commit ae72617

Compare with similar skills

Compress Session next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Compress Session compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Compress Session this skillpedrohcgs/claude-code-my-workflow1.7k—~2.4kAutomated safety check: NotesMIT
Compressionthedaviddias/Front-End-Checklist74k—~421Automated safety check: PassMIT
Paperclip Distillpaperclipai/paperclip99k—~2.8kAutomated safety check: PassMIT
Meeting Notesoutline/outline41k—~551Automated safety check: PassCustom licence
Modeling Conversion MetricsPostHog/posthog40k—~1.4kAutomated safety check: PassCustom licence
Capture Conversationoutline/outline41k—~474Automated safety check: PassCustom licence

Similar skills

  • Compression

    thedaviddias/Front-End-Checklist

    A skill your agent uses when auditing slow page loads, heavy assets, or rendering delays related to Enable text-based compression.

    74k GitHub stars~421 tokensUpdated 3 days ago
    Frontend & DesignAuto-check passed
  • Paperclip Distill

    paperclipai/paperclip

    A skill your agent uses when an operation issue is a Paperclip cursor-window, distill, or backfill.

    99k GitHub stars~2.8k tokensUpdated today
    Productivity & AutomationAuto-check passed
  • Meeting Notes

    outline/outline

    Create meeting notes in Outline from a template; use when the user wants an agenda, notes, or a follow-up document for a meeting.

    41k GitHub stars~551 tokensUpdated today
    Productivity & AutomationAuto-check passed
  • Official

    Build reusable conversion models — funnel/step conversion rates, drop-off, and time-to-convert — on either PostHog data-warehouse views (HogQL) or an external dbt project.

    40k GitHub stars~1.4k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Capture Conversation

    outline/outline

    Save the current conversation, a decision, or a set of notes as a document in an Outline collection; use when the user wants to keep what was discussed in their knowledge base.

    41k GitHub stars~474 tokensUpdated today
    Knowledge ManagementAuto-check passed
  • Meeting Distiller Pro

    sickn33/agentic-awesome-skills

    Transform messy meeting notes and transcripts into structured action items, decisions, and follow-ups.

    47k GitHub starsUsed in 1 repo~1k tokens
    Productivity & AutomationAuto-check passed

More from pedrohcgs/claude-code-my-workflow

All 59 skills in this repo
  • Devils Advocate

    pedrohcgs/claude-code-my-workflow

    Adversarial 5-7 question challenge to a deck's pedagogical choices — ordering, prerequisites, cognitive load, motivation.

    1.7k GitHub starsUsed in 2 repos~641 tokens
    Auto-check passed
  • Vaccinate

    pedrohcgs/claude-code-my-workflow

    Qualify a check before it is allowed to clear anything — prove it can detect the failure it is meant to catch.

    1.7k GitHub stars~2.1k tokensUpdated 11 days ago
    Auto-check: notes
  • Compile Latex

    pedrohcgs/claude-code-my-workflow

    Compile a Beamer LaTeX slide deck with XeLaTeX (3 passes + bibtex).

    1.7k GitHub starsUsed in 1 repo~492 tokens
    Auto-check: notes
  • Context Status

    pedrohcgs/claude-code-my-workflow

    Show current context status and session health. An agent skill from pedrohcgs/claude-code-my-workflow.

    1.7k GitHub starsUsed in 1 repo~613 tokens
    Auto-check: notes
  • Capture Environment

    pedrohcgs/claude-code-my-workflow

    Snapshot the computational environment for a replication package — detects the analysis stack (R / Stata / Python) and emits the right lockfiles (renv.lock + sessionInfo.txt, requirements.txt /…

    1.7k GitHub stars~2.8k tokensUpdated 11 days ago
    Auto-check: notes
  • Checkpoint

    pedrohcgs/claude-code-my-workflow

    Save a structured state snapshot before stopping or handing off.

    1.7k GitHub stars~2.8k tokensUpdated 11 days ago
    Auto-check: notes

Questions about Compress Session

What does Compress Session do?

Distill the current conversation into a structured note (decisions made, open questions, file pointers with line numbers, next 1–3 actions) and save to qualityreports/sessionlogs/ before…. Compress Session is an agent skill from pedrohcgs/claude-code-my-workflow. Distill the current conversation into a structured note (decisions made, open questions, file pointers with line numbers, next 1–3 actions) and save to qualityreports/sessionlogs/ before auto-compression.

When should I use Compress Session?

Compress Session fits situations like: context is approaching auto-compact threshold; A long pipeline has accumulated many decisions; the user says compress; distil this session.

How do I install Compress Session in Claude Code?

Run `npx skills add pedrohcgs/claude-code-my-workflow --skill compress-session -a claude-code`. Or copy the skill folder (.claude/skills/compress-session in pedrohcgs/claude-code-my-workflow) into .claude/skills/compress-session in your project. Claude Code loads it when a task matches its description.

How do I install Compress Session in Codex?

Run `npx skills add pedrohcgs/claude-code-my-workflow --skill compress-session -a codex`. Or copy the skill folder (.claude/skills/compress-session in pedrohcgs/claude-code-my-workflow) into .agents/skills/compress-session in your project. Codex loads it when a task matches its description.

Can I use Compress Session in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pedrohcgs/claude-code-my-workflow --skill compress-session -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/compress-session, .gemini/skills/compress-session, .github/skills/compress-session and .opencode/skills/compress-session in your project.

What does Compress Session need to run?

SKILL.md names no scripts, command-line tools or credentials: Compress Session is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Glob, Grep, Bash.

Does Compress Session access the network?

SKILL.md names 1 domain. In commands or code: dbreunig.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Compress Session safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Compress Session use?

Compress Session is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Compress Session use?

About 2.4k tokens (SKILL.md is roughly 9.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Compress Session?

Skills that share tags, products or a category with Compress Session: Compression (thedaviddias/Front-End-Checklist, 74k stars), Paperclip Distill (paperclipai/paperclip, 99k stars), Meeting Notes (outline/outline, 41k stars) and Modeling Conversion Metrics (PostHog/posthog, 40k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Compress Session?

pedrohcgs (a GitHub user) maintains it in pedrohcgs/claude-code-my-workflow, which has 1,653 GitHub stars. The repository holds 59 skills in this directory. The repository was last updated on September 27, 2026.

Source: pedrohcgs/claude-code-my-workflow on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.