Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Strategic Compaction?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ansh44233-strategic-compaction)
---
description: Manage long agent sessions: when to compact or clear, what to keep in handoffs, and how to avoid context rot
profile: minimal
tags: agents, context, productivity
---
# Strategic compaction
Use in long agent sessions, or when an agent starts forgetting decisions or repeating mistakes.
## When to compact
- After research or exploration, before implementing.
- After a milestone passes its checks, before the next one.
- After a failed approach, before trying another.
## When not to
In the middle of an edit or a debugging run, where file paths, variable names and partial state still matter.
## Before compacting
Write a handoff: the goal, decisions and why, files changed, the current check status and the next step. `forge memory handoff` saves it, and FORGE's pre-compact hook saves one automatically when files changed.
## Clear instead of compact
Start a fresh session (`/clear`) between unrelated tasks. Carrying an old task's context costs tokens and confuses the agent.
## Keep context small from the start
- Measure what loads every session with `forge context`, and trim the heaviest files.
- Put procedures in skills that load on demand, not in always-on instruction files.
- Disable MCP servers this repo does not use.
## Verify
After compacting, ask the agent to restate the goal, constraints and next step. Fix the handoff if anything important is missing.