CommandCodeAI / CommandCodeAI/command-code

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

Ouverte
#569 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
Aucune donnée de langage
Étoiles
4k
Forks
350
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par suivre les payloads des hooks pour PreToolUse, PostToolUse, Stop et SessionStart, puis examinez le JSONL de la transcription de session et le chemin existant /internal/usage/summary mentionné dans l’issue. Déterminez si les données d’utilisation et de modèle par tour peuvent être exposées via les hooks, persistées dans les transcriptions ou renvoyées pour une session ; le travail est considéré comme terminé lorsqu’il existe un moyen pris en charge d’obtenir le coût de la session actuelle pour l’afficher dans la TUI.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Domaine
ai, cli
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.