crew-context

Manages context exhaustion by warning near limits, writing handoff notes, and resuming sessions after clears.

2|Updated Jul 28, 2026
One-click install
npx skills add https://github.com/mbadali25/useful-claude-add-ons --skill crew-context-mbadali25
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: crew-context
Source: https://github.com/mbadali25/useful-claude-add-ons/tree/main/plugin/crew/skills/crew-context
Command: npx skills add https://github.com/mbadali25/useful-claude-add-ons --skill crew-context-mbadali25

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Long Claude Code sessions eventually exhaust their context window, and a /clear or /compact normally wipes all working state. This Skill detects when the window is filling up, prompts for a structured handoff note before the session ends, and injects that note into the next session so work resumes without losing state. ## Core Features & Use Cases - Context usage monitoring: A Stop hook reads the transcript's real message.usage token counts and warns once per session when usage crosses a threshold (the later of a percentage rule and a reserve-token floor). - Structured handoff notes: Writes a short pointer-based HANDOFF.md (done, in-flight, next action, do-not, verify-first) that SessionStart injects into the next session after a clear, compact, or resume. - Staleness detection and archiving: Judges handoff notes by age and git drift (branch/head versus the current checkout) and archives stale notes to a timestamped folder instead of injecting outdated state. - Use Case: A developer working a multi-hour ticket hits 85% context; the watcher fires, they write a handoff, type /clear, and the new session opens already holding the note and the single next action. ## Quick Start Ask the assistant to set up context handoff monitoring so it warns before the window fills and resumes work from a handoff note after a clear.

Frequently Asked Questions about crew-context

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

FAQPage Schema
How do I resume a Claude Code session after clearing context?

Write a handoff note to .work/HANDOFF.md before clearing, then run /clear or /compact. The SessionStart hook prints the note and Claude Code injects it as context, so the new session opens already holding the prior state and next action.

How do I measure Claude Code context window usage?

Read the last message.usage record in the session's JSONL transcript and sum input, cache-read, and cache-creation tokens. That figure is the real prompt size, unlike transcript file-size estimates which read high because transcripts are cumulative.

Can Claude Code clear its own session automatically?

No. Hooks run as child processes and cannot reset the parent conversation. The experimental context.autoClear option only drives the terminal by typing /clear, and it requires identifying the terminal, which is why tmux by pane id is the only title-free method.

Why does the context warning fire too early on large windows?

A pure percentage threshold like 0.8 leaves 200k tokens free on a 1M window. The watcher fires at the later of the percentage rule and a reserve-token floor, so on large windows the floor pushes the warning from 80% to about 90%.

What happens to stale handoff notes?

Notes are judged by age against maxAgeHours and by git drift against the current branch and head. A flagged note is archived to .crew/handoffs with a timestamp rather than deleted, so it stays recoverable but is not injected as current state.

Should I enable auto-resume for handoffs?

Keep it off by default. Auto-resume injects the handoff via additionalContext without a human reviewing it first, so a subtly wrong note compounds unattended. Enable context.autoResume only after observing enough handoffs to trust their accuracy.