diff --git a/config.lua b/config.lua index cc3c08b..aea7aa9 100644 --- a/config.lua +++ b/config.lua @@ -284,4 +284,22 @@ return { -- written to session/*.jsonl (assistant-turn `usage` field) for -- after-the-fact scripting; cross-session aggregation deferred -- to a future phase (Q-C2). + + -- Phase 8 (docs/PHASE8.md): accurate tokenization via the broker's + -- /tokenize endpoint, replacing the Phase 0 ยง8 char/4 heuristic. + -- Two consequences when use_endpoint=true: + -- (1) Context:estimate_tokens hits /tokenize once per + -- new turn (cached on the turn dict thereafter). Network + -- cost is one round-trip (~30ms) per fresh turn; subsequent + -- calls reuse the cache. + -- (2) Context:enforce_budget actually ENFORCES token_budget now + -- (previously only max_turns was checked). Sessions that + -- fit under char/4 may evict earlier โ€” raise token_budget + -- to match your model's real context window if needed. + -- Cloud endpoints (OpenRouter) don't expose /tokenize; capability + -- cached as unsupported on first probe -> silent char/4 fallback. + -- + -- tokenize = { + -- use_endpoint = true, + -- }, } diff --git a/docs/PHASE8.md b/docs/PHASE8.md index f8afe14..fff7daa 100644 --- a/docs/PHASE8.md +++ b/docs/PHASE8.md @@ -2,7 +2,7 @@ **Project:** aish โ€” AI-augmented conversational shell **Document:** Phase 8 Requirements, Architecture & Design Decisions -**Status:** Plan + review fold-in (tree at `aa64ad3`) +**Status:** Implement (5 commits landed: 7ef2a6e, 8502517, db26d0c, 94b7d86, this) **Date:** 2026-05-16 **Review findings (independent Sonnet agent, 2026-05-16) โ€” 2 BLOCKERs