Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/Morrison-Lab/ai-config --skill compress-session명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| name | compress-session |
| description | Distill context before compacting. |
| user-invocable | true |
| allowed-tools | ["Bash","Read","Write"] |
Claude Code auto-compacts long conversations on its own once the context window fills up (see What survives compaction). The automatic pass guesses what to keep. This skill runs before that happens so a higher-fidelity, structured distillation — one the agent actually controls — is what carries forward, using two mechanisms Claude Code already provides rather than any custom hook:
MEMORY.md) is re-injected from disk automatically after
any compaction — no hook needed. Writing the distillation there is enough
to survive compaction./compact — running /compact focus on <what matters> before the automatic pass kicks in lets the summary keep what
you choose, instead of what the automatic pass guesses.checkpoint — that's a deliberate mid-task snapshot triggered by task
phase, written to its own topic file under the same memory directory
(not MEMORY.md itself, since it doesn't need to survive compaction
automatically the way this skill's distillation does). See checkpoint's
distinction table.handoff — that's for ending/pausing the session; this skill doesn't
end anything, it just makes sure the parts worth keeping survive the
next compaction, automatic or manual.MEMORY.md) preserves.MEMORY.mdMEMORY.md lives at ~/.claude/projects/<project>/memory/MEMORY.md (the
same auto-memory directory handoff/checkpoint/memorize use) and its
first 200 lines or 25KB, whichever is smaller, are re-injected into context
automatically after every compaction — this is the load-bearing property
this skill relies on. Keep the entry itself short and move real detail into
a separate topic file in the same directory (referenced from MEMORY.md),
since only MEMORY.md itself is guaranteed to reload after compaction —
topic files reload only when Claude reads them again.
Capture, concisely:
Update the existing MEMORY.md entry for this task in place rather than
appending a new one each time — MEMORY.md has a strict size budget for
what auto-reloads, so a growing pile of stale entries pushes the current,
relevant one past the 200-line/25KB cutoff.
Once the distillation is written, you can additionally run /compact focus on <what to keep> right away instead of waiting for the automatic pass.
Per context-window.md's "When your context fills up"
section:
"The summary keeps what you choose instead of what the automatic pass
guesses is important." This is optional (step 1 alone already protects the
distillation), but worth doing when you know compaction is imminent and
want the conversation summary itself — not just MEMORY.md — to reflect
a deliberate choice.
State that the distillation was written to MEMORY.md (and whether a
focused /compact was also triggered). Don't produce a long report — this
is meant to be a quick, low-ceremony action.
checkpoint — the deliberate, phase-triggered sibling that writes to
its own topic file rather than MEMORY.md itself, because it doesn't need
the auto-reload-after-compaction property. See its distinction table for
the trigger/scope difference.handoff — the session-end/pause counterpart; run that instead when
the session is actually stopping, not just compacting.memorize — general-purpose fact persistence via the same auto-memory
mechanism; this skill is the specialized "protect the highest-value facts
against the next compaction" case, with the added /compact focus
trigger.PreCompact/SessionStart hook is needed to survive
compaction — auto memory already re-injects MEMORY.md automatically;
don't add hook complexity for something the harness already does.MEMORY.md itself — topic files don't auto-reload after compaction, only
MEMORY.md's first 200 lines/25KB do.MEMORY.md entry per compaction instead of updating the
task's existing entry in place — bloats MEMORY.md past its auto-load
budget and pushes the current entry out.