Agent skill
context-compactor
9-section context compression with analysis scratchpad. Adapted from Claude Code's /compact system (2026-03-31).
Install this agent skill to your Project
npx add-skill https://github.com/winstonkoh87/Athena-Public/tree/main/examples/skills/workflow/context-compactor
SKILL.md
Semantic Context Compactor v2.0
Protects the session from Token Bloat and "Lost in the Middle" syndrome.
Source: Claude Code
/compactprompt architecture (2026-03-31). Key Innovation: Uses an<analysis>scratchpad block (chain-of-thought) that gets stripped before the summary reaches context. The analysis improves summary quality but consumes no tokens in the final context window.
Triggers
"compact", "token limit", "clean memory", "summarize session", "context full"
Execution Protocol
Step 1: Analysis Phase (Private Scratchpad)
Wrap your analysis in <analysis> tags. This is a drafting scratchpad that will be stripped from the final output. In your analysis:
- Chronologically analyze each message and section of the conversation. For each section thoroughly identify:
- The user's explicit requests and intents
- Your approach to addressing the user's requests
- Key decisions, technical concepts and frameworks discussed
- Specific details like: file names, full code snippets, function signatures, file edits
- Errors you ran into and how you fixed them
- Specific user feedback — especially if the user told you to do something differently
- Double-check for technical accuracy and completeness
Step 2: 9-Section Summary (Structured Output)
After analysis, produce a summary in <summary> tags with exactly these sections:
1. Primary Request and Intent
— Capture ALL explicit user requests and intents in detail
2. Key Technical Concepts
— List all important technical concepts, technologies, and frameworks discussed
3. Files and Code Sections
— Enumerate specific files examined, modified, or created
— Include full code snippets where applicable
— Include WHY each file read or edit is important
4. Errors and Fixes
— List ALL errors encountered + how fixed + user feedback on each
5. Problem Solving
— Document problems solved and ongoing troubleshooting
6. All User Messages (Non-Tool-Result)
— Verbatim list of ALL user messages
— CRITICAL for detecting intent drift across the session
7. Pending Tasks
— Outline any pending tasks explicitly asked to work on
8. Current Work
— Describe in detail precisely what was being worked on IMMEDIATELY before this summary
— Include file names and code snippets
9. Optional Next Step
— Only if directly in line with user's most recent explicit request
— Include DIRECT QUOTES from the most recent conversation
— Do NOT start on tangential or old completed requests
Step 3: Post-Processing
- Strip the
<analysis>block — it was for reasoning quality only - Format the
<summary>content with section headers - Write the formatted summary to
activeContext.mdunder a new## Compacted Sessionheading - If activeContext.md exceeds 15K tokens, archive older compacted sessions to
sessionArchive.md
Anti-Patterns
- ❌ Summarizing tool results verbatim (summarize the OUTCOME, not the output)
- ❌ Losing user feedback/corrections (these are the MOST IMPORTANT signals)
- ❌ Starting tangential work after compaction without user confirmation
- ❌ Acknowledging the summary or recapping — just resume as if the break never happened
Auto-Continue Rule (Post-Compact)
"Continue the conversation from where it left off without asking the user any further questions. Resume directly — do not acknowledge the summary, do not recap what was happening, do not preface with 'I'll continue' or similar. Pick up the last task as if the break never happened."
Reference Paths
.context/memory_bank/activeContext.md.context/memory_bank/sessionArchive.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
academic-delivery
8-step pipeline for academic deliverables — essays, reports, analysis, capstones. Encodes the full intake-to-delivery workflow with automatic red-team triggering.
trade-journal-analyzer
Unified post-trade analytics: journal pattern extraction + drawdown classification. Absorbs: drawdown-classifier.
circuit-breaker
Mandatory systemic pause when cumulative red flags exceed threshold. Forces disengagement across Trading, Spending, Relationships, Work, and Energy domains.
Red-Team Review
Bias-aware adversarial review for any artifact before shipping. 5-phase QA protocol with severity-weighted findings.
power-inversion
Unified negotiation engine: BATNA mapping, Dignity Premium pricing, and commitment device protection. Absorbs: commitment-device.
consiglieri-protocol
Mandatory pre-flight checklist for high-variance social contracts. Covers the Pryce Test, Exit Test, STFU Clause, Blast Radius Audit, Vibe Veto, and Adult-to-Adult comms rewrite.
Didn't find tool you were looking for?