Context Window Management

Compress context and spawn fresh agents when usage exceeds defined thresholds.

Updated Feb 3, 2026
One-click install
npx skills add https://github.com/jason-hchsieh/mycelium --skill context-window-management
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Context Window Management
Source: https://github.com/jason-hchsieh/mycelium/tree/main/skills/context
Command: npx skills add https://github.com/jason-hchsieh/mycelium --skill context-window-management

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Context is finite; without deliberate management, long-running AI sessions suffer from context bloat, misalignment between agents, and risky handoffs. This skill provides a disciplined approach to maintain coherence across phases and ensure reliable transitions between agent instances.

Core Features & Use Cases

  • Monitor context usage across phases and apply compression when usage crosses defined thresholds.
  • Spawn fresh agents for long-running sessions to prevent context overflow and preserve critical decisions in the progress file.
  • Support per-worktree isolation and explicit checkpoints to enable seamless handoffs and robust recovery.

Quick Start

Describe current session context usage, compress context beyond 50%, spawn a fresh agent when usage exceeds 80%, and update .workflow/state/progress.md accordingly.

Frequently Asked Questions about Context Window Management

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent context loss during long-running AI sessions?

To prevent context loss in long-running AI sessions, monitor context usage and update a central progress file. This skill enforces compression thresholds and spawns fresh agents when usage exceeds defined limits, ensuring critical decisions are preserved.

When should I compress context or spawn a fresh agent for a multi-phase workflow?

You should compress context when usage crosses 50% and spawn a fresh agent when usage exceeds 80%. This prevents context overflow during multi-phase workflows by enforcing strict thresholds and updating the state file accordingly.

How does agent handoff work with a central progress file?

Agent handoff works by updating the central progress file at .workflow/state/progress.md to preserve critical decisions. Fresh agents read this checkpoint to resume long-running sessions seamlessly without losing prior context.

Does context window management support per-worktree isolation for checkpoints?

Yes, context window management supports per-worktree isolation and explicit checkpoints. This enables seamless handoffs and robust recovery by isolating session state and tracking progress independently across worktrees.

What is Phase 4.5B Context Sync and why is it needed?

Phase 4.5B Context Sync is a process for managing context windows to prevent information loss. It is needed during long multi-phase workflows and agent handoffs to enforce compression thresholds and trigger fresh agent spawning.