DevTrendsDeveloper trends
Accent color

drkokorev /

context-diet

Hi HN, I built this after watching long Claude Code sessions fill up with tool output: a single verbose test run or build log can be 30–50k characters, almost all of it PASSED lines, warnings and lockfile churn. The cont…

DTData & operationsDTAgent extensionDTAgent observabilityDTContent / resourceDTClaude Code

About

Hi HN, I built this after watching long Claude Code sessions fill up with tool output: a single verbose test run or build log can be 30–50k characters, almost all of it PASSED lines, warnings and lockfile churn. The context fills, compaction comes sooner, and the agent forgets earlier instructions. Context Diet is a mod (Claude Code's new JS hook API) that rewrites tool results before they are stored in the conversation: - test runners and build tools (jest, vitest, pytest, go test, cargo, tsc, eslint, npm/pip install, docker build) get parsed digests: every failure with its message and location, plus the summary; passing tests are counted, not listed - JSON becomes a skeleton, diffs drop lockfile churn, grep results and file lists are grouped, tables keep exact first and last rows - running the same command again shows only what changed - the full output is always saved to a file, and the digest says where, so the agent can read it when it needs more The question I cared about most was whether it makes the agent worse. On 7 Q&A tasks with known answers, both groups were 7/7, with 8 tool calls instead of 13. On a bug-fixing task (600 tests, two hidden bugs, Haiku/Sonnet/Opus, 18 runs) every agent fixed both bugs with or without it, using 6 tool calls instead of 8. Honest caveats: the token saving on very large outputs is modest, because Claude Code already moves those to a file; the gain there is fewer steps. Also, when a command fails, Claude Code keeps only ~10k characters and drops the end of the output, where the failures usually are. There is an opt-in mode that saves the whole output first, off by default because it changes the command text. It's MIT, makes no network calls, and I'd love examples of output it digests badly.

Discovery history

  1. Show HN

    Oct 10, 2026 · 1 observations

Discuss this product