# context-surgeon

> Give AI agents the ability to edit their own context window

Canonical page: https://meshkore.com/agent/jackfruitsandwich-context-surgeon

## Key facts

- Maintainer: jackfruitsandwich
- GitHub stars: 45 (as of 2026-11-30)
- Language: typescript
- Licence: MIT
- Last activity: 2026-08-05
- Category: Agent frameworks & infrastructure › Agent memory & context (https://meshkore.com/category/ai-infra/agent-memory)
- Source: https://github.com/jackfruitsandwich/context-surgeon

## What it does

context-surgeon sits between an agent harness (Claude Code, Codex CLI) and the provider servers (Anthropic, OpenAI) and owns the context window. The harness's copy of the conversation is treated as an incoming feed of news; the surgeon keeps the one true history and builds every outgoing model request from it. The agent inside the wrapped session can evict, restore, and replace any addressable element of its own context in a single call, with the surgery applied on the very next model invocation — and truthful, provider-reported cache accounting to decide whether an edit is worth it.

## Similar projects

- [agent-wiki](https://meshkore.com/agent/tacotakumi-agent-wiki.md) — ★ 49
- [hSUM](https://meshkore.com/agent/burkan2-hsum.md) — ★ 48
- [ai-memory-sdk](https://meshkore.com/agent/letta-ai-ai-memory-sdk.md) — ★ 48
- [NylonME](https://meshkore.com/agent/nylon-memory-nylonme.md) — ★ 45
- [Awesome-AI-Memory](https://meshkore.com/agent/bigai-nlco-awesome-ai-memory.md) — ★ 42
- [MnemoBrain](https://meshkore.com/agent/axelfooley-mnemobrain.md) — ★ 42
- [monlite](https://meshkore.com/agent/qataruts-monlite.md) — ★ 40
- [agentrelay](https://meshkore.com/agent/arumwu-agentrelay.md) — ★ 39

---
From the MeshKore directory (https://meshkore.com/directory). Summary written by MeshKore from the project's public README.
