feat(claude): a context-window readout for sessions you are not watching - #16
Merged
Conversation
macarchy-core's Claude Code status line writes each session's context percentage to `$XDG_RUNTIME_DIR/macarchy-claude/<session id>` as it renders. This module reads those back every five seconds and puts the fullest one on the bar: green under 60 %, orange, red at 85 % where a compaction is close. The point is the sessions off-screen. Running a fleet of agents, the terminal in front of you says nothing about the three working in branches you cannot see — so the pill carries a badge with how many are alive, and the percentage is the worst of them, not the nearest. Files from sessions that have exited are swept on the same pass, and tmpfs clears whatever is left at logout. With no status line running the pill is a plain icon, so it costs nothing to leave in a layout. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TN4cPFxUtafhd87w2ZqY7R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
claude.contextwidget: how full the Claude Code context window is, on the bar.macarchy/macarchy-core#16 makes the status line drop each session's percentage in
$XDG_RUNTIME_DIR/macarchy-claude/<session id>as it renders. This module reads those back every five seconds and shows the fullest one — green under 60 %, orange, red at 85 % where a compaction is close.The point is the sessions off-screen. Running a fleet of agents, the terminal in front of you says nothing about the three working in branches you cannot see, so the percentage is the worst of them rather than the nearest, and the pill carries a badge with how many are alive.
Files from exited sessions are swept on the same pass; tmpfs clears the rest at logout. With no status line running the pill is a plain icon, so it costs nothing to leave in a layout.
Test
pytest tests/test_module_claude.py— five cases: percentage and tint tracking the fullest session, a fleet badge, the stale sweep taking the button quiet, unreadable files ignored rather than fatal, and noXDG_RUNTIME_DIRmeaning no reading.Note:
tests/test_widgets.py::test_button_with_icon_and_text_honours_tintfails onorigin/mainas well — pre-existing, untouched here.🤖 Generated with Claude Code
https://claude.ai/code/session_01TN4cPFxUtafhd87w2ZqY7R