Expose per-session cost to hooks / TUI (or add the a cost session section in the TUI)

オープン
#569 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
領域
ai, cli

調査の方向性

まず PreToolUse、PostToolUse、Stop、SessionStart の hook payload を追跡し、次にセッションのトランスクリプト JSONL と、issue で言及されている既存の /internal/usage/summary パスを調査します。ターンごとの使用量とモデルのデータを hooks 経由で公開できるか、トランスクリプトに永続化できるか、またはセッションに対して返せるかを判断します。完了とは、TUI に表示するために現在のセッションのコストを取得する、サポートされた方法が 1 つあることを意味します。

索引モデルが 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 はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CommandCodeAI/command-code のほかの issue

CommandCodeAI/command-code の issue をすべて見る

似ている issue

AI Infra & Agents の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。