tj context shows unweighted re-read shares and names ended sessions as action items
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 66/100
Research direction
Read tokenjam/cli/cmd_context.py and tokenjam/cli/cmd_tokenmaxx.py at the cited lines, then inspect the quota-weighted properties in tokenjam/core/context_diagnostic.py. Find the relevant CLI tests and check how they verify the displayed shares and reclaim advice. Done means both commands use quota-weighted headline shares and show only aggregate reclaim guidance, without naming ended sessions.
Written by the indexing model from the issue text.
Description
Problem
tj context (cli/cmd_context.py) has two defects that a sibling command already fixed for itself.
1. Raw, unweighted re-read shares. cmd_context.py:137 and :218 render diag.reread_share / c.reread_share directly — a raw ratio of re-read tokens to total tokens. Cache-read tokens are billed (and rate-limited) well below a fresh input token, so a raw token-count ratio overstates how much of a user's actual quota re-reading consumes. ContextDiagnostic already exposes a quota-weighted version of the same figure: quota_weighted_reread_share (core/context_diagnostic.py:389) and quota_weighted_work_share (core/context_diagnostic.py:403), both computed from the per-turn TurnComposition.quota_weighted_reread_share (core/context_diagnostic.py:267). cmd_context.py doesn't read either property. Neither does cmd_tokenmaxx.py, which also renders the raw diag.reread_share (cli/cmd_tokenmaxx.py:111).
2. A reclaim list that names already-ended sessions. cmd_context.py:214-225 lists up to three individual compact_candidates by session id ("session <id> — X% re-read... → /compact mid-session... to reclaim that quota"). compact_candidates is built by _compact_candidates() (core/context_diagnostic.py:825), which groups TurnComposition rows by session_id over the full queried window (turns = load_turn_compositions(conn, since, until, agent_id) at core/context_diagnostic.py:567) — it has no concept of "still active." So the printed advice to run /compact "mid-session" routinely names sessions that have already ended, which is not actionable: a closed session can't be compacted.
Expected
tj contextandtj tokenmaxxrender the quota-weighted shares (quota_weighted_reread_share/quota_weighted_work_share) as their headline percentages, the same way another command in this codebase already does. Raw token-ratio shares may still be shown, but only under an explicit "raw tokens" label if kept for debugging — never presented as the quota share.- The reclaim section stops naming individual past sessions. It should report an aggregate instead (how many of the analyzed sessions crossed the compact threshold, and what share of the window's re-read tokens they represent), with a note that only the live session is actually actionable.
Where to look
tokenjam/cli/cmd_context.py:137and:218— rawreread_sharereadstokenjam/cli/cmd_context.py:214-225— the per-session reclaim listtokenjam/cli/cmd_tokenmaxx.py:111— rawdiag.reread_sharereadtokenjam/core/context_diagnostic.py:267,389,403— the existing quota-weighted properties to reusetokenjam/core/context_diagnostic.py:825—_compact_candidates(), which has no "still live" filter
Done when
- No default
tj contextortj tokenmaxxoutput presents a raw token ratio as a quota share. - Neither command's default output names an individual ended session as something to act on; the reclaim message is aggregate-only.
- Dominant language
- Python
- Stars
- 122
- Forks
- 35
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 8
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Metabuilder-Labs/tokenjam
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Metabuilder-Labs/tokenjam#786 ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Metabuilder-Labs/tokenjam#759 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Metabuilder-Labs/tokenjam#728 ·
Maintainers usually reply within 1 day
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Metabuilder-Labs/tokenjam#591 ·
Maintainers usually reply within 1 day
-
bug good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Metabuilder-Labs/tokenjam#559 ·
Maintainers usually reply within 1 day
All issues in Metabuilder-Labs/tokenjam
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
[Bug]: Queen's own Ollama model loses num_ctx when a running session switches to itPossibly taken @anasamin26 claimed this today. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
aden-hive/hive#7508 · 1 comment ·
Maintainers usually reply within 1 day
-
llm translation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
BerriAI/litellm#47884 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug 🐛
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
netalertx/NetAlertX#1856 · 1 reaction ·
Maintainers usually reply within 1 day