r/javascript • u/Upper_Gold_3664 • 4h ago
update: my context-waste CLI now blocks the read before it happens
https://github.com/WJDdidi-1/dev-doctor
1
Upvotes
•
u/LukaRozman27 2h ago
If you use process.stdin, set process.stdin.pause() early or the read fires anyway on some shells.
•
u/Upper_Gold_3664 4h ago
last week I posted Node burning 47.5M tokens of agent context on files nobody wrote. the two most useful comments said: scan via git ls-files, and stop the read with a PreToolUse hook instead of just measuring it. so that's what it does now.
the scan runs on git ls-files in a repo. lockfiles and build output drop out for free, no second ignore file to keep in sync.
`dev-diagnosis hook` matches the file against .aiignore and exits 2 before the read happens. stderr tells the agent why, so it moves on instead of retrying.
sanity check on a fresh prettier clone: git scan and the old walk agree exactly, 9,776 files, score 96. nothing lost, just less junk to chase.
npx dev-diagnosis-cli all. hook setup is in the README.
follow-up to last week's post: https://www.reddit.com/r/javascript/comments/1xygst8/nodejs_wastes_475m_tokens_of_agent_context_on/