claude-master-toolkit 0.1.1
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.
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/dist/cli.js +677 -0
- package/dist/public/assets/index-aH43pgAv.css +1 -0
- package/dist/public/assets/index-lE5fsDTh.js +136 -0
- package/dist/public/index.html +14 -0
- package/dist/server.js +1174 -0
- package/package.json +96 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Oliver Calderon
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# workctl
|
|
2
|
+
|
|
3
|
+
**Token-efficient CLI + metrics dashboard for [Claude Code](https://claude.ai/code).**
|
|
4
|
+
|
|
5
|
+
See what your sessions actually cost. Cut context bloat before it bites. Query your history in a real dashboard instead of squinting at `/cost`.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g workctl
|
|
9
|
+
workctl dashboard
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Opens a local dashboard at `http://localhost:3200` backed by SQLite. Reads your Claude Code session JSONL files directly — no API keys, no telemetry, no accounts.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Why
|
|
17
|
+
|
|
18
|
+
Claude Code stores every session as JSONL under `~/.claude/projects/`. That's the source of truth for real token usage and cost — but there's no good way to see it. `workctl` parses those files into SQLite and gives you:
|
|
19
|
+
|
|
20
|
+
- **Realized cost** per session, per project, per day — using the actual Claude 4.6 / 4.5 pricing table.
|
|
21
|
+
- **Context window telemetry** — know when you're about to hit the 200k wall before the warning.
|
|
22
|
+
- **Token-saving primitives** for the Bash tool — `slice`, `find`, `git-log`, `test-summary` — return compact output instead of full files.
|
|
23
|
+
- **A dashboard** (React + Recharts) that lives on your machine. Nothing leaves it.
|
|
24
|
+
|
|
25
|
+
Think of it as the missing `/cost` page for Claude Code.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g workctl
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Requires Node 18+. The database auto-initializes on first run at `~/.claude/state/claude-master-toolkit/ctk.sqlite`.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Dashboard
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
workctl dashboard # http://localhost:3200
|
|
41
|
+
workctl dashboard -p 4000 # custom port
|
|
42
|
+
workctl dashboard --no-open # don't auto-open browser
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The server watches `~/.claude/projects/` and syncs new session events in real time.
|
|
46
|
+
|
|
47
|
+
### CLI primitives
|
|
48
|
+
|
|
49
|
+
All commands are designed to return **compact, Claude-friendly output** — ideal for the `Bash` tool in agent loops.
|
|
50
|
+
|
|
51
|
+
| Command | What it does |
|
|
52
|
+
|---|---|
|
|
53
|
+
| `workctl cost [--quiet]` | Realized cost of the current session (reads session JSONL, applies pricing) |
|
|
54
|
+
| `workctl context` | Current window usage, cumulative totals, cost, threshold advice |
|
|
55
|
+
| `workctl tokens [file]` | Rough token count for a file or stdin (`chars / 4`) |
|
|
56
|
+
| `workctl estimate <file>` | Faithful pre-flight count via Anthropic `count_tokens` API |
|
|
57
|
+
| `workctl slice <file> <symbol>` | Extract just one function / class / type from a file |
|
|
58
|
+
| `workctl find <query> [path]` | Ranked ripgrep, top 20 results |
|
|
59
|
+
| `workctl git-log [N]` | One-line log for last N commits |
|
|
60
|
+
| `workctl git-changed` | Files changed vs main branch with line counts |
|
|
61
|
+
| `workctl test-summary [cmd]` | Run a test command, print only pass/fail summary |
|
|
62
|
+
| `workctl model <phase>` | Model alias recommendation per SDD phase |
|
|
63
|
+
| `workctl dashboard` | Launch the local metrics dashboard |
|
|
64
|
+
|
|
65
|
+
Every command supports `--json` for machine-readable output.
|
|
66
|
+
|
|
67
|
+
> **`ctk` alias.** The binary is also installed as `ctk` for backwards compatibility. Use whichever you prefer.
|
|
68
|
+
|
|
69
|
+
## Cost accuracy
|
|
70
|
+
|
|
71
|
+
Three fidelity sources, picked per use case:
|
|
72
|
+
|
|
73
|
+
| Source | Fidelity | Used by |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| Session JSONL (`~/.claude/projects/*/*.jsonl`) | **100%** — real API-charged counts | `cost`, `context`, dashboard |
|
|
76
|
+
| Anthropic `count_tokens` API | **100%** — official endpoint | `estimate` (needs `ANTHROPIC_API_KEY`) |
|
|
77
|
+
| `chars / 4` | rough | `tokens`, fallback for `estimate` |
|
|
78
|
+
|
|
79
|
+
Pricing table is hard-coded in `src/shared/pricing.ts` for the Claude 4.6 / 4.5 family. Update there when Anthropic changes prices.
|
|
80
|
+
|
|
81
|
+
## Context window vs cumulative cost
|
|
82
|
+
|
|
83
|
+
These are **different metrics** and `workctl` reports both:
|
|
84
|
+
|
|
85
|
+
- **Context window** = what Claude sees right now. Equals the last turn's `input + cache_read + output`. Not a running sum — summing double-counts cache reads.
|
|
86
|
+
- **Cumulative cost** = every turn's tokens weighted by per-model prices. This is what `/cost` shows.
|
|
87
|
+
|
|
88
|
+
Use the window metric to decide when to `/compact` (70 / 85 / 95 % of 200k). Use cumulative to measure spend.
|
|
89
|
+
|
|
90
|
+
## Privacy
|
|
91
|
+
|
|
92
|
+
- No network calls except the optional `count_tokens` pre-flight endpoint.
|
|
93
|
+
- No telemetry.
|
|
94
|
+
- Database lives under `~/.claude/state/` on your machine.
|
|
95
|
+
- Override with `CTK_DB_PATH=/custom/path.sqlite`.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT — see [LICENSE](./LICENSE).
|