interpulse
What it does: Single-hook session context-pressure monitor. A PostToolUse hook (matcher Edit|Write|Bash|Task|NotebookEdit|MultiEdit, 5s timeout) maintains ephemeral state in /tmp/interpulse-${SID}.json and computes a dual-threshold level = max(pressure_level, context_level). Pressure is heuristic: +1.0 per call (+1.5 for Read/Grep/Task/WebFetch/WebSearch), -0.5 decay per 10 idle minutes, plus a cumulative token estimate (tool_output length / 4). Context is ground truth: it reads context_window.remaining_percentage from hook stdin and normalizes for Claude Code’s 16.5% autocompact buffer, falling back to pressure-only when absent (subagents/old CC). Warnings (yellow/orange/red) are emitted via additionalContext with 5-call debounce + severity-escalation bypass; red writes a /tmp checkpoint markdown; orange emits an interband checkpoint_needed signal intended for intermem; every call writes an interband pressure payload for a statusline. One skill (pressure) renders a dashboard from the state file. lib/interpulse-lib.sh holds the shared state + normalization helpers.</purpose_confirmed>
Rationale: The core engine is sound and notably modern for its size: it prefers Claude Code’s ground-truth context_window.remaining_percentage and only falls back to heuristics, which sidesteps the usual naive-token-counting critique; debounce + severity-escalation-bypass is well-judged; hooks fail open (trap ‘exit 0’). This is not a deprecate — it owns a real concern (context-rot early warning, repeatedly validated in the 2026 token-economics/context-rot findings as a first-order cost/quality driver). But it has two concrete integration breaks that make its outputs invisible, plus internal doc/skill drift, and it stops at ‘warn’ when the SOTA move is to act. Hence improve, not keep: fix the broken wiring and close the pressure->action loop, but don’t rebuild the engine. Specific evidence: (1) interpulse writes the statusline payload to interband channel interpulse/pressure/, but interline/scripts/statusline.sh Layer 4 still reads intercheck/pressure/${session_id}.json — the pressure indicator never reflects interpulse. (2) interpulse emits interband interpulse/checkpoint/ checkpoint_needed at orange “for intermem,” but intermem has zero consumers of that channel — a dead signal. (3) Doc drift: README.md and AGENTS.md document a skills/status/SKILL.md and /interpulse:status, but the actual skill is skills/pressure/SKILL.md and the command was renamed to /interpulse:pressure (git commit c218f7b) to resolve a 4-way status collision; README’s threshold table (Yellow 60/Orange 90/Red 120) also disagrees with its own prose (60/75/85) and with CLAUDE.md. (4) Token estimate output_len/4 double-counts vs the now-authoritative remaining_percentage and over-counts subagent/Task output that never enters the parent context.
SOTA gap: Passive gauge with no relief action. Frontier (Anthropic write/select/compress/isolate, +29%/+39%; demand-paging for context arXiv:2603.09023; SWE-Pruner arXiv:2601.16746; structured note-taking/externalization) treats a pressure threshold as the trigger for automated compaction/eviction/externalize-to-memory. interpulse has the authoritative input and even fires a checkpoint event, but the loop is dead. Missing frontier idea: pressure-as-trigger, not pressure-as-warning.
Redundancy: It is the canonical context-pressure owner post-extraction from intercheck, but ownership is split mid-migration: intercheck still references the concern and interline still reads the legacy intercheck/pressure channel. Signal-level overlap with interstat (session token analytics) and tool-time (hook-based tool-usage analytics), but those are post-hoc whereas interpulse is the live gauge. intermem/interline are intended collaborators, not duplicates. No merge target — fix the seams instead.
Actions:
- Fix the statusline integration: either repoint interline/scripts/statusline.sh Layer 4 to read interband channel interpulse/pressure/ (with intercheck/ as fallback during migration), or coordinate the channel name — currently the live pressure indicator never reflects interpulse output.
- Close the dead checkpoint loop: make intermem (or a documented consumer) read the interband interpulse/checkpoint/ checkpoint_needed signal at orange and auto-synthesize/externalize session memory — turning the existing signal into the SOTA pressure-triggers-compaction/externalization action (cite Anthropic context-engineering write/select/compress/isolate, +39% with memory tool).
- Reconcile docs to code: update README.md + AGENTS.md to reference skills/pressure/SKILL.md and /interpulse:pressure (not status), and fix the contradictory threshold tables (README prose 60/75/85 vs table 60/90/120 vs CLAUDE.md) so the published numbers match the hook.
- De-emphasize the heuristic token estimate when context_window.remaining_percentage is present (avoid double-counting and over-counting subagent/Task output that never enters parent context); make ground truth authoritative and the heuristic a labeled fallback.