compact-instructions
Skill2 starsChanged 6 months agoMITView on GitHub
Context preservation strategy for multi-session projects during context window compaction. Use when running `/compact`, when auto-compact is triggered, or when determining what state to preserve across session boundaries to maintain continuity.
In this repository30 other files it gives its agents.
- adr-spec-gateSkill
- agent-continuity-loopSkill
- agent-flywheelSkill
- agent-runtime-paritySkill
- business-guardrailsSkill
- debug-protocolSkill
- dns-and-whois-toolsSkill
- docs-as-codeSkill
- engineering-standardsSkill
- excellence-no-intermediatesSkill
- git-pr-rulesSkill
- hooks-for-enforcementSkill
- hooks-multi-tool-paritySkill
- iac-first-commitSkill
- impact-metrics-gateSkill
- large-payload-completenessSkill
- ledger-auto-updatesSkill
- llm-model-selectionSkill
- local-service-autostartSkill
- multi-phase-sessionSkill
- new-projectSkill
- notion-apiSkill
- notion-batch-patternSkill
- observability-when-to-addSkill
- permanent-learning-protocolSkill
- progress-md-businessSkill
- reactive-integration-designSkill
- secure-secret-inputSkill
- tokens-taxonomySkill
- version-bump-rulesSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
When a Claude Code session approaches context-window limits and performs context compaction (manual /compact or automatic), the agent must …
- Very specific: line 34
If compaction is being used to work around missing handoff documentation, that is a symptom — fix the root cause (write the missing …
- Distinctive: line 44
Before finalizing a compact summary, ask:
- Distinctive: line 47
Is decision context preserved?: If a decision matters for the next steps, include the reasoning in one sentence.
- Very specific: line 49
Does it reference durable docs?: If PROGRESS.md or session-handoff.md exists, point to it: "see PROGRESS.md for detailed timeline."
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Compact Instructions: Context Preservation Strategy
When a Claude Code session approaches context-window limits and performs context compaction (manual /compact or automatic), the agent must balance information density with continuity. This skill defines what to preserve and what to discard.
What to Preserve
- Current objective / phase — one-line statement of what the session is actively working on
- Blockers and open blockers — issues preventing forward progress, with minimal context
- Decisions that remain valid — architectural or planning decisions made in earlier sessions that still apply
- Validation state — which tests are passing, which requirements are met, which gates are open/blocked
- Worktree / branch state — when relevant to resuming work (branch name, uncommitted changes, PR status)
- Next concrete step — what the next AI session should do immediately after loading context
What to Discard
- Resolved conversations — back-and-forth debugging or decision-making that concluded
- Repeated reasoning — the same analysis or explanation presented multiple times across the session
- Discarded attempts — approaches tried and rejected, unless the rejection reason remains strategically important
- Large tool outputs — full log dumps, verbose grep results, API responses in their entirety (keep only the relevant extracted data)
- Intermediate mental models — exploratory reasoning or "let me think through this" passages that didn't lead to decision
Critical Principle
The compact summary is a sketch, not a replacement for durable state. If the project has a session-handoff.md, PROGRESS.md, CHANGELOG.md, or equivalent living documentation, those files remain the source of truth. The compacted context is temporary and lossy — it buys context space in the current session, but it does not eliminate the need to maintain formal handoff documents for the next session.
If compaction is being used to work around missing handoff documentation, that is a symptom — fix the root cause (write the missing session-handoff.md or PROGRESS.md) rather than relying on compaction to carry state.
Trigger Conditions
- Manual invocation:
/compactcommand during an active session - Automatic invocation: Claude Code's built-in auto-compact mechanism when token usage exceeds threshold
- Proactive: when working on multi-phase projects and ending a phase, consider manual compact + handoff update in parallel
Output Quality Check
Before finalizing a compact summary, ask:
- Can a blind AI read the preserved state and continue without asking? If the next session would need to ask "what phase are we in?" or "which branch?", add more specificity.
- Is decision context preserved? If a decision matters for the next steps, include the reasoning in one sentence.
- Are blockers actionable? "Blocked on X" is better than "something wrong" — the next session should know what to check first.
- Does it reference durable docs? If
PROGRESS.mdorsession-handoff.mdexists, point to it: "see PROGRESS.md for detailed timeline."
See Also
session-handoff.mdpattern — permanent cross-session statePROGRESS.md— executive/phase-level tracking/compactcommand documentation — Claude Code reference
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

