[FEATURE] Context threshold hooks to auto-trigger skills (e.g., session handoff at 70%)
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Problem
When working on complex, multi-step tasks, sessions often hit context limits unexpectedly. By the time the user or Claude notices, it's too late to create a proper handoff document - work context is
lost and the next session starts from scratch.
Currently there is no way to automatically trigger a skill based on context window utilization. Claude has no self-awareness of its token usage during a session, and the hook system only supports
tool-based events (PreToolUse, PostToolUse), not context-based events.
Proposed Solution
Add a context threshold event system that can trigger skills or hooks at configurable utilization percentages.
Example configuration in .claude/settings.json:
{
"contextThresholds": [
{
"percentage": 70,
"action": "skill",
"skill": "session-handoff-skill"
},
{
"percentage": 90,
"action": "notification",
"message": "Context limit approaching - consider wrapping up"
}
]
}
Alternative Solutions
_No response_
Priority
Medium - Would be very helpful
Feature Category
CLI commands and flags
Use Case Example
Use Cases
- Session handoff: Auto-trigger handoff document creation at 70% to preserve work context before limits hit
- User notification: Warn the user at configurable thresholds so they can prioritize remaining work
- Checkpoint creation: Periodically save progress on long-running tasks
- Multi-session planning: Automatically break remaining work into follow-up tasks
Current Workarounds
- Adding heuristic instructions to CLAUDE.md ("proactively create handoffs during long sessions") - unreliable since Claude can't measure actual token usage
- Manually invoking /session-handoff-skill - requires user to guess when context is getting full
- Using multi-session-planner upfront - helps but doesn't cover sessions that unexpectedly grow large
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