kerf-cli 0.1.3 → 0.1.5

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,198 @@
1
+ # kerf-cli Architecture
2
+
3
+ ## Overview
4
+
5
+ kerf-cli is a TypeScript CLI tool that provides cost intelligence for Claude Code. It parses Claude Code's JSONL session logs, calculates token costs, and presents the data through an interactive terminal UI.
6
+
7
+ ## System Diagram
8
+
9
+ ```
10
+ ┌─────────────────────────────────────────────────────────┐
11
+ │ kerf-cli │
12
+ │ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌─────┐ │
13
+ │ │watch │ │esti- │ │budget│ │audit │ │report│ │init │ │
14
+ │ │ │ │mate │ │ │ │ │ │ │ │ │ │
15
+ │ └──┬───┘ └──┬───┘ └──┬───┘ └──┬───┘ └──┬───┘ └──┬──┘ │
16
+ ├─────┼────────┼────────┼────────┼────────┼────────┼────┤
17
+ │ ▼ ▼ ▼ ▼ ▼ ▼ │
18
+ │ ┌─────────────────────────────────────────────────┐ │
19
+ │ │ Core Engine Layer │ │
20
+ │ │ ┌────────┐ ┌──────────┐ ┌───────────────────┐ │ │
21
+ │ │ │ JSONL │ │ Cost │ │ Token │ │ │
22
+ │ │ │ Parser │ │Calculator│ │ Counter │ │ │
23
+ │ │ └────────┘ └──────────┘ └───────────────────┘ │ │
24
+ │ │ ┌────────┐ ┌──────────┐ ┌───────────────────┐ │ │
25
+ │ │ │Estimat-│ │ Budget │ │ Cache │ │ │
26
+ │ │ │ or │ │ Manager │ │ Analyzer │ │ │
27
+ │ │ └────────┘ └──────────┘ └───────────────────┘ │ │
28
+ │ └─────────────────────────────────────────────────┘ │
29
+ ├────────────────────────────────────────────────────────┤
30
+ │ ┌──────────────┐ ┌─────────────┐ ┌──────────────┐ │
31
+ │ │ ~/.claude/ │ │ ~/.kerf/ │ │ .claude/ │ │
32
+ │ │ projects/ │ │ kerf.db │ │ settings.json│ │
33
+ │ │ *.jsonl │ │ (SQLite) │ │ (hooks) │ │
34
+ │ └──────────────┘ └─────────────┘ └──────────────┘ │
35
+ └────────────────────────────────────────────────────────┘
36
+ ```
37
+
38
+ ## Project Structure
39
+
40
+ ```
41
+ kerf-cli/
42
+ ├── src/
43
+ │ ├── cli/ # CLI layer
44
+ │ │ ├── index.ts # Entry point (Commander.js)
45
+ │ │ ├── commands/
46
+ │ │ │ ├── watch.ts # Real-time dashboard
47
+ │ │ │ ├── estimate.ts # Pre-flight cost estimation
48
+ │ │ │ ├── budget.ts # Budget management
49
+ │ │ │ ├── audit.ts # Ghost token audit
50
+ │ │ │ ├── report.ts # Historical reports
51
+ │ │ │ └── init.ts # Setup & hook installation
52
+ │ │ └── ui/
53
+ │ │ ├── Dashboard.tsx # Main Ink dashboard
54
+ │ │ ├── CostMeter.tsx # Token burn rate gauge
55
+ │ │ ├── ContextBar.tsx # Context window fill bar
56
+ │ │ ├── BudgetAlert.tsx # Budget threshold warnings
57
+ │ │ └── EstimateCard.tsx# Pre-flight estimate display
58
+ │ ├── core/ # Business logic
59
+ │ │ ├── parser.ts # JSONL session log parser
60
+ │ │ ├── costCalculator.ts # Per-model pricing engine
61
+ │ │ ├── tokenCounter.ts # Token counting + context overhead
62
+ │ │ ├── estimator.ts # Pre-flight cost estimation
63
+ │ │ ├── budgetManager.ts # SQLite budget CRUD
64
+ │ │ ├── cacheAnalyzer.ts # Cache hit/miss analysis
65
+ │ │ └── config.ts # Constants & configuration
66
+ │ ├── audit/ # Audit modules
67
+ │ │ ├── ghostTokens.ts # Ghost token overhead calculator
68
+ │ │ ├── claudeMdLinter.ts # CLAUDE.md attention curve scorer
69
+ │ │ ├── mcpAnalyzer.ts # MCP server token cost analysis
70
+ │ │ └── recommendations.ts # Actionable optimization suggestions
71
+ │ ├── hooks/ # Claude Code hook system
72
+ │ │ ├── templates/
73
+ │ │ │ ├── notification.sh # Token usage logger
74
+ │ │ │ └── stop.sh # Budget enforcement
75
+ │ │ └── installer.ts # Hook installation logic
76
+ │ ├── db/
77
+ │ │ ├── schema.ts # SQLite schema & init
78
+ │ │ └── migrations.ts # Database migrations
79
+ │ └── types/
80
+ │ ├── jsonl.ts # JSONL log types
81
+ │ ├── pricing.ts # Model pricing types
82
+ │ └── config.ts # Config & audit types
83
+ ├── tests/
84
+ │ ├── parser.test.ts
85
+ │ ├── costCalculator.test.ts
86
+ │ ├── estimator.test.ts
87
+ │ ├── tokenCounter.test.ts
88
+ │ └── fixtures/
89
+ │ ├── sample-session.jsonl
90
+ │ └── sample-claude-md.md
91
+ ├── package.json
92
+ ├── tsconfig.json
93
+ ├── tsup.config.ts
94
+ └── vitest.config.ts
95
+ ```
96
+
97
+ ## Technology Stack
98
+
99
+ | Component | Technology | Why |
100
+ |-----------|-----------|-----|
101
+ | CLI framework | Commander.js | Subcommand routing, option parsing |
102
+ | Terminal UI | Ink 5 (React 18) | Interactive dashboard with live updates |
103
+ | Database | better-sqlite3 | Synchronous access, fast for CLI tools |
104
+ | File watching | chokidar | Cross-platform file change detection |
105
+ | Dates | Day.js | Lightweight, immutable date operations |
106
+ | Colors | chalk | Terminal color output |
107
+ | Bundler | tsup | Fast ESM bundling with shebang support |
108
+ | Testing | vitest | Fast, ESM-native test runner |
109
+
110
+ ## Key Design Decisions
111
+
112
+ ### Token counting: heuristic over API
113
+
114
+ kerf-cli uses `characters / 3.5` as a fast local heuristic instead of calling the Anthropic token counting API. This keeps the tool instant and dependency-free. For actual session costs, it reads the authoritative `total_cost_usd` field from JSONL logs when available.
115
+
116
+ ### Synchronous SQLite
117
+
118
+ `better-sqlite3` is used instead of async alternatives because CLI tools benefit from synchronous access — no event loop overhead, faster startup, simpler code.
119
+
120
+ ### Multiply-then-divide cost calculation
121
+
122
+ To avoid floating point drift in financial calculations:
123
+ ```typescript
124
+ const cost = (tokens * pricePerMillion) / 1_000_000;
125
+ ```
126
+ When `total_cost_usd` is present in the JSONL, it's used as the authoritative source.
127
+
128
+ ### JSONL message deduplication
129
+
130
+ Claude Code streams responses, producing intermediate JSONL entries with partial data (e.g., `output_tokens: 1`). The parser deduplicates by message ID, keeping the **last** occurrence for each ID to get final token counts.
131
+
132
+ ### Context overhead constants
133
+
134
+ ```
135
+ System prompt: 14,328 tokens (fixed)
136
+ Built-in tools: 15,000 tokens (fixed, 24 tools)
137
+ MCP tools: ~600 tokens per tool (variable)
138
+ CLAUDE.md: variable (parsed from file)
139
+ Autocompact buffer: 33,000 tokens (fixed)
140
+ Context window: 200,000 tokens total
141
+ ```
142
+
143
+ ### CLAUDE.md attention curve
144
+
145
+ Claude's attention follows a U-shaped curve across the context. kerf-cli maps each CLAUDE.md section to an attention zone:
146
+ - **0-30%:** High attention (top of file)
147
+ - **30-70%:** Low attention ("dead zone")
148
+ - **70-100%:** High attention (bottom of file)
149
+
150
+ Critical rules (NEVER, ALWAYS, MUST, CRITICAL) in the dead zone are flagged for reordering.
151
+
152
+ ## Data Flow
153
+
154
+ ### Watch command
155
+ ```
156
+ ~/.claude/projects/*.jsonl → parser.ts → costCalculator.ts → Dashboard.tsx
157
+ ↑ chokidar watches ↓ React state updates every 2s
158
+ ```
159
+
160
+ ### Estimate command
161
+ ```
162
+ task description → estimator.ts → complexity detection → turn estimation
163
+
164
+ tokenCounter.ts → context overhead
165
+
166
+ costCalculator.ts → pricing per model
167
+
168
+ EstimateCard.tsx (or JSON output)
169
+ ```
170
+
171
+ ### Audit command
172
+ ```
173
+ CLAUDE.md → claudeMdLinter.ts → section analysis + attention scoring
174
+ .mcp.json → mcpAnalyzer.ts → tool count + token overhead
175
+
176
+ ghostTokens.ts → total overhead + grade
177
+
178
+ recommendations.ts → prioritized actions
179
+ ```
180
+
181
+ ## Model Pricing (as of May 2025)
182
+
183
+ | Model | Input | Output | Cache Read | Cache Creation |
184
+ |-------|-------|--------|------------|----------------|
185
+ | Sonnet 4 | $3/M | $15/M | $0.30/M | $3.75/M |
186
+ | Opus 4 | $15/M | $75/M | $1.50/M | $18.75/M |
187
+ | Haiku 4 | $0.80/M | $4/M | $0.08/M | $1.00/M |
188
+
189
+ ## Key Paths
190
+
191
+ | Path | Purpose |
192
+ |------|---------|
193
+ | `~/.claude/projects/<encoded-path>/<session>.jsonl` | Claude Code session logs |
194
+ | `~/.claude/settings.json` | Global Claude Code settings & hooks |
195
+ | `.claude/settings.json` | Project-level settings & hooks |
196
+ | `.mcp.json` / `~/.claude.json` | MCP server configurations |
197
+ | `~/.kerf/kerf.db` | SQLite database (budgets, usage) |
198
+ | `~/.kerf/session-log.jsonl` | kerf-cli hook event log |
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  ```
13
13
  ┌──────────────────────────────────────────────────────────────┐
14
- │ kerf watch | session: a3f8c2d1... | 47 messages (q=quit)
14
+ │ kerf-cli watch | session: a3f8c2d1... | 47 messages
15
15
  ├──────────────────────────────────────────────────────────────┤
16
16
  │ >> $4.82 / ~$15.00 window | $0.18/min | ~56m remaining │
17
17
  │ [████████████░░░░░░░░░░░░░░░░░░] 38% | 76K / 200K tokens │
@@ -26,68 +26,173 @@
26
26
 
27
27
  ---
28
28
 
29
+ ## Quick Start
30
+
31
+ ```bash
32
+ npx kerf-cli@latest init # Set up hooks & database
33
+ npx kerf-cli@latest watch # Real-time cost dashboard
34
+ npx kerf-cli@latest audit # Find ghost token waste
35
+ ```
36
+
37
+ **Tip:** Add an alias for convenience:
38
+ ```bash
39
+ echo 'alias kerf="npx kerf-cli@latest"' >> ~/.zshrc
40
+ ```
41
+
42
+ ---
43
+
29
44
  ## The Problem
30
45
 
31
46
  > "20x Max plan exhausted in 19 minutes"
32
47
 
33
- You don't know what you're spending until it's gone. Claude Code sessions burn through tokens fast — context overhead, MCP tools, bloated CLAUDE.md files — and there's no way to see it happening in real time.
48
+ Claude Code sessions burn through tokens fast — context overhead, MCP tools, bloated CLAUDE.md files — and there's no way to see it in real time. kerf-cli fixes that with live dashboards, pre-flight estimates, budgets, and ghost token auditing.
34
49
 
35
- **kerf-cli fixes that.**
50
+ ---
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ # No install needed — run directly
56
+ npx kerf-cli@latest --help
57
+
58
+ # Or install globally
59
+ npm install -g kerf-cli
60
+ ```
61
+
62
+ ### First-time setup
63
+
64
+ ```bash
65
+ npx kerf-cli init
66
+ ```
67
+
68
+ Creates `~/.kerf/` directory, initializes the SQLite database, and optionally installs Claude Code hooks for automatic tracking.
36
69
 
