Compaction Recovery logo

Compaction Recovery

Community
Omar-Obando
compaction-recovery

Context compaction recovery skill that preserves mission state across session compaction events. Ensures TODO items, sub-task details, and implementation progress survive context window compression.

Overview

PublisherOmar-Obando
Repositoryqwen-orchestrator
Skill namecompaction-recovery
Stars
53
Forks
13
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Omar-Obando on GitHub. Read the source before you install it.

Installation

Install the Compaction Recovery AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Omar-Obando/qwen-orchestrator/tree/main/skills/compaction-recovery
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Omar-Obando/qwen-orchestrator.git /tmp/qwen-orchestrator
mkdir -p .claude/skills
cp -r /tmp/qwen-orchestrator/skills/compaction-recovery .claude/skills/compaction-recovery
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Compaction Recovery in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Compaction Recovery on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Compaction Recovery is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Compaction Recovery Skill — Context Preservation Protocol

This skill ensures that when the LLM context window is compacted (compressed), no mission-critical information is lost. It defines what to preserve and how to restore it.

The Compaction Problem

When context is compacted:

  • Previous conversation is summarized/compressed
  • Detailed TODO items may lose their sub-task descriptions
  • Implementation progress may be forgotten
  • File-level assignment details may vanish
  • Partial code changes may lose their context

Prevention Protocol

Write Everything Important to Files

NEVER rely on conversation context for critical information. ALWAYS persist to the active session directory.

Each /orchestrator invocation creates a new isolated session. The active session ID is stored in .qwen-orchestrator/current-session. All state writes go to .qwen-orchestrator/sessions/<session-id>/.

.qwen-orchestrator/
├── current-session                  # Active session ID (single line: YYYY-MM-DDTHH-MM-SS)
├── sessions/
│   ├── 2026-05-07T14-30-00/         # Archived session (IMMUTABLE — never modify)
│   │   ├── context.md
│   │   ├── memory.md
│   │   └── ...
│   └── 2026-05-07T16-45-00/         # Active session (pointed to by current-session)
│       ├── context.md               # Project context (<150 lines)
│       ├── memory.md                # Session state for recovery
│       ├── redesign-analysis.md     # Redesign analysis (if applicable)
│       ├── tech-decisions.md        # Technology decisions
│       ├── seo-report.md            # SEO audit results
│       ├── sync-issues.md           # Cross-file sync issues
│       ├── project-status.md        # Progress tracking
│       ├── qa-report.md             # Quality reports
│       ├── agent-health.md          # Agent status tracking
│       ├── progress/
│       │   ├── mission-state.md     # Current mission snapshot
│       │   ├── active-files.md      # Files being worked on + status
│       │   └── decisions.md         # Architecture decisions made
│       ├── checkpoints/
│       │   └── cp-[timestamp].md    # Periodic checkpoint snapshots
│       └── docs/                    # Cached documentation
│           └── *.md
└── shared/                          # Cross-session persistent data (future use)

Shorthand: $SESSION_DIR = .qwen-orchestrator/sessions/$(cat .qwen-orchestrator/current-session)/

TODO Format for Compaction Survival

Each TODO item must be SELF-CONTAINED (understandable without conversation):

markdown
## T3.1: Implement User Authentication Module | agent:Backend Developer | status:in_progress

### Context ( survives compaction )

- **Goal**: JWT-based auth with refresh tokens
- **Files**: src/auth/jwt.service.ts, src/auth/auth.controller.ts
- **Dependencies**: jsonwebtoken, bcrypt
- **Business Rules**: Token expires in 15min, refresh in 7 days
- **Pattern**: Repository pattern with Passport.js strategy

### Sub-tasks

- [x] S3.1.1: Create JWT service with sign/verify/refresh | PASS
- [ ] S3.1.2: Create auth controller with login/logout/register
- [ ] S3.1.3: Add refresh token rotation
- [ ] S3.1.4: Write integration tests

### Progress

- S3.1.1 DONE: jwt.service.ts created, unit tests pass (12/12)
- S3.1.2 NEXT: Starting auth.controller.ts

