Uses git repository root for automatic workspace detection and expects the .context/ directory to be committed to git for sharing context across machines and team members.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Context Management Systemshow me the TODO items for the authentication feature branch"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Context Management System
A context management system for AI development tools like Cursor, Claude Code, and Gemini CLI that enables leveraging previous context from chat sessions while maintaining dynamic workflows.
š Quick Start (5 Minutes)
Get up and running immediately:
Install dependencies:
pip install -r requirements.txt # Or install in development mode: pip install -e .Set up MCP integration (choose your tool):
Cursor: Copy
mcp-config-cursor.jsonto~/.cursor/mcp.jsonor.cursor/mcp.jsonin your projectGemini CLI: Copy
mcp-config-gemini.jsonto.gemini/settings.jsonin your projectClaude Desktop: Edit
~/Library/Application Support/Claude/claude_desktop_config.json
Restart your AI tool - The context management tools are now available!
Start using it - The AI will automatically:
Create context branches for different tasks
Log reasoning steps as it works
Create checkpoints when you make progress
Remember context across sessions
That's it! The system auto-detects your project workspace and creates a .context/ directory automatically.
⨠What You Get
Once set up, your AI assistant can:
Remember across sessions: Pick up exactly where you left off, even days later
Organize by task: Automatically branch context for different features/bugs
Track progress: See what's been done, what's pending, and what's next
Smart context switching: Automatically detect which branch matches your current work
No manual work: The AI handles all context management automatically
Features
LOG: Record reasoning steps as the AI works through problems
COMMIT: Checkpoint important points in chat sessions
BRANCH: Create new branches with easy access to previous branch context
MERGE: Merge context from multiple branches into the current branch
INFO: Get project information at different levels (project goals, branch summaries, detailed chat sessions)
TODO Management: Track and manage TODO items across branches
Smart Branch Detection: Automatically suggest the right branch for your work
Installation
Option 1: Development Install (Recommended)
Option 2: Direct Install
Integration Options
Option 1: MCP Server (Recommended)
The MCP (Model Context Protocol) server allows AI tools to call context management functions directly. This is the recommended approach as it enables seamless integration.
For Cursor
Quick Setup:
Copy the config file:
# For project-specific setup (recommended): cp mcp-config-cursor.json .cursor/mcp.json # Or for global setup: mkdir -p ~/.cursor cp mcp-config-cursor.json ~/.cursor/mcp.jsonEdit the in the config file to point to this repository:
{ "mcpServers": { "context-management": { "command": "python3", "args": ["-m", "src.mcp_server"], "cwd": "/absolute/path/to/context-engineering" } } }Note: Use
${workspaceFolder}for project-specific configs (Cursor will auto-replace it)Restart Cursor - The AI will now have access to context management tools!
What happens next:
When you start a new chat, the AI can call
context_status()to check your workspaceThe AI will automatically create a
.context/directory in your project rootAll context management happens automatically - no manual intervention needed
For Gemini CLI
Create the config directory:
mkdir -p .gemini cp mcp-config-gemini.json .gemini/settings.jsonEdit and update the
cwdpath:{ "mcpServers": { "context-management": { "command": "python3", "args": ["-m", "src.mcp_server"], "cwd": "/absolute/path/to/context-engineering" } } }Restart Gemini CLI - Context management tools are now available!
For Claude Desktop
Edit the config file:
# On macOS: open ~/Library/Application\ Support/Claude/claude_desktop_config.json # On Windows: # %APPDATA%\Claude\claude_desktop_config.json # On Linux: # ~/.config/Claude/claude_desktop_config.jsonAdd or merge this configuration:
{ "mcpServers": { "context-management": { "command": "python3", "args": ["-m", "src.mcp_server"], "cwd": "/absolute/path/to/context-engineering" } } }Restart Claude Desktop - You're all set!
Option 2: CLI Commands
Use the CLI directly or have the AI invoke shell commands:
šÆ First Steps After Setup
Once you've configured MCP and restarted your AI tool, here's what to expect:
1. Automatic Workspace Detection
When you start a new chat session, the AI will:
Automatically detect your project workspace (via git root or existing
.context/directory)Create a
.context/directory structure if it doesn't existInitialize the main context file with your project goals
2. Start Working Normally
Just work with your AI as usual! The system will:
Automatically branch when you switch to different tasks
Log reasoning steps as the AI thinks through problems
Create checkpoints when significant progress is made
Track TODOs across your work sessions
3. Example: Your First Session
4. Returning Later
When you come back days or weeks later:
No manual context management needed - it all happens automatically!
MCP Tools
When using the MCP server, the AI has access to these tools:
context_status() - Check workspace path and current branch. Used at session start.
context_set_workspace(workspace_path) - Set the project workspace directory. Used if auto-detection fails.
context_summary() - Get quick overview of TODOs and progress. Used at session start and when checking status.
context_detect_branch(context_hint) - Smart branching: find the right branch for current work. Used before starting new tasks.
context_todos(action, item, todo_id) - View, add, or complete TODO items. Used throughout the session.
context_log(reasoning_step) - Log a reasoning step during AI thought process. Used as the AI works through problems.
context_commit(message, from_log) - Checkpoint progress by creating a commit. Used when significant progress is made.
context_branch(name, purpose, from_branch, empty) - Create a new branch or switch to existing one. Used when switching tasks.
context_merge(branches) - Merge context from other branches. Used when combining work from multiple branches.
context_info(level, branch) - Get detailed project/branch/session information. Used when you need detailed context.
Note: The AI uses these tools automatically - you don't need to call them manually!
Workflow Example
Here's a real-world example of how the system works across multiple sessions:
Day 1: Starting a New Feature
You ask: "Let's add user authentication"
The AI automatically:
Detects this is a new task and calls
context_detect_branch("user authentication")Creates a new branch called "add-user-auth"
Logs: "Starting auth implementation..."
Works on the feature, logging steps like "Created User model..." and "Implemented login endpoint..."
Creates a checkpoint with
context_commit(from_log="all")
Day 2: Switching Tasks
You say: "Actually, let's fix the login bug first"
The AI automatically:
Detects the task switch and calls
context_detect_branch("login bug fix")Switches to (or creates) the "fix-login-bug" branch
Logs: "Investigating login issue..."
Finds and fixes the bug
Commits: "Fixed password validation"
Day 5: Returning to Previous Work
You ask: "What were we working on?"
The AI automatically:
Calls
context_summary()to load your contextShows you're on branch "add-user-auth"
Shows pending TODO: "Add password reset"
Shows last commit: "Implemented login endpoint"
Picks up exactly where you left off
Key Benefits:
No context loss between sessions
Automatic task organization
Seamless switching between features
Progress tracking and TODO management
Project Structure
The system creates a .context/ directory in your project root:
Important: The .context/ directory should be committed to git so context is shared across machines and team members.
Troubleshooting
MCP Server Not Working
Problem: AI doesn't have access to context tools
Solutions:
Check the config file path - Make sure you edited the correct config file for your tool
Verify the - Use absolute paths, not relative ones
Check Python path - Ensure
python3is in your PATHRestart your AI tool - MCP configs are only loaded on startup
Check for errors - Look in your AI tool's logs/console for MCP errors
Workspace Not Detected
Problem: context_status() shows wrong workspace or "not found"
Solutions:
Set workspace manually: The AI can call
context_set_workspace(workspace_path="/path/to/project")Ensure git repository: The system auto-detects via git root
Create : If needed, create
.context/in your project root
Branch Detection Not Working
Problem: AI creates new branches instead of switching to existing ones
Solutions:
Use descriptive hints: When the AI calls
context_detect_branch(), provide clear contextCheck branch names: Existing branches are matched by name similarity
Manual switch: You can ask the AI to switch branches explicitly
Context Not Persisting
Problem: Context is lost between sessions
Solutions:
Check : The directory should be in your project root
Verify git commit: Make sure
.context/is committed to gitCheck branch: Ensure you're on the same branch as before
Development
This tool is under active development. See TODO.md for implementation progress.
Contributing
Contributions are welcome! The system is designed to be extensible and modular.
Requirements
Python 3.8+
See
requirements.txtfor dependencies