context-management

Manage session history with context trimming and structured summaries.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/M2AI-jp/thanks4claudecode-fresh --skill context-management-m2ai-jp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: context-management
Source: https://github.com/M2AI-jp/thanks4claudecode-fresh/tree/main/.claude/skills/context-management
Command: npx skills add https://github.com/M2AI-jp/thanks4claudecode-fresh --skill context-management-m2ai-jp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It defines /compact optimization and summary guidelines to retain essential information while pruning history.

Core Features & Use Cases

  • Must_keep & can_remove rules: Prioritize critical context while discarding noise.
  • Compact workflow: Pre/post compact checks and storage of session summaries.
  • Context-log & storage: Externalize context for traceability.

Quick Start

Run /compact before ending a session to prune history and preserve essential context.

Frequently Asked Questions about context-management

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

FAQPage Schema
How do I prevent my AI sessions from running out of context space?

Context management optimizes session history by trimming non-essential information while preserving critical context. Use the /compact command before sessions end to prune history, apply must_keep and can_remove rules to prioritize what stays, and monitor context usage at 70% (warning), 80% (critical), and 90% (danger) thresholds to stay within limits.

What's the best way to summarize long conversation histories without losing important details?

Structured session summaries store essential information in .claude/session-history with pre- and post-compact checks. The Skill tracks prior and current phases, externalizes context via context-log records, and maintains a Single Source of Truth through current-implementation.md updates to preserve reasoning while reducing token overhead.

Can I track context usage across multiple AI agent sessions?

Yes. The Skill integrates on_session_start and on_session_end hooks into your workflow, centralizes logging via context-log records, and stores standardized session summaries for traceability. This enables monitoring context drift across interactive agents and long-running sessions with full auditability.

How do I decide which parts of my conversation history to keep or remove?

Define must_keep rules for critical context—reasoning, decisions, system state—and can_remove rules for noise or redundant exchanges. The Skill applies these prioritized retention lists during /compact to balance information density with token efficiency, guided by threshold-based warnings.

Why does my AI agent lose track of earlier reasoning in long sessions?

Context drift occurs when history grows unchecked and important prior reasoning gets deprioritized or dropped. Proactive context trimming, phase tracking, and structured summaries prevent drift by maintaining essential information while compacting redundant content, ensuring continuity across session boundaries.