Repository navigation
feat(bearings): report real session context usage in every digest - #4
Merged
Merged
Conversation
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
This was referenced Sep 26, 2026
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.
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.shpasses (6 scenarios: last-non-sidechain selection, window override, usage-free failure, missing-file failure, newest-transcript auto-discovery, absent-directory failure);bin/fm-lint.shclean 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