Hacker News

Top stories

Live mirror
30 storiesupdated just nowView source snapshot
  1. Hacking OpenAI(hacktron.ai ↗)
    33comments
  2. Astra for Law(openai.com ↗)
    430comments
  3. Bonsai 2 27B: Near-Lossless Compression in a 9x Smaller Footprint(prismml.com ↗)
    106comments
  4. Waymo in Singapore(waymo.com ↗)
    10comments
  5. Bend – A language that blocks AI mistakes via proof, on CPU and GPU(bend-lang.com ↗)
    185comments
  6. Hister: A private search engine for the pages you visit and the files you keep(github.com/asciimoo ↗)
    141comments
  7. Alibaba releases Qwen 3.8 Omni Flash(qwen.ai ↗)
    24comments
  8. Wax motor(wikipedia.org ↗)
    57comments
  9. Pre-Greek: The lost language hidden within Ancient Greek(linguisticdiscovery.com ↗)
    discuss
  10. Fujitsu launches made-in-Japan next-generation CPU FUJITSU-MONAKA(global.fujitsu ↗)
    205comments
  11. Telstra outage: The night a network decided the year was 2006(netnod.se ↗)
    10comments
  12. Shapelearn Qwen 3.8 27B (13.1 GB VRAM)(byteshape.com ↗)
    discuss
  13. Apple detectives solved mystery of ancient tree and rewrote the history of fruit(scientificamerican.com ↗)
    discuss
  14. Ask A Monk – A digital wilderness for thoughts with no immediate answer(askamonk.online ↗)
    11comments
  15. How to Write with an LLM(sockpuppet.org ↗)
    55comments
  16. Code Scans(devin.ai ↗)
    2comments
  17. Flet 1.0 – Build cross-platform apps in Python(flet.dev ↗)
    39comments
  18. Diplodocus, Long Thought Exclusively American, Turns Up in Spain(sci.news ↗)
    27comments
  19. The most important product decision is what you don't build(liamnugent.me ↗)
    24comments
  20. How Uber Protects Against Retry Storms(uber.com ↗)
    31comments
  21. I Put Nam A2-Lite Inside an iRig HD X(playtaurus.com ↗)
    4comments
  22. CrowdSec Source Code Leak(crowdsec.net ↗)
    42comments
  23. Why I didn’t sign the Fields medallists’ letter(gowers.wordpress.com ↗)
    332comments
  24. Khipu (Quipu) Field Guide(khipufieldguide.com ↗)
    discuss
  25. How do we prevent mathemathics from devolving into the Medieval Era of secrecy?(mathoverflow.net ↗)
    74comments
  26. Infinite-Parameter LLMs: Generating and Adapting Weights from Live Data(arxiv.org ↗)
    38comments
  27. Better Icon and Label Alignment(ishadeed.com ↗)
    2comments
  28. Rate limits on GitLab.com are changing(about.gitlab.com ↗)
    110comments
  29. Zettascale (YC S24) Is Hiring ASIC/FPGA Engineers to Build Chips for ASI(zscc.ai ↗)
    discuss
  30. The American Religion of Self-Storage Facilities(newyorker.com ↗)
    363comments

Show HN: Context Mode – 315 KB of MCP output becomes 5.4 KB in Claude Code

84 pointsby 6mo agogithub.com
22 comments
Every MCP tool call dumps raw data into Claude Code's 200K context window. A Playwright snapshot costs 56 KB, 20 GitHub issues cost 59 KB. After 30 minutes, 40% of your context is gone.

I built an MCP server that sits between Claude Code and these outputs. It processes them in sandboxes and only returns summaries. 315 KB becomes 5.4 KB.

It supports 10 language runtimes, SQLite FTS5 with BM25 ranking for search, and batch execution. Session time before slowdown goes from ~30 min to ~3 hours.

MIT licensed, single command install:

/plugin marketplace add mksglu/claude-context-mode

/plugin install context-mode@claude-context-mode

Benchmarks and source: https://github.com/mksglu/claude-context-mode

Would love feedback from anyone hitting context limits in Claude Code.

6mo agoHN ↗

One moment you're speaking about context but talking in kilobytes, can you confirm the token savings data?

And when you say only returns summaries, does this mean there is LLM model calls happening in the sandbox?

6mo agoHN ↗

Hey! Thank you for your comment! There are test examples in the README. Could you please try them? Your feedback is valuable.

6mo agoHN ↗

For your second question: No LLM calls. Context Mode uses algorithmic processing — FTS5 indexing with BM25 ranking and Porter stemming. Raw output gets chunked and indexed in a SQLite database inside the sandbox, and only the relevant snippets matching your intent are returned to context. It's purely deterministic text processing, no model inference involved.

6mo agoHN ↗

Excellent, thank you for your responses. Will be putting it through a test drive.

6mo agoHN ↗

Looks pretty interesting. How could i use this on other MCP clients e.g OpenCode ?

6mo agoHN ↗

Hey! Thank you for your comment! You can actually use an MCP on this basis, but I haven't tested it yet. I'll look into it as soon as possible. Your feedback is valuable.

6mo agoHN ↗

nice, I'd love to se it for codex and opencode

6mo agoHN ↗

Thanks! Context Mode is a standard MCP server, so it works with any client that supports MCP — including Codex and opencode.

Codex CLI:

  codex mcp add context-mode -- npx -y context-mode

Or in ~/.codex/config.toml:

  [mcp_servers.context-mode]
  command = "npx"
  args = ["-y", "context-mode"]

opencode:

In opencode.json:

  {
    "mcp": {
      "context-mode": {
        "type": "local",
        "command": ["npx", "-y", "context-mode"],
        "enabled": true
      }
    }
  }

We haven't tested yet — would love to hear if anyone tries it!

6mo agoHN ↗

Nice trick. I’m going to see how I can apply it to tool calls in pi.dev as well

6mo agoHN ↗

That means a lot, thank you! Would love to hear your feedback once you try it — and an upvote would be much appreciated if you find it useful

6mo agoHN ↗

Really cool. A tangential task that seems to be coming up more and more is masking sensitive data in these calls for security and privacy. Is that something you considered as a feature?

6mo agoHN ↗

Good question.

The SQLite database is ephemeral — stored in the OS temp directory (/tmp/context-mode-{pid}.db) and scoped to the session process. Nothing persists after the session ends. For sensitive data masking specifically: right now the raw data never leaves the sandbox (it stays in the subprocess or the temp SQLite store), and only stdout summaries enter the conversation. But a dedicated redaction layer (regex-based PII stripping before indexing) is an interesting idea worth exploring. Would be a clean addition to the execute pipeline.

6mo agoHN ↗

Nothing persists after the session ends.

Does that mean that if I exit claude code and then later resume the session, the database is already lost? When exactly does the session end?

6mo agoHN ↗

Yes — the database is tied to the MCP server process, so it's created fresh on each claude launch and lost when you exit; resuming a session starts a new process with a new empty database.

6mo agoHN ↗

Interesting approach, I tried the Hackernews example from the docs, but its tools don't seem to trigger reliably. Any suggestions?

Fetch the Hacker News front page, extract all posts with titles, scores, and domains. Group by domain. Then run /context-mode stats.

* Claude used regular fetch *

why didnt you use the context mode fetch?

● Fair point. Two honest reasons:

  1. First request: The context-mode tools weren't loaded yet when I called WebFetch. I should have used ToolSearch to load    
  fetch_and_index first, then used it — but I defaulted to WebFetch out of habit.                                              
  2. Second request (the interrupted one): The tools were already loaded at that point. I had no excuse. I should have done:   
  fetch_and_index(url: "https://news.ycombinator.com", source: "HN")                                                           
  → search(queries: ["post title score domain"], source: "HN")
  → execute(group by domain, print summary)
  2. Instead I reached for WebFetch again — that's the anti-pattern the plugin exists to prevent.

  The context-mode skill instructions explicitly list this in the decision tree:

  Fetching web documentation or HTML page? → Use fetch_and_index → search

  I ignored it. The WebFetch output (the full post table) went straight into context when it didn't need to. I'll use
  fetch_and_index correctly if you want to retry.
6mo agoHN ↗

That's a known bug in older versions — the WebFetch hook wasn't blocking reliably. Fixed in v0.7.1.

npm install -g context-mode@latest

If you're on the plugin install, re-run:

  /plugin marketplace add mksglu/claude-context-mode
  /plugin install context-mode@claude-context-mode

Then restart Claude Code. Sorry about that.

6mo agoHN ↗

Im not sure i understand how it coexists with existing installed MCP servers

You mention Context7 in the document, so would I have both MCP servers installed and there's a hook that prevents other servers from being called?

6mo agoHN ↗

Context Mode doesn't replace your other MCP servers — it sits alongside them. Your Context7, Playwright, GitHub servers all stay installed and work normally. The hook intercepts output-heavy tool calls (like WebFetch, curl) and redirects them through the sandbox. For example, instead of WebFetch dumping 56KB of raw HTML into context, the hook blocks it and tells the model to use fetch_and_index instead — which fetches the same URL but indexes it in a local SQLite DB, returning only a 3KB summary.

Your other MCP servers still run. Context Mode just gives the model a more context-efficient way to process their results when the output would be large.

6mo agoHN ↗

Interesting approach. I just finished some work for a similar task in a different domain.

One thing that surprised me: tantivy's BM25 search is faster, more expressive, and more scalable than SQLite. If you're just building a local search (or want to optimize for local FTS), I would strongly recommend looking into tantivy.

If you have the resources, it would be very interesting to throw a some models (especially smart-but-context-constrained cheaper ones) at some of the benchmark programming problems and see if this approach can show an effective improvement.

6mo agoHN ↗

On Tantivy: Agree it's the better search engine, but context-mode is session-scoped — DB is a temp file that dies when the process exits. At that scale (50-200 chunks), FTS5 is zero-config, single-file, <1ms startup, and good enough. If we ever add persistent cross-session indexing, Tantivy would be the move.

On benchmarking: This is the experiment I most want to see. The hypothesis: context-mode benefits smaller models disproportionately — a 32K model with clean context could outperform a 200K model drowning in raw tool output. Would love to see SWE-bench results with context-mode on vs. off across model tiers.

6mo agoHN ↗

It would be helpful if you could add a diagram showing the flow of data. I get the general idea but not how you implemented it.