Skip to content

components C3a: context awareness + custom statusline command - #294

Merged
ericleepi314 merged 1 commit into
mainfrom
components/c3-context-status
Jun 11, 2026
Merged

components C3a: context awareness + custom statusline command#294
ericleepi314 merged 1 commit into
mainfrom
components/c3-context-status

Conversation

@ericleepi314

Copy link
Copy Markdown
Collaborator

Summary

  • Status/context half of components plan §3 (C3b = transcript polish, next PR)
  • Context-% status segment + context-low transcript row, measured from the LAST response's prompt-side tokens (new last-wins last_* usage keys incl. cache read/creation — cumulative sums double-count, TS tokens.ts:407-420); zeroed on /clear///resume
  • Threshold math delegates to the canonical autoCompact.ts port 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/disabled
  • settings.statusLine.command runner (TS executeStatusLineCommand contract: 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 crashes
  • uv.lock drift deliberately excluded (stale-lock regen unrelated to this change)

Test plan

  • 20 new tests — thresholds DERIVED from the canonical functions, pinning warn < compact < window; payload shape incl. current_usage object/null; runner contract (first-line, non-zero, timeout, JSON stdin via sys.executable); once-per-crossing warning + re-arm; hermetic widget tests
  • Full suite BASELINE-IDENTICAL (12 known pre-existing failures, diff-verified)
  • Impl-critic: REQUEST CHANGES (usage measure, threshold fork, crash vectors, payload shapes, polling) → all fixed → APPROVE

🤖 Generated with Claude Code

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>
@ericleepi314
ericleepi314 merged commit a2c80b6 into main Jun 11, 2026
singlaamitesh pushed a commit to singlaamitesh/clawcodex that referenced this pull request Jul 7, 2026
…-context-status

components C3a: context awareness + custom statusline command
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