pr-cost: annotate GitHub PRs with session AI cost - #31
Open
ideogram-fredtran wants to merge 5 commits into
Open
Conversation
Create a stdlib-only pr-cost skill that emits a typed payload, records local ledger entries, and only posts GitHub PR comments when live writes are explicitly enabled.
Thin harness wrappers call the shared collector after gh pr create. Codex is an opt-in gh wrapper because it has no native PR hook.
Prove Cursor, Claude, and Codex wrappers write a ledger on gh pr create without invoking GitHub while live writes stay off.
Paste the Claude handover into a fresh session to comment Claude cost on an open PR. Codex token_count JSONL can be read the same way.
Contributor
Author
|
AI cost payload for the session that created this PR: {
"confidence": "estimated",
"generated_at": "2026-08-20T20:17:07+00:00",
"harness": "codex",
"model": "gpt-5.6-sol",
"notes": "Dogfood live annotate --harness codex. Tokens from the latest local Codex JSONL token_count (session 01a0207b, cwd was a ui worktree, not this repo). USD estimated at gpt-5.6-sol catalog rates $5/$30 per MTok without a cache discount. This PR was opened from Cursor via the ideogram-fredtran fork.",
"pr_url": "https://github.com/cheshirecode/dotfiles/pull/31",
"schema_version": "pr-cost/v1",
"session_id": "01a0207b-1898-7240-bc55-9968ab569b57",
"tokens_in": 924232,
"tokens_out": 5942,
"usd": 4.7994,
"window_end": "2026-08-20T18:44:52.141Z",
"window_start": "2026-08-20T18:42:13.335Z"
} |
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
ghwrapper (not on PATH by default). Comments stay off unlessPR_COST_HOOK_LIVE=1.skills/pr-cost/handovers/claude-comment-pr-cost.md) so a fresh Claude session can comment its own cost on this PR.Test plan
python3 -m unittest discover -s skills/pr-cost/tests -q(7 tests)skills/pr-cost/handovers/claude-comment-pr-cost.mdinto Claude Code and confirm a second comment for Claude cost.