prism-cc 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.
@@ -0,0 +1 @@
1
+ {"sessionId":"fef4c8d5-b00e-4586-a17a-74703c2046fd","pid":12596,"acquiredAt":1776051214766}
@@ -0,0 +1,21 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.pyo
4
+ *.pyd
5
+ .Python
6
+ *.egg-info/
7
+ dist/
8
+ build/
9
+ .eggs/
10
+ *.egg
11
+ .venv/
12
+ venv/
13
+ env/
14
+ .env
15
+ *.whl
16
+ .pytest_cache/
17
+ .mypy_cache/
18
+ .ruff_cache/
19
+ .coverage
20
+ htmlcov/
21
+ *.log
@@ -0,0 +1,23 @@
1
+ # PRISM
2
+
3
+ Python CLI tool. Session intelligence for Claude Code.
4
+
5
+ ## Commands
6
+ - Run tests: `pytest`
7
+ - Install dev: `pip install -e ".[dev]"` or `uv sync --dev`
8
+ - Run locally: `python -m prism` or `prism` after install
9
+
10
+ ## Structure
11
+ - `prism/parser.py` — all JSONL parsing logic, no analysis here
12
+ - `prism/analyzer.py` — all metrics calculation, no I/O here
13
+ - `prism/advisor.py` — recommendation generation, reads analyzer output
14
+ - `prism/app.py` — Textual TUI, imports widgets from prism/widgets/
15
+ - `prism/cli.py` — Typer CLI, thin layer that calls analyzer/advisor/app
16
+
17
+ ## Rules
18
+ - Never mix parsing and analysis — parser returns raw records, analyzer computes metrics
19
+ - Never hardcode `~/.claude` path — use `Path.home() / ".claude"` and make it configurable
20
+ - Always handle malformed JSONL gracefully — skip bad lines, never crash
21
+ - Use `Path` objects throughout, never string concatenation for paths
22
+ - Textual widgets must not import from cli.py — no circular deps
23
+ - Run `pytest` before marking any task done
@@ -0,0 +1,160 @@
1
+ # PRISM Launch Checklist + Post Copy
2
+
3
+ ---
4
+
5
+ ## Before You Push to GitHub
6
+
7
+ - [ ] Replace YOUR_USERNAME with `jakeefr` in pyproject.toml
8
+ - [ ] Add MIT LICENSE file
9
+ - [ ] Record demo GIF with vhs (demo.tape) and add to README
10
+ - [ ] Set GitHub repo description: "Session intelligence for Claude Code — find why your sessions fail and fix them"
11
+ - [ ] Add GitHub topics: `claude-code`, `claude`, `developer-tools`, `cli`, `tui`, `python`, `textual`
12
+ - [ ] Publish to PyPI: `uv build && uv publish` (needs PyPI account + token)
13
+ - [ ] Verify `pip install prism-cc` works from a clean environment
14
+ - [ ] Star your own repo (baseline social proof)
15
+
16
+ ---
17
+
18
+ ## GitHub Repo Settings
19
+
20
+ **Description:**
21
+ ```
22
+ Session intelligence for Claude Code — find why your sessions fail and fix them
23
+ ```
24
+
25
+ **Website:** (leave blank for now, or link to PyPI)
26
+
27
+ **Topics:**
28
+ ```
29
+ claude-code claude anthropic developer-tools cli tui python textual terminal
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Hacker News Post
35
+
36
+ **Post at 13:00–15:00 UTC for best timing.**
37
+
38
+ **Title:**
39
+ ```
40
+ PRISM – session intelligence for Claude Code (find why your sessions fail)
41
+ ```
42
+
43
+ **Body:**
44
+ ```
45
+ I've been using Claude Code heavily and kept hitting my token limits without understanding why.
46
+ Turns out the session data is all there in JSONL files — Claude Code writes everything to
47
+ ~/.claude/projects/ — but nothing was reading it to surface patterns.
48
+
49
+ So I built PRISM. It reads those files and does three things:
50
+
51
+ 1. Health scores across 5 dimensions (token efficiency, tool call patterns, context hygiene,
52
+ CLAUDE.md adherence, session continuity)
53
+ 2. Diagnoses root causes — not just "you used tokens" but "your 237-line CLAUDE.md is being
54
+ re-read on every tool call, that's where 6738% of your session tokens went"
55
+ 3. Concrete CLAUDE.md diffs — specific lines to add, remove, or move to subdirectory files
56
+
57
+ Running it against my own projects found things I never expected: migration file edits in a
58
+ project with a rule saying never to touch them, retry loops from commands that hung waiting
59
+ for interactive input, rules that stopped being followed after line 80 because the file
60
+ got too long.
61
+
62
+ The CLAUDE.md adherence detection is the part I'm most interested in getting feedback on —
63
+ it extracts imperative statements from your CLAUDE.md and checks whether session tool calls
64
+ actually comply. It's not perfect but it caught real violations in my data.
65
+
66
+ GitHub: https://github.com/jakeefr/prism
67
+ Install: pip install prism-cc
68
+
69
+ Would love feedback on the adherence detection — it's the hardest part to get right and
70
+ I'd like to know if it works on other people's setups.
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Reddit Post — r/ClaudeAI
76
+
77
+ **Title:**
78
+ ```
79
+ I built a tool that reads your Claude Code session files and tells you exactly
80
+ why you're burning through tokens — found some wild stuff in my own data
81
+ ```
82
+
83
+ **Body:**
84
+ ```
85
+ Been frustrated with hitting Claude Code limits and not knowing where the tokens went.
86
+ The session data is all there in JSONL files on your machine but nothing was surfacing it usefully.
87
+
88
+ Built PRISM — runs locally, reads ~/.claude/projects/, no API key needed.
89
+
90
+ What it found on my machine:
91
+
92
+ - One session where CLAUDE.md re-reads consumed **6738%** of session tokens.
93
+ A 237-line file being re-read on every single tool call.
94
+ - A project where Claude was editing migration files despite a rule saying never to —
95
+ rule existed in CLAUDE.md, was being ignored
96
+ - 5 consecutive tool failures in one session that I never noticed until PRISM flagged it
97
+
98
+ The main things it does:
99
+ - Health scores per project (A–F across 5 dimensions)
100
+ - CLAUDE.md adherence check — are your rules actually being followed?
101
+ - Concrete recommendations: which lines to remove, which to move to subdirectory files
102
+
103
+ Install: `pip install prism-cc` then just run `prism analyze`
104
+
105
+ Repo: https://github.com/jakeefr/prism
106
+
107
+ Curious if anyone else runs it and finds surprising stuff in their own data.
108
+ The 6738% number genuinely shocked me.
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Reddit Post — r/programming
114
+
115
+ **Title:**
116
+ ```
117
+ I built a TUI that analyzes Claude Code's session JSONL files and surfaces
118
+ why your context window is filling up
119
+ ```
120
+
121
+ **Body:**
122
+ ```
123
+ Claude Code writes detailed session logs to ~/.claude/projects/ — every tool call,
124
+ every message, every compaction boundary. Nobody was reading them to surface useful patterns.
125
+
126
+ PRISM is a Python/Textual TUI that parses those files and computes:
127
+
128
+ - CLAUDE.md re-read cost (every tool call re-reads your CLAUDE.md from context top —
129
+ a 200-line file × 50 tool calls = 10k tokens just on instructions)
130
+ - Retry loop detection (3+ consecutive identical tool calls)
131
+ - Edit-revert cycles (write to file → write to same file within 3 turns)
132
+ - CLAUDE.md adherence — extracts imperative rules and checks whether session
133
+ tool calls comply
134
+ - Compaction loss events and what context disappeared
135
+
136
+ Real finding: one session showed 6738% CLAUDE.md re-read cost ratio.
137
+ The file had grown to 237 lines including personality instructions that
138
+ Claude Code's system prompt already handles.
139
+
140
+ Stack: Python, Textual (TUI framework), Rich, Typer, watchdog for live mode.
141
+ Tests: 70 passing.
142
+
143
+ pip install prism-cc / https://github.com/jakeefr/prism
144
+
145
+ Happy to answer questions about the JSONL format or the adherence detection logic.
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Timing
151
+
152
+ Best window: **Tuesday–Thursday, 13:00–15:00 UTC**
153
+
154
+ Post HN first. If it gets traction in the first 2 hours (10+ upvotes, a few comments),
155
+ post Reddit the same day. If HN is slow, post Reddit next day independently.
156
+
157
+ Be online for 4 hours after posting HN. Answer every technical question in depth.
158
+ Never deflect. If someone criticizes the adherence detection — agree with the limitation
159
+ first, then explain what it does catch.
160
+ ```
prism_cc-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PRISM Contributors
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,216 @@
1
+ Metadata-Version: 2.4
2
+ Name: prism-cc
3
+ Version: 0.1.0
4
+ Summary: Session intelligence for Claude Code — find why your sessions fail and fix them
5
+ Project-URL: Homepage, https://github.com/YOUR_USERNAME/prism
6
+ Project-URL: Repository, https://github.com/YOUR_USERNAME/prism
7
+ Project-URL: Issues, https://github.com/YOUR_USERNAME/prism/issues
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: ai,claude,claude-code,developer-tools,tui
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: rich>=14.0.0
20
+ Requires-Dist: textual>=0.80.0
21
+ Requires-Dist: typer>=0.12.0
22
+ Requires-Dist: watchdog>=4.0.0
23
+ Description-Content-Type: text/markdown
24
+
25
+ # PRISM
26
+
27
+ **Session intelligence for Claude Code. Find out why your sessions are burning tokens — and fix them.**
28
+
29
+ [![PyPI version](https://img.shields.io/pypi/v/prism-cc.svg)](https://pypi.org/project/prism-cc/)
30
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
31
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/)
32
+ [![Tests](https://img.shields.io/github/actions/workflow/status/jakeefr/prism/tests.yml?label=tests)](https://github.com/jakeefr/prism/actions)
33
+
34
+ ![PRISM demo](demo.gif)
35
+
36
+ ```bash
37
+ pip install prism-cc
38
+ ```
39
+
40
+ ---
41
+
42
+ ## The problem
43
+
44
+ Your Claude Code sessions are silently wasting tokens and you don't know why.
45
+
46
+ Running PRISM against real session data from a single machine found:
47
+
48
+ - A project with **6738% CLAUDE.md re-read cost** in one session — a 237-line file being re-read on every tool call
49
+ - A project where **CLAUDE.md re-reads consumed 480% of total session tokens** — more tokens on instructions than on actual work
50
+ - **4 migration file edits** in a project that had a rule saying never to touch them — the rule existed, Claude ignored it
51
+ - **5 consecutive tool failures** in a single session with no diagnosis
52
+
53
+ None of this was visible before PRISM. The token counter just said you hit your limit.
54
+
55
+ ---
56
+
57
+ ## What PRISM does
58
+
59
+ PRISM reads Claude Code's session files from `~/.claude/projects/` — the same files Claude Code writes automatically — and tells you three things:
60
+
61
+ 1. **Why your tokens are disappearing** — CLAUDE.md re-read costs, retry loops, compaction losses, sidechain waste
62
+ 2. **Whether your CLAUDE.md rules are actually being followed** — or silently ignored mid-session
63
+ 3. **Exactly what to change** — concrete diff recommendations, not generic advice
64
+
65
+ You keep using Claude Code exactly as normal. PRISM is the tool you run after.
66
+
67
+ ---
68
+
69
+ ## Quick start
70
+
71
+ ```bash
72
+ # Install
73
+ pip install prism-cc
74
+
75
+ # Analyze all your Claude Code projects
76
+ prism analyze
77
+
78
+ # Get specific CLAUDE.md fix recommendations
79
+ prism advise
80
+
81
+ # Open the full interactive dashboard
82
+ prism
83
+
84
+ # Watch a session live as it runs
85
+ prism watch
86
+ ```
87
+
88
+ ---
89
+
90
+ ## What you'll see
91
+
92
+ ```
93
+ Project Overall Token Eff. Tool Health Ctx Hygiene MD Adherence Continuity
94
+ D//jarvis/space C+ D B+ D C A
95
+ D//winaborator/ai C F A B B+ A-
96
+ D//tcgintel/project C+ C+ D B C+ B
97
+ D//bounty C+ D+ B B+ B A
98
+ D//prism B+ B+ A- B+ A A
99
+ ```
100
+
101
+ Followed by the advisor:
102
+
103
+ ```
104
+ ╭──────────────────────────────────────────────────────────╮
105
+ │ PRISM ADVISOR — recommendations for jarvis/space │
106
+ ╰──────────────────────────────────────────────────────────╯
107
+
108
+ ✦ TRIM (High impact — silent token drain every session)
109
+ Remove lines 120–148: personality/tone instructions
110
+ Claude Code's system prompt already handles this.
111
+ These 29 lines cost tokens on every single tool call.
112
+
113
+ ✦ RESTRUCTURE (Reduce root-level re-read cost)
114
+ Move 3 rules to subdirectory CLAUDE.md files:
115
+ - "Use functional components only in React"
116
+ - "Import from @/components, never relative paths"
117
+ - "Run bun run typecheck after TypeScript changes"
118
+ These only matter in src/ — loading them globally wastes
119
+ tokens in every session that doesn't touch that directory.
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Features
125
+
126
+ | Dimension | What PRISM measures |
127
+ |---|---|
128
+ | **Token Efficiency** | CLAUDE.md re-read costs, cache hit patterns, compaction frequency |
129
+ | **Tool Health** | Retry loops, edit-revert cycles, consecutive failures, interactive command hangs |
130
+ | **Context Hygiene** | Compaction loss events, mid-task boundaries, sidechain fragmentation |
131
+ | **CLAUDE.md Adherence** | Whether your rules are actually being followed — or ignored mid-session |
132
+ | **Session Continuity** | Resume success rate, context loss on restart, truncated session files |
133
+
134
+ ---
135
+
136
+ ## How it works
137
+
138
+ ```
139
+ You use Claude Code normally
140
+
141
+ Claude Code writes session files to ~/.claude/projects/
142
+
143
+ PRISM reads and analyzes those files
144
+
145
+ Health scores + root cause diagnosis + CLAUDE.md diff
146
+ ```
147
+
148
+ PRISM never touches Claude Code. It never modifies your sessions. It reads the JSONL files Claude Code already writes and surfaces what's inside them.
149
+
150
+ ---
151
+
152
+ ## The CLAUDE.md re-read problem
153
+
154
+ Every tool call Claude Code makes re-reads your CLAUDE.md from the top of the context. A 200-line CLAUDE.md × 50 tool calls = 10,000 tokens spent on instructions, per session. If your CLAUDE.md has grown to include personality instructions, full documentation copies, or rules that only apply to one subdirectory — you're paying for all of it every time.
155
+
156
+ PRISM measures this exactly and tells you which lines are costing you the most.
157
+
158
+ The "Mr. Tinkleberry test" (from HN, 748 upvotes): put an absurd instruction in your CLAUDE.md. When Claude stops following it mid-session, your file has grown too long and adherence is degrading. PRISM automates this test across all your real sessions.
159
+
160
+ ---
161
+
162
+ ## Commands
163
+
164
+ ```bash
165
+ prism # Full interactive TUI dashboard
166
+ prism analyze # Rich-formatted health report, then exit
167
+ prism analyze --project ~/myproject # One project only
168
+ prism analyze --json # JSON output for scripting
169
+ prism advise # CLAUDE.md recommendations
170
+ prism advise --apply # Write recommendations (with confirmation)
171
+ prism replay <session-id> # Scrub through a session timeline
172
+ prism watch # Live dashboard for the running session
173
+ prism projects # List all projects with session counts
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Install
179
+
180
+ ```bash
181
+ # pip
182
+ pip install prism-cc
183
+
184
+ # pipx (recommended — isolated install)
185
+ pipx install prism-cc
186
+
187
+ # from source
188
+ git clone https://github.com/jakeefr/prism
189
+ cd prism
190
+ pip install -e .
191
+ ```
192
+
193
+ Requires Python 3.11+. No Claude API key needed — reads local files only. Works on macOS and Linux. Windows support via WSL.
194
+
195
+ ---
196
+
197
+ ## Contributing
198
+
199
+ Issues and PRs welcome. If you run `prism analyze` and find something interesting in your own session data, open an issue — real-world patterns help improve the detection logic.
200
+
201
+ ```bash
202
+ git clone https://github.com/jakeefr/prism
203
+ cd prism
204
+ pip install -e ".[dev]"
205
+ pytest
206
+ ```
207
+
208
+ ---
209
+
210
+ ## License
211
+
212
+ MIT — do whatever you want with it.
213
+
214
+ ---
215
+
216
+ *PRISM doesn't send anything anywhere. All analysis runs locally against files already on your machine.*