Updated readme with an amazing new discovery
This commit is contained in:
@@ -8,6 +8,7 @@ This guide covers advanced features, configuration options, and workflows for po
|
||||
- [Model Usage Restrictions](#model-usage-restrictions)
|
||||
- [Thinking Modes](#thinking-modes)
|
||||
- [Tool Parameters](#tool-parameters)
|
||||
- [Context Revival: AI Memory Beyond Context Limits](#context-revival-ai-memory-beyond-context-limits)
|
||||
- [Collaborative Workflows](#collaborative-workflows)
|
||||
- [Working with Large Prompts](#working-with-large-prompts)
|
||||
- [Web Search Integration](#web-search-integration)
|
||||
@@ -276,6 +277,33 @@ All tools that work with files support **both individual files and entire direct
|
||||
"Refactor src/ for better organization, focus on maintainability and readability"
|
||||
```
|
||||
|
||||
## Context Revival: AI Memory Beyond Context Limits
|
||||
|
||||
**The Zen MCP Server's most revolutionary feature** is its ability to maintain conversation context even after Claude's memory resets. This enables truly persistent AI collaboration across multiple sessions and context boundaries.
|
||||
|
||||
### 🔥 **The Breakthrough**
|
||||
|
||||
Even when Claude's context resets or compacts, conversations can continue seamlessly because other models (O3, Gemini) have access to the complete conversation history stored in Redis and can "remind" Claude of everything that was discussed.
|
||||
|
||||
### Key Benefits
|
||||
|
||||
- **Persistent conversations** across Claude's context resets
|
||||
- **Cross-tool continuation** with full context preservation
|
||||
- **Multi-session workflows** that maintain complete history
|
||||
- **True AI orchestration** where models can build on each other's work
|
||||
- **Seamless handoffs** between different tools and models
|
||||
|
||||
### Quick Example
|
||||
|
||||
```
|
||||
Session 1: "Design a RAG system with gemini pro"
|
||||
[Claude's context resets]
|
||||
Session 2: "Continue our RAG discussion with o3"
|
||||
→ O3 receives the full history and reminds Claude of everything discussed
|
||||
```
|
||||
|
||||
**📖 [Read the complete Context Revival guide](context-revival.md)** for detailed examples, technical architecture, configuration options, and best practices.
|
||||
|
||||
## Collaborative Workflows
|
||||
|
||||
### Design → Review → Implement
|
||||
|
||||
96
docs/context-revival.md
Normal file
96
docs/context-revival.md
Normal file
@@ -0,0 +1,96 @@
|
||||
# Context Revival: AI Memory Beyond Context Limits
|
||||
|
||||
## **The Most Profound Feature: Context Revival After Reset**
|
||||
|
||||
**This powerful feature cannot be highlighted enough**: The Zen MCP Server implements a simple continuation system that seemingly transcends Claude's context limitations.
|
||||
|
||||
## How Context Revival Works
|
||||
|
||||
The conversation memory system (`utils/conversation_memory.py`) implements a sophisticated architecture that bridges the gap between Claude's stateless
|
||||
nature and true persistent AI collaboration (within limits, of course):
|
||||
|
||||
### The Architecture Behind the Magic
|
||||
|
||||
1. **Persistent Thread Storage**: Every conversation creates a UUID-based thread stored in memory
|
||||
2. **Cross-Tool Continuation**: Any tool can pick up where another left off using the same `Continuation ID`, like an email thread identifier
|
||||
3. **Context Reconstruction**: When Claude's context resets, past conversations persist in the MCP's memory
|
||||
4. **History Retrieval**: When you prompt Claude to `continue` with another model, the MCP server rebuilds the entire conversation history, including file references
|
||||
5. **Full Context Transfer**: The complete conversation context gets passed to the other model (O3, Gemini, etc.) with awareness of what was previously discussed
|
||||
6. **Context Revival**: Upon returning the response to Claude, the other model effectively "reminds" Claude of the entire conversation, re-igniting Claude's understanding
|
||||
|
||||
### The Dual Prioritization Strategy
|
||||
|
||||
The system employs a sophisticated **"newest-first"** approach that ensures optimal context preservation:
|
||||
|
||||
**File Prioritization**:
|
||||
- Walks backwards through conversation turns (newest to oldest)
|
||||
- When the same file appears multiple times, only the **newest reference** is kept
|
||||
- Ensures most recent file context is preserved when token limits require exclusions
|
||||
|
||||
**Conversation Turn Prioritization**:
|
||||
- **Collection Phase**: Processes turns newest-to-oldest to prioritize recent context
|
||||
- **Presentation Phase**: Reverses to chronological order for natural LLM flow
|
||||
- When token budget is tight, **older turns are excluded first**
|
||||
|
||||
## Real-World Context Revival Example
|
||||
|
||||
Here's how this works in practice with a modern AI/ML workflow:
|
||||
|
||||
**Session 1 - Claude's Initial Context (before reset):**
|
||||
You: "Help me design a RAG system for our customer support chatbot. I want to integrate vector embeddings with real-time retrieval. think deeply with zen using 03 after you've come up with a detailed plan."
|
||||
|
||||
Claude: "I'll analyze your requirements and design a comprehensive RAG architecture..."
|
||||
→ Uses [`thinkdeep`](../README.md#1-chat---general-development-chat--collaborative-thinking) to brainstorm the overall approach
|
||||
→ Zen creates a new thread: abc123-def456-ghi789
|
||||
→ Zen responds, Claude finalizes the plan and presents it to you
|
||||
|
||||
*[Claude's context gets reset/compacted after extensive analysis]*
|
||||
|
||||
**Session 2 - After Context Reset:**
|
||||
You: "Continue our RAG system discussion with O3 - I want to focus on the real-time inference optimization we talked about"
|
||||
|
||||
→ Claude re-uses the last continuation identifier it received, _only_ poses the new prompt (since Zen is supposed to know what was being talked about) thus saving on tokens trying to re-prompt Claude
|
||||
→ O3 receives the FULL conversation history from Zen
|
||||
→ O3 sees the complete context: "Claude was designing a RAG system, comparing vector databases, and analyzing embedding strategies for customer support..."
|
||||
→ O3 continues: "Building on our previous vector database analysis, for real-time inference optimization, I recommend implementing semantic caching with embedding similarity thresholds..."
|
||||
→ O3's response re-ignites Claude's understanding of the entire conversation
|
||||
|
||||
Claude: "Ah yes, excellent plan! Based on O3's optimization insights and our earlier vector database comparison, let me implement the semantic caching layer..."
|
||||
|
||||
**The Magic**: Even though Claude's context was completely reset, the conversation flows seamlessly because O3 had access to the entire conversation history and could "remind" Claude of everything that was discussed.
|
||||
|
||||
## Why This Changes Everything
|
||||
|
||||
**Before Zen MCP**: Claude's context resets meant losing entire conversation threads.
|
||||
Complex multi-step analyses were fragmented and had to restart from scratch. You most likely need to re-prompt Claude or to make it re-read some previously
|
||||
saved document / `CLAUDE.md` etc - no need. Zen remembers.
|
||||
|
||||
**With Zen MCP**: Claude can orchestrate multi-hour, multi-tool workflows where:
|
||||
- **O3** handles logical analysis and debugging
|
||||
- **Gemini Pro** performs deep architectural reviews
|
||||
- **Flash** provides quick formatting and style checks
|
||||
- **Claude** coordinates everything while maintaining full context
|
||||
|
||||
**The breakthrough**: Even when Claude's context resets, the conversation continues seamlessly because other models can "remind" Claude of the complete conversation history stored in memory.
|
||||
|
||||
## Configuration
|
||||
|
||||
The system is highly configurable:
|
||||
|
||||
```env
|
||||
# Maximum conversation turns (default: 20)
|
||||
MAX_CONVERSATION_TURNS=20
|
||||
|
||||
# Thread expiration in hours (default: 3)
|
||||
CONVERSATION_TIMEOUT_HOURS=3
|
||||
```
|
||||
|
||||
## The Result: True AI Orchestration
|
||||
|
||||
This isn't just multi-model access—it's **true AI orchestration** where:
|
||||
- Conversations persist beyond context limits
|
||||
- Models can build on each other's work across sessions
|
||||
- Claude can coordinate complex multi-step workflows
|
||||
- Context is never truly lost, just temporarily unavailable to Claude
|
||||
|
||||
**This is the closest thing to giving Claude permanent memory for complex development tasks.**
|
||||
Reference in New Issue
Block a user