You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Publish context-window, compaction and subagent figures in telemetry #245
Telemetry shows how full the main context is against the window the CLI actually uses, the compactions so far, and each subagent's context, each tagged with its figure basis.
Acceptance criteria
context.main and context.main_peak come from the ledger, with the basis of the ledger reading.
context.window and context.auto_compact_threshold come from the SDK's context-usage call, made on the attempt's event loop only at session start and after each compaction (never per turn). Their basis is sdk_assumed, or configured when CLAUDE_CODE_MAX_CONTEXT_TOKENS is set. A failed call yields unavailable with a reason and does not affect the attempt.
context.compactions is {count, last: {at, trigger, pre_tokens, post_tokens}} (measured), from compaction boundary events.
context.subagents lists {id, type, context, running} (context estimated), running ones first, at most 20 entries. Subagent start and finish are tracked so running is accurate.
Snapshot trimming over the size cap drops subagent entries after recent events.
Tests: window basis with and without the override; a compaction updates the count and the last compaction and triggers a new context-usage reading; subagent ordering and the 20-entry limit.
Implemented context telemetry for issue #245 (uncommitted at handoff): simple_coding_agent/model_execution.py tracks the context window/threshold via the SDK get_context_usage() call at session start and after each compaction only (basis sdk_assumed, or configured when CLAUDE_CODE_MAX_CONTEXT_TOKENS is set; failures yield unavailable with a reason and never affect the attempt), compaction count/last (at, trigger, pre_tokens, post_tokens) from compact_boundary events with post filled from the follow-up usage total, and a subagent registry keyed by Task tool_use_id with running flags cleared on Task tool results (view capped at 20, running first, newest first). simple_coding_agent/telemetry.py builds context.{main,main_peak,window,auto_compact_threshold,compactions,subagents} with figure invariants, and the tracer carries an unavailable context section. New tests/test_telemetry_context.py (untracked) covers window basis with/without the override, failed usage, compaction count/last plus re-reading, and subagent ordering plus the 20-entry cap.
Remaining work
Invoke the code-review skill on the diff and address findings.
Commit the implementation (model_execution.py, telemetry.py, tests/test_telemetry_context.py) on agent/issue-245.
Run the completion gate in order: (1) ruff check, (2) py3.11 pytest, (3) py3.13 pytest.
Evidence
Branch state at handoff: M simple_coding_agent/model_execution.py, M simple_coding_agent/telemetry.py, ?? tests/test_telemetry_context.py (left uncommitted; sealing preserves them).
Prior turn results (pre-threshold): new context tests 11 passed; full py3.11 suite 1125 passed, 10 skipped; ruff check clean.
Automatic continuation 0/2 used; the agent will continue automatically.
Activity
Address code-review findings for #244 (deep-freeze published view, wi…
lbacik commentedon Oct 14, 2026
Agent Attempt Result: handoff
Branch: agent/issue-245
PR: none
Handoff note commit:
10d3a0be7087e12b67db60f96debd686b095d605Evidence
UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev ruff check && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev pytest && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py313 uv run --python 3.13 --extra dev pytest→ exit code NoneDetails
Handoff note: issue #245
Summary
Implemented context telemetry for issue #245 (uncommitted at handoff):
simple_coding_agent/model_execution.pytracks the context window/threshold via the SDKget_context_usage()call at session start and after each compaction only (basissdk_assumed, orconfiguredwhenCLAUDE_CODE_MAX_CONTEXT_TOKENSis set; failures yieldunavailablewith a reason and never affect the attempt), compaction count/last (at,trigger,pre_tokens,post_tokens) fromcompact_boundaryevents with post filled from the follow-up usage total, and a subagent registry keyed by Task tool_use_id with running flags cleared on Task tool results (view capped at 20, running first, newest first).simple_coding_agent/telemetry.pybuildscontext.{main,main_peak,window,auto_compact_threshold,compactions,subagents}with figure invariants, and the tracer carries an unavailable context section. Newtests/test_telemetry_context.py(untracked) covers window basis with/without the override, failed usage, compaction count/last plus re-reading, and subagent ordering plus the 20-entry cap.Remaining work
code-reviewskill on the diff and address findings.model_execution.py,telemetry.py,tests/test_telemetry_context.py) onagent/issue-245.Evidence
M simple_coding_agent/model_execution.py,M simple_coding_agent/telemetry.py,?? tests/test_telemetry_context.py(left uncommitted; sealing preserves them).ruff checkclean.Automatic continuation 0/2 used; the agent will continue automatically.
Address code-review findings for #245 (peak basis, trim order, keep-l…
lbacik commentedon Oct 14, 2026
Agent Attempt Result: complete
Branch: agent/issue-245
PR: #255
Merge: auto-merge enabled (merge)
Evidence
UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev ruff check && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py311 uv run --python 3.11 --extra dev pytest && UV_PROJECT_ENVIRONMENT=/home/agent/venv-py313 uv run --python 3.13 --extra dev pytest→ exit code 0Details
Claude SDK completed the implementation workflow.