docs(specs): kecualikan tool read dari squash

Ditemukan saat menulis plan: kompresi JSON pada hasil read akan merusak
byte-exactness yang dibutuhkan untuk edit selanjutnya jika file yang
dibaca kebetulan berformat JSON (package.json, tsconfig.json, dst).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
asepharyana
2026-07-16 07:49:43 +07:00
co-authored by Claude Sonnet 5
parent f62ac3f688
commit da39033e81
@@ -135,9 +135,13 @@ Runs every turn, unconditionally, before token counting — not gated on `should
pub fn apply(tool_name: &str, output: &str) -> String
```
Size floor: outputs under 1500 bytes pass through unchanged (compression only pays off on
large output, and touching small results risks losing detail with no token benefit).
Above the floor, dispatch by content shape:
`read` is exempted entirely, always passed through unchanged regardless of size: its output
must stay byte-exact because the agent relies on it for exact-match edits afterward, and a
squashed view of a JSON config file (or any file whose content happens to parse as JSON)
would otherwise be silently altered. Size floor for every other tool: outputs under 1500
bytes pass through unchanged (compression only pays off on large output, and touching small
results risks losing detail with no token benefit). Above the floor, dispatch by content
shape:
- `squash_json(&str) -> String` — hand-rolled JSON tokenizer; structural tokens (keys,
brackets, colons, commas, booleans, null) always kept; string values kept if ≤20 chars or