You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: remove dead code, deprecated v1 schema, and fix stale docs (#6)
* refactor: remove dead code, deprecated v1 schema, and fix stale docs
Remove 4 dead functions from legacy character-based parser (jsonl.py),
dead get_all_widgets(), 8 dead dataclass fields across TokenMetrics/
ContextWindow/RenderContext, deprecated StatusLineConfig v1 schema class,
and 2 dead constants. Simplify vestigial UUID guard in debug.py. Fix
extensive README/AGENTS.md documentation rot: remove nonexistent
subscription widget, calibration tool section, v1 config examples, and
stale field/worker claims. Consolidate script/ into scripts/.
* fix: address review feedback on dead code cleanup
Fix benchmark.sh self-references after script→scripts rename.
Strengthen test assertions for image token counting and compact
boundary behavior.
* fix: add PSR build_command to sync lockfile on release
Copy file name to clipboardExpand all lines: AGENTS.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,9 +90,9 @@ tests/
90
90
91
91
**Widget System**: All widgets extend `Widget` base class with `render(context: RenderContext) -> Optional[str]`. Register with `@register_widget(display_name, default_color, description, fallback_text)`.
92
92
93
-
**RenderContext**: Dataclass passed to all widgets containing `data`, `token_metrics`, `git_status`, `session_metrics`, `subscription_info`, `context_window`.
93
+
**RenderContext**: Dataclass passed to all widgets containing `data`, `token_metrics`, `git_status`, `duration_seconds`, `terminal_width`, `context_window`.
94
94
95
-
**Parallel I/O**: `statusline.py` uses `ThreadPoolExecutor(max_workers=3)` for transcript parsing, subscription loading, and model prefetch.
95
+
**Parallel I/O**: `statusline.py` uses `ThreadPoolExecutor(max_workers=2)` for transcript parsing and model prefetch.
96
96
97
97
**Config Caching**: `config/loader.py` caches config files by mtime to avoid re-reading unchanged files.
98
98
@@ -141,7 +141,7 @@ Fixtures in `tests/conftest.py`: `mock_stdin`, `sample_input_payload`, `basic_se
If no config file exists, one is automatically created with all widgets enabled. Delete `~/.config/claude-statusline/config.yaml` to regenerate defaults.
165
-
166
-
**Stale Config Warning:**
167
-
When new widgets are added, the script warns you:
168
-
```
169
-
Warning: Config is missing widgets from defaults: session-clock.
170
-
Delete ~/.config/claude-statusline/config.yaml to regenerate with new defaults.
171
-
```
158
+
**Default Config:**
159
+
If no config file exists, all default widgets are shown with built-in defaults. Create `~/.config/claude-statusline/config.yaml` to customize colors, ordering, or disable specific widgets.
172
160
173
161
## Features
174
162
@@ -177,11 +165,9 @@ Delete ~/.config/claude-statusline/config.yaml to regenerate with new defaults.
177
165
- **Built-in Widgets**: 14 widgets including model, directory, git status, context, cost, session info
178
166
- **Flexible Styling**: Per-widget color customization and bold formatting
179
167
- **Automatic Fallback**: Missing config uses sensible defaults with all widgets enabled
180
-
- **Stale Config Detection**: Warns when config is missing newly-added widgets
181
168
182
169
**Available Widgets:**
183
170
- `model`- Claude model name (e.g., "Sonnet 4.5")
184
-
- `subscription`- Subscription type (Pro/Max) or API usage indicator
185
171
- `directory`- Current working directory
186
172
- `git-branch`- Active git branch name
187
173
- `git-changes`- Staged/unstaged changes count
@@ -207,7 +193,6 @@ Delete ~/.config/claude-statusline/config.yaml to regenerate with new defaults.
207
193
- **Priority-Based Sources**: Prefers `context_window` payload data → transcript parsing → model lookups
208
194
- **Session Metrics**: Continues parsing transcripts for session duration and compact boundary detection
209
195
- **Backwards Compatible**: Gracefully handles missing or null `context_window` data from older Claude Code versions
210
-
- **Calibration Tool**: Includes `calibrate_token_counting.py` to validate and improve accuracy
211
196
212
197
### Token Calculation
213
198
@@ -343,60 +328,6 @@ Debug logs are written to **per-session files** in the `logs/` directory:
343
328
344
329
---
345
330
346
-
## Token Counting Calibration Tool
347
-
348
-
The project includes `claude-calibrate`, a command-line tool to verify and improve token counting accuracy against Claude's official measurements.
349
-
350
-
### Purpose
351
-
- Compare script calculations against Claude's official `/context` command output
352
-
- Identify discrepancies and suggest calibration factors
353
-
- Validate token counting accuracy when new Claude Code versions are released
354
-
355
-
### Usage
356
-
357
-
#### Semi-Automated Mode (Default)
358
-
```bash
359
-
uv run --no-config claude-calibrate session1.jsonl session2.jsonl --verbose
360
-
```
361
-
The tool provides precise instructions for resuming each session and prompts you to enter the official token counts.
362
-
363
-
#### Manual Override Mode
364
-
```bash
365
-
uv run --no-config claude-calibrate session1.jsonl session2.jsonl \
366
-
--known-tokens 17.5k 68k --verbose
367
-
```
368
-
Provide known token counts to skip automatic session resumption (useful for sessions that can't be resumed).
369
-
370
-
#### Auto-Discovery Mode
371
-
```bash
372
-
uv run --no-config claude-calibrate --max-sessions 3 --verbose
373
-
```
374
-
Automatically finds recent session files from all Claude Code project directories and provides instructions for manual calibration.
375
-
376
-
### Example Calibration Report
377
-
```
378
-
📊 Successfully calibrated 2 session(s)
379
-
380
-
INDIVIDUAL RESULTS:
381
-
❌ session1.jsonl: Script 46,520 vs Claude 68,000 tokens (+31.6% difference)
382
-
✅ session2.jsonl: Script 17,470 vs Claude 17,500 tokens (+0.2% difference)
383
-
384
-
SUMMARY:
385
-
Average discrepancy: +15.9% | Suggested calibration factor: 1.231
386
-
⚠️ Token counting has moderate accuracy - consider adjusting CHARS_PER_TOKEN ratio
387
-
```
388
-
389
-
### Features
390
-
-**Auto-discovery**: Finds recent sessions from all Claude Code project directories
391
-
-**Semi-automated**: Provides precise resumption instructions for manual token collection
0 commit comments