Expose per-session cost to hooks / TUI (or add the a cost session section in the TUI)
還沒有人認領這個 Issue。
評估
研究方向
先追蹤 PreToolUse、PostToolUse、Stop 和 SessionStart 的 hook payload,接著檢查工作階段 transcript JSONL,以及 issue 中提到的現有 /internal/usage/summary 路徑。確認每一輪的使用量和模型資料是否能透過 hooks 暴露、持久化至 transcripts,或針對某個工作階段回傳;完成的標準是存在一種受支援的方式,可取得目前工作階段的成本以供 TUI 顯示。
由索引模型根據 Issue 內容生成。
描述
Feature Description
Today hooks (PreToolUse/PostToolUse/Stop/SessionStart) receive a stdin payload with tool_input/tool_response, but it does not include the
LLM usage (input/output/cache tokens) or the model per turn. Also, the session transcript JSONL
(~/.commandcode/projects//.jsonl) persists only the message content, not the usage.
I know CommandCode already computes usage internally (it powers the "updated" indicator in the TUI) and exposes /internal/usage/summary at
the account level, but there's no way to see the accumulated cost of the current session from outside.
Request: include usage (input_tokens, output_tokens, cache_read_input_tokens, cache_creation_input_tokens) and model per turn in the hook
payload, and/or persist that usage in the transcript JSONL. That would let a Stop/SessionStart hook display the session cost in the TUI via
systemMessage without patching the dist. As an alternative, an endpoint like /internal/usage/summary?sessionId= would return per-session
cost directly. Or add a cost session section in the TUI.
Would this be something you'd consider for upcoming hook events?
Use Case
No response
Additional Context
As a developer who runs long, multi-turn coding sessions with Command Code, I want to see the running cost of the current session directly
in the TUI so I can make informed decisions without leaving the terminal — for example, stopping or switching models when a session is
getting expensive, comparing cost across models (non-open vs. open models) on the same task, or tracking spend per project/client for billing.
Today the only cost visibility is the account-level /internal/usage/summary (after the fact, mixed across all sessions) or the internal
"updated" indicator, neither of which tells me what the session I'm actively in is costing. If per-turn usage and model were exposed to
hooks (or persisted in the transcript), I could write a small Stop/SessionStart hook that prints the live session cost as a systemMessage in
the feed — no dist patching, fully under my control.
How important is this to you?
Ver important.
- 主要語言
- 沒有語言資料
- 星號
- 4k
- 分支
- 350
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
CommandCodeAI/command-code 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
CommandCodeAI/command-code#855 ·
-
難度 2/5 1-3 小時 新手友好度 78/100
CommandCodeAI/command-code#841 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 68/100
CommandCodeAI/command-code#655 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 68/100
CommandCodeAI/command-code#608 ·
-
難度 3/5 1-2 天 新手友好度 70/100
CommandCodeAI/command-code#893 ·
查看 CommandCodeAI/command-code 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
use-agent-os/agent-os#3263 ·
-
[Bug]: context-limit error parsing has no pattern for llama.cpp's "context size (N tokens)" phrasing 未關閉area/compression area/local-models area/sessions comp/agent duplicate P2 sweeper:risk-session-state type/bug
難度 2/5 1-3 小時 新手友好度 82/100
NousResearch/hermes-agent#117793 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 84/100
-
難度 2/5 1-3 小時 新手友好度 75/100
BasedHardware/omi#15236 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 84/100
areal-project/AReaL#1741 ·