Skip to content

whittle watch: live unified feed of routing + compression - #11

Merged
anshal21 merged 1 commit into
mainfrom
polish
Jul 10, 2026
Merged

whittle watch: live unified feed of routing + compression#11
anshal21 merged 1 commit into
mainfrom
polish

Conversation

@anshal21

Copy link
Copy Markdown
Contributor

Implements the whittle watch subcommand: one live terminal feed merging both event streams — the router's per-request verdicts (/.whittle/logs/router.log) and the compression hook's per-carve records (/.whittle/stats.jsonl) — rendered as chips in the house visual vocabulary (▸ verdicts colored by served tier, 🪓 carves with token deltas, non-200s in red, signals inline).

Poll-based dual-file follower, stdlib only: waits for files that don't exist yet, buffers partial lines, recovers from rotation/truncation. -n backlog merged across both files by timestamp, -plain/NO_COLOR support. Tests cover renderers (route, no-op, startup passthrough, non-200, carve, retrieve, junk), the follower's edge cases, backlog merge order, and number formatting.

Verified live against real files: session carves and a mid-watch routing verdict rendered together.

This also makes the retired hero-GIF concept honest: whittle watch now actually exists, so a future demo can type a real command.

🤖 Generated with Claude Code

The two surfaces write two event streams (logs/router.log verdicts,
stats.jsonl carve records); until now the only live view was raw tail. whittle
watch merges both into one feed with the same visual vocabulary as whittle
stats: ▸ verdicts colored by served tier family with the reason, family move
(opus→haiku / kept), ctx tokens, latency, non-200 statuses, and the full
signals trace; 🪓 carves with tool, in→out tokens, percent, strategy; startup
lines pass through dim; MCP retrievals render as their own event.

Implementation is stdlib-only: a poll-based follower per file (300ms) that
tolerates missing files (waits for creation), buffers partial lines, and
recovers from rotation by size regression; -n backlog is merged across files by
timestamp before following; -plain and NO_COLOR disable ANSI. Watch reads the
background service's log; foreground `whittle route` prints to the terminal
directly (documented).

Docs: README router bullet, ROUTER.md §8, and POLICY.md's authoring loop now
reference watch. Tests pin all renderers, follower edge cases, backlog order.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@anshal21
anshal21 merged commit 2850e87 into main Jul 10, 2026
1 check passed
@anshal21
anshal21 deleted the polish branch July 10, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant