|
|
|
Show HN: Automatic context rotation for Claude Code (no manual steps)
|
|
2 points
by vincentvandeth
113 days ago
|
|
AI coding agents break when the context window fills up — they lose state,
hallucinate, or auto-compact shreds the context you built up. I built a 3-hook pipeline that rotates before that happens, with a dry-run
replay you can run locally (no LLM/API keys). Quick demo:
- https://github.com/Vinix24/vnx-orchestration/tree/master/dem... How it works: ┌─────────────────┐
│ PreToolUse hook │── checks context % every tool call
│ (≥65% → block) │
└────────┬────────┘
▼
┌─────────────────┐
│ Agent writes │── structured ROTATION-HANDOVER.md
│ handover file │ (task state, files, progress, next steps)
└────────┬────────┘
▼
┌─────────────────┐
│ PostToolUse │── detects handover → atomic lock
│ launches rotator│ → vnx_rotate.sh (nohup, detached)
└────────┬────────┘
▼
┌─────────────────┐
│ Rotator │── /clear via tmux → waits for SessionStart
│ injects resume │ → pastes continuation prompt
└─────────────────┘
Why 65%? It’s ~15 points before auto-compact (~80%), so there’s enough
headroom to write a clean handover without racing compaction.I analyzed 5 projects attempting similar fixes — none have a full
detect → handover → clear → resume → verify loop. Repo: https://github.com/Vinix24/vnx-orchestration
Docs: https://github.com/Vinix24/vnx-orchestration/blob/master/doc... |
|