feat: token budget positioning doc and wtcraft cost command - #11
Closed
zywkloo wants to merge 3 commits into
Closed
Conversation
…user narratives Integrates npm/GitHub token budget tool landscape research into a new docs/token-budget.md. Defines two primary user narratives (all-free-tier and all-lowest-paid-tier across Claude Code / Codex / Antigravity) and maps wtcraft's layer-2 architecture position against layer-3 observability tools (CodeBurn, llm-token-tracker) and Anthropic's native Task Budget API. https://claude.ai/code/session_01A5oU4c7YSGpwatMA2PK1AE
Adds a new `wtcraft cost [--all]` subcommand that reads ~/.claude/projects/**/*.jsonl and aggregates token usage (input, output, cache_read, cache_write) and estimated USD cost by git branch. No API key or proxy required — purely local JSONL parsing. Default view filters to branches visible in the current repo's active worktrees. --all shows every branch on record. Implemented in src/wtcraft/_cost.py (Python); _cli.py intercepts the `cost` argv before delegating to bash, so the shell script needs no JSON parsing. Help text added to shell script for `wtcraft help cost`. https://claude.ai/code/session_01A5oU4c7YSGpwatMA2PK1AE
Owner
Author
|
as #12 covered this change, we close this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wtcraft cost [--all]— new CLI command that reads~/.claude/projects/**/*.jsonland aggregates token usage + estimated USD cost per git branch; defaults to active worktree branches,--allshows every recorded branch__pycache__/,*.egg-info/)User narratives introduced
How
wtcraft costworksReads Claude Code's local JSONL session files — no API key, no proxy. Matches sessions to branches via the
gitBranchfield already embedded in each record. Pricing table is bundled in_cost.pyand covers Sonnet / Opus / Haiku (mid-2026 rates).The command is intercepted in
_cli.pybefore the bash exec, so it runs in pure Python with no shell-level JSON parsing.Test plan
wtcraft cost— shows only branches for active worktrees in current repowtcraft cost --all— shows all branches recorded in Claude Code sessionswtcraft help cost— displays usage textwtcraft help— includescostin command listhttps://claude.ai/code/session_01A5oU4c7YSGpwatMA2PK1AE
Generated by Claude Code