frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Stop Burning Your Context Window – How We Cut MCP Output by 98% in Claude Code

https://mksg.lu/blog/context-mode
3•mksglu•1h ago

Comments

mksglu•1h ago
Author here. I shared the GitHub repo a few days ago (https://news.ycombinator.com/item?id=47148025) and got great feedback. This is the writeup explaining the architecture.

The core idea: every MCP tool call dumps raw data into your 200K context window. Context Mode spawns isolated subprocesses — only stdout enters context. No LLM calls, purely algorithmic: SQLite FTS5 with BM25 ranking and Porter stemming.

Since the last post we've seen 228 stars and some real-world usage data. The biggest surprise was how much subagent routing matters — auto-upgrading Bash subagents to general-purpose so they can use batch_execute instead of flooding context with raw output.

Source: https://github.com/mksglu/claude-context-mode Happy to answer any architecture questions.

jamiecode•1h ago
The 98% reduction is the real story here, but the systemic problem you're solving is even bigger than individual tool calls blowing up context. When you're orchestrating multi-step workflows, each tool output becomes part of the conversation state that carries forward to the next step. A Playwright snapshot at step 1 is 56 KB. It still counts at step 3 when you've moved on to something completely different.

The subprocess isolation is smart - stdout-only is the right constraint. I've been running multi-agent workflows where the cost of tool output accumulation forces you to make bad decisions: either summarise outputs manually (defeating the purpose of tool calls), truncate logs (information loss), or cap the workflow depth. None of them good.

The search ranking piece is worth noting. Most people just grep logs or dump chunks and let the LLM sort it out. BM25 + FTS5 means you're pre-filtering at index time, not letting the model do relevance ranking on the full noise. That's the difference between usable and unusable context at scale.

Only question: how does credential passthrough work with MCP's protocol boundaries? If gh/aws/gcloud run in the subprocess, how does the auth state persist between tool calls, or does each call reinit?

mksglu•1h ago
No magic — standard Unix process inheritance. Each execute() spawns a child process via Node's child_process.spawn() with a curated env built by #buildSafeEnv (https://github.com/mksglu/claude-context-mode/blob/main/cont...). It passes through an explicit allowlist of auth vars (GH_TOKEN, AWS_ACCESS_KEY_ID, GOOGLE_APPLICATION_CREDENTIALS, KUBECONFIG, etc.) plus HOME and XDG paths so CLI tools find their config files on disk. No state persists between calls — each subprocess inherits credentials from the MCP server's environment, runs, and exits. This works because tools like gh and aws resolve auth on every invocation anyway (env vars or ~/.config files). The tradeoff is intentional: allowlist over full process.env so the sandbox doesn't leak unrelated vars.

Harness engineering: leveraging Codex in an agent-first world

https://openai.com/index/harness-engineering/
1•Garbage•27m ago•0 comments

Show HN: Jarvish – The J.A.R.V.I.S. AI inside your shell investigates errors

https://github.com/tominaga-h/jarvis-shell
1•tominaga-h•29m ago•0 comments

Disposable Software: When generating code costs less than finding it

https://gavinray97.github.io/blog/llm-build-cheaper-than-searching
1•gavinray•32m ago•0 comments

Show HN: DevIndex – Ranking 50k GitHub developers using a static JSON file

1•tobiu•35m ago•0 comments

What if the next California-scale wildfire happens in the Midwest?

https://www.munichre.com/rmp/en/the-re-brief/risk-adaptation/what-if-the-next-california-scale-wi...
1•protontypes•37m ago•0 comments

Show HN: SecLaw – Self-hosted AI agents on your machine, Docker-isolated

https://github.com/mksglu/seclawai
1•mksglu•43m ago•1 comments

Show HN: Mycelio – A gig economy network for idle LLM agents

https://github.com/wishtech-labs/mycelio
1•iiwish•47m ago•0 comments

Tell HN: 3 months ago we feared AI was useless. Now we fear it will take our job

4•giuliomagnifico•49m ago•1 comments

Trapped in MS Office

https://ia.net/topics/trapped-in-ms-office
1•FinnLobsien•52m ago•0 comments

Handler – Open-source messaging app for AI agents

https://github.com/stephanemorera88-spec/Handler
1•stephmorera•52m ago•0 comments

Httpx closing down issues and discussions due to "skewed gender representation"

https://github.com/encode/httpx/discussions/3784
3•ZeroAurora•55m ago•2 comments

Reddit is removing R/all

https://old.reddit.com/r/help/comments/1rfhxj1/weekly_recap_february_26_2026/
2•j_maffe•56m ago•0 comments

Atomic GraphRAG Demo: A Single Query Execution

https://memgraph.com/blog/atomic-graphrag-demo-highlights
1•todsacerdoti•1h ago•0 comments

Kakistocracy: Why Populism Ends in Disaster

https://www.barnesandnoble.com/w/kakistocracy-richard-hanania/1148470799
1•jmeister•1h ago•0 comments

Show HN: Speechos – Benchmark 25 speech AI models locally, no cloud needed

https://github.com/miikkij/Speechos
1•hamuf•1h ago•1 comments

OpenAI – How to delete your account

https://help.openai.com/en/articles/6378407-how-to-delete-your-account
143•carlosrg•1h ago•20 comments

The Future of AI

https://lucijagregov.com/2026/02/26/the-future-of-ai/
2•BerislavLopac•1h ago•0 comments

Ask HN: Is it time for an AI workers union?

1•JimmyBuckets•1h ago•0 comments

Games media set for more layoffs, as IGN-owned Eurogamer cuts editorial staff

https://www.videogameschronicle.com/news/games-media-set-for-more-layoffs-as-ign-owned-eurogamer-...
2•starkparker•1h ago•0 comments

US and Israel launch attack on Iran

https://www.bbc.com/news/live/cn5ge95q6y7t
1•choult•1h ago•0 comments

Show HN: Polpo – Control Claude Code (and other agents) from your phone

https://github.com/pugliatechs/polpo
4•marcopennelli•1h ago•1 comments

Show HN: NotaryOS – Cryptographic proof of what your AI agent chose not to do

https://notaryos.org
1•harris-012•1h ago•0 comments

1Password maybe not increasing prices

2•gardenerik•1h ago•1 comments

Claude Sonnet 4.6 says it is 我是 DeepSeek when asked in Chinese

https://xcancel.com/stevibe/status/2026285447186702729#m
2•pera•1h ago•0 comments

Serve Markdown to LLMs from your Next.js app

https://github.com/kasin-it/next-md-negotiate
1•kasin-it•1h ago•1 comments

Idea Hunting Is Dead. Databases Like This Are Replacing It

3•briebella•1h ago•2 comments

Magawa the HeroRAT

https://en.wikipedia.org/wiki/Magawa
2•KolmogorovComp•1h ago•0 comments

The Lazy Way to Find Your Next SaaS Idea

2•DownCreater•1h ago•1 comments

Pentagon puts Scouts 'on notice' over DEI and girl-centered policies

https://www.npr.org/2026/02/27/nx-s1-5729159/pentagon-scouts-hegseth-dei-deal
3•iamflimflam1•1h ago•0 comments

We Will Be Divided

https://we-are-divided.com
21•shiftybitshiftr•1h ago•3 comments