tokenblame 2.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,189 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated into the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE file from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright notice to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contribution.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the origin of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your use of the Work.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any kind arising as a result of
159
+ this License or out of the use or inability to use the Work (including
160
+ but not limited to damages for loss of goodwill, work stoppage,
161
+ computer failure or malfunction, or any and all other commercial
162
+ damages or losses), even if such Contributor has been advised of the
163
+ possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to accept support,
167
+ warranty, or additional liability obligations and/or rights consistent
168
+ with this License. However, in accepting such obligations, You may act
169
+ only on Your own behalf and on Your own responsibility, and not on
170
+ behalf of any other Contributor, and only if You agree to indemnify,
171
+ defend, and defend each Contributor for any liability incurred by, or
172
+ claims asserted against, such Contributor by reason of your accepting
173
+ any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ Copyright 2026 Junhyung Lee
178
+
179
+ Licensed under the Apache License, Version 2.0 (the "License");
180
+ you may not use this file except in compliance with the License.
181
+ You may obtain a copy of the License at
182
+
183
+ http://www.apache.org/licenses/LICENSE-2.0
184
+
185
+ Unless required by applicable law or agreed to in writing, software
186
+ distributed under the License is distributed on an "AS IS" BASIS,
187
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
188
+ See the License for the specific language governing permissions and
189
+ limitations under the License.
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.4
2
+ Name: tokenblame
3
+ Version: 2.1.1
4
+ Summary: Offline AI coding token ledger with 1:1 Git commit provenance, Squash-Merge-resilient 30-day git-blame survival rates, and root-cause burn forensics
5
+ Author: espressolee
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/espressolee/tokenblame
8
+ Project-URL: Repository, https://github.com/espressolee/tokenblame
9
+ Project-URL: Issues, https://github.com/espressolee/tokenblame/issues
10
+ Project-URL: Releases, https://github.com/espressolee/tokenblame/releases
11
+ Keywords: claude-code,codex,gemini-cli,token-usage,git-blame,git-provenance,observability
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Version Control :: Git
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Dynamic: license-file
25
+
26
+ # TokenBlame (`v2.1`)
27
+
28
+ **Don't just count AI coding tokens — blame them.**
29
+ *Zero-config, 100% offline multi-agent token ledger with 1:1 Git commit provenance, Squash-Merge-resilient 30-day `git blame` patch survival rates, and root-cause burn forensics.*
30
+
31
+ ![TokenBlame Overview — Shareable Redacted Edition](docs/assets/tokenblame-overview.png)
32
+
33
+ Most local AI usage counters (`ccusage`, `tokscale`) stop at summing raw tokens — often mixing `95%+` cached prompt reads with generated output and telling you nothing about whether an `$85` agent session shipped durable code or spun in an `Edit` / `pytest` retry loop.
34
+
35
+ **TokenBlame** joins your local multi-agent transcripts (**Claude Code**, **Codex CLI**, **Gemini CLI**, **Antigravity**) with your local **Git repositories** (100% read-only via `git --no-optional-locks`) to measure real engineering durability:
36
+
37
+ | Capability | Token Counters (`ccusage`, `tokscale`) | Git Trailers (`git-ai`, `Entire`) | **TokenBlame (`v2.0`)** |
38
+ | :--- | :---: | :---: | :---: |
39
+ | **4-Bucket Accounting** (`Fresh` / `Cache Read` / `Visible` / `Reasoning`) | Partial | No | **Yes** |
40
+ | **Retention-Safe SQLite Archive** (survives 30-day CLI log purges) | Partial | Yes | **Yes** |
41
+ | **Zero Repo Mutation** (no commit trailers, no `.git/refs` notes) | Yes | No | **Yes** (`record-hook` spool) |
42
+ | **Post-Commit Revert & 30-Day `git blame` Line Survival Rate** | No | Partial | **Yes** |
43
+ | **High-Burn Turn Spike & `RETRY_LOOP` Forensics** (zero prompt/arg leaks) | No | No | **Yes** |
44
+ | **Sub-10ms Indexed SQLite CLI & `--shareable` Redacted HTML** | No | No | **Yes** (`3.5ms`, `CSP default-src 'none'`) |
45
+ | **Runtime Dependencies** | Node / Rust | Go / Rust | **Zero** (Python 3.11+ stdlib) |
46
+
47
+ ---
48
+
49
+ ## High-Burn Root-Cause Forensics & Multi-Grain Heatmap
50
+
51
+ ![TokenBlame Heatmap and High-Burn Forensics Radar](docs/assets/tokenblame-radar.png)
52
+
53
+ - **Allowlisted Tool Forensics (Zero Leakage):** Extracts peak turn spikes (`Peak #T: Out / Fresh`) and automatic loop warnings (`RETRY_LOOP(Edit x132)`, `RETRY_LOOP(Bash:pytest x9)`) using an allowlist of tool/command basenames — **never** storing command arguments, file paths, or prompts.
54
+ - **Privacy-Sealed `--shareable` Mode:** `tokenblame build --shareable` produces a standalone offline HTML dashboard (`shareable-observatory.html`) with salted SHA-256 aliases (`repo-01`, `c-9a4f1b2c`) and **zero** local paths, usernames, or commit subjects.
55
+
56
+ ---
57
+
58
+ ## Quickstart (Zero-Config, Python 3.11+ Stdlib Only)
59
+
60
+ ```bash
61
+ # Instant zero-install run via uvx:
62
+ uvx tokenblame
63
+
64
+ # Or install globally:
65
+ uv tool install tokenblame
66
+ # or: pip install tokenblame
67
+
68
+ # Harvest logs + build offline HTML + print 30-day summary in one command:
69
+ tokenblame
70
+
71
+ # Also emit privacy-redacted shareable HTML + IR:
72
+ tokenblame build --shareable
73
+
74
+ # Open dashboard in your browser (or Orca tab when running inside Orca):
75
+ tokenblame open
76
+ tokenblame open --shareable
77
+
78
+ # Sub-10ms filtered queries powered by indexed observatory.sqlite:
79
+ tokenblame summary --days 7
80
+ tokenblame summary --days 30 --lane my-repo --json
81
+
82
+ # Check environment, detected agent logs, timezone, and hook status:
83
+ tokenblame doctor
84
+
85
+ # One-click 1:1 provenance hook setup (with automatic backup & --uninstall):
86
+ tokenblame init
87
+ tokenblame init --dry-run
88
+ tokenblame init --uninstall
89
+
90
+ # Override local OS timezone when needed:
91
+ tokenblame summary --days 7 --tz America/New_York
92
+ ```
93
+
94
+ By default, TokenBlame discovers local Git repos under `~/projects`, `~/code`, `~/dev`, `~/src`, `~/work`, `~/repos`, and `~/GitHub` (plus repeatable `--scan-root /custom/dir`) and writes all local artifacts with `0600` permissions to:
95
+ - **macOS:** `~/Library/Application Support/tokenblame/`
96
+ - **Linux:** `${XDG_DATA_HOME:-~/.local/share}/tokenblame/`
97
+ - **Override:** `TOKENBLAME_DIR=/path/to/dir`
98
+
99
+ ---
100
+
101
+ ## Optional 1:1 Commit Provenance Hook (`record-hook`)
102
+
103
+ To upgrade concurrent same-repo agent sessions from time-window heuristics (`[-2h, +12h]`) to deterministic **1:1 `EXACT_HOOK_OID`** attribution without adding files, trailers, or git notes to your repositories:
104
+
105
+ ### Claude Code (`~/.claude/settings.json`)
106
+ ```json
107
+ {
108
+ "hooks": {
109
+ "PostToolUse": [
110
+ {
111
+ "matcher": "Bash",
112
+ "hooks": [
113
+ {
114
+ "type": "command",
115
+ "command": "tokenblame record-hook --provider claude"
116
+ }
117
+ ]
118
+ }
119
+ ]
120
+ }
121
+ }
122
+ ```
123
+
124
+ ### Gemini CLI (`~/.gemini/settings.json`)
125
+ ```json
126
+ {
127
+ "hooks": {
128
+ "AfterTool": [
129
+ {
130
+ "matcher": "run_shell_command",
131
+ "hooks": [
132
+ {
133
+ "type": "command",
134
+ "command": "tokenblame record-hook --provider gemini_cli --emit-empty-json"
135
+ }
136
+ ]
137
+ }
138
+ ]
139
+ }
140
+ }
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Epistemic Integrity Guarantees
146
+
147
+ - **Strict Fidelity Separation:** Unexposed IDE transcripts or legacy unbucketed SQLite threads are never blended into exact 4-bucket totals; estimated byte-volume side ledgers (`ESTIMATED_TRANSCRIPT`) are reported separately.
148
+ - **Honest API-Equivalent Pricing:** Uses pinned official token rates (`input`, `cache_write`, `cache_read`, `output`), labels alias/fast-mode tiers explicitly, and leaves unpriced preview models as `unpriced` rather than fabricating USD totals.
149
+ - **Transparent Causality Tiers:** Separately badges `1:1 HOOK`, `SHA_META`, `WINDOW_HEURISTIC`, and `DAY_EPISODE` links so attribution strength is never overstated.
150
+
151
+ ---
152
+
153
+ ## Closing the Loop: Pre-Merge Verification
154
+
155
+ TokenBlame measures **post-hoc** token burn, retry loops, and 30-day patch survival. To **prevent** AI test shortcuts, tautological assertions, and surviving mutants *before* code merges on GitHub PRs, check out **[NoCheat Merge Gate](https://github.com/espressolee/nocheat-action)** — a deterministic, zero-LLM CI verification gate (`Apache-2.0`).
156
+
157
+ ---
158
+
159
+ ## License
160
+
161
+ Apache-2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,136 @@
1
+ # TokenBlame (`v2.1`)
2
+
3
+ **Don't just count AI coding tokens — blame them.**
4
+ *Zero-config, 100% offline multi-agent token ledger with 1:1 Git commit provenance, Squash-Merge-resilient 30-day `git blame` patch survival rates, and root-cause burn forensics.*
5
+
6
+ ![TokenBlame Overview — Shareable Redacted Edition](docs/assets/tokenblame-overview.png)
7
+
8
+ Most local AI usage counters (`ccusage`, `tokscale`) stop at summing raw tokens — often mixing `95%+` cached prompt reads with generated output and telling you nothing about whether an `$85` agent session shipped durable code or spun in an `Edit` / `pytest` retry loop.
9
+
10
+ **TokenBlame** joins your local multi-agent transcripts (**Claude Code**, **Codex CLI**, **Gemini CLI**, **Antigravity**) with your local **Git repositories** (100% read-only via `git --no-optional-locks`) to measure real engineering durability:
11
+
12
+ | Capability | Token Counters (`ccusage`, `tokscale`) | Git Trailers (`git-ai`, `Entire`) | **TokenBlame (`v2.0`)** |
13
+ | :--- | :---: | :---: | :---: |
14
+ | **4-Bucket Accounting** (`Fresh` / `Cache Read` / `Visible` / `Reasoning`) | Partial | No | **Yes** |
15
+ | **Retention-Safe SQLite Archive** (survives 30-day CLI log purges) | Partial | Yes | **Yes** |
16
+ | **Zero Repo Mutation** (no commit trailers, no `.git/refs` notes) | Yes | No | **Yes** (`record-hook` spool) |
17
+ | **Post-Commit Revert & 30-Day `git blame` Line Survival Rate** | No | Partial | **Yes** |
18
+ | **High-Burn Turn Spike & `RETRY_LOOP` Forensics** (zero prompt/arg leaks) | No | No | **Yes** |
19
+ | **Sub-10ms Indexed SQLite CLI & `--shareable` Redacted HTML** | No | No | **Yes** (`3.5ms`, `CSP default-src 'none'`) |
20
+ | **Runtime Dependencies** | Node / Rust | Go / Rust | **Zero** (Python 3.11+ stdlib) |
21
+
22
+ ---
23
+
24
+ ## High-Burn Root-Cause Forensics & Multi-Grain Heatmap
25
+
26
+ ![TokenBlame Heatmap and High-Burn Forensics Radar](docs/assets/tokenblame-radar.png)
27
+
28
+ - **Allowlisted Tool Forensics (Zero Leakage):** Extracts peak turn spikes (`Peak #T: Out / Fresh`) and automatic loop warnings (`RETRY_LOOP(Edit x132)`, `RETRY_LOOP(Bash:pytest x9)`) using an allowlist of tool/command basenames — **never** storing command arguments, file paths, or prompts.
29
+ - **Privacy-Sealed `--shareable` Mode:** `tokenblame build --shareable` produces a standalone offline HTML dashboard (`shareable-observatory.html`) with salted SHA-256 aliases (`repo-01`, `c-9a4f1b2c`) and **zero** local paths, usernames, or commit subjects.
30
+
31
+ ---
32
+
33
+ ## Quickstart (Zero-Config, Python 3.11+ Stdlib Only)
34
+
35
+ ```bash
36
+ # Instant zero-install run via uvx:
37
+ uvx tokenblame
38
+
39
+ # Or install globally:
40
+ uv tool install tokenblame
41
+ # or: pip install tokenblame
42
+
43
+ # Harvest logs + build offline HTML + print 30-day summary in one command:
44
+ tokenblame
45
+
46
+ # Also emit privacy-redacted shareable HTML + IR:
47
+ tokenblame build --shareable
48
+
49
+ # Open dashboard in your browser (or Orca tab when running inside Orca):
50
+ tokenblame open
51
+ tokenblame open --shareable
52
+
53
+ # Sub-10ms filtered queries powered by indexed observatory.sqlite:
54
+ tokenblame summary --days 7
55
+ tokenblame summary --days 30 --lane my-repo --json
56
+
57
+ # Check environment, detected agent logs, timezone, and hook status:
58
+ tokenblame doctor
59
+
60
+ # One-click 1:1 provenance hook setup (with automatic backup & --uninstall):
61
+ tokenblame init
62
+ tokenblame init --dry-run
63
+ tokenblame init --uninstall
64
+
65
+ # Override local OS timezone when needed:
66
+ tokenblame summary --days 7 --tz America/New_York
67
+ ```
68
+
69
+ By default, TokenBlame discovers local Git repos under `~/projects`, `~/code`, `~/dev`, `~/src`, `~/work`, `~/repos`, and `~/GitHub` (plus repeatable `--scan-root /custom/dir`) and writes all local artifacts with `0600` permissions to:
70
+ - **macOS:** `~/Library/Application Support/tokenblame/`
71
+ - **Linux:** `${XDG_DATA_HOME:-~/.local/share}/tokenblame/`
72
+ - **Override:** `TOKENBLAME_DIR=/path/to/dir`
73
+
74
+ ---
75
+
76
+ ## Optional 1:1 Commit Provenance Hook (`record-hook`)
77
+
78
+ To upgrade concurrent same-repo agent sessions from time-window heuristics (`[-2h, +12h]`) to deterministic **1:1 `EXACT_HOOK_OID`** attribution without adding files, trailers, or git notes to your repositories:
79
+
80
+ ### Claude Code (`~/.claude/settings.json`)
81
+ ```json
82
+ {
83
+ "hooks": {
84
+ "PostToolUse": [
85
+ {
86
+ "matcher": "Bash",
87
+ "hooks": [
88
+ {
89
+ "type": "command",
90
+ "command": "tokenblame record-hook --provider claude"
91
+ }
92
+ ]
93
+ }
94
+ ]
95
+ }
96
+ }
97
+ ```
98
+
99
+ ### Gemini CLI (`~/.gemini/settings.json`)
100
+ ```json
101
+ {
102
+ "hooks": {
103
+ "AfterTool": [
104
+ {
105
+ "matcher": "run_shell_command",
106
+ "hooks": [
107
+ {
108
+ "type": "command",
109
+ "command": "tokenblame record-hook --provider gemini_cli --emit-empty-json"
110
+ }
111
+ ]
112
+ }
113
+ ]
114
+ }
115
+ }
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Epistemic Integrity Guarantees
121
+
122
+ - **Strict Fidelity Separation:** Unexposed IDE transcripts or legacy unbucketed SQLite threads are never blended into exact 4-bucket totals; estimated byte-volume side ledgers (`ESTIMATED_TRANSCRIPT`) are reported separately.
123
+ - **Honest API-Equivalent Pricing:** Uses pinned official token rates (`input`, `cache_write`, `cache_read`, `output`), labels alias/fast-mode tiers explicitly, and leaves unpriced preview models as `unpriced` rather than fabricating USD totals.
124
+ - **Transparent Causality Tiers:** Separately badges `1:1 HOOK`, `SHA_META`, `WINDOW_HEURISTIC`, and `DAY_EPISODE` links so attribution strength is never overstated.
125
+
126
+ ---
127
+
128
+ ## Closing the Loop: Pre-Merge Verification
129
+
130
+ TokenBlame measures **post-hoc** token burn, retry loops, and 30-day patch survival. To **prevent** AI test shortcuts, tautological assertions, and surviving mutants *before* code merges on GitHub PRs, check out **[NoCheat Merge Gate](https://github.com/espressolee/nocheat-action)** — a deterministic, zero-LLM CI verification gate (`Apache-2.0`).
131
+
132
+ ---
133
+
134
+ ## License
135
+
136
+ Apache-2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tokenblame"
7
+ version = "2.1.1"
8
+ description = "Offline AI coding token ledger with 1:1 Git commit provenance, Squash-Merge-resilient 30-day git-blame survival rates, and root-cause burn forensics"
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.11"
13
+ dependencies = []
14
+ authors = [{ name = "espressolee" }]
15
+ keywords = [
16
+ "claude-code",
17
+ "codex",
18
+ "gemini-cli",
19
+ "token-usage",
20
+ "git-blame",
21
+ "git-provenance",
22
+ "observability",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Environment :: Console",
27
+ "Intended Audience :: Developers",
28
+ "Operating System :: OS Independent",
29
+ "Programming Language :: Python :: 3",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ "Topic :: Software Development :: Version Control :: Git",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/espressolee/tokenblame"
38
+ Repository = "https://github.com/espressolee/tokenblame"
39
+ Issues = "https://github.com/espressolee/tokenblame/issues"
40
+ Releases = "https://github.com/espressolee/tokenblame/releases"
41
+
42
+ [project.scripts]
43
+ tokenblame = "tokenblame.cli:main"
44
+
45
+ [tool.setuptools.packages.find]
46
+ include = ["tokenblame", "tokenblame.*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+