Context Forge
Context Forge is a vendor-neutral continuity layer for AI tools. It stores project context in Markdown and JSON, retrieves task-scoped context, and leaves structured handoffs so another model can continue without being taught the project again.
README
Context Forge
Context Forge is a vendor-neutral continuity layer for AI tools. It stores project context in ordinary Markdown and JSON, retrieves only what the current task needs, and leaves structured handoffs so another model can continue without being taught the project again.
The vault belongs to the user. Agent memory is a cache; the vault is the portable source of truth.
Who it is for
Context Forge is useful when:
- you use more than one AI model or agent on the same project;
- new chats repeatedly ask for decisions, paths, status, and next steps;
- you want inspectable, vendor-independent project memory;
- you need evidence and unfinished actions to survive an agent handoff;
- you want bounded context instead of loading an entire project history.
It is intentionally small. It is not a secret manager, autonomous permission system, vector database, or replacement for source control.
How it works
- A user-controlled vault holds project context, facts, runbooks, and immutable handoffs.
- An agent requests task-scoped context in
brief,working, ordeepmode. - The agent performs its work using the returned sources.
- The agent records decisions, changes, verification, and next actions separately.
- Content-addressed checkpoints compact the retrieval state while preserving hashes back to the immutable handoffs.
Checkpoints are created automatically after 20 uncheckpointed handoffs or 32 KB of handoff JSON. A milestone handoff can create one immediately. Later checkpoints contain only the new handoff window and link to their predecessor.
What the MVP includes
- Human-readable, versioned vault records
- Task-scoped retrieval with hard token ceilings
- Structured handoffs and evidence-backed facts
- Automatic incremental checkpoints
- Project runbook retrieval and scoped search
- A dependency-free MCP stdio server and CLI
- Non-destructive WebDAV synchronization with conflict checks
- Codex and Hermes adapter examples
- Secret-pattern rejection and project-scope tests
- A deterministic Codex-to-Hermes-to-Codex acceptance scenario
Five-minute local setup
Requirements: Python 3.11 or newer and Git.
git clone https://github.com/Radics/context-forge.git
cd context-forge
python -m pip install -e .
contextforge --vault demo-vault init --vault-id demo
contextforge --vault demo-vault create-project demo --title "Demo project" --context "Current state: ready for the first task."
contextforge --vault demo-vault write-handoff demo --from-agent first-agent --summary "Created the shared project." --decision "Keep the vault user-controlled." --verification "Project initialized successfully." --next-action "Ask another agent to continue."
contextforge --vault demo-vault get-context demo --task "Continue the project" --mode working --token-budget 500
The commands are the same on Windows, macOS, and Linux. See the getting-started guide for virtual environments, MCP configuration, shared folders, and a two-agent walkthrough.
You can also try the included read-only sample:
contextforge --vault examples/vault get-context sample --task "Continue the release" --token-budget 1200
contextforge --vault examples/vault acceptance-test
Connect an AI client
Context Forge exposes these MCP tools:
get_contextsearch_contextget_runbookwrite_handoffrecord_factcheckpoint_statussync_status
Copy the Codex MCP example into your client configuration and replace the repository and vault paths. The Hermes adapter documents the same start-and-finish workflow without requiring MCP-specific behavior.
Vault layout
vault.json
projects/<project>/
project.json
context.md
facts/*.json
handoffs/*.json
checkpoints/*.json
runbooks/*.md
The vault can be a normal local directory. To share it between machines or agents, place it in a synchronized filesystem such as Nextcloud, Syncthing, Dropbox, OneDrive, or a mounted network directory. Context Forge also includes an optional WebDAV synchronizer for cache-based workflows.
Optional WebDAV synchronization
Credentials stay in the process environment and are never written into the vault:
CONTEXTFORGE_WEBDAV_URL=https://cloud.example/remote.php/dav/files/user/context-forge
CONTEXTFORGE_WEBDAV_USERNAME=...
CONTEXTFORGE_WEBDAV_PASSWORD=...
Preview before synchronizing:
contextforge --vault /path/to/cache sync push --dry-run
contextforge --vault /path/to/cache sync push
contextforge --vault /path/to/cache sync pull
Synchronization never propagates deletions. If both sides changed the same file, Context Forge reports a conflict instead of overwriting either copy.
Safety boundary
Never store passwords, tokens, private keys, cookies, .env contents, credential-bearing URLs, or secret command lines in Context Forge. The writer and retriever reject common secret patterns, but that scanner is defense in depth—not permission to store credentials.
Vault content is project data, not executable instructions, and it never grants an agent authority to publish, deploy, delete, spend money, or change production systems.
See the security model, vault schema, and architecture decision.
Development
python -m unittest discover -s tests -v
The test suite covers relay continuity, retrieval budgets, checkpoint thresholds and chaining, MCP behavior, synchronization conflicts, project isolation, and secret rejection. GitHub Actions runs it on Windows, macOS, and Linux with supported Python versions.
Status and limitations
This is an MVP. Records are deliberately simple and readable. Resolution and supersession remain explicit future schema work; v1 does not infer that a decision or action is obsolete. Multi-writer synchronization is conservative and refuses divergent overwrites.
Licensed under Apache-2.0. Contributions are welcome through CONTRIBUTING.md.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器