37
70
  ---
38
71
 
39
- ## Quick Start
72
+ ## Using With Claude Code
73
+
74
+ ### Live monitoring (most common workflow)
75
+
76
+ Run Claude Code in one tab, kerf-cli in another:
77
+
78
+ ```
79
+ Terminal Tab 1 (Claude Code): Terminal Tab 2 (kerf-cli):
80
+ ┌──────────────────────────┐ ┌──────────────────────────┐
81
+ │ $ claude │ │ $ npx kerf-cli watch │
82
+ │ │ │ │
83
+ │ > Fix the auth bug in │ │ >> $1.20 / ~$8.00 window │
84
+ │ src/auth/login.ts │ │ [████░░░░░░] 18% │
85
+ │ │ │ │
86
+ │ I'll fix the auth bug... │ │ 10:30:02 2.1K $0.08 │
87
+ │ │ │ 10:30:45 3.4K $0.15 │
88
+ └──────────────────────────┘ └──────────────────────────┘
89
+ ```
90
+
91
+ kerf-cli auto-detects the active session. Press `q` to quit, `b` to toggle budget view.
92
+
93
+ ### Before starting work
40
94
 
41
95
  ```bash
42
- npx kerf-cli@latest init # Set up hooks & database
43
- npx kerf-cli@latest watch # Real-time cost dashboard
44
- npx kerf-cli@latest audit # Find ghost token waste
96
+ npx kerf-cli estimate 'refactor the auth module'
97
+ npx kerf-cli budget show
98
+ ```
99
+
100
+ ### End-of-day review
101
+
102
+ ```bash
103
+ npx kerf-cli report
104
+ npx kerf-cli report --sessions
45
105
  ```
46
106
 
47
107
  ---
48
108
 
49
109
  ## Features
50
110
 
51
- ### Real-Time Dashboard — `kerf watch`
111
+ ### Real-Time Dashboard — `kerf-cli watch`
52
112
 
53
- Live cost monitoring while Claude Code runs. See your burn rate, context usage, and projected costs.
113
+ Live cost monitoring with burn rate, context usage, and projected costs. Refreshes every 2 seconds.
54
114
 
55
- ### Pre-Flight Estimation — `kerf estimate <task>`
115
+ ```bash
116
+ npx kerf-cli watch # auto-find active session
117
+ npx kerf-cli watch --session abc123 # specific session
118
+ npx kerf-cli watch --interval 5000 # slower refresh
119
+ ```
120
+
121
+ ### Pre-Flight Estimation — `kerf-cli estimate`
56
122
 
57
- Know the cost before you start.
123
+ Know what a task will cost before you start.
58
124
 
59
125
  ```bash
60
126
  $ npx kerf-cli estimate 'refactor auth module'
61
127
 
62
128
  ╭──────────────────────────────────────────────────────────╮
63
- │ kerf estimate: 'refactor auth module'
129
+ │ kerf-cli estimate: 'refactor auth module'
64
130
  │ │
65
- │ Model: Sonnet 4
131
+ │ Model: sonnet
66
132
  │ Estimated turns: 15-40 (expected: 25) │
67
133
  │ Context overhead: 62.7K tokens (ghost tokens) │
68
134
  │ │
69
135
  │ Estimated Cost: │
70
- │ Low: $2.10
71
- │ Expected: $5.80 │
72
- │ High: $12.40 │
136
+ │ Low: $1.60 Expected: $2.62 High: $4.43
73
137
  │ │
74
- │ -> Using Opus would cost ~$29.00 (5x more) │
138
+ │ -> Using Opus would cost ~$13.11 (5x more) │
75
139
  ╰──────────────────────────────────────────────────────────╯
76
140
  ```
