Skip to content

feat(bearings): report real session context usage in every digest - #4

Merged
sKeLe100 merged 1 commit into
mainfrom
ctx-usage-in-bearings
Aug 20, 2026
Merged

sKeLe100 merged 1 commit into
mainfrom
ctx-usage-in-bearings

Conversation

@sKeLe100

Copy link
Copy Markdown
Owner

Adds bin/fm-context-usage.sh: reads the Claude session transcript's own usage records (input + cache_creation + cache_read of the last non-sidechain assistant turn - the same total the terminal /context command displays) and prints one data-only line with tokens, window, percent, transcript path, and age. Fails loudly when no transcript exists (non-claude harness) instead of guessing; sidechain (subagent) turns are excluded.

The bearings skill now runs it in the gather step and appends exactly one non-structural context-usage closing line to the chat digest and file-mode report, so every /bearings and every morning debrief (which runs bearings) shows the real context number instead of trusting the padded countdown known to stick at 0.

Verification: tests/fm-context-usage.test.sh passes (6 scenarios: last-non-sidechain selection, window override, usage-free failure, missing-file failure, newest-transcript auto-discovery, absent-directory failure); bin/fm-lint.sh clean under pinned ShellCheck 0.11.0; live smoke run matched the session's actual /context readout.

Delivery note: shipped direct-PR rather than through the no-mistakes daemon because of its two open wedges (fm-nomistakes-hang-debug); GitHub Actions do not fire on this private repo, so validation is the local test + lint evidence above.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YKWMeN2ydAuD1SfjDinTHg

Add bin/fm-context-usage.sh, which reads the Claude session transcript's
own usage records (input + cache_creation + cache_read of the last
non-sidechain assistant turn - the same total /context displays) and
prints one data-only line. The bearings skill now runs it in the gather
step and appends one context-usage closing line to the chat digest and
file-mode report, so every /bearings and morning debrief shows the real
number instead of trusting the stickable padded countdown.

Claude-Session: https://claude.ai/code/session_01YKWMeN2ydAuD1SfjDinTHg
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