From 1f34b6dce8c9db3b1824ccdd4e42a582ed7859bc Mon Sep 17 00:00:00 2001 From: Markus Fritsche Date: Sat, 16 May 2026 23:02:55 +0000 Subject: [PATCH] config + docs/PHASE7: example block + status -> Implement (Phase 7 commit #6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R9-resolved single-owner of the status bump (commit #5 didn't touch PHASE7.md). N5: PHASE0 §11 amendment landed in commit 3bad07b (formulate); not re-applied here. config.lua: - Commented-out `cost = { warn_at_dollars, warn_at_tokens }` block with parity to the Phase 1-6 example blocks. - Notes warn flags are independent (R4) and per-turn usage flows to session/*.jsonl for after-the-fact analysis. docs/PHASE7.md: - Status header bumped: "Plan + review fold-in" -> "Implement" - Lists the 6 implement commits inline for traceability: 7364963 broker: usage capture + opts widening 7b4a9be context: accumulator helpers 8adebd5 repl: _record_usage + opts.category at 5 sites b30212a safety + repl: opts.category for Norris + probe 0d6ff93 repl: :cost meta surface this config example + status bump Phase 7 implementation is complete. Next inner-loop step is verify (7) — user-driven smoke tests, then memory-update (8). Regression: test_safety 87/87, test_router_model 31/31, repl loads. Co-Authored-By: Claude Opus 4.7 (1M context) --- config.lua | 20 ++++++++++++++++++++ docs/PHASE7.md | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/config.lua b/config.lua index 724468b..cc3c08b 100644 --- a/config.lua +++ b/config.lua @@ -264,4 +264,24 @@ return { -- Requires the external `tree-sitter` CLI plus configured parser- -- directories with cloned + built `tree-sitter-` grammars -- (see `:highlight on` for the install hints). + + -- Phase 7 (docs/PHASE7.md): cost / usage observability. broker.lua + -- captures `usage` (+ `cost` for cloud) from every chat/chat_stream + -- call and routes via ctx:add_usage to a per-session accumulator. + -- `:cost` / `:cost detail` / `:cost reset` surface the totals. + -- The `cost` block below configures OPTIONAL warn thresholds — + -- a single status line fires the first time the cumulative + -- crosses each threshold. Default off. Useful when paid cloud + -- presets are in play so runaway-cost sessions get a nudge. + -- + -- cost = { + -- warn_at_dollars = 0.50, -- one-shot warn when cumulative cost crosses + -- warn_at_tokens = 100000, -- one-shot warn when cumulative tokens crosses + -- }, + -- + -- Both flags are independent (R4 — first-to-fire doesn't suppress + -- the other); `:cost reset` re-arms both. Per-turn usage is also + -- written to session/*.jsonl (assistant-turn `usage` field) for + -- after-the-fact scripting; cross-session aggregation deferred + -- to a future phase (Q-C2). } diff --git a/docs/PHASE7.md b/docs/PHASE7.md index 0c3d5d1..d01b208 100644 --- a/docs/PHASE7.md +++ b/docs/PHASE7.md @@ -2,7 +2,7 @@ **Project:** aish — AI-augmented conversational shell **Document:** Phase 7 Requirements, Architecture & Design Decisions -**Status:** Plan + review fold-in (tree at `0f14dc1`) +**Status:** Implement (6 commits landed: 7364963, 7b4a9be, 8adebd5, b30212a, 0d6ff93, this) **Date:** 2026-05-16 **Review findings (independent Sonnet agent, 2026-05-16) — 3 BLOCKERs