docs(claude): add billing-grade token/cost ledger instructions#3
Open
SpaceTrucker2196 wants to merge 1 commit into
Open
docs(claude): add billing-grade token/cost ledger instructions#3SpaceTrucker2196 wants to merge 1 commit into
SpaceTrucker2196 wants to merge 1 commit into
Conversation
Adds a Token / Cost Ledger section to CLAUDE.md pointing at the centralized ledger tool at ~/.claude/billing/ledger.py for accurate per-commit token and USD accounting from JSONL transcripts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds Claude-specific contributor guidance for recording per-commit token usage and USD cost via an external “billing-grade” ledger script, intended to standardize how LEDGER.md entries are generated and committed.
Changes:
- Adds a new
CLAUDE.mdwith a “Token / Cost Ledger” section describing the append workflow and commit message format. - Documents script behavior/exit codes and operational rules (append-only, separate commits, multi-machine caveats).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ## Token / Cost Ledger (billing-grade) | ||
|
|
||
| The owner bills clients from `LEDGER.md` at this repo's root. Entries must be **exact, not estimated**. |
| - **Never bypass the script.** Do not hand-author rows, estimate tokens, or fabricate costs. If the script can't produce a row (unknown model, missing transcript, session ran from a different cwd), stop and surface the problem to the owner. | ||
| - **Append-only.** Never rewrite, reorder, or delete past rows. Correct mistakes by adding a new row whose `summary` notes the correction. | ||
| - **Separate commits.** The ledger update lands as its own `chore(ledger): <short-sha>` commit. Never amend the substantive commit. | ||
| - **Keep pricing current.** If you notice Anthropic pricing has changed, update `~/.claude/billing/pricing.json` in its own commit before running the ledger again. Past rows correctly preserve historical pricing. |
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
Test plan
~/.claude/billing/ledger.py --dry-runto verify it can produce a row🤖 Generated with Claude Code