tokenblame 2.2.2__tar.gz → 2.2.4__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.
- {tokenblame-2.2.2 → tokenblame-2.2.4}/PKG-INFO +18 -11
- {tokenblame-2.2.2 → tokenblame-2.2.4}/README.md +17 -10
- {tokenblame-2.2.2 → tokenblame-2.2.4}/pyproject.toml +1 -1
- tokenblame-2.2.4/tests/test_integrity.py +502 -0
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tests/test_observatory.py +16 -9
- tokenblame-2.2.4/tests/test_review_r2.py +618 -0
- tokenblame-2.2.4/tests/test_v224_repair.py +411 -0
- tokenblame-2.2.4/tokenblame/__init__.py +3 -0
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame/cli.py +55 -43
- tokenblame-2.2.4/tokenblame/config.py +52 -0
- tokenblame-2.2.4/tokenblame/fsutil.py +53 -0
- tokenblame-2.2.4/tokenblame/gitenv.py +16 -0
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame/harvesters.py +18 -2
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame/joiner.py +215 -57
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame/provenance.py +120 -47
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame/redact.py +71 -10
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame/render.py +55 -12
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame/schema.py +6 -1
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame/store.py +3 -1
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame/survival.py +84 -10
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame.egg-info/PKG-INFO +18 -11
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame.egg-info/SOURCES.txt +6 -0
- tokenblame-2.2.2/tokenblame/__init__.py +0 -3
- {tokenblame-2.2.2 → tokenblame-2.2.4}/LICENSE +0 -0
- {tokenblame-2.2.2 → tokenblame-2.2.4}/setup.cfg +0 -0
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame/hooks.py +0 -0
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame.egg-info/dependency_links.txt +0 -0
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame.egg-info/entry_points.txt +0 -0
- {tokenblame-2.2.2 → tokenblame-2.2.4}/tokenblame.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tokenblame
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.4
|
|
4
4
|
Summary: Offline AI coding token ledger with out-of-repo Git commit provenance, Squash-Merge-resilient HEAD line retention, and allowlisted burn forensics
|
|
5
5
|
Author: espressolee
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -23,10 +23,10 @@ Description-Content-Type: text/markdown
|
|
|
23
23
|
License-File: LICENSE
|
|
24
24
|
Dynamic: license-file
|
|
25
25
|
|
|
26
|
-
# TokenBlame (`v2.2`)
|
|
26
|
+
# TokenBlame (`v2.2.4`)
|
|
27
27
|
|
|
28
28
|
**Don't just count AI coding tokens — blame them.**
|
|
29
|
-
*Zero-config, 100% offline multi-agent token ledger with out-of-repo Git commit provenance, fixed-horizon (`t+30/60/90d`)
|
|
29
|
+
*Zero-config, 100% offline multi-agent token ledger with out-of-repo Git commit provenance, sampled fixed-horizon (`t+30/60/90d`) line retention with disclosed coverage, and exit-code-aware burn forensics.*
|
|
30
30
|
|
|
31
31
|

|
|
32
32
|
|
|
@@ -42,11 +42,11 @@ Token accounting, commit attribution, and code survival each have strong existin
|
|
|
42
42
|
| **`Git AI` (OSS / Teams)** | Line-level AI authorship + Teams PR cost, rework & churn analytics | Yes (spec covers buckets & 90d DB; team analytics in Teams tier) | Line-level authorship + PR cost/churn | Git notes / metadata | Rust / Cloud |
|
|
43
43
|
| **`Entire`** | Session checkpoints & token hotspot diagnostics | Yes (`fresh` / `cache` / `output` / `subagent`) | Session checkpoints linked to commits | Checkpoint metadata | Go |
|
|
44
44
|
| **`survived`** | Fixed-horizon `t+30/60/90d` code survival (with `notYet` cohort separation) | No | Fixed-horizon commit survival | None | TypeScript |
|
|
45
|
-
| **`TokenBlame` (`v2.2`)** | **Local offline multi-agent cost + commit provenance + `t+30/60/90d` cohorts & HEAD retention + exit-code burn loops** | **Yes** (4-bucket + strict unbucketed separation) | **Out-of-repo `record-hook` spool + revert, HEAD retention & matured cohorts (`notYet` separated)** | **None** | **Python 3.11+ stdlib only** |
|
|
45
|
+
| **`TokenBlame` (`v2.2.4`)** | **Local offline multi-agent cost + commit provenance + `t+30/60/90d` cohorts & HEAD retention + exit-code burn loops** | **Yes** (4-bucket + strict unbucketed separation) | **Out-of-repo `record-hook` spool + revert, sampled HEAD retention & sampled matured cohorts (`notYet` separated, measured/eligible commits shown)** | **None** | **Python 3.11+ stdlib only** |
|
|
46
46
|
|
|
47
47
|
> **Honest measurement scope:**
|
|
48
48
|
> - **HEAD Line Retention vs. Fixed-Horizon Cohorts (`t+30/60/90d`):** `line_survival_30d_pct` tracks HEAD retention of lines from the recent 30-day window (with Squash-Merge / Rebase fallback and `unobserved_lines` kept separate on `git blame` errors). Alongside it, `durability.cohorts` (`t30d`, `t60d`, `t90d`) measures **matured** fixed-horizon cohorts explicitly separated from immature `notYet` commits.
|
|
49
|
-
> - **
|
|
49
|
+
> - **Sampled, with disclosed coverage:** retention is computed on a sample, not on every matured commit. At most 30 repositories, 30 commits per repository per horizon and 18 paths per historical snapshot are measured; binary/no-added-line files, some extensions and files over 262,144 bytes are excluded. Each cohort carries `eligible_commits`, `selected_commits`, `measured_commits`, `changed_paths` / `eligible_paths` / `selected_paths` / `measured_paths`, exclusions by reason, `unobserved_lines` / `unobserved_paths` and `fallback_used` (squash text-match fallback). The card prints measured/eligible commits and the line numerator/denominator; a rate with no observed lines is shown as unavailable, never as a percentage.
|
|
50
50
|
> - **Diagnostic Signals ≠ Causal Proof:** `FAILURE_LOOP` (nonzero exit/error streaks), `ITERATION_LOOP` (zero-error verification repeats), uncommitted high-burn sessions, and line retention are investigative signals — not automatic proofs of wasted effort, code correctness, or causal ROI.
|
|
51
51
|
|
|
52
52
|
---
|
|
@@ -76,18 +76,19 @@ tokenblame
|
|
|
76
76
|
# Also emit privacy-redacted shareable HTML + IR:
|
|
77
77
|
tokenblame build --shareable
|
|
78
78
|
|
|
79
|
-
# Open dashboard in your browser (or
|
|
79
|
+
# Open dashboard in your browser (or via TOKENBLAME_OPEN_COMMAND if you set one):
|
|
80
80
|
tokenblame open
|
|
81
81
|
tokenblame open --shareable
|
|
82
82
|
|
|
83
|
-
#
|
|
83
|
+
# Filtered queries read the indexed observatory.sqlite (no re-harvest):
|
|
84
84
|
tokenblame summary --days 7
|
|
85
85
|
tokenblame summary --days 30 --lane my-repo --json
|
|
86
86
|
|
|
87
87
|
# Check environment, detected agent logs, timezone, and hook status:
|
|
88
88
|
tokenblame doctor
|
|
89
89
|
|
|
90
|
-
# One-click
|
|
90
|
+
# One-click provenance hook setup for Claude Code and Gemini CLI only (Codex and Antigravity are not auto-installed;
|
|
91
|
+
# automatic backup & --uninstall):
|
|
91
92
|
tokenblame init
|
|
92
93
|
tokenblame init --dry-run
|
|
93
94
|
tokenblame init --uninstall
|
|
@@ -105,7 +106,7 @@ By default, TokenBlame discovers local Git repos under `~/projects`, `~/code`, `
|
|
|
105
106
|
|
|
106
107
|
## Optional 1:1 Commit Provenance Hook (`record-hook`)
|
|
107
108
|
|
|
108
|
-
To upgrade concurrent same-repo agent sessions from time-window heuristics (`[-2h, +12h]`) to
|
|
109
|
+
To upgrade concurrent same-repo agent sessions from time-window heuristics (`[-2h, +12h]`) to **`EXACT_HOOK_OID`** attribution without adding files, trailers, or git notes to your repositories. A receipt counts as exact only when its original full commit OID is present among the scanned commits and its session ID matches a harvested session; a commit that was rewritten after the receipt (rebase, amend) is **not** matched by author time or subject and falls back to the lower tiers. Exactness is per session (one cost row per session), not per commit:
|
|
109
110
|
|
|
110
111
|
### Claude Code (`~/.claude/settings.json`)
|
|
111
112
|
```json
|
|
@@ -150,8 +151,8 @@ To upgrade concurrent same-repo agent sessions from time-window heuristics (`[-2
|
|
|
150
151
|
## Epistemic Integrity Guarantees
|
|
151
152
|
|
|
152
153
|
- **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.
|
|
153
|
-
- **Honest API-Equivalent Pricing:** Uses pinned
|
|
154
|
-
- **Transparent Causality Tiers:** Separately badges `1:1 HOOK
|
|
154
|
+
- **Honest API-Equivalent Pricing:** Uses a pinned rate table (`input`, `cache_write`, `cache_read`, `output`), labels alias/fast-mode tiers explicitly, and leaves unpriced preview models as `unpriced` rather than fabricating USD totals. Rates are a static per-model snapshot with no per-request date, service-tier or modality. `gemini-2.5-flash` uses the Standard *text* rates from the 2026-12-01 Google AI Studio capture and is tagged `standard_text_assumed`, not `official`; audio, Batch and Free-tier usage, and Google's 2026-12-01 automatic routing to another model, are not modelled.
|
|
155
|
+
- **Transparent Causality Tiers:** Separately badges `1:1 HOOK` (receipt OID matched an existing commit and session ID), `SHA_META`, `WINDOW_HEURISTIC`, and `DAY_EPISODE` links. `DAY_EPISODE` has no commit evidence and still maps to the `VERIFIED_OUTCOME` attribution label for compatibility.
|
|
155
156
|
|
|
156
157
|
---
|
|
157
158
|
|
|
@@ -161,6 +162,12 @@ TokenBlame measures **post-hoc** token burn, retry loops, and 30-day patch survi
|
|
|
161
162
|
|
|
162
163
|
---
|
|
163
164
|
|
|
165
|
+
### Optional plugin: NoCheat verdict summary (off by default)
|
|
166
|
+
|
|
167
|
+
If you also run the NoCheat gate and it appends receipts to `nocheat_verdicts.jsonl` in the TokenBlame data directory, set `TOKENBLAME_NOCHEAT=1` before `tokenblame build` to add a read-only PASS/BLOCK/ABSTAIN summary to the report. Without that variable the file is never read and no NoCheat section is shown. See `docs/OWNER_CONFIG.md`.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
164
171
|
## License
|
|
165
172
|
|
|
166
173
|
Apache-2.0 — see [LICENSE](LICENSE).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# TokenBlame (`v2.2`)
|
|
1
|
+
# TokenBlame (`v2.2.4`)
|
|
2
2
|
|
|
3
3
|
**Don't just count AI coding tokens — blame them.**
|
|
4
|
-
*Zero-config, 100% offline multi-agent token ledger with out-of-repo Git commit provenance, fixed-horizon (`t+30/60/90d`)
|
|
4
|
+
*Zero-config, 100% offline multi-agent token ledger with out-of-repo Git commit provenance, sampled fixed-horizon (`t+30/60/90d`) line retention with disclosed coverage, and exit-code-aware burn forensics.*
|
|
5
5
|
|
|
6
6
|

|
|
7
7
|
|
|
@@ -17,11 +17,11 @@ Token accounting, commit attribution, and code survival each have strong existin
|
|
|
17
17
|
| **`Git AI` (OSS / Teams)** | Line-level AI authorship + Teams PR cost, rework & churn analytics | Yes (spec covers buckets & 90d DB; team analytics in Teams tier) | Line-level authorship + PR cost/churn | Git notes / metadata | Rust / Cloud |
|
|
18
18
|
| **`Entire`** | Session checkpoints & token hotspot diagnostics | Yes (`fresh` / `cache` / `output` / `subagent`) | Session checkpoints linked to commits | Checkpoint metadata | Go |
|
|
19
19
|
| **`survived`** | Fixed-horizon `t+30/60/90d` code survival (with `notYet` cohort separation) | No | Fixed-horizon commit survival | None | TypeScript |
|
|
20
|
-
| **`TokenBlame` (`v2.2`)** | **Local offline multi-agent cost + commit provenance + `t+30/60/90d` cohorts & HEAD retention + exit-code burn loops** | **Yes** (4-bucket + strict unbucketed separation) | **Out-of-repo `record-hook` spool + revert, HEAD retention & matured cohorts (`notYet` separated)** | **None** | **Python 3.11+ stdlib only** |
|
|
20
|
+
| **`TokenBlame` (`v2.2.4`)** | **Local offline multi-agent cost + commit provenance + `t+30/60/90d` cohorts & HEAD retention + exit-code burn loops** | **Yes** (4-bucket + strict unbucketed separation) | **Out-of-repo `record-hook` spool + revert, sampled HEAD retention & sampled matured cohorts (`notYet` separated, measured/eligible commits shown)** | **None** | **Python 3.11+ stdlib only** |
|
|
21
21
|
|
|
22
22
|
> **Honest measurement scope:**
|
|
23
23
|
> - **HEAD Line Retention vs. Fixed-Horizon Cohorts (`t+30/60/90d`):** `line_survival_30d_pct` tracks HEAD retention of lines from the recent 30-day window (with Squash-Merge / Rebase fallback and `unobserved_lines` kept separate on `git blame` errors). Alongside it, `durability.cohorts` (`t30d`, `t60d`, `t90d`) measures **matured** fixed-horizon cohorts explicitly separated from immature `notYet` commits.
|
|
24
|
-
> - **
|
|
24
|
+
> - **Sampled, with disclosed coverage:** retention is computed on a sample, not on every matured commit. At most 30 repositories, 30 commits per repository per horizon and 18 paths per historical snapshot are measured; binary/no-added-line files, some extensions and files over 262,144 bytes are excluded. Each cohort carries `eligible_commits`, `selected_commits`, `measured_commits`, `changed_paths` / `eligible_paths` / `selected_paths` / `measured_paths`, exclusions by reason, `unobserved_lines` / `unobserved_paths` and `fallback_used` (squash text-match fallback). The card prints measured/eligible commits and the line numerator/denominator; a rate with no observed lines is shown as unavailable, never as a percentage.
|
|
25
25
|
> - **Diagnostic Signals ≠ Causal Proof:** `FAILURE_LOOP` (nonzero exit/error streaks), `ITERATION_LOOP` (zero-error verification repeats), uncommitted high-burn sessions, and line retention are investigative signals — not automatic proofs of wasted effort, code correctness, or causal ROI.
|
|
26
26
|
|
|
27
27
|
---
|
|
@@ -51,18 +51,19 @@ tokenblame
|
|
|
51
51
|
# Also emit privacy-redacted shareable HTML + IR:
|
|
52
52
|
tokenblame build --shareable
|
|
53
53
|
|
|
54
|
-
# Open dashboard in your browser (or
|
|
54
|
+
# Open dashboard in your browser (or via TOKENBLAME_OPEN_COMMAND if you set one):
|
|
55
55
|
tokenblame open
|
|
56
56
|
tokenblame open --shareable
|
|
57
57
|
|
|
58
|
-
#
|
|
58
|
+
# Filtered queries read the indexed observatory.sqlite (no re-harvest):
|
|
59
59
|
tokenblame summary --days 7
|
|
60
60
|
tokenblame summary --days 30 --lane my-repo --json
|
|
61
61
|
|
|
62
62
|
# Check environment, detected agent logs, timezone, and hook status:
|
|
63
63
|
tokenblame doctor
|
|
64
64
|
|
|
65
|
-
# One-click
|
|
65
|
+
# One-click provenance hook setup for Claude Code and Gemini CLI only (Codex and Antigravity are not auto-installed;
|
|
66
|
+
# automatic backup & --uninstall):
|
|
66
67
|
tokenblame init
|
|
67
68
|
tokenblame init --dry-run
|
|
68
69
|
tokenblame init --uninstall
|
|
@@ -80,7 +81,7 @@ By default, TokenBlame discovers local Git repos under `~/projects`, `~/code`, `
|
|
|
80
81
|
|
|
81
82
|
## Optional 1:1 Commit Provenance Hook (`record-hook`)
|
|
82
83
|
|
|
83
|
-
To upgrade concurrent same-repo agent sessions from time-window heuristics (`[-2h, +12h]`) to
|
|
84
|
+
To upgrade concurrent same-repo agent sessions from time-window heuristics (`[-2h, +12h]`) to **`EXACT_HOOK_OID`** attribution without adding files, trailers, or git notes to your repositories. A receipt counts as exact only when its original full commit OID is present among the scanned commits and its session ID matches a harvested session; a commit that was rewritten after the receipt (rebase, amend) is **not** matched by author time or subject and falls back to the lower tiers. Exactness is per session (one cost row per session), not per commit:
|
|
84
85
|
|
|
85
86
|
### Claude Code (`~/.claude/settings.json`)
|
|
86
87
|
```json
|
|
@@ -125,8 +126,8 @@ To upgrade concurrent same-repo agent sessions from time-window heuristics (`[-2
|
|
|
125
126
|
## Epistemic Integrity Guarantees
|
|
126
127
|
|
|
127
128
|
- **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.
|
|
128
|
-
- **Honest API-Equivalent Pricing:** Uses pinned
|
|
129
|
-
- **Transparent Causality Tiers:** Separately badges `1:1 HOOK
|
|
129
|
+
- **Honest API-Equivalent Pricing:** Uses a pinned rate table (`input`, `cache_write`, `cache_read`, `output`), labels alias/fast-mode tiers explicitly, and leaves unpriced preview models as `unpriced` rather than fabricating USD totals. Rates are a static per-model snapshot with no per-request date, service-tier or modality. `gemini-2.5-flash` uses the Standard *text* rates from the 2026-12-01 Google AI Studio capture and is tagged `standard_text_assumed`, not `official`; audio, Batch and Free-tier usage, and Google's 2026-12-01 automatic routing to another model, are not modelled.
|
|
130
|
+
- **Transparent Causality Tiers:** Separately badges `1:1 HOOK` (receipt OID matched an existing commit and session ID), `SHA_META`, `WINDOW_HEURISTIC`, and `DAY_EPISODE` links. `DAY_EPISODE` has no commit evidence and still maps to the `VERIFIED_OUTCOME` attribution label for compatibility.
|
|
130
131
|
|
|
131
132
|
---
|
|
132
133
|
|
|
@@ -136,6 +137,12 @@ TokenBlame measures **post-hoc** token burn, retry loops, and 30-day patch survi
|
|
|
136
137
|
|
|
137
138
|
---
|
|
138
139
|
|
|
140
|
+
### Optional plugin: NoCheat verdict summary (off by default)
|
|
141
|
+
|
|
142
|
+
If you also run the NoCheat gate and it appends receipts to `nocheat_verdicts.jsonl` in the TokenBlame data directory, set `TOKENBLAME_NOCHEAT=1` before `tokenblame build` to add a read-only PASS/BLOCK/ABSTAIN summary to the report. Without that variable the file is never read and no NoCheat section is shown. See `docs/OWNER_CONFIG.md`.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
139
146
|
## License
|
|
140
147
|
|
|
141
148
|
Apache-2.0 — see [LICENSE](LICENSE).
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tokenblame"
|
|
7
|
-
version = "2.2.
|
|
7
|
+
version = "2.2.4"
|
|
8
8
|
description = "Offline AI coding token ledger with out-of-repo Git commit provenance, Squash-Merge-resilient HEAD line retention, and allowlisted burn forensics"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|