From claude-swe-workflows
Performs pre-compaction housekeeping: updates persistent memory, git hygiene checks, trash cleanup, session audit, SBAR go/no-go recommendation, and post-compaction resume prompt.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-swe-workflows:pre-compactopusThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
The user is about to run `/compact`. Compaction destroys conversation
The user is about to run /compact. Compaction destroys conversation
context. Anything important from this session that is not persisted
somewhere durable — memory files, commits, tickets, code, the issue
tracker — is lost.
This skill is the last-chance pass to capture session state. Walk a fixed checklist as a floor, then use judgment for anything the checklist does not anticipate, and end with an SBAR-formatted go/no-go report.
Updating persistent memory is the core reason this skill exists. The
user invokes /pre-compact because they want memory written before
compaction. Do not skip this step or treat it as conditional. Follow
whatever memory conventions are documented in the user's global or
project CLAUDE.md (auto-memory directory, project notes, etc.).
Re-scan the session for facts worth saving across conversations. Look for:
For each candidate:
git log / current
code, or ephemeral to this conversation.Run git status and assess:
git commit.Do not commit or stage on the user's behalf without explicit per-invocation permission. Match the scope of any granted permission exactly.
Identify candidate trash:
/tmp/*,
*.bak, ad-hoc test scripts, debug dumps)scratch.*, debug.*,
tmp_*, nohup.out)For each candidate:
A false delete loses the user's work-in-progress. A false retain costs nothing. Bias accordingly.
Walk the session and look for anything else that would be hard to
reconstruct from git log + persistent memory + the issue tracker
after compaction. Examples (non-exhaustive — the point of this step
is to think past the checklist):
run_in_background tasks, dev
servers, watchers) that the user may have forgotten aboutFor each item: either persist it now (memory, ticket, comment) or flag it explicitly in the SBAR.
Per the user's session handoff format:
Keep each field tight — one to three lines. The user reads this returning to a stale tmux pane, and may also use it to brief the post-compaction version of the session.
The post-compaction agent reads the lossy summary, not the live conversation. A resume prompt drafted now, while full context is still in scope, is far higher-quality than what that agent could reconstruct from the summary. Always emit one of two outputs in this step — never silently skip it, since absence is ambiguous.
If there is pending work the next turn should pick up, emit a single fenced block the user can copy clean into the next prompt. The block must be:
path/to/file.py:42 to do Y, then run Z."If there is no pending work, emit exactly this line and nothing else in this step:
No resume prompt — work is sealed.
Wait for the user. Do not run /compact. Do not start new
implementation work — this skill exists to seal the session, not to
extend it.
npx claudepluginhub chrisallenlane/claude-swe-workflows --plugin claude-swe-workflowsSaves critical files, task progress, and working state before context compaction, then restores them after. Use before /compact or when auto-compact triggers.
Closes out a session cleanly by reviewing work, updating project tracking files, committing changes, and capturing session knowledge. Use when a task is complete with no passoff needed.
Suggests manual context compaction at logical intervals (e.g., after research, before implementation) to preserve task context, avoiding arbitrary auto-compaction during long sessions.