config + docs/PHASE7: example block + status -> Implement (Phase 7 commit #6)

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) <noreply@anthropic.com>
This commit is contained in:
2026-05-16 23:02:55 +00:00
parent 0d6ff93134
commit 1f34b6dce8
2 changed files with 21 additions and 1 deletions
+20
View File
@@ -264,4 +264,24 @@ return {
-- Requires the external `tree-sitter` CLI plus configured parser-
-- directories with cloned + built `tree-sitter-<lang>` 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).
}
+1 -1
View File
@@ -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