components C3a: context awareness + custom statusline command - #294
Merged
Conversation
Status/context half of plan §3 (C3b ships the transcript polish):
- context-% status segment + context-low transcript row, driven by
the LAST response's prompt-side tokens (new last-wins last_* keys
in the compat usage incl. cache read/creation — the cumulative
sums double-count and drop cache, TS tokens.ts:407-420); zeroed
on /clear and /resume
- threshold math delegates to the CANONICAL autoCompact port the
engine already uses (review caught a forked module warning at the
engine's compact point — the fork is gone); the canonical percent
display modernized to current-TS raw-window half-up rounding;
warning copy branches on auto-compact enabled ("N% until
auto-compact") vs disabled ("Context low … /compact")
- settings statusLine.command runner (TS executeStatusLineCommand:
JSON payload on stdin w/ TS field shapes, 5s timeout, failures →
no text); event-driven refresh on run-finish + 30s hot-reload
keepalive instead of hot polling; thread worker hardened so no
codec/teardown error can exit the app
20 new tests (thresholds DERIVED from the canonical functions and
pinning warn < compact < window); suite baseline-identical.
Critic-approved after one REQUEST CHANGES round (usage measure,
threshold fork, worker crash vectors, payload shapes, hot polling).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
3 tasks
singlaamitesh
pushed a commit
to singlaamitesh/clawcodex
that referenced
this pull request
Jul 7, 2026
…-context-status components C3a: context awareness + custom statusline command
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.
Summary
last_*usage keys incl. cache read/creation — cumulative sums double-count, TStokens.ts:407-420); zeroed on/clear///resumeautoCompact.tsport the engine already uses (review killed a forked module that warned exactly at the engine's compact point); canonical percent modernized to current-TS raw-window display; copy branches on auto-compact enabled/disabledsettings.statusLine.commandrunner (TSexecuteStatusLineCommandcontract: JSON stdin payload with TS field shapes, 5s timeout, failures → no text), event-driven refresh + 30s keepalive (no hot polling), worker hardened against codec/teardown crashesuv.lockdrift deliberately excluded (stale-lock regen unrelated to this change)Test plan
current_usageobject/null; runner contract (first-line, non-zero, timeout, JSON stdin via sys.executable); once-per-crossing warning + re-arm; hermetic widget tests🤖 Generated with Claude Code