Skip to content
Back to skills

Strategic Compaction

ASecurity

Manage long agent sessions: when to compact or clear, what to keep in handoffs, and how to avoid context rot

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
developmentgodebugging

Works with

  • mcp

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill strategic-compaction --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Strategic Compaction?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Strategic Compaction
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-strategic-compaction/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-strategic-compaction)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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. `anvil memory handoff` saves it, and ANVIL'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 `anvil 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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.