feat(tokenizer): lcc fetch-tokenizer for exact counts on first run #130
All Vouch review confidence checks passed
Residual risk 0.47 = Change Risk (0.58) × (1 − Review Confidence (0.19)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.58 · 170 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 23% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.308
Sensitive Paths
sensitive_paths
0.058
Real PR Conversation Timeline
1 comments
"Review active on #130"
general
weight: 0.35
claude[bot]
A new user who follows the README (
pip install "local-context-compiler[tiktoken]", thenlcc measure-session) getstokens (approximate)and a four-line warning, because lcc blocks tiktoken's download to stay offline (ADR 0008). The only fix was settingTIKTOKEN_CACHE_DIRby hand.This adds one explicit command:
lcc fetch-tokenizerdownloadscl100k_baseando200k_baseinto~/.cache/lcc/tiktoken(orTIKTOKEN_CACHE_DIRwhen set). It is the only command that goes online.TIKTOKEN_CACHE_DIRis unset and that directory exists,counters.pypoints tiktoken at it. An explicitTIKTOKEN_CACHE_DIRalways wins.Normal operation stays offline: the no-network guard is unchanged and still wraps every count.
Measured (2026-10-28, one 3,898-message session, fresh
HOME): before fetch523,741 tokens (approximate); afterlcc fetch-tokenizer,844,444 tokens (exact). One session, so the 38% gap is an example, not a general error rate.Tests:
test_fetch_tokenizer_fills_the_cache_dir_with_network_allowed;tests/test_token_budget.py tests/test_session_report.py tests/test_docs.pypass; ruff check clean.ruff format --checkflagscounters.pyfor a missing blank line that is already onmain, left as is.