chisle 3.6.1 → 3.8.0

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/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  <p align="center">
16
16
  <a href="https://www.npmjs.com/package/chisle"><img src="https://img.shields.io/npm/v/chisle?style=flat-square&color=d78a3c" alt="npm version"></a>
17
- <img src="https://img.shields.io/badge/works%20with-11%20agents-d78a3c?style=flat-square" alt="Works with 11 agents">
17
+ <img src="https://img.shields.io/badge/works%20with-13%20agents-d78a3c?style=flat-square" alt="Works with 13 agents">
18
18
  <a href="https://github.com/JayPokale/Chisle/actions/workflows/test.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayPokale/Chisle/test.yml?style=flat-square&label=CI" alt="CI"></a>
19
19
  <img src="https://img.shields.io/badge/deps-0-2da44e?style=flat-square" alt="Zero deps">
20
20
  <img src="https://img.shields.io/badge/license-MIT-d78a3c?style=flat-square" alt="MIT">
@@ -22,58 +22,73 @@
22
22
  </p>
23
23
 
24
24
  <p align="center">
25
- <strong>83% of a bare model's output, where caveman and ponytail land above 100% &middot; 11 agents &middot; zero dependencies &middot; one command</strong>
25
+ <strong>Built for Claude Code: answers about half as long, shorter than caveman and ponytail &middot; 13 agents &middot; zero dependencies &middot; one command</strong>
26
26
  </p>
27
27
 
28
+ Chisle is a Claude Code plugin that makes Claude cheaper to run without making it dumber. It cuts what Claude writes: no filler, no hedging, no speculative abstractions, just the smallest code that works. It also cuts what Claude reads: a `PostToolUse` hook trims oversized tool output by ~46% before it re-enters the context window, where it would be re-billed on every later request. In agent-loop tests Claude with Chisle passes the same tasks as Claude without it. One `npx chisle` installs it, and the same ruleset ships to Pi, Cursor, Codex, Gemini, Copilot, OpenCode, Antigravity and four more agents. Every number here comes from committed raw transcripts, including the runs where it lost.
29
+
28
30
  <p align="center">
29
- <a href="https://chisle.jaypokale.me"><strong>chisle.jaypokale.me</strong></a> is the site version of this README, with fewer words
31
+ <img src="assets/benchmark-pi.svg" width="820" alt="Pi benchmark, 6 tasks on GPT-5.5, answer length as percent of the same model with no ruleset. caveman 56%, ponytail 49%, Chisle 37%.">
30
32
  </p>
31
33
 
34
+ <p align="center"><sub>Pi 0.85.1 + GPT-5.5, 6 tasks: answer length vs the same model with no ruleset. Lower is leaner. <a href="#benchmarks">More below.</a></sub></p>
35
+
32
36
  ---
33
37
 
34
- "Add debounce to a search input that currently fires an API call on every keystroke." Same model, same prompt, one difference: the injected ruleset. Both answers below are the **verbatim committed output** from [`benchmarks/results/raw/`](benchmarks/results/raw/):
38
+ "Implement an order state machine covering created, paid, shipped, delivered, cancelled and refunded, with the legal transitions enforced and invalid ones rejected." Same model, same prompt, one difference: the injected ruleset. Both answers are the **verbatim committed output** from [`raw-oct-notools/large-s2`](benchmarks/results/raw-oct-notools/large-s2/):
35
39
 
36
40
  <table>
37
- <tr><th align="left" width="50%">bare agent: 142 lines, 1506 tokens</th><th align="left" width="50%">Chisle: 35 lines, 602 tokens</th></tr>
41
+ <tr><th align="left" width="50%">bare model: 125 lines, 1,342 answer tokens</th><th align="left" width="50%">Chisle: 54 lines, 450 answer tokens</th></tr>
38
42
  <tr valign="top"><td>
39
43
 
40
- Opens with *"Let me show you the most common approaches"*, then ships a reusable generic `useDebounce<T>` hook in its own file…
41
-
42
- ```typescript
43
- // useDebounce.ts
44
- export function useDebounce<T>(
45
- value: T, delay: number
46
- ): T {
47
- const [debouncedValue, setDebouncedValue]
48
- = useState<T>(value);
49
- useEffect(() => { /* … */ }, [value, delay]);
50
- return debouncedValue;
51
- }
44
+ An `Enum` of states, a custom exception class, type hints and docstrings on every method, a file write, then a test harness:
45
+
46
+ ```python
47
+ class OrderState(Enum):
48
+ CREATED = "created"
49
+ PAID = "paid"
50
+ # … four more
51
+
52
+ class InvalidTransition(Exception):
53
+ """Raised when attempting an invalid state transition."""
54
+ pass
55
+
56
+ class Order:
57
+ VALID_TRANSITIONS = { … }
58
+ def transition_to(self, next_state: OrderState) -> None:
59
+ """Transition to next state if valid, …"""
52
60
  ```
53
61
 
54
- …then **Option 2** and **Option 3**, a comparison table, and a caveats section.
62
+ …plus usage, tests and a summary.
55
63
 
56
64
  </td><td>
57
65
 
58
- Asks which framework, then answers the question that was actually asked: `setTimeout` in the effect you already have, no new file, no generic:
59
-
60
- ```jsx
61
- useEffect(() => {
62
- const timer = setTimeout(async () => {
63
- if (query.trim()) { /* fetch */ }
64
- }, 300);
65
- return () => clearTimeout(timer);
66
- }, [query]);
66
+ One dict of legal transitions, one method that enforces it:
67
+
68
+ ```python
69
+ class OrderStateMachine:
70
+ TRANSITIONS = {
71
+ 'created': {'paid', 'cancelled'},
72
+ 'paid': {'shipped', 'refunded'},
73
+ 'shipped': {'delivered', 'cancelled'},
74
+ 'delivered': {'refunded'},
75
+ 'cancelled': set(),
76
+ 'refunded': set(),
77
+ }
78
+ def transition(self, new_state):
79
+ if new_state not in self.TRANSITIONS[self.state]:
80
+ raise ValueError(f"Invalid transition: …")
81
+ self.state = new_state
67
82
  ```
