Skip to content

feat: add /cfo skill — session cost + AI spend dashboard#34

Open
shivanipods wants to merge 3 commits intogarrytan:mainfrom
shivanipods:feature/cfo-skill
Open

feat: add /cfo skill — session cost + AI spend dashboard#34
shivanipods wants to merge 3 commits intogarrytan:mainfrom
shivanipods:feature/cfo-skill

Conversation

@shivanipods
Copy link

Summary

Adds a /cfo skill that answers "what am I spending?" without leaving Claude Code.

  • Session banner — cost, elapsed time, and git line count for the current session
  • 30-day spend dashboard — daily spend, spend by project/branch, prompt repetition detection with waste estimates, personalized cost-saving tips
  • Multi-tool support — manually log spend from Cursor, Lovable, ChatGPT, etc. via ai_spend.py --add
  • Team/org views — share aggregated spend across a team via a shared directory (--export, --team, --org)

Reads token usage directly from ~/.claude/projects/ transcripts — no API keys, no third-party tracking.

What's included

  • cfo/SKILL.md — skill prompt (4 steps: find script, gather session metrics in one atomic bash call, run dashboard, print banner)
  • cfo/ai_spend.py — ~1000-line stdlib-only Python dashboard script, originally from @shivanipods/claude-session-skill

Notes for reviewer

  • README voice: The /cfo section is written in third-person to let you adapt it to your voice if you accept the PR
  • ai_spend.py authorship: This script was written by me (@shivanipods) and is MIT-licensed — happy to add a header comment if you'd prefer
  • New requirements: jq and python3 (3.10+) — added to the Requirements line in README; both are pre-installed or one brew install jq away on macOS
  • setup script: No changes needed — it auto-discovers any cfo/ subdirectory with a SKILL.md

Test plan

  • ./setup symlinks cfo alongside the other skills
  • /cfo runs and outputs session banner + spend dashboard
  • Works from a project with no prior spend history (shows empty dashboard gracefully)
  • python3 cfo/ai_spend.py --help runs without errors (stdlib only, no pip required)
  • jq is the only new system dependency

🤖 Generated with Claude Code

Shivani Poddar and others added 3 commits March 13, 2026 10:04
Adds a new `/cfo` skill that shows:
- Current session cost and elapsed time as a banner
- 30-day AI spend dashboard for the project (by day, by branch)
- Prompt repetition detection with waste estimates
- Personalized cost-saving tips based on usage patterns

Includes `ai_spend.py`, a ~1000-line stdlib-only Python script
(originally by @shivanipods) that reads token usage directly from
`~/.claude/projects/` — no API keys, no third-party tracking.
Also supports team/org aggregation and manual logging of spend
from other AI tools (Cursor, Lovable, ChatGPT, etc.).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace deprecated datetime.utcnow() with timezone-aware
datetime.now(timezone.utc) in build_export_payload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant