weekburn 0.1.0__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.
weekburn-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ishan Yash
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,169 @@
1
+ Metadata-Version: 2.4
2
+ Name: weekburn
3
+ Version: 0.1.0
4
+ Summary: See which Claude Code sessions burned your weekly limit, and whether your usage per message really changed.
5
+ Author-email: Ishan Yash <ishan.yash17@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ishanyash/weekburn
8
+ Project-URL: Issues, https://github.com/ishanyash/weekburn/issues
9
+ Project-URL: Author, https://ishanyash.com
10
+ Keywords: claude,claude-code,usage,tokens,cli
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development
20
+ Classifier: Topic :: Utilities
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: typer>=0.12
25
+ Requires-Dist: rich>=13
26
+ Requires-Dist: numpy>=1.26
27
+ Provides-Extra: test
28
+ Requires-Dist: pytest>=8; extra == "test"
29
+ Dynamic: license-file
30
+
31
+ # WeekBurn
32
+
33
+ **See which Claude Code sessions burned your weekly limit, and whether your usage per message really changed.**
34
+
35
+ ![weekburn report on demo data](https://raw.githubusercontent.com/ishanyash/weekburn/main/docs/report.svg)
36
+
37
+ <sub>Screenshot made from synthetic demo data (`scripts/make_demo_data.py`), not a real account.</sub>
38
+
39
+ ```bash
40
+ pipx install weekburn
41
+ weekburn report --since 7d
42
+ ```
43
+
44
+ Live on PyPI: <https://pypi.org/project/weekburn/>
45
+
46
+ WeekBurn reads the transcripts Claude Code already keeps on your computer. It makes no network calls and uploads nothing.
47
+
48
+ ## Why
49
+
50
+ In late October 2026 many people reported that their Claude Code weekly limit was draining much faster than before (for example [#105240](https://github.com/anthropics/claude-code/issues/105240)). Anthropic's Claude Code team said it found no single root cause and no regression in Claude Code (it did find a few smaller issues and is rolling out fixes), and pointed to one or two heavy sessions (xhigh effort, `/goal`, Workflows, Agent Teams, long SDK jobs) and to subagents that inherit the parent's effort level ([summary](https://sysnote.net/news/claude-code-usage-draining-fast-anthropic-found-no-regression-blames-heavy-sessi)).
51
+
52
+ That leaves one question for each user: is it me, or the meter? WeekBurn answers the part you can answer from local files, and gives you a short, counts-only report you can paste into a GitHub issue.
53
+
54
+ ## Quick start
55
+
56
+ ```bash
57
+ pipx install weekburn
58
+
59
+ # Your heaviest sessions in the last 7 days, with cause tags
60
+ weekburn report --since 7d
61
+
62
+ # Did tokens per message really change between two weeks?
63
+ weekburn compare --before 2026-10-10:2026-10-16 --after 2026-10-24:2026-10-30
64
+
65
+ # Same reports as Markdown, safe to paste into a GitHub issue
66
+ weekburn report --since 7d --markdown > report.md
67
+ weekburn compare --before 2026-10-10:2026-10-16 --after 2026-10-24:2026-10-30 --markdown > compare.md
68
+ ```
69
+
70
+ `--since` takes `7d`, `48h`, `2w` or a date like `2026-10-20`. `--before` and `--after` take whole days in your computer's time zone, first and last day included. If your transcripts live somewhere else, add `--projects-dir PATH`.
71
+
72
+ ## What you get
73
+
74
+ **`weekburn report`**
75
+
76
+ - Totals for the period: sessions, API requests, user messages and tokens, split into cache read, cache write, uncached input and output, plus the part that came from subagents.
77
+ - The top 10 sessions by tokens, each with its cause tags.
78
+ - A table of the share of all tokens that sits in sessions with each tag.
79
+
80
+ **`weekburn compare`**
81
+
82
+ ![weekburn compare on demo data](https://raw.githubusercontent.com/ishanyash/weekburn/main/docs/compare.svg)
83
+
84
+ - Tokens per user message, cache read share and cache write share in each period.
85
+ - A 95% bootstrap interval for each number and for the change.
86
+ - The same comparison again with the top 5% heaviest sessions removed.
87
+ - A plain verdict: "your usage per message changed" or "no clear change in your local usage".
88
+
89
+ ## Cause tags
90
+
91
+ A tag is only given when the data supports it. A session can have more than one.
92
+
93
+ | Tag | Rule |
94
+ | :--- | :--- |
95
+ | heavy session | In the top 5% of sessions by total tokens in the period (rounded up, so at least one) |
96
+ | subagent heavy | Over 50% of the session's tokens came from subagents |
97
+ | idle resume | A request after more than 60 minutes of silence that sent over 100k tokens not served from cache (the prompt cache had expired) |
98
+ | long context | The median prompt size of the main conversation is over 150k tokens |
99
+ | high effort | Over 50% of the session's tokens ran at `xhigh` or `max` effort. Only shown when your transcripts record effort |
100
+
101
+ ## How it works
102
+
103
+ 1. **Find files.** Every `*.jsonl` under `~/.claude/projects` and `~/.config/claude/projects` (or `$CLAUDE_CONFIG_DIR/projects`), including subagent files in `<session>/subagents/`.
104
+ 2. **One record per API request.** Claude Code writes each response as several lines, one per content block (thinking, text, each tool call), and every line repeats the same usage block. Adding up lines counts the same request 2 to 8 times. WeekBurn keeps one record per `requestId` (or `message.id` when there is no request id), also across files, so requests copied into a resumed session are not counted twice. If the copies differ, the largest count is kept.
105
+ 3. **Per request** it keeps input, output, cache write and cache read tokens, the model, the session, whether it came from a subagent, the effort level when recorded, and the minutes since the previous request in the same session.
106
+ 4. **Per session** it adds these up and gives the tags above.
107
+ 5. **Compare.** For each period it sums tokens and user messages over sessions and divides (a ratio of sums, so long sessions count more than short ones). The interval comes from 2,000 bootstrap resamples of sessions, with a fixed seed so the same data gives the same answer. The change is called clear when its 95% interval does not include zero. Then everything is run again without the top 5% of sessions by tokens in each period.
108
+
109
+ ### Transcript fields WeekBurn relies on
110
+
111
+ Checked against real transcripts written by Claude Code 2.1.314.
112
+
113
+ | Field | Where | Used for |
114
+ | :--- | :--- | :--- |
115
+ | `type` | every line | `assistant` lines carry usage; `user` lines are messages or tool results |
116
+ | `requestId`, then `message.id` | assistant lines | one record per API request |
117
+ | `message.usage.input_tokens` | assistant lines | uncached input |
118
+ | `message.usage.output_tokens` | assistant lines | output (includes thinking) |
119
+ | `message.usage.cache_creation_input_tokens` | assistant lines | cache write |
120
+ | `message.usage.cache_read_input_tokens` | assistant lines | cache read |
121
+ | `message.model` | assistant lines | model column |
122
+ | `timestamp` | every line | periods and idle gaps |
123
+ | `sessionId` | every line | grouping (subagent files carry the parent's id) |
124
+ | `isSidechain`, `agentId`, a `subagents/` folder | every line / path | subagent or main |
125
+ | `effort` (or `perTurnEffort`) | assistant lines | high effort tag (only recent Claude Code versions write it) |
126
+ | `isMeta`, `toolUseResult`, content block types | user lines | telling user messages apart from tool results and system notes |
127
+ | `cwd` | every line | project name in terminal output only, never in Markdown |
128
+
129
+ Seen but not used yet: `message.usage.cache_creation.ephemeral_1h_input_tokens` and `ephemeral_5m_input_tokens`, `service_tier`, `speed`, `output_tokens_details.thinking_tokens`, `entrypoint`.
130
+
131
+ **User messages** are `user` lines with text or an image that are not tool results, not system notes (`isMeta`), not subagent prompts, and not local command output or "[Request interrupted]" markers.
132
+
133
+ ## Privacy
134
+
135
+ - Reads local files only. No network calls, no telemetry, nothing uploaded.
136
+ - `--markdown` output holds counts, dates, model names and the first 8 characters of random session ids. It never holds prompt text, file paths, project names or code. A test checks this.
137
+ - Terminal output shows the project folder name (the last part of the path) so you can find the session. Use `--markdown` when you share.
138
+
139
+ ## Known limits
140
+
141
+ - **Token counts are not plan usage.** Anthropic does not publish how the plan meter weights input, output, cache write and cache read tokens, so WeekBurn cannot tell you what share of your weekly limit a session used. It can only tell you whether your local token use changed.
142
+ - **Old transcripts may be gone.** Claude Code deletes transcripts older than its `cleanupPeriodDays` setting (30 days by default), so `compare` can only look back as far as your files go.
143
+ - **"Heavy session" is relative.** It is the top 5% of the period, so there is always at least one.
144
+ - **Tags overlap,** so the cause shares do not add up to 100%.
145
+ - **Sessions are treated as independent** in the bootstrap. A session that spans both periods is split by request time and counts in both.
146
+ - **Slash commands** such as `/clear` are written as user lines and are counted as user messages. This is the same in both periods, so it does not bias the comparison much.
147
+ - **Few sessions, wide intervals.** With fewer than 5 sessions in a period WeekBurn warns you, and the intervals may be missing.
148
+ - **The transcript format is not a public API.** A future Claude Code version could change it.
149
+
150
+ ## Development
151
+
152
+ ```bash
153
+ git clone https://github.com/ishanyash/weekburn
154
+ cd weekburn
155
+ python -m pip install -e ".[test]"
156
+ python -m pytest
157
+ python scripts/make_demo_data.py /tmp/demo-projects # synthetic data to try it on
158
+ weekburn report --since 7d --projects-dir /tmp/demo-projects
159
+ ```
160
+
161
+ Releases are published to PyPI from GitHub Actions with trusted publishing when a `v*` tag is pushed. No API tokens are stored.
162
+
163
+ ## Licence
164
+
165
+ MIT. See [LICENSE](LICENSE).
166
+
167
+ ---
168
+
169
+ Built by [Ishan Yash](https://ishanyash.com).
@@ -0,0 +1,139 @@
1
+ # WeekBurn
2
+
3
+ **See which Claude Code sessions burned your weekly limit, and whether your usage per message really changed.**
4
+
5
+ ![weekburn report on demo data](https://raw.githubusercontent.com/ishanyash/weekburn/main/docs/report.svg)
6
+
7
+ <sub>Screenshot made from synthetic demo data (`scripts/make_demo_data.py`), not a real account.</sub>
8
+
9
+ ```bash
10
+ pipx install weekburn
11
+ weekburn report --since 7d
12
+ ```
13
+
14
+ Live on PyPI: <https://pypi.org/project/weekburn/>
15
+
16
+ WeekBurn reads the transcripts Claude Code already keeps on your computer. It makes no network calls and uploads nothing.
17
+
18
+ ## Why
19
+
20
+ In late October 2026 many people reported that their Claude Code weekly limit was draining much faster than before (for example [#105240](https://github.com/anthropics/claude-code/issues/105240)). Anthropic's Claude Code team said it found no single root cause and no regression in Claude Code (it did find a few smaller issues and is rolling out fixes), and pointed to one or two heavy sessions (xhigh effort, `/goal`, Workflows, Agent Teams, long SDK jobs) and to subagents that inherit the parent's effort level ([summary](https://sysnote.net/news/claude-code-usage-draining-fast-anthropic-found-no-regression-blames-heavy-sessi)).
21
+
22
+ That leaves one question for each user: is it me, or the meter? WeekBurn answers the part you can answer from local files, and gives you a short, counts-only report you can paste into a GitHub issue.
23
+
24
+ ## Quick start
25
+
26
+ ```bash
27
+ pipx install weekburn
28
+
29
+ # Your heaviest sessions in the last 7 days, with cause tags
30
+ weekburn report --since 7d
31
+
32
+ # Did tokens per message really change between two weeks?
33
+ weekburn compare --before 2026-10-10:2026-10-16 --after 2026-10-24:2026-10-30
34
+
35
+ # Same reports as Markdown, safe to paste into a GitHub issue
36
+ weekburn report --since 7d --markdown > report.md
37
+ weekburn compare --before 2026-10-10:2026-10-16 --after 2026-10-24:2026-10-30 --markdown > compare.md
38
+ ```
39
+
40
+ `--since` takes `7d`, `48h`, `2w` or a date like `2026-10-20`. `--before` and `--after` take whole days in your computer's time zone, first and last day included. If your transcripts live somewhere else, add `--projects-dir PATH`.
41
+
42
+ ## What you get
43
+
44
+ **`weekburn report`**
45
+
46
+ - Totals for the period: sessions, API requests, user messages and tokens, split into cache read, cache write, uncached input and output, plus the part that came from subagents.
47
+ - The top 10 sessions by tokens, each with its cause tags.
48
+ - A table of the share of all tokens that sits in sessions with each tag.
49
+
50
+ **`weekburn compare`**
51
+
52
+ ![weekburn compare on demo data](https://raw.githubusercontent.com/ishanyash/weekburn/main/docs/compare.svg)
53
+
54
+ - Tokens per user message, cache read share and cache write share in each period.
55
+ - A 95% bootstrap interval for each number and for the change.
56
+ - The same comparison again with the top 5% heaviest sessions removed.
57
+ - A plain verdict: "your usage per message changed" or "no clear change in your local usage".
58
+
59
+ ## Cause tags
60
+
61
+ A tag is only given when the data supports it. A session can have more than one.
62
+
63
+ | Tag | Rule |
64
+ | :--- | :--- |
65
+ | heavy session | In the top 5% of sessions by total tokens in the period (rounded up, so at least one) |
66
+ | subagent heavy | Over 50% of the session's tokens came from subagents |
67
+ | idle resume | A request after more than 60 minutes of silence that sent over 100k tokens not served from cache (the prompt cache had expired) |
68
+ | long context | The median prompt size of the main conversation is over 150k tokens |
69
+ | high effort | Over 50% of the session's tokens ran at `xhigh` or `max` effort. Only shown when your transcripts record effort |
70
+
71
+ ## How it works
72
+
73
+ 1. **Find files.** Every `*.jsonl` under `~/.claude/projects` and `~/.config/claude/projects` (or `$CLAUDE_CONFIG_DIR/projects`), including subagent files in `<session>/subagents/`.
74
+ 2. **One record per API request.** Claude Code writes each response as several lines, one per content block (thinking, text, each tool call), and every line repeats the same usage block. Adding up lines counts the same request 2 to 8 times. WeekBurn keeps one record per `requestId` (or `message.id` when there is no request id), also across files, so requests copied into a resumed session are not counted twice. If the copies differ, the largest count is kept.
75
+ 3. **Per request** it keeps input, output, cache write and cache read tokens, the model, the session, whether it came from a subagent, the effort level when recorded, and the minutes since the previous request in the same session.
76
+ 4. **Per session** it adds these up and gives the tags above.
77
+ 5. **Compare.** For each period it sums tokens and user messages over sessions and divides (a ratio of sums, so long sessions count more than short ones). The interval comes from 2,000 bootstrap resamples of sessions, with a fixed seed so the same data gives the same answer. The change is called clear when its 95% interval does not include zero. Then everything is run again without the top 5% of sessions by tokens in each period.
78
+
79
+ ### Transcript fields WeekBurn relies on
80
+
81
+ Checked against real transcripts written by Claude Code 2.1.314.
82
+
83
+ | Field | Where | Used for |
84
+ | :--- | :--- | :--- |
85
+ | `type` | every line | `assistant` lines carry usage; `user` lines are messages or tool results |
86
+ | `requestId`, then `message.id` | assistant lines | one record per API request |
87
+ | `message.usage.input_tokens` | assistant lines | uncached input |
88
+ | `message.usage.output_tokens` | assistant lines | output (includes thinking) |
89
+ | `message.usage.cache_creation_input_tokens` | assistant lines | cache write |
90
+ | `message.usage.cache_read_input_tokens` | assistant lines | cache read |
91
+ | `message.model` | assistant lines | model column |
92
+ | `timestamp` | every line | periods and idle gaps |
93
+ | `sessionId` | every line | grouping (subagent files carry the parent's id) |
94
+ | `isSidechain`, `agentId`, a `subagents/` folder | every line / path | subagent or main |
95
+ | `effort` (or `perTurnEffort`) | assistant lines | high effort tag (only recent Claude Code versions write it) |
96
+ | `isMeta`, `toolUseResult`, content block types | user lines | telling user messages apart from tool results and system notes |
97
+ | `cwd` | every line | project name in terminal output only, never in Markdown |
98
+
99
+ Seen but not used yet: `message.usage.cache_creation.ephemeral_1h_input_tokens` and `ephemeral_5m_input_tokens`, `service_tier`, `speed`, `output_tokens_details.thinking_tokens`, `entrypoint`.
100
+
101
+ **User messages** are `user` lines with text or an image that are not tool results, not system notes (`isMeta`), not subagent prompts, and not local command output or "[Request interrupted]" markers.
102
+
103
+ ## Privacy
104
+
105
+ - Reads local files only. No network calls, no telemetry, nothing uploaded.
106
+ - `--markdown` output holds counts, dates, model names and the first 8 characters of random session ids. It never holds prompt text, file paths, project names or code. A test checks this.
107
+ - Terminal output shows the project folder name (the last part of the path) so you can find the session. Use `--markdown` when you share.
108
+
109
+ ## Known limits
110
+
111
+ - **Token counts are not plan usage.** Anthropic does not publish how the plan meter weights input, output, cache write and cache read tokens, so WeekBurn cannot tell you what share of your weekly limit a session used. It can only tell you whether your local token use changed.
112
+ - **Old transcripts may be gone.** Claude Code deletes transcripts older than its `cleanupPeriodDays` setting (30 days by default), so `compare` can only look back as far as your files go.
113
+ - **"Heavy session" is relative.** It is the top 5% of the period, so there is always at least one.
114
+ - **Tags overlap,** so the cause shares do not add up to 100%.
115
+ - **Sessions are treated as independent** in the bootstrap. A session that spans both periods is split by request time and counts in both.
116
+ - **Slash commands** such as `/clear` are written as user lines and are counted as user messages. This is the same in both periods, so it does not bias the comparison much.
117
+ - **Few sessions, wide intervals.** With fewer than 5 sessions in a period WeekBurn warns you, and the intervals may be missing.
118
+ - **The transcript format is not a public API.** A future Claude Code version could change it.
119
+
120
+ ## Development
121
+
122
+ ```bash
123
+ git clone https://github.com/ishanyash/weekburn
124
+ cd weekburn
125
+ python -m pip install -e ".[test]"
126
+ python -m pytest
127
+ python scripts/make_demo_data.py /tmp/demo-projects # synthetic data to try it on
128
+ weekburn report --since 7d --projects-dir /tmp/demo-projects
129
+ ```
130
+
131
+ Releases are published to PyPI from GitHub Actions with trusted publishing when a `v*` tag is pushed. No API tokens are stored.
132
+
133
+ ## Licence
134
+
135
+ MIT. See [LICENSE](LICENSE).
136
+
137
+ ---
138
+
139
+ Built by [Ishan Yash](https://ishanyash.com).
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "weekburn"
7
+ version = "0.1.0"
8
+ description = "See which Claude Code sessions burned your weekly limit, and whether your usage per message really changed."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Ishan Yash", email = "ishan.yash17@gmail.com" }]
14
+ keywords = ["claude", "claude-code", "usage", "tokens", "cli"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Software Development",
25
+ "Topic :: Utilities",
26
+ ]
27
+ dependencies = [
28
+ "typer>=0.12",
29
+ "rich>=13",
30
+ "numpy>=1.26",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ test = ["pytest>=8"]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/ishanyash/weekburn"
38
+ Issues = "https://github.com/ishanyash/weekburn/issues"
39
+ Author = "https://ishanyash.com"
40
+
41
+ [project.scripts]
42
+ weekburn = "weekburn.cli:main"
43
+
44
+ [tool.setuptools.packages.find]
45
+ where = ["src"]
46
+
47
+ [tool.pytest.ini_options]
48
+ testpaths = ["tests"]
49
+ pythonpath = ["src"]
50
+ addopts = "-q"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """WeekBurn: see which Claude Code sessions burned your weekly limit."""
2
+
3
+ __version__ = "0.1.0"