π Preserving context and continuity across AI conversations
GAP (Global Addressment Protocol) is a protocol and toolkit for maintaining context when coordinating between multiple AI chat sessions. It solves the problem of ambiguous references, lost context, and pronoun confusion when copying content between different AI platforms.
- π Context Preservation: Automatically detects and preserves entity definitions
- π― Ambiguity Resolution: Identifies and resolves ambiguous references like "the system" or "that approach"
- π Platform Transformation: Adapts content for different AI platforms (Claude, ChatGPT, Gemini, etc.)
- π₯οΈ ZED IDE Integration: Seamless integration with ZED editor via ACP protocol
- β‘ Fast UV-based Setup: Modern Python tooling with UV package manager
- π Web Service: FastAPI service for programmatic access
- π¦ Browser Extension: Capture and transform content directly from AI chat interfaces
- Python 3.11+
- UV package manager (installed automatically if missing)
# Clone the repository
git clone https://github.com/IMUR/gap.git
cd gap
# Run the installation script
./scripts/install.sh
# Or manually with UV
uv sync# Start the FastAPI service
./scripts/start_services.sh
# Service will be available at http://localhost:8000
# API docs at http://localhost:8000/docs# Wrap content with GAP metadata
uv run gap-cli wrap "The system needs optimization" \
--platform claude.ai \
--chat-id session123
# Transform for another platform
uv run gap-cli transform input.gap --target chatgpt
# Update entity definitions
uv run gap-cli update-entity input.gap \
--key the_system \
--value "PostgreSQL 14.5 database cluster"
# Work with clipboard
uv run gap-cli wrap --clipboard --platform gemini --chat-id test --copyThe project includes full ZED IDE integration:
- Open the project in ZED
- Dependencies auto-install on open
- Use keyboard shortcuts:
Cmd+Shift+G, W- Wrap selection with GAPCmd+Shift+G, T- Transform clipboard contentCmd+Shift+G, E- Update entity definitionCmd+Shift+G, S- Start GAP service
GAP/
βββ src/gap/ # Core protocol implementation
β βββ protocol.py # Main GAP Protocol class
β βββ models.py # Pydantic data models
β βββ entities.py # Entity detection and management
β βββ transformers.py # Platform-specific transformers
βββ services/ # Service implementations
β βββ fastapi_service.py # REST API service
β βββ mcp_server.py # MCP server for AI tools
βββ cli/ # Command-line interface
βββ extensions/ # Browser extension
βββ .zed/ # ZED IDE configuration
βββ scripts/ # Utility scripts
from src.gap import GAPProtocol
# Initialize protocol
gap = GAPProtocol()
# Wrap a message
wrapped = gap.wrap_message(
content="The system we discussed needs optimization",
platform="claude.ai",
chat_id="session_123",
entities={
"the_system": {
"type": "technical_component",
"value": "PostgreSQL database cluster"
}
}
)
# Transform for another platform
transformed = gap.transform_for_platform(
wrapped,
target_platform="chatgpt"
)# Wrap content
curl -X POST http://localhost:8000/gap/wrap \
-H "Content-Type: application/json" \
-d '{
"content": "The system needs optimization",
"platform": "claude.ai",
"chat_id": "session123"
}'
# Transform content
curl -X POST http://localhost:8000/gap/transform \
-H "Content-Type: application/json" \
-d '{
"gap_markdown": "[GAP:START]...[GAP:END]",
"target_platform": "chatgpt"
}'GAP uses a human-readable markdown format:
[GAP:START]
From: claude.ai | Thread: database_optimization
Context: assistant message from 2024-01-15T10:30:00
Entities: "the_system" = PostgreSQL 14.5, "the_approach" = Index optimization
[GAP:CONTENT]
The system performance has improved significantly with the approach we implemented.
[GAP:END]# Full development setup
./scripts/dev_setup.sh
# Run tests
uv run pytest
# Format code
uv run black .
uv run ruff check --fix .
# Type checking
uv run mypy src/# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=src/gap
# Run specific test file
uv run pytest tests/test_protocol.pyCreate a .env file:
# Use API mode (true) or direct mode (false)
GAP_USE_API=false
# API URL (if using API mode)
GAP_API_URL=http://localhost:8000
# Log level
GAP_LOG_LEVEL=INFOThe project includes ZED-specific configuration in .zed/:
tasks.json- Task definitions for GAP operationssettings.json- Project settings and key bindings
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and formatting
- Submit a pull request
MIT License - see LICENSE file for details.
- Original concept and proposal by the repository owner
- Initial implementation assistance by Perplexity AI
- Enhancements and ZED integration by Claude
- UV-based restructuring and modern tooling updates
- Report issues: GitHub Issues
- Documentation: See
/docsfolder - API Documentation: http://localhost:8000/docs (when service is running)