77
141
 
78
- ### Per-Project Budgets `kerf budget`
142
+ Compare all models side by side:
143
+
144
+ ```bash
145
+ $ npx kerf-cli estimate --compare 'add feature'
146
+
147
+ Model Turns Low Expected High
148
+ ----------------------------------------------------------
149
+ sonnet 5-15 $0.67 $1.05 $1.45
150
+ opus 5-15 $3.35 $5.24 $7.26
151
+ haiku 5-15 $0.18 $0.28 $0.39
152
+
153
+ Cheapest: haiku at $0.28
154
+ Priciest: opus at $5.24
155
+ ```
79
156
 
80
- Set spending limits and get warnings before you go over.
157
+ Task complexity is detected from keywords:
158
+
159
+ | Complexity | Keywords | Estimated Turns |
160
+ |-----------|----------|-----------------|
161
+ | Simple | typo, rename, delete | 2-5 |
162
+ | Medium | fix, add, update | 5-15 |
163
+ | Complex | refactor, rewrite, build, implement, migrate | 15-40 |
81
164
 
82
165
  ```bash
83
- npx kerf-cli budget set 50 --period weekly
84
- npx kerf-cli budget show
85
- npx kerf-cli budget list
166
+ npx kerf-cli estimate 'fix bug' --model opus # specific model
167
+ npx kerf-cli estimate 'add auth' --files 'src/auth/*' # with file context
168
+ npx kerf-cli estimate 'fix bug' --json # JSON output
86
169
  ```