68
83
 
69
- Then two lines on why it works, and *"use `lodash.debounce` if already installed."*
84
+ Then a short usage block and one line on how it works.
70
85
 
71
86
  </td></tr>
72
87
  </table>
73
88
 
74
- Not golfed, **boring**. Same behaviour, one less abstraction, no second file, and it names the dependency you might already have instead of reinventing it.
89
+ Same behaviour, a third of the tokens. caveman wrote 1,140 and ponytail 842 on the same prompt.
75
90
 
76
- Most efficiency tools compress one thing. Chisle compresses **three**:
91
+ ## What it compresses
77
92
 
78
93
  | axis | what | how |
79
94
  |---|---|---|
@@ -112,17 +127,11 @@ flowchart LR
112
127
 
113
128
  The loop on the right is the input axis: tool output is billed again on *every* later request in the session, so shrinking it once pays repeatedly. `Read`, `Edit`, and `Write` are deliberately outside it.
114
129
 
115
- <p align="center">
116
- <img src="assets/thumbnail.png" width="820" alt="Chisle: less tokens, same results. Four parts: output compressor (compress noisy tool outputs), context diet (read only what's actually relevant), terse persona (short, focused, YAGNI-first), YAGNI ladder (do less, reuse more, build only when needed).">
117
- </p>
118
-
119
- Every "be concise" tool has a worst day, the day it makes the model write *more* than no tool at all. Across 20 measured tasks over two suites, the specialists had that day **6** and **8** times, blowing up to **424%** of the baseline. Chisle had it **once**, capped at 173%, and that one failure was root-caused, fixed in the ruleset, and re-validated live at 93%, with the whole investigation [committed to the repo](benchmarks/results/2026-07-07-verify-rerun.md). Think of it as downside insurance for your token bill: not always the single cheapest answer, always the smallest worst case, from the only tool in this class that publishes its own failures. [Why not caveman or ponytail? →](docs/comparison.md)
120
-
121
130
  ---
122
131
 
123
132
  ## Install
124
133
 
