Skip to content

feat(claude): a context-window readout for sessions you are not watching - #16

Merged
phmatray merged 1 commit into
mainfrom
feat/claude-context
Sep 5, 2026
Merged

feat(claude): a context-window readout for sessions you are not watching#16
phmatray merged 1 commit into
mainfrom
feat/claude-context

Conversation

@phmatray

@phmatray phmatray commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

A claude.context widget: 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.

[items.claude]
widget = "claude.context"

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 no XDG_RUNTIME_DIR meaning no reading.

Note: tests/test_widgets.py::test_button_with_icon_and_text_honours_tint fails on origin/main as well — pre-existing, untouched here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TN4cPFxUtafhd87w2ZqY7R

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
@phmatray
phmatray merged commit ec1726a into main Sep 5, 2026
1 check passed
@phmatray
phmatray deleted the feat/claude-context branch September 5, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant