context-management

Monitor context pressure, prune history, and summarize outputs for AI agents.

Updated Mar 14, 2026
One-click install
npx skills add https://github.com/dgroch/metacognition --skill context-management-dgroch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-management
Source: https://github.com/dgroch/metacognition/tree/main/skills/context-management
Command: npx skills add https://github.com/dgroch/metacognition --skill context-management-dgroch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Proactively manage the finite context window to prevent degradation in output quality and to ensure timely, efficient reasoning under heavy workloads.

Core Features & Use Cases

  • Proactive context hygiene: monitor context pressure, prune history, and summarize outputs to keep conversations focused.
  • Spawn decision framework: determine when to spawn sub-agents based on task complexity and context load.
  • Output hygiene: summarize large results, extract essentials, and write intermediates to files for easy resumption.
  • Pre- and post-compaction routines: checkpoint critical state before compaction and recover after.
  • Model continuity: reuse on-disk self-model and env-model persistence to avoid rebuilds and maintain consistency.

Quick Start

Enable the Context Management skill to begin proactive context hygiene, sub-agent spawning decisions, and pre/post-compaction safeguards.

Frequently Asked Questions about context-management

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

FAQPage Schema
How do I prevent context overload in AI agents during long-running sessions?

Prevent AI context overload by applying proactive context hygiene, which monitors context pressure, prunes history, and summarizes outputs to maintain reasoning efficiency. This skill automates these checks to sustain output quality during extended workloads.

What is the best way to manage context compaction without losing critical state?

Manage context compaction safely by using pre-compaction checkpoints to save critical state and post-compaction recovery routines to restore it. This ensures model continuity and prevents data loss during context window reductions.

How do I decide when to spawn sub-agents based on task complexity?

Decide when to spawn sub-agents by evaluating task complexity and current context load using a structured spawn decision framework. This prevents context window exhaustion by offloading heavy multi-step planning to separate processes.

Can I persist AI self-model and env-model on disk to avoid rebuilds?

Yes, you can persist AI self-model and env-model on disk to avoid rebuilds and maintain consistency. Reusing on-disk persistence allows agents to resume long-running sessions efficiently without losing environmental awareness.

Does proactive context management work for multi-step planning tasks?

Yes, proactive context management works for multi-step planning tasks by implementing context-guard checkpoints and output hygiene. It extracts essentials and writes intermediates to files, ensuring focused reasoning and easy resumption.