Agent Compaction Architecture — Production Context Management
SkillSkill
6-condition autocompact gate, 3-strike circuit breaker, post-compaction cleanup — complete context death spiral prevention
About
Every serious Claude Code agent eventually hits the same wall. The session was running perfectly. Then it crossed a token threshold with no architecture to handle it — and the agent came back confused, missing its own decisions, or looping. This SKILL.md is the complete fix.
⚡ What's Inside
-
Empirically verified token thresholds autocompact gate at 167k/200k window, soft warning at 160k, hard block at 177k. These numbers came from production runs, not documentation guesswork
-
The 6-condition autocompact gate All six must pass before compaction is permitted. One failed condition is a full abort, not a partial execution
-
3-strike circuit breaker Consecutive compaction failures trip the breaker, prevent cascading context loss, and surface the failure cleanly instead of letting the agent degrade silently
-
Post-compaction cleanup protocol The ordered sequence required after compaction to restore agent coherence before the next task begins
-
freshTailCount calibration The parameter that determines how much recent context survives compaction and how to set it for your session depth
🏭 Proven in Production
This architecture ran in a live deployment for months — same agent, back-to-back sessions, handling real tasks across multi-hour runs. The thresholds stopped being theory the day they stopped a cascade failure mid-task. Every constant in this file has a story.
🆕 What's New in v1.1
- Cross-references added to the complete 10-skill bundle
- Attribution language removed — patterns are production-validated, not vendor-sourced
✅ Core Capabilities
- ✅ Drop-in SKILL.md — works immediately with any Claude Code agent
- ✅ All 6 autocompact gate conditions with pass/fail logic
- ✅ 3-strike circuit breaker — prevents cascading compaction failures
- ✅ Post-compaction cleanup sequence — agent coherence restored before next task
- ✅ freshTailCount reference — calibrate context survival for your session depth
- ✅ Full threshold map: 160k warning → 167k autocompact → 177k hard block
Core Capabilities
- Token threshold management
- Autocompact gate logic
- Circuit breaker on compaction failures
- Post-compaction cleanup
- Microcompaction scheduling
- Recursion guards
- Summary content structure
Customer ratings
0 reviews
No ratings yet
- 5 star0
- 4 star0
- 3 star0
- 2 star0
- 1 star0
No reviews yet. Be the first buyer to share feedback.
Version History
This skill is actively maintained.
April 1, 2026
v1.1: Added setup guide, production threshold table, and cross-references to free primers.
March 31, 2026
One-time purchase
$19
By continuing, you agree to the Buyer Terms of Service.
Details
- Type
- Skill
- Category
- Engineering
- Price
- $19
- Version
- 2
- License
- One-time purchase
Works With
Works with OpenClaw, Claude Projects, Custom GPTs and other instruction-friendly AI tools.
Compatible With
Claude Code (all versions)
Works great with
Personas that pair well with this skill.
Developer Skill Pack
Bundle
Four engineering skills in one — Rails, Python, SQL, and API design patterns that make agents write production-quality code
$69
IT Orchestrator Agent
Persona
Keep technical work moving. Reduce operational friction.
$39
Software Architect Agent
Persona
Design systems that are clear, scalable, and actually buildable.
$49