87
170
 
88
- ### Ghost Token Audit — `kerf audit`
171
+ ### Per-Project Budgets — `kerf-cli budget`
89
172
 
90
- Find and fix invisible token waste: system prompt overhead, MCP tool bloat, CLAUDE.md dead zones.
173
+ Set spending limits with automatic warnings.
174
+
175
+ ```bash
176
+ npx kerf-cli budget set 50 --period weekly # set budget
177
+ npx kerf-cli budget show # check status
178
+ npx kerf-cli budget list # all projects
179
+ npx kerf-cli budget remove # remove budget
180
+ ```
181
+
182
+ ```
183
+ kerf-cli budget
184
+
185
+ Period: weekly (2026-03-31 to 2026-04-06)
186
+ Budget: $50.00
187
+ Spent: $42.30
188
+ [████████████████░░░░] 84.6%
189
+ ```
190
+
191
+ With hooks installed, you get warnings at 80% and alerts at 100%.
192
+
193
+ ### Ghost Token Audit — `kerf-cli audit`
194
+
195
+ Find invisible token waste eating your context window.
91
196
 
92
197
  ```bash
93
198
  $ npx kerf-cli audit
@@ -106,17 +211,81 @@ $ npx kerf-cli audit
106
211
  2. [MED] Disable unused 'playwright' MCP server
107
212
  ```
108
213
 
109
- ### Historical Reports `kerf report`
214
+ **Grades:** A (>70% usable) | B (50-70%) | C (30-50%) | D (<30%)
215
+
216
+ **Ghost tokens** are context consumed before your conversation starts: system prompt, built-in tools, MCP tools (~600 tokens each), CLAUDE.md, and autocompact buffer.
110
217
 
111
- Track spending over time with per-model and per-session breakdowns.
218
+ **CLAUDE.md attention curve:** Claude's attention is U-shaped. Rules at 0-30% and 70-100% get high attention. The 30-70% middle is a "dead zone." kerf-cli flags critical rules (NEVER, ALWAYS, MUST) stuck there.
112
219
 
113
220
  ```bash
114
- npx kerf-cli report # Today's costs
115
- npx kerf-cli report --period week # Weekly summary
116
- npx kerf-cli report --csv # Export for spreadsheets
117
- npx kerf-cli report --sessions # Per-session breakdown
221
+ npx kerf-cli audit --claude-md-only # per-section breakdown with attention zones
222
+ npx kerf-cli audit --mcp-only # MCP server analysis
223
+ npx kerf-cli audit --json # machine-readable output
118
224
  ```
119
225
 
226
+ ### Historical Reports — `kerf-cli report`
227
+
228
+ Track spending over time with hourly charts and model breakdowns.
229
+
230
+ ```bash
231
+ $ npx kerf-cli report
232
+
233
+ kerf-cli report -- Sat, Apr 4, 2026
234
+
235
+ Total Cost: $12.77
236
+ Total Tokens: 906 in / 84.1K out
237
+ Cache Hit Rate: 100.0%
238
+ Sessions: 3
239
+
240
+ Hourly:
241
+ Apr 4, 2 AM █████░░░░░░░ $2.27
242
+ Apr 4, 1 PM █░░░░░░░░░░░ $0.50
243
+ Apr 4, 2 PM ████░░░░░░░░ $1.75
244
+ Apr 4, 6 PM ████████████ $5.64
245
+ ```
246
+
247
+ ```bash
248
+ npx kerf-cli report --period week # weekly
249
+ npx kerf-cli report --period month # monthly
250
+ npx kerf-cli report --sessions --model # per-session + per-model breakdown
251
+ npx kerf-cli report --csv > costs.csv # export CSV
252
+ npx kerf-cli report --json # export JSON
253
+ ```
254
+
255
+ ### Hooks — Automatic Tracking
256
+
257
+ Claude Code hooks run automatically during sessions:
258
+
259
+ - **Notification hook:** Logs token usage to `~/.kerf/session-log.jsonl`
260
+ - **Stop hook:** Checks budget and warns at 80%, alerts at 100%
261
+
262
+ ```bash
263
+ npx kerf-cli init # install hooks for current project
264
+ npx kerf-cli init --global # install globally
265
+ npx kerf-cli init --no-hooks # database only, skip hooks
266
+ ```
267
+
268
+ ---
269
+
270
+ ## All Commands
271
+
272
+ | Command | Description |
273
+ |---------|-------------|
274
+ | `npx kerf-cli watch` | Real-time cost dashboard (default) |
275
+ | `npx kerf-cli estimate <task>` | Pre-flight cost estimation |
276
+ | `npx kerf-cli estimate --compare <task>` | Compare Sonnet vs Opus vs Haiku |
277
+ | `npx kerf-cli budget set <amt> --period weekly` | Set project budget |
278
+ | `npx kerf-cli budget show` | Check budget status |
279
+ | `npx kerf-cli budget list` | List all project budgets |
280
+ | `npx kerf-cli budget remove` | Remove budget |
281
+ | `npx kerf-cli audit` | Ghost token & CLAUDE.md audit |
282
+ | `npx kerf-cli audit --claude-md-only` | CLAUDE.md section analysis |
283
+ | `npx kerf-cli audit --mcp-only` | MCP server analysis |
284
+ | `npx kerf-cli report` | Today's cost report |
285
+ | `npx kerf-cli report --period week` | Weekly report |
286
+ | `npx kerf-cli report --csv` | Export as CSV |
287
+ | `npx kerf-cli init` | First-time setup |
288
+
120
289
  ---
121
290
 
122
291
  ## Why kerf-cli?
@@ -133,40 +302,65 @@ npx kerf-cli report --sessions # Per-session breakdown
133
302
 
134
303
  **RTK compresses. ccusage tracks. kerf predicts.**
135
304
 
305
+ Works alongside RTK, ccusage, and ECC.
306
+
136
307
  ---
137
308
 
138
- ## Works With
309
+ ## Tips
139
310
 
140
- - **RTK** complementary (kerf-cli shows savings from RTK compression)
141
- - **ccusage** — compatible (kerf-cli can import historical data)
142
- - **ECC** — compatible hooks
311
+ - **Use Sonnet for implementation, Opus for planning** check with `estimate --compare`
312
+ - **Keep CLAUDE.md under 200 lines** — audit with `audit --claude-md-only`
313
+ - **Disable unused MCP servers** — each tool costs ~600 tokens
314
+ - **Monitor cache hit rate** — high rates (>80%) mean efficient context reuse
315
+ - **Set weekly budgets** — enough flexibility without runaway costs
143
316
 
144
317
  ---
145
318
 
146
- ## All Commands
319
+ ## Troubleshooting
147
320
 
148
- | Command | Description |
149
- |---------|-------------|
150
- | `npx kerf-cli` / `npx kerf-cli watch` | Real-time cost dashboard (default) |
151
- | `npx kerf-cli estimate <task>` | Pre-flight cost estimation |
152
- | `npx kerf-cli budget set <amt>` | Set project budget |
153
- | `npx kerf-cli budget show` | Show current budget status |
154
- | `npx kerf-cli budget list` | List all project budgets |
155
- | `npx kerf-cli audit` | Ghost token & CLAUDE.md audit |
156
- | `npx kerf-cli audit --fix` | Auto-apply safe optimizations |
157
- | `npx kerf-cli report` | Historical cost reports |
158
- | `npx kerf-cli init` | Set up kerf (hooks, database) |
321
+ | Problem | Solution |
322
+ |---------|----------|
323
+ | "No active session found" | Ensure Claude Code is running and has sent a message |
324
+ | Dashboard shows no data | Send a message in Claude Code, wait for response |
325
+ | Costs seem wrong | kerf-cli uses `total_cost_usd` from logs when available; estimates use heuristic |
326
+ | Command not found | Use `npx kerf-cli@latest` or `npm install -g kerf-cli` |
327
+ | Database errors | `rm ~/.kerf/kerf.db && npx kerf-cli init` |
328
+ | Watch crashes | Must run in an interactive terminal, not piped |
159
329
 
160
- **Tip:** Add an alias for convenience:
161
- ```bash
162
- echo 'alias kerf="npx kerf-cli"' >> ~/.zshrc
163
- ```
330
+ ---
331
+
332
+ ## Changelog
333
+
334
+ ### v0.1.4 (2026-04-04)
335
+ - Fix: `--version` now reads dynamically from package.json
336
+ - Fix: `--compare` shows proper side-by-side table for all 3 models
337
+ - Fix: `watch` gracefully exits in non-TTY environments
338
+ - Fix: CLAUDE.md detection searches git root and `~/.claude/`
339
+ - Fix: `--claude-md-only` shows per-section breakdown with attention zones
340
+ - Fix: Hourly report dates no longer show "Invalid Date"
341
+
342
+ ### v0.1.3 (2026-04-04)
343
+ - Fix: CLAUDE.md found via git root, not just cwd
344
+ - Fix: Audit filtering for `--claude-md-only` and `--mcp-only`
345
+ - Fix: Hourly report date parsing
346
+
347
+ ### v0.1.1 (2026-04-04)
348
+ - Fix: ContextBar crash when token usage exceeds 100%
349
+
350
+ ### v0.1.0 (2026-04-04)
351
+ - Initial release: watch, estimate, budget, audit, report, init
352
+
353
+ ---
354
+
355
+ ## Architecture
356
+
357
+ See [ARCHITECTURE.md](ARCHITECTURE.md) for project structure, design decisions, data flow, and technology choices.
164
358
 
165
359
  ---
166
360
 
167
361
  ## Contributing
168
362
 
169
- Contributions welcome! Please open an issue first to discuss what you'd like to change.
363
+ Contributions welcome! Please open an issue first.
170
364
 
171
365
  ```bash
172
366
  git clone https://github.com/dhanushkumarsivaji/kerf-cli.git