Checkpoint Schedule

Write checkpoints at these moments:

  1. After every milestone completion
  2. Before complex refactoring
  3. When switching between agents
  4. Every 30 minutes of active work
  5. Before any risky operation

Checkpoint Format

markdown
# Checkpoint — [Timestamp]

## Mission: [Name]

## Progress: [N]/[Total] tasks complete

## Currently Active

- Agent: [Name]
- Task: [ID + Description]
- File: [Current file being worked on]
- Status: [What was just done, what's next]

## Completed This Session

- [Task 1]: [Result]
- [Task 2]: [Result]

## Pending

- [Next 3 immediate tasks]

## Blockers

- [Any blockers and their status]

## Key Decisions

- [Decisions made this session]

## Files Modified

- [file1]: [what changed]
- [file2]: [what changed]

Recovery Protocol

When Compaction is Detected

  1. STOP current operation
  2. READ .qwen-orchestrator/current-session to find the active session ID
  3. READ $SESSION_DIR/memory.md for session state
  4. READ current TodoWrite state for task status
  5. READ latest checkpoint in $SESSION_DIR/checkpoints/
  6. RESUME from the exact point recorded

Where $SESSION_DIR = .qwen-orchestrator/sessions/<active-session-id>/

Recovery Checklist

  • Memory file read and understood
  • TODO status matches reality (verify files)
  • Last checkpoint verified against actual file state
  • Active agent identified and re-engaged
  • No duplicate work started

Agent-Specific Preservation

Commander

Must persist: Mission scope, delegation plan, active sessions, sync issues

Planner

Must persist: Research findings, architecture decisions, TODO structure

Developer

Must persist: Current file, implementation approach, test status, code patterns

Reviewer

Must persist: Review findings, sync issues, verification evidence

QA Engineer

Must persist: Test strategy, coverage targets, known bugs

Project Manager

Must persist: Scope changes, risk register, progress metrics

Rules

  • ALWAYS write state to files BEFORE doing risky operations
  • ALWAYS make TODO items self-contained (no conversation context needed)
  • ALWAYS create checkpoints at regular intervals
  • ALWAYS verify file state matches recorded state after recovery
  • NEVER rely on conversation memory for mission-critical information
  • NEVER modify files from archived sessions — each session's data is IMMUTABLE after that session ends
  • ALWAYS read .qwen-orchestrator/current-session first to determine the active session directory
  • ALWAYS write state to $SESSION_DIR/ (not the flat .qwen-orchestrator/ root)

When NOT to Use

Do NOT use this skill when:

  • Writing application business logic (use domain-driven skill for complete business modules)
  • Designing database schemas (use database-design skill for normalization and indexing)
  • Writing API endpoint implementations (use api-design skill for REST/GraphQL endpoint patterns)
  • Reviewing code for quality issues (use code-review skill for comprehensive audits)
  • Performing security audits (use security-auditor skill for vulnerability analysis)
  • Analyzing deployment configurations (use deployment skill for CI/CD pipelines and infrastructure)
  • Writing SQL queries (use sql-best-practices skill for query optimization and N+1 prevention)
  • Designing multi-page website layouts (use design-system skill for professional UI/UX and spacing)
  • Planning funnels or integrations (use multi-channel-funnels or third-party-integrations skills)
  • Refactoring existing code (use refactoring skill for safe behavior-preserving transformations)

Frequently asked questions

What does the Compaction Recovery AI skill do?

Context compaction recovery skill that preserves mission state across session compaction events. Ensures TODO items, sub-task details, and implementation progress survive context window compression.

Why use Compaction Recovery on TypingMind?

Because you install it once and use it with any model. Compaction Recovery is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Compaction Recovery in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Omar-Obando/qwen-orchestrator/tree/main/skills/compaction-recovery. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Compaction Recovery?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Compaction Recovery?

As many as you like. As long as a model supports skills, you can use Compaction Recovery with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Compaction Recovery AI skill free?

Yes. It is published on GitHub by Omar-Obando under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