125
- One command. Auto-detects your agents (Claude Code, Pi, Cursor, Windsurf, Cline, Kiro, Codex, Gemini, Copilot, OpenCode, Hermes) and wires each one. `--uninstall` puts everything back.
134
+ One command. Auto-detects your agents (Claude Code, Pi, Cursor, Windsurf, Cline, Kiro, Antigravity, Codex, Gemini, Copilot, Copilot CLI, OpenCode, Hermes) and wires each one. `--uninstall` puts everything back. `npx chisle mcp wrap` extends tool-output compression to MCP servers in any agent ([details](INSTALL.md#mcp-output-compression-any-agent)).
126
135
 
127
136
  ```bash
128
137
  npx chisle
@@ -140,280 +149,32 @@ irm https://raw.githubusercontent.com/JayPokale/Chisle/main/install.ps1 | iex
140
149
 
141
150
  Preview first with `npx chisle --dry-run`, scope with `--only claude` or `--only pi`, see everything with `npx chisle --help`. Remove with `npx chisle --uninstall`.
142
151
 
143
- **Requirements:** Node ≥18 (installer / `npx`) · Claude Code or Pi for `/chisle` toggling and input-side compression. The always-on ruleset still ships to every other agent.
144
-
145
- ### Upgrading
146
-
147
- ```bash
148
- npx chisle@latest --update
149
- ```
150
-
151
- That refreshes every agent that already has Chisle and installs it into none that don't. Two details it exists to handle:
152
-
153
- - **Plain `npx chisle` does not upgrade.** Every install path skips what is already present, so an upgrade run reports success and changes nothing. `--update` pairs the refresh with that check.
154
- - **`@latest` matters.** `npx chisle` can serve a cached copy of the package from a previous run, so the pin is what guarantees you get the new one.
155
-
156
- Update one agent at a time with `--only`:
157
-
158
- ```bash
159
- npx chisle@latest --update --only claude # or: claude plugin update chisle@chisle
160
- npx chisle@latest --update --only pi # or: pi install npm:chisle
161
- npx chisle@latest --update --only gemini # or: gemini extensions install https://github.com/JayPokale/Chisle
162
- npx chisle@latest --update --only codex
163
- npx chisle@latest --update --only opencode # ruleset + skills + the compression plugin
164
- npx chisle@latest --update --only hermes
165
- ```
166
-
167
- Cursor, Windsurf, Cline, Kiro and Copilot keep their rule file **inside the repo**, because that is how those agents load rules:
168
-
169
- ```bash
170
- cd ~/code/my-project
171
- npx chisle@latest --update --only cursor
172
- ```
173
-
174
- `--update` looks for that file in the current directory, so running it from `~` reports "Nothing to update" even when the project is set up correctly. Run it once per repo that has one. Full table, including what each agent's update actually refreshes: [INSTALL.md](./INSTALL.md#per-agent).
175
-
176
- Not sure what you are running? `npx chisle --list` prints the agents it detects, and `claude plugin list` shows the installed plugin and its version.
177
-
178
- Chisle checks npm on session start and mentions it once when a **major** version is out (cached 3 days, `CHISLE_UPDATE_CHECK=0` to silence). Minor and patch releases stay quiet on purpose.
179
-
180
- Upgrading to 3.0.0 from 2.x needs nothing: a `lite`/`full`/`ultra` value in `CHISLE_DEFAULT_MODE` or `config.json` is no longer meaningful, falls through to the default, and Chisle stays active. It says so once so the setting is not ignored silently. Replace it with `on`/`off` or delete it.
181
-
182
- ### Claude Code plugin (marketplace)
183
-
184
- ```bash
185
- claude plugin marketplace add JayPokale/Chisle # register the marketplace
186
- claude plugin install chisle@chisle # enable the plugin
187
- ```
188
-
189
- ### Pi package
190
-
191
- ```bash
192
- pi install npm:chisle
193
- ```
194
-
195
- The package loads the zero-dependency extension and `chisle` skill globally. Pi extensions run with your user permissions; review the source before installation. Project-local installs (`pi install -l npm:chisle`) load only after you trust that project.
196
-
197
- ### Where the savings show up
198
-
199
- Two places, both measured rather than estimated:
200
-
201
- ```bash
202
- npx chisle --stats # what the compressor has saved, cumulative
203
- ```
204
-
205
- ```text
206
- chisle: tool-output savings
207
-
208
- saved: 88,967 chars (~22,241 tokens)
209
- outputs: 18 compressed, 4,943 chars each on average
210
- ```
211
-
212
- In Claude Code the statusline badge carries the same number live: `[CHISLE] ⇣22k tok`. Pi shows it in the footer for the current session.
213
-
214
- This is the **input axis only**, and deliberately so. Chars elided have a real baseline, since the hook knows exactly what it cut. The output axis has none: there is no way to know what the model would have written without the ruleset, which is why that half is measured with A/B benchmark arms instead of a counter. A number that blended the two would be inventing the interesting half.
215
-
216
- ### See what it would do, before it does it
217
-
218
- ```bash
219
- npx chisle --dry-run # prints every file it would touch, changes nothing
220
- npx chisle --stats # prints what it has saved, changes nothing
221
- ```
222
-
223
- Want the savings measured on your own work rather than ours? Clone the repo and replay the compressor over local transcripts. It reads them locally, writes nothing, and reports the input the hook would have stripped:
224
-
225
- ```bash
226
- git clone https://github.com/JayPokale/Chisle && cd Chisle
227
- node benchmarks/replay-compress.js # Claude Code
228
- node benchmarks/replay-compress.js pi # Pi; marginal over Pi's native truncation
229
- ```
152
+ Upgrading, per-agent setup, `--stats` and config: [docs/usage.md](docs/usage.md).
230
153
 
231
154
  ---
232
155
 
233
- ## Numbers
234
-
235
- Nothing here is estimated. Every figure below is recomputed from committed raw data; the 2026-07-07 [verification writeup](benchmarks/results/2026-07-07-verify-rerun.md) re-derived the old claims from scratch, re-ran the whole suite against the competitors' **installed plugins**, and retired the one claim that didn't survive.
236
-
237
- ### Output axis, re-measured 2026-10-01 (current)
238
-
239
- Re-run with the shipped ruleset, Claude Code 2.1.285 and the rivals' current plugins (caveman `ef6050c5e184`, ponytail 4.8.3): 13 live prompts × 2 seeds = 26 cells per arm on Haiku 4.5, billed output tokens vs the no-tool baseline ([writeup + raw cells](benchmarks/results/2026-10-01-live-rerun.md)):
240
-
241
- | | total bill | 95% CI | visible answer | worst cell | backfires |
242
- |---|--:|--:|--:|--:|--:|
243
- | caveman | 102% | 79–128% | 105% | 305% | 15 / 26 |
244
- | ponytail | 105% | 86–129% | 97% | 493% | 16 / 26 |
245
- | **Chisle** | **83%** | **69–95%** | **76%** | **170%** | **11 / 26** |
246
-
247
- Chisle is the only arm measurably below a bare model, by about a third of what the June table below claimed. It pays on long answers (77%) and coding prompts (76%); on short answers it breaks even (106%), on explanation prompts ponytail is leaner (86% vs 91%), and reasoning tokens are not cut (107%). Single cells swing hard between seeds (57% → 135% on one prompt), and the bare model "backfires" against itself on 13 of 26 cells, so read totals, not backfire counts ([control](benchmarks/results/2026-10-01-backfires.md)).
248
-
249
- **Why the June headline was retired.** Its 52% leaned on one cell: the June bare `cache` answer billed 4,910 tokens, while every later run of the same prompt billed 375–813. The ruleset also carried examples matching `cache` (from June 18) and `auth-bug` (from June 27), so four cells may have been primed; without them the June total was 70%. The tables below stay as what they were.
250
-
251
- ### Output axis, June–July 2026 (superseded): vs caveman & ponytail, 20 live tasks
252
-
253
- **What this suite measures, and what it does not.** Every figure below is *billed output tokens on single-turn prompts with no tools available*. That isolates the ruleset's effect on how the model writes, which is what it was built to measure. It is not whole-session cost: a real agentic session is dominated by tool output and cached input, so a tool can win here and still fail to pay for itself end to end. The input axis below is measured separately, and against its own baseline.
254
-
255
- **59+ live model runs** across two suites (June 4-arm matrix on Haiku + Sonnet sweep; July re-verification run). Arms differ only in the injected system prompt. Billed output tokens vs the no-tool baseline:
256
-
257
- | | total bill (all 20 tasks) | average task | worst case | backfires |
258
- |---|--:|--:|--:|--:|
259
- | caveman | 80% | 98% | **424%** | 6 / 20 |
260
- | ponytail | 68% | 91% | 227% | 8 / 20 |
261
- | **Chisle** | **52%** | **69%** | **173%** | **1 / 20** |
262
-
263
- Chisle wins all four columns: it cut the total 20-task bill **nearly in half** while the specialists managed 20–32%, and it did so with the smallest worst day and a twentieth the backfire rate.
264
-
265
- <p align="center">
266
- <img src="assets/benchmark.svg" width="820" alt="Total billed output across 20 tasks as percent of the no-tool baseline. caveman 80% (worst day 424%, backfired 6), ponytail 68% (worst day 227%, backfired 8), Chisle 52% (worst day 173%, backfired 1, root-caused and fixed).">
267
- </p>
156
+ ## Benchmarks
268
157
 
269
- The bar is the whole 20-task bill; the badge is each tool's worst single day. caveman's worst day cost **4.2×** a bare model; ponytail's, a tool whose entire job is writing less, **2.3×**. Chisle's worst day was 1.7×, it happened once, and the fix is measured and merged.
158
+ Same model, same prompts, one difference: the injected ruleset. Lower = leaner. Chisle is the leanest on every row.
270
159
 
271
- In the July run all 24 answers, every arm, **graded correct**: nobody here buys token savings with wrong answers.
160
+ **Claude Code** (Haiku 4.5, 26 live prompts, tools off, [raw cells](benchmarks/results/raw-oct-notools/)):
272
161
 
273
- #### Code vs. explanation
162
+ | % of a bare model | caveman | ponytail | **Chisle** |
163
+ |---|--:|--:|--:|
164
+ | answer length | 65% | 58% | **56%** |
165
+ | answer lines | 66% | 54% | **52%** |
274
166
 
275
- Across all 20 cells, split by what the prompt actually asks for:
167
+ **Pi** (GPT-5.5, 6 tasks, [raw cells](benchmarks/results/raw-pi/)):
276
168
 
277
- | | n | caveman | ponytail | **Chisle** |
278
- |---|--:|--:|--:|--:|
279
- | **coding** (wants working code) | 12 | 74% | 59% | **44%** |
280
- | **non-coding** (wants an explanation) | 8 | 103% | 104% | **87%** |
169
+ | % of a bare model | caveman | ponytail | **Chisle** |
170
+ |---|--:|--:|--:|
171
+ | answer length | 56% | 49% | **37%** |
172
+ | answer lines | 75% | 38% | **37%** |
173
+ | billed tokens, explanations | 43% | 76% | **39%** |
281
174
 
282
- Code is where the YAGNI ladder has something to bite on: an abstraction to skip, a stdlib call to reach for, a file not to create. Chisle bills **44%** of a bare model there, a third less than ponytail, which is the closest thing to a dedicated lazy-code tool.
283
-
284
- On explanation-only prompts the picture is worse for everyone. Both specialists land **above 100%**: a tool whose job is writing less made the model write *more* than using nothing at all. Chisle is the only arm that stays under water (87%), which is a smaller win than the coding number and worth saying plainly.
285
-
286
- This does revise a claim the earlier Sonnet writeup made. On that suite's three prose prompts caveman was leaner (44% vs 52%), and that still holds *for those cells*. Pooled across all eight non-coding cells it does not: caveman is at 103%. The prose win was suite-specific, not general.
287
-
288
- #### Task by task
289
-
290
- Averages hide the interesting part, so here is every cell of the June suite, same six prompts, every arm, no cherry-picking:
291
-
292
- <p align="center">
293
- <img src="assets/per-task.svg" width="820" alt="Billed output per task as a percent of the no-tool baseline across the six-task June suite: Chisle is leanest on five of six, caveman wins the cache task at 8% versus Chisle's 12%.">
294
- </p>
295
-
296
- Chisle is leanest on **5 of 6**. caveman takes `cache` (8% vs our 12%) by answering in prose where we still emit working code, which is the trade you would want on a task that asked for code. Note the two prose rows where ponytail lands **above** 100%: a tool built to write less made the model write *more* than using no tool at all. That is the failure mode the worst-case column above is really about.
297
-
298
- #### The headline average is hiding the good part
299
-
300
- Split the same 20 cells at their median baseline, short answers below and long answers above, and the tools separate sharply:
301
-
302
- <p align="center">
303
- <img src="assets/by-size.svg" width="820" alt="Total billed output split by answer size. On short answers caveman and Chisle are level at about 84% of baseline and ponytail is above 100%. On long answers Chisle drops to about 45% while caveman is 79% and ponytail 59%.">
304
- </p>
305
-
306
- On **short** answers Chisle and caveman are level (84% each), because there is not much to cut in a three-line reply, and the ruleset overhead is proportionally at its worst. On **long** answers Chisle drops to **45%** while caveman only reaches 79%. The 52% headline is the blend of the two, so it understates the case where it matters and overstates the case where it doesn't.
307
-
308
- The effect is not driven by one lucky cell. Dropping the `cache` outlier (the row where the baseline invented 150 lines against a codebase it never saw) *widens* the gap on long answers: caveman degrades to **116%**, worse than using no tool, while Chisle holds at **65%**.
309
-
310
- Two honest limits. Per-task rank correlation between baseline size and leanness is weak (Spearman ρ = −0.15), so this is a difference between aggregate bills, not a tidy per-task law. With n=10 a side, treat it as a strong signal rather than a settled result. And much of the widening gap comes from the specialists getting *worse* on long answers, not only from Chisle getting better.
311
-
312
- #### Size or kind? Both, and they're tangled
313
-
314
- Coding prompts average ~1129 baseline tokens against ~393 for explanation prompts, so "long" and "code" largely describe the same cells. Crossing the two separates them as far as 20 tasks allow:
315
-
316
- | | n | caveman | ponytail | **Chisle** |
317
- |---|--:|--:|--:|--:|
318
- | coding · short | 5 | **62%** | 116% | 70% |
319
- | coding · long | 7 | 76% | 52% | **41%** |
320
- | non-coding · short | 5 | 104% | 98% | **96%** |
321
- | non-coding · long | 3 | 103% | 111% | **77%** |
322
-
323
- <p align="center">
324
- <img src="assets/by-kind.svg" width="820" alt="Billed output by task kind crossed with answer size. Code and short: caveman 62%, ponytail 116%, Chisle 70%. Code and long: caveman 76%, ponytail 52%, Chisle 41%. Explanation and short: caveman 104%, ponytail 98%, Chisle 96%. Explanation and long: caveman 103%, ponytail 111%, Chisle 77%.">
325
- </p>
175
+ **Tool output** is two thirds of a Claude Code session's context and re-billed every turn. The compressor cuts **~46%** off every oversized output ([171 sessions](benchmarks/results/2026-07-07-input-axis.md)); on OpenCode a 30 KB log dropped **87%** of fresh input tokens.
326
176
 
327
- Size matters *within* each kind: coding goes 70% → 41% and non-coding 96% → 77%, so it isn't merely code in disguise. But the cells are thin, and the non-coding "long" bucket spans only 522–542 tokens, which is barely long at all.
328
-
329
- The one row Chisle loses is **short coding**, where caveman takes it 62% to 70%. That is the honest shape of it: on a small code question there is little to skip, and the ruleset costs more than the ladder saves. The tool earns its keep on the long ones.
330
-
331
- `SUITE=large` exists to fill the thin cells, see [below](#see-what-it-would-do-before-it-does-it).
332
-
333
- These prompts were never designed to test this, which is the real caveat. To probe it directly:
334
-
335
- ```bash
336
- SUITE=large bash benchmarks/run-live.sh <model> benchmarks/results/raw-large
337
- ```
338
-
339
- #### Where each tool actually helps
340
-
341
- | | prose | code judgment | input/context | worst-case guard | publishes failures |
342
- |---|:---:|:---:|:---:|:---:|:---:|
343
- | caveman | ✅ | ❌ | ❌ | ❌ 305% | ❌ |
344
- | ponytail | ❌ | ✅ | ❌ | ❌ 493% | ❌ |
345
- | headroom | ❌ | ❌ | ✅ proxy | n/a | ❌ |
346
- | **Chisle** | ✅ | ✅ | ✅ hook | **170%** | ✅ |
347
-
348
- The row that matters is the last one. Every tool here looks good on its best day; the numbers above are the only ones in this class published alongside the run that went wrong. [Full comparison →](docs/comparison.md)
349
-
350
- ### Input axis: tool-output compression (Claude Code + Pi)
351
-
352
- Measured over 171 real sessions ([receipts](benchmarks/results/2026-07-07-input-axis.md)): tool output is **67.5%** of context content, and every byte of it is re-billed on *every subsequent request* in the session (median: 171 requests). A `PostToolUse` hook shrinks it before the model reads it: deterministic, zero LLM, zero network:
353
-
354
- | tier | what it does | loss |
355
- |---|---|---|
356
- | **scrub** | strips ANSI escapes, collapses blank runs and `line repeated N×` | none |
357
- | **elide** | oversized output → head + tail, error-like lines salvaged from the cut | bounded, guarded |
358
- | **dedup** | byte-identical repeat of a tool's previous output (same session) → one-line marker | none, the copy is already in context |
359
-
360
- Replayed over the same 171 Claude Code sessions: **~61k tokens** saved one-shot, ~46% off every eligible output: a floor, not an estimate, since each saved byte also stops being re-sent on every later request. Correctness rules: allowlist only (`Bash`, `Agent`, `WebFetch`, `WebSearch`, `Grep`, `Glob`, `mcp__*`), never `Read`/`Edit`, whose exact bytes feed later edits. Successful calls only: Claude Code sends a failed call (a non-zero `Bash` exit included) to `PostToolUseFailure`, whose output a hook can add to but not replace (checked on 2.1.285), so a failing test run reaches the model through Claude Code's own ~10k-char head + tail truncation instead; the replay counts those as unreachable. Honest ledger: dedup scored **0 hits** on this corpus (rtk-filtered at source); it's kept for the test-rerun case, kill-switchable, and labeled speculative until it earns a number.
361
-
362
- Pi already truncates built-in output at 50KB/2,000 lines. Replay over 8,044 persisted Pi results measured the compressor's **marginal** saving after that truncation: **27.4% of tool-output chars** ([receipt + raw live Pi arm](benchmarks/results/2026-09-11-pi.md)). Pi compresses `bash`, `powershell`, `grep`, `find`, `ls`, MCP, and explicitly allowlisted extension-tool results; `read`/`edit`/`write` remain untouched. `CHISLE_COMPRESS_TOOLS` supplies the same explicit override for runtime and replay. Runtime dedup only compares earlier turns, so concurrently completed sibling calls cannot dedup one another.
363
-
364
- ```bash
365
- node benchmarks/replay-compress.js # Claude Code
366
- node benchmarks/replay-compress.js pi # Pi
367
- ```
368
-
369
- Outputs over 8k chars are elided, and the elided original spills to `<config>/chisle-spill/` so the dropped middle stays reachable. The marker carries the path, so recovering one line is a targeted grep rather than a re-run of the command, which matters most when the command is not idempotent: a test run, a build, a `git log` at a moment in time. The newest 40 spills are kept, owner-readable only. `stop chisle`, `CHISLE_COMPRESS=0`, `CHISLE_COMPRESS_SCRUB=0`, `CHISLE_COMPRESS_DEDUP=0`, `CHISLE_COMPRESS_SPILL=0`. Every tier has an off switch.
370
-
371
- ### Pi arm: where the output axis lost
372
-
373
- Six tasks, Pi 0.85.1 on `openai-codex/gpt-5.5`, as % of the vanilla no-tool baseline. Lower is better, bold is the winner of the row:
374
-
375
- | segment | vanilla | caveman | ponytail | **Chisle** |
376
- |---|--:|--:|--:|--:|
377
- | coding billed tokens | 100% | 87% | **49%** | 73% |
378
- | non-coding billed tokens | 100% | 43% | 76% | **39%** |
379
- | **all billed tokens** | 100% | 72% | **59%** | 61% |
380
- | all visible-answer tokens | 100% | 56% | 49% | **37%** |
381
- | all answer lines | 100% | 75% | 38% | **37%** |
382
- | tasks correct | 5/6 | 5/6 | 5/6 | 5/6 |
383
-
384
- **Chisle lost billed output here.** ponytail used 63 fewer tokens over the six tasks. Publishing that is the point of this section.
385
-
386
- The coding gap is one task. Chisle leads 4 of 6 tasks outright; `auth-bug` alone accounts for 283 of the 337-token coding gap. On that task Chisle produced the shortest answer of any arm (377 chars to ponytail's 632) and was the only arm to find the real defect: ponytail flipped `>` to `>=`, while Chisle identified the seconds-versus-milliseconds unit mismatch behind it. The grader scored every arm as failing regardless, which says more about that task than about the tools.
387
-
388
- Six tasks, one model, one run. Raw events and per-task cells: [`benchmarks/results/raw-pi/`](benchmarks/results/raw-pi/).
389
-
390
- ### Prevention: the context diet
391
-
392
- The biggest context whale (whole-file `Read`s, 5.6M chars in the measured corpus) can't be compressed without breaking later edits. So the ruleset attacks it upstream, in every agent: grep for the symbol first, read only the matching region, narrow at the source (`ls dir` not `ls -R`, pipe long output through `tail`/`grep`), never re-read what's already in context.
393
-
394
- ---
395
-
396
- ## What the output sounds like
397
-
398
- **"Why does this React component re-render?"**
399
- > New object ref each render. Inline object prop = new ref = re-render. `useMemo`.
400
-
401
- **"Add a cache for API responses."**
402
- > `@lru_cache(maxsize=1000)` on the fetch fn. Skipped a custom cache class; add one when `lru_cache` measurably falls short.
403
-
404
- ---
405
-
406
- ## Usage
407
-
408
- | Command | Effect |
409
- |---------|--------|
410
- | *(nothing)* | On automatically every session after install |
411
- | `/chisle` | Re-activate if you'd stopped it |
412
- | `/chisle off` | Deactivate |
413
- | `stop chisle` | Deactivate (ruleset *and* input-side compression) |
414
- | `normal mode` | Deactivate |
415
-
416
- Natural language works too: "activate chisle", "chisle mode", "chislify this". Code symbols, function/API names, and error strings stay verbatim, so only the noise around them compresses.
177
+ Method and every raw cell: [docs/benchmarks.md](docs/benchmarks.md).
417
178
 
418
179
  ---
419
180
 
@@ -456,109 +217,23 @@ Mark deliberate simplifications so "later" doesn't quietly become "never":
456
217
  // chisle: O(n) scan, index this when table exceeds ~10k rows
457
218
  ```
458
219
 
459
- ---
460
-
461
- ## Config
462
-
463
- **On by default.** After install, Chisle activates automatically every session, with no `/chisle` needed. Set `off` to stay dormant until you type `/chisle`:
464
-
465
- ```bash
466
- # env var (highest priority)
467
- export CHISLE_DEFAULT_MODE=off
468
-
469
- # config file (persists across shells)
470
- ~/.config/chisle/config.json → { "defaultMode": "off" }
471
- ```
472
-
473
- Resolution: env var → config file → `on`. Valid: `off`, `on`.
474
-
475
- **Output styles are detected automatically.** Claude Code's output-style mechanism also governs
476
- prose structure, so an active style and Chisle's prose section give directly conflicting
477
- instructions — the style mandates tables and bullets for comparisons, Chisle's prose section forbids
478
- manufactured tables and bullets the question didn't ask for. Chisle now reads the active style and
479
- steps its prose rules aside on its own. Nothing to configure: run `/output-style Explanatory` and the
480
- prose section stops shipping; switch back to `default` and it returns.
481
-
482
- The code rules, the ladder, the context diet and the compressor are all unaffected — output styles
483
- govern prose, so only the prose section yields.
484
-
485
- Detection reads the `outputStyle` key across Claude Code's own settings precedence
486
- (`.claude/settings.local.json`, where `/output-style` writes, then `.claude/settings.json`, then
487
- `~/.claude/settings.json`). Claude Code only — Pi and OpenCode have no output-style mechanism, so
488
- there is nothing to detect and nothing changes for them.
489
-
490
- **Suppress a rule group manually.** The same `sections` key gives explicit control, and it always
491
- beats detection — set `prose: true` to keep Chisle's prose rules even with a style active:
492
-
493
- ```json
494
- { "sections": { "prose": false } }
495
- ```
496
-
497
- `sections.prose: false` suppresses the prose rules; `sections.code: false` suppresses the code
498
- rules. Config file only, no env override. Anything absent, malformed, or non-boolean falls back to
499
- enabled, which is also what lets automatic detection apply — only an explicitly written boolean
500
- overrides it. With no style active and nothing configured, the emitted ruleset is byte-identical to
501
- before either feature existed. The always-on sections
502
- (Persistence, Thinking Is Billed Too, Auto-Clarity, When NOT to be lazy, Boundaries) ship regardless
503
- of either setting.
504
-
505
- Scope: this only affects the runtime-hook agents that read `skills/chisle/SKILL.md` live — Claude
506
- Code and Pi. The seven static-rule agents built by `scripts/build-rules.js` (Cursor, Windsurf,
507
- Cline, Kiro, Codex, Gemini, Copilot) get flat files baked at build time with no runtime config to
508
- read, so they can't honor this key.
509
-
510
- ---
511
-
512
- ## Prior art & what stacks with it
513
-
514
- Chisle borrows the best published token-saving techniques and implements the ones that fit a zero-dep hook; the rest stack cleanly alongside it:
515
-
516
- | technique | source | in Chisle? |
517
- |---|---|---|
518
- | Prose compression persona | [caveman](https://github.com/JuliusBrussee/caveman) | ✅ + code judgment it lacks |
519
- | YAGNI/lazy-code ruleset | [ponytail](https://github.com/dietrichgebert/ponytail) | ✅ + prose discipline it lacks |
520
- | Tool-output elision (head/tail) | [headroom](https://github.com/headroomlabs-ai/headroom)-style, proxy-free | ✅ hook, no proxy, works on subscription OAuth |
521
- | ANSI strip / log crush / dedup | headroom transforms | ✅ scrub + dedup tiers |
522
- | Command rewriting at the source | RTK-style `PreToolUse` ([writeup](https://andrewpatterson.dev/posts/token-savings-rtk-headroom/)) | ❌ stacks; RTK shrinks at source, Chisle catches what it can't reach (subagents, MCP, web) |
523
- | MCP/codebase-graph indexing | context-mode, [token-optimizer-mcp](https://github.com/ooples/token-optimizer-mcp) | ❌ stacks, orthogonal layer |
524
- | CLAUDE.md dieting | [community guides](https://www.firecrawl.dev/blog/claude-code-token-efficiency) | ✅ `/chisle-audit` flags bloated docs/config prose |
525
-
526
- ## Multi-agent
527
-
528
- Ships to eleven agents: Claude Code and Pi get both axes, live `/chisle` toggling, and a status badge; OpenCode gets both axes too — the global fenced ruleset, on-demand skills, and a native compression plugin — but no live toggle; Cursor, Windsurf, Cline, Kiro, Codex, Gemini, and Copilot get the always-on ruleset; Hermes gets the skills as `/chisle` commands. Per-agent static copies come from `scripts/build-rules.js`; Pi uses its package extension plus the Agent Skills standard. See [`docs/agent-portability.md`](./docs/agent-portability.md).
529
-
530
- ## FAQ
531
-
532
- **Doesn't injecting a persona every turn cost tokens?**
533
- Claude Code uses a ruleset at session start (~900 tokens) plus a ~50-token reminder per turn. Pi injects one persistent rules message only when project `AGENTS.md` does not already provide it; resume/reload does not duplicate it, and compaction restores it only if removed.
534
-
535
- Worth reading the dissent before you take that on faith: [@enc0ded](https://github.com/enc0ded) measured 173 of their own sessions ([#2](https://github.com/JayPokale/Chisle/issues/2)) and found the injection overhead roughly cancelling the compressor's savings, because the ruleset was being re-sent on every resume and clear, not just at startup. That re-injection is fixed, which removes most of the overhead they measured, but their wider point stands: prose is only ~25% of what the model emits, so the ceiling on the output axis is lower than the headline suggests, and on a one-line throwaway prompt the overhead still exceeds the saving.
536
-
537
- **Will it golf my code into clever one-liners?**
538
- No. Boring over clever. Deletion beats addition; obfuscation isn't deletion.
539
-
540
- **Does it cut corners on safety?**
541
- Never. Input validation, data-loss handling, security, and accessibility are off the table. Lazy about solutions, not about reading the problem.
542
-
543
- **Can the output compressor eat a line I needed?**
544
- Designed not to: allowlist keeps `Read`/`Edit` exact, error-looking lines are salvaged from any elided region, dedup only fires on byte-identical same-session repeats, and every tier has a kill switch. If it still bites you, file an issue. That's a bug, not the design.
220
+ ## Usage
545
221
 
546
- **Should the star count worry me?**
547
- Everyone starts at zero. Run `npx chisle --dry-run`, see what it'd do, decide. And if the receipts convinced you, [a star](https://github.com/JayPokale/Chisle/stargazers) is how the next person finds them, and it's also the only payment a zero-dep MIT tool will ever ask for.
222
+ | Command | Effect |
223
+ |---------|--------|
224
+ | *(nothing)* | On automatically every session after install |
225
+ | `/chisle` | Re-activate if you'd stopped it |
226
+ | `/chisle off` | Deactivate |
227
+ | `stop chisle` | Deactivate (ruleset *and* input-side compression) |
228
+ | `normal mode` | Deactivate |
548
229
 
549
- → [More FAQ and competitor comparison](docs/comparison.md)
230
+ Natural language works too: "activate chisle", "chisle mode", "chislify this". Code symbols, function/API names, and error strings stay verbatim, so only the noise around them compresses.
550
231
 
551
232
  ---
552
233
 
553
234
  ## Contributing
554
235
 
555
- See [CONTRIBUTING.md](CONTRIBUTING.md). Edit the skill (`skills/chisle/SKILL.md`) **and** the condensed rule body in `scripts/build-rules.js`, regenerate copies and chart, run the tests. CI enforces all three.
556
-
557
- Built by [Jay Pokale](https://github.com/JayPokale) with [Claude](https://claude.com/claude-code), [Antigravity](https://antigravity.google), and [Codex](https://openai.com/blog/openai-codex/) as co-engineers: the input-compression hook, the benchmark verification, and several of the bug hunts documented in the changelog were pair-work.
558
-
559
- ```bash
560
- npm test # 67 tests: flag safety, tracker, settings merge, installer, compressor
561
- ```
236
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Built by [Jay Pokale](https://github.com/JayPokale) with [Claude](https://claude.com/claude-code), [Antigravity](https://antigravity.google), and [Codex](https://openai.com/blog/openai-codex/) as co-engineers.
562
237
 
563
238
  ## Star History
564
239
 
@@ -574,6 +249,8 @@ npm test # 67 tests: flag safety, tracker, settings merge, installer, compres
574
249
 
575
250
  [MIT](LICENSE). The shortest license that works.
576
251
 
252
+ Chisle began as a merge of [caveman](https://github.com/JuliusBrussee/caveman) (terse prose) and [ponytail](https://github.com/DietrichGebert/ponytail) (lazy-senior-dev code rules), and its ruleset still carries parts of both. Their MIT notices are in [NOTICE](NOTICE).
253
+
577
254
  ## Contributors
578
255
 
579
256
  <a href="https://github.com/JayPokale/Chisle/graphs/contributors">