Context Surgeon
Let AI agents edit their own context window
Details
- External ID
- 47753430
- Source
- HN
- Company
- —
- Product
- Context Surgeon
- Website domain
- github.com
- Launched
- April 13, 2026
- Cohort
- —
- Upvotes
- 5
- Upvotes percentile
- 0.11182519280205655
- Tags
- —
- Fetched at
- Sept. 7, 2026, 9:26 p.m.
- Updated at
- Sept. 7, 2026, 9:26 p.m.
Description
AI agents accumulate stale tool results — file reads, web fetches, bash outputs — in their context window. Every one sits there for the entire conversation, consuming tokens and degrading quality. The standard fix is auto-compaction: wait until full, then drop content indiscriminately.Context Surgeon gives the agent three operations — evict, replace, and restore — so it can manage its own context. It works as a transparent local proxy that intercepts API requests, assigns IDs to content blocks, and applies eviction directives before forwarding. The agent calls the tools via bash. The proxy is ephemeral: starts with your CLI session, dies when it ends.The interesting part is that agents naturally start managing their own context without much prompting. In testing, the agent decided on its own to evict old research results before starting an implementation phase.Works with Codex CLI and Claude Code.Install: npm install -g context-surgeon Usage: context-surgeon codex
Enrichment
- Theme
- browser automation and scraping for AI
- Vertical
- Horizontal
- Function
- Agent / copilot
- Audience
- Developer
- AI stance
- AI-native
- Project type
- Commercial product
- Normalized one-liner
- let ai agents manage their own context
- Manually corrected
- False
Could you build this?
Yes Context Surgeon is an MCP server or middleware helper providing tools for agents to edit or prune previous tool call messages in their conversation history, which is straightforward prompt/message-array manipulation.
Discussion
5 comments analyzed.
Feature requests: Automatic state persistence to file between sessions, Project-level configuration folder (like .git) for storing state, Multi-session work support
Competitors
Other products that read as similar to this one — 279 launches clear the similarity bar, closest 8 shown.
Attention rank: #255 of 280 (itself plus its competitors, highest first — normalized so YC and Product Hunt are compared fairly).
Launched 158 days after the earliest competitor.
- Context-compact · hn · 2026-03-07 · 6 upvotes · similarity 0.56
- UltraContext · hn · 2026-01-21 · 21 upvotes · similarity 0.50
- I built a tool that turns any API into a CLI for agents · hn · 2026-03-01 · 6 upvotes · similarity 0.50
- ContextOS · ph · 2026-09-16 · 7 upvotes · similarity 0.48
- Context Auto-Maintainer · ph · 2026-09-29 · 2 upvotes · similarity 0.48
- Context Gateway · hn · 2026-03-13 · 97 upvotes · similarity 0.47
- A Context Registry for AI coding agents · hn · 2026-09-03 · 9 upvotes · similarity 0.47
- A better way to handoff web bugs to AI agents · hn · 2025-11-25 · 5 upvotes · similarity 0.46
Other launches for this product
- No other launches for this product.
Same idea, different domain
Nobody's really built a agent / copilot tool for Agriculture yet.