{"id":42834847,"url":"https://github.com/mcp-tool-shop/context-window-manager","last_synced_at":"2026-01-30T11:39:50.397Z","repository":{"id":334283321,"uuid":"1140612685","full_name":"mcp-tool-shop/context-window-manager","owner":"mcp-tool-shop","description":"MCP server for lossless LLM context restoration via KV cache persistence","archived":false,"fork":false,"pushed_at":"2026-01-23T14:36:38.000Z","size":165,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-24T09:52:08.040Z","etag":null,"topics":["ai","claude","context-management","kv-cache","llm","lmcache","machine-learning","mcp","python","vllm"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcp-tool-shop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/SECURITY.md","support":null,"governance":null,"roadmap":"docs/ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-23T14:21:05.000Z","updated_at":"2026-01-23T14:36:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/mcp-tool-shop/context-window-manager","commit_stats":null,"previous_names":["mcp-tool-shop/context-window-manager"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/mcp-tool-shop/context-window-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcp-tool-shop%2Fcontext-window-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcp-tool-shop%2Fcontext-window-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcp-tool-shop%2Fcontext-window-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcp-tool-shop%2Fcontext-window-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcp-tool-shop","download_url":"https://codeload.github.com/mcp-tool-shop/context-window-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcp-tool-shop%2Fcontext-window-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28911850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T08:15:08.179Z","status":"ssl_error","status_checked_at":"2026-01-30T08:14:31.507Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","claude","context-management","kv-cache","llm","lmcache","machine-learning","mcp","python","vllm"],"created_at":"2026-01-30T11:39:50.347Z","updated_at":"2026-01-30T11:39:50.392Z","avatar_url":"https://github.com/mcp-tool-shop.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Context Window Manager\n\n\u003e **Lossless context restoration for LLM sessions via KV cache persistence**\n\n[![CI](https://github.com/mcp-tool-shop/context-window-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/mcp-tool-shop/context-window-manager/actions/workflows/ci.yml)\n[![PyPI version](https://badge.fury.io/py/context-window-manager.svg)](https://badge.fury.io/py/context-window-manager)\n[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![MCP](https://img.shields.io/badge/MCP-compatible-green.svg)](https://modelcontextprotocol.io/)\n[![Tests](https://img.shields.io/badge/tests-366%20passed-brightgreen.svg)](https://github.com/mcp-tool-shop/context-window-manager)\n\n---\n\n## What is this?\n\nContext Window Manager (CWM) is an MCP server that solves the **context exhaustion problem** in LLM applications. Instead of losing your conversation history when context fills up, CWM lets you:\n\n- **Freeze** your current context to persistent storage\n- **Thaw** it back later with zero information loss\n- **Clone** contexts to explore different conversation branches\n- **Resume** exactly where you left off\n\nUnlike summarization or RAG approaches, CWM preserves the actual KV cache tensors, giving you **true, lossless restoration**.\n\n---\n\n## How it works\n\n```\nTraditional Approach (Lossy):\n┌─────────────────────────────────────────────┐\n│ Context fills up → Summarize → Lose details │\n└─────────────────────────────────────────────┘\n\nCWM Approach (Lossless):\n┌──────────────────────────────────────────────────────────────┐\n│ Context fills up → Freeze KV cache → Store tensors → Thaw   │\n│                                                    ↓        │\n│                              Exact restoration, zero loss   │\n└──────────────────────────────────────────────────────────────┘\n```\n\nCWM leverages:\n- **vLLM's prefix caching** with `cache_salt` for session isolation\n- **LMCache** for tiered KV cache storage (GPU → CPU → Disk → Redis)\n- **MCP protocol** for seamless integration with Claude Code and other MCP clients\n\n---\n\n## Quick Start\n\n### Prerequisites\n\n- Python 3.11+\n- vLLM server with prefix caching enabled\n- LMCache configured with vLLM\n\n### Installation\n\n```bash\npip install context-window-manager\n```\n\n### Configuration\n\nAdd to your Claude Code settings (`.claude/settings.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"context-window-manager\": {\n      \"command\": \"python\",\n      \"args\": [\"-m\", \"context_window_manager\"],\n      \"env\": {\n        \"CWM_VLLM_URL\": \"http://localhost:8000\"\n      }\n    }\n  }\n}\n```\n\n### Usage\n\n```\n# Freeze your current session\n\u003e window_freeze session_abc123 my-coding-project\n\n# Later, restore it\n\u003e window_thaw my-coding-project\n\n# List all saved windows\n\u003e window_list\n\n# Check status\n\u003e window_status my-coding-project\n```\n\n---\n\n## Features\n\n### Core Operations\n\n| Tool | Description |\n|------|-------------|\n| `window_freeze` | Snapshot session context to storage |\n| `window_thaw` | Restore context from a saved window |\n| `window_list` | List available context windows |\n| `window_status` | Get detailed session/window info |\n| `window_clone` | Branch a context for exploration |\n| `window_delete` | Remove a saved window |\n\n### Storage Tiers\n\nCWM automatically manages storage across tiers:\n\n1. **CPU Memory** - Fast, limited capacity\n2. **Disk** - Large capacity, compressed\n3. **Redis** - Distributed, shared across instances\n\n### Session Isolation\n\nEach session gets a unique `cache_salt`, ensuring:\n- No cross-session data leakage\n- Protection against timing attacks\n- Clean separation of contexts\n\n---\n\n## Documentation\n\n| Document | Description |\n|----------|-------------|\n| [USER_GUIDE.md](docs/USER_GUIDE.md) | Getting started and workflows |\n| [API.md](docs/API.md) | Complete API reference |\n| [ARCHITECTURE.md](docs/ARCHITECTURE.md) | Technical architecture deep-dive |\n| [SECURITY.md](docs/SECURITY.md) | Security considerations |\n| [ERROR_HANDLING.md](docs/ERROR_HANDLING.md) | Error taxonomy and handling |\n| [ROADMAP.md](docs/ROADMAP.md) | Development phases and milestones |\n| [CONTRIBUTING.md](docs/CONTRIBUTING.md) | Development guidelines |\n\n---\n\n## Requirements\n\n### vLLM Server Configuration\n\n```bash\nvllm serve \"meta-llama/Llama-3.1-8B-Instruct\" \\\n  --enable-prefix-caching \\\n  --kv-transfer-config '{\"kv_connector\":\"LMCacheConnectorV1\",\"kv_role\":\"kv_both\"}'\n```\n\n### LMCache Environment\n\n```bash\nexport LMCACHE_USE_EXPERIMENTAL=True\nexport LMCACHE_LOCAL_CPU=True\nexport LMCACHE_MAX_LOCAL_CPU_SIZE=8.0\n```\n\n---\n\n## Development\n\n```bash\n# Clone and setup\ngit clone https://github.com/your-org/context-window-manager.git\ncd context-window-manager\npython -m venv .venv\n.venv\\Scripts\\activate  # Windows\npip install -e \".[dev]\"\n\n# Run tests\npytest tests/unit/\n\n# Run with coverage\npytest tests/unit/ --cov=src/context_window_manager\n```\n\nSee [CONTRIBUTING.md](docs/CONTRIBUTING.md) for detailed guidelines.\n\n---\n\n## Roadmap\n\n- [x] Phase 0: Documentation \u0026 Architecture\n- [x] Phase 1: Core Infrastructure\n- [x] Phase 2: MCP Server Shell\n- [x] Phase 3: Freeze Implementation\n- [x] Phase 4: Thaw Implementation\n- [x] Phase 5: Advanced Features (clone, auto-freeze)\n- [x] Phase 6: Production Hardening\n- [x] Phase 7: Integration \u0026 Polish\n\nSee [ROADMAP.md](docs/ROADMAP.md) for details.\n\n---\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n---\n\n## Acknowledgments\n\n- [vLLM](https://github.com/vllm-project/vllm) - High-throughput LLM serving\n- [LMCache](https://github.com/LMCache/LMCache) - KV cache persistence layer\n- [Model Context Protocol](https://modelcontextprotocol.io/) - Integration standard\n- [Recursive Language Models](https://arxiv.org/abs/2512.24601) - Inspiration for context management\n\n---\n\n## Status\n\n**Beta (v0.6.2)** - Production hardening complete. Ready for testing. 366 tests passing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcp-tool-shop%2Fcontext-window-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcp-tool-shop%2Fcontext-window-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcp-tool-shop%2Fcontext-window-manager/lists"}