claude-tokens watch never re-arms after compaction, so a Claude Code session goes silent for the rest of its life
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
advance() in bin/claude-tokens only ever adds to w["armed"] — nothing removes a threshold once it has fired, and nothing detects compaction. So when a Claude Code session compacts, usage drops back to (say) 12% and climbs the whole window again, but 50/75/90/95 are all still armed and no further crossing is ever reported. The watch keeps running and keeps printing nothing.
Pi does not have this: token-watch.ts handles session_compact and calls TokenWatch.reset(), so its milestones re-arm and the second climb reports normally. The two implementations disagree about what a milestone means across a compaction.
The Python watcher is an external process polling telemetry snapshots, so it has no compaction event to hook. It would have to infer one — a reading whose percentage drops materially below the previous reading is a compaction (or a session restart, which wants the same treatment), and should re-arm every threshold and re-emit a start line.
Related: #32 adds reminder text to breakpoints. That raises the cost of this bug — a missed re-fire stops being a missed statistic and becomes a missed instruction, and post-compaction is exactly when the agent has lost the context that would have reminded it anyway. #32 is deliberately not fixing this; it is its own defect with its own semantics.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in bin/claude-tokens at advance(), then compare Pi's token-watch.ts reset behavior and the described telemetry flow. Done means a material percentage drop re-arms every threshold and emits a new start line, with the watcher reporting crossings again on the next climb.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100