fix(costs): disable cost tracking until Claude Code exposes cost data
Cost tracking infrastructure works but has no data source: - Claude Code displays costs in TUI status bar, not scrollback - tmux capture-pane can't see TUI chrome - All sessions show $0.00 Changes: - Mark gt costs command as [DISABLED] with deprecation warnings - Mark costs-digest patrol step as [DISABLED] with skip instructions - Document requirement for Claude Code to expose CLAUDE_SESSION_COST Infrastructure preserved for re-enabling when Claude Code adds support. Ref: GH#24, gt-7awfjq Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,13 +44,22 @@ var (
|
|||||||
var costsCmd = &cobra.Command{
|
var costsCmd = &cobra.Command{
|
||||||
Use: "costs",
|
Use: "costs",
|
||||||
GroupID: GroupDiag,
|
GroupID: GroupDiag,
|
||||||
Short: "Show costs for running Claude sessions",
|
Short: "Show costs for running Claude sessions [DISABLED]",
|
||||||
Long: `Display costs for Claude Code sessions in Gas Town.
|
Long: `Display costs for Claude Code sessions in Gas Town.
|
||||||
|
|
||||||
By default, shows live costs scraped from running tmux sessions.
|
⚠️ COST TRACKING IS CURRENTLY DISABLED
|
||||||
|
|
||||||
Cost tracking uses ephemeral wisps for individual sessions that are
|
Claude Code displays costs in the TUI status bar, which cannot be captured
|
||||||
aggregated into daily "Cost Report" digest beads for audit purposes.
|
via tmux. All sessions will show $0.00 until Claude Code exposes cost data
|
||||||
|
through an API or environment variable.
|
||||||
|
|
||||||
|
What we need from Claude Code:
|
||||||
|
- Stop hook env var (e.g., $CLAUDE_SESSION_COST)
|
||||||
|
- Or queryable file/API endpoint
|
||||||
|
|
||||||
|
See: GH#24, gt-7awfj
|
||||||
|
|
||||||
|
The infrastructure remains in place and will work once cost data is available.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
gt costs # Live costs from running sessions
|
gt costs # Live costs from running sessions
|
||||||
@@ -194,6 +203,11 @@ func runCosts(cmd *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runLiveCosts() error {
|
func runLiveCosts() error {
|
||||||
|
// Warn that cost tracking is disabled
|
||||||
|
fmt.Fprintf(os.Stderr, "%s Cost tracking is disabled - Claude Code does not expose session costs.\n",
|
||||||
|
style.Warning.Render("⚠"))
|
||||||
|
fmt.Fprintf(os.Stderr, " All sessions will show $0.00. See: GH#24, gt-7awfj\n\n")
|
||||||
|
|
||||||
t := tmux.NewTmux()
|
t := tmux.NewTmux()
|
||||||
|
|
||||||
// Get all tmux sessions
|
// Get all tmux sessions
|
||||||
@@ -253,6 +267,11 @@ func runLiveCosts() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runCostsFromLedger() error {
|
func runCostsFromLedger() error {
|
||||||
|
// Warn that cost tracking is disabled
|
||||||
|
fmt.Fprintf(os.Stderr, "%s Cost tracking is disabled - Claude Code does not expose session costs.\n",
|
||||||
|
style.Warning.Render("⚠"))
|
||||||
|
fmt.Fprintf(os.Stderr, " Historical data may show $0.00 for all sessions. See: GH#24, gt-7awfj\n\n")
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
var entries []CostEntry
|
var entries []CostEntry
|
||||||
var err error
|
var err error
|
||||||
|
|||||||
@@ -629,41 +629,29 @@ Skip dispatch - system is healthy.
|
|||||||
|
|
||||||
[[steps]]
|
[[steps]]
|
||||||
id = "costs-digest"
|
id = "costs-digest"
|
||||||
title = "Aggregate daily costs"
|
title = "Aggregate daily costs [DISABLED]"
|
||||||
needs = ["session-gc"]
|
needs = ["session-gc"]
|
||||||
description = """
|
description = """
|
||||||
**DAILY DIGEST** - Aggregate yesterday's session cost wisps.
|
**⚠️ DISABLED** - Skip this step entirely.
|
||||||
|
|
||||||
Session costs are recorded as ephemeral wisps (not exported to JSONL) to avoid
|
Cost tracking is temporarily disabled because Claude Code does not expose
|
||||||
log-in-database pollution. This step aggregates them into a permanent daily
|
session costs in a way that can be captured programmatically.
|
||||||
"Cost Report YYYY-MM-DD" bead for audit purposes.
|
|
||||||
|
|
||||||
**Step 1: Check if digest is needed**
|
**Why disabled:**
|
||||||
```bash
|
- The `gt costs` command uses tmux capture-pane to find costs
|
||||||
# Preview yesterday's costs (dry run)
|
- Claude Code displays costs in the TUI status bar, not in scrollback
|
||||||
gt costs digest --yesterday --dry-run
|
- All sessions show $0.00 because capture-pane can't see TUI chrome
|
||||||
```
|
- The infrastructure is sound but has no data source
|
||||||
|
|
||||||
If output shows "No session cost wisps found", skip to Step 3.
|
**What we need from Claude Code:**
|
||||||
|
- Stop hook env var (e.g., `$CLAUDE_SESSION_COST`)
|
||||||
|
- Or queryable file/API endpoint
|
||||||
|
|
||||||
**Step 2: Create the digest**
|
**Re-enable when:** Claude Code exposes cost data via API or environment.
|
||||||
```bash
|
|
||||||
gt costs digest --yesterday
|
|
||||||
```
|
|
||||||
|
|
||||||
This:
|
See: GH#24, gt-7awfj
|
||||||
- Queries all session.ended wisps from yesterday
|
|
||||||
- Creates a single "Cost Report YYYY-MM-DD" bead with aggregated data
|
|
||||||
- Deletes the source wisps
|
|
||||||
|
|
||||||
**Step 3: Verify**
|
**Exit criteria:** Skip this step - proceed to next."""
|
||||||
The digest appears in `gt costs --week` queries.
|
|
||||||
Daily digests preserve audit trail without per-session pollution.
|
|
||||||
|
|
||||||
**Timing**: Run once per morning patrol cycle. The --yesterday flag ensures
|
|
||||||
we don't try to digest today's incomplete data.
|
|
||||||
|
|
||||||
**Exit criteria:** Yesterday's costs digested (or no wisps to digest)."""
|
|
||||||
|
|
||||||
[[steps]]
|
[[steps]]
|
||||||
id = "patrol-digest"
|
id = "patrol-digest"
|
||||||
|
|||||||
Reference in New Issue
Block a user