Skip to content

docs(claude): add billing-grade token/cost ledger instructions#3

Open
SpaceTrucker2196 wants to merge 1 commit into
mainfrom
claude-ledger-instructions
Open

docs(claude): add billing-grade token/cost ledger instructions#3
SpaceTrucker2196 wants to merge 1 commit into
mainfrom
claude-ledger-instructions

Conversation

@SpaceTrucker2196

Copy link
Copy Markdown
Owner

Summary

  • Adds a Token / Cost Ledger section to CLAUDE.md
  • Points at the centralized billing tool at ~/.claude/billing/ledger.py for accurate per-commit token + USD accounting from JSONL transcripts

Test plan

  • Review section text
  • From repo root, run ~/.claude/billing/ledger.py --dry-run to verify it can produce a row

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings June 12, 2026 18:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md with 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.

Comment thread CLAUDE.md

## Token / Cost Ledger (billing-grade)

The owner bills clients from `LEDGER.md` at this repo's root. Entries must be **exact, not estimated**.
Comment thread CLAUDE.md
- **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.
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.

2 participants