
ContextLib
io.github.willykeenan由 GitHub 账号 willykeenan 发布v0.1.0更新于 Oct 25, 2026
A project's long-term memory as plain Markdown files, with an append-only, tamper-evident log.
概览
ContextLib 让助手以纯 Markdown 文件保存项目长期记忆,并带有只追加、可防篡改的日志。
- 可以做什么
- 读取项目简报,搜索、获取并以带前置元数据和正文哈希的 Markdown 记录写入决策、需求、事实、经验、术语、来源和返回成果。取代、审阅、接受或拒绝记录,并列出到期需复审的记录。把结果文件捕获为返回记录并附上建议经验,导入或导出项目包。报告库状态与健康检查。
- 适用场景
- 当项目需要能跨助手会话保留、且以文件形式可读、可对比、可迁移的持久上下文,而不是只存在于聊天记录或仅模型可解析的存储中时使用。适合希望人与多个助手共享可审计决策与经验记录的团队。
- 运行要求
- 以 ctxlib 命令行(Python 3.9+,仅标准库)或已发布的 Docker 镜像在本地运行,库挂载到 /library。库路径来自 --library、环境变量 CONTEXTLIB_ROOT 或 ~/ContextLib。启动时用 --identity 固定身份。同步时 Git 可选。
安装
在 SourceWeft 中
- 打开 控制台中的 ContextLib,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
ContextLib
A project library that outlives every agent session.
Real screenshot of the sample library (an invented project).
Each project's knowledge — decisions, requirements, facts, lessons, glossary, sources and returned work — is stored as plain Markdown files with a small front-matter block, in one folder per project. The folders can sit on an external SSD. A person can understand a project from Finder alone. Agents read and write the same files through a CLI (ctxlib) and an MCP server (context_* tools). Any database is a search index rebuilt from the files, never the source of truth.
It is the open core of the context plugin of AgentBrain.
The Python package is agentbrain_contextlib. The CLI is ctxlib. Python 3.9+, standard library only. Git is optional.
Why
Agent sessions end. Chat logs drift. A store that only a model can parse is a dead end the first time you open Finder on an airplane.
ContextLib keeps the durable layer as files you can read, diff, copy, and take to another Mac. The search index is disposable. The Markdown is the product.
60-second quickstart
The library path is --library PATH, else env CONTEXTLIB_ROOT, else ~/ContextLib.
A finished sample you can open in Finder without installing anything lives at examples/sample-library/. Start at that README, then the project BRIEF, then decisions/INDEX.md.
Full walkthrough: docs/QUICKSTART.md.
CLI (ctxlib)
Types: decision, requirement, fact, lesson, glossary, source, return, brief-note.
MCP (context_* tools)
ctxlib mcp --identity ID is a stdio JSON-RPC server. Protocol versions: 2024-11-05, 2025-03-26, 2025-06-18.
Tools: context_brief, context_search, context_get, context_record, context_supersede, context_review_due, context_review, context_capture, context_export, context_import, context_status.
The identity is fixed at start. Tools cannot write as another identity. Errors come back as isError results.
Claude Code
Codex
Cursor
In .cursor/mcp.json (project) or ~/.cursor/mcp.json (user):
Details: docs/MCP.md.
Record format
A record is UTF-8 Markdown. It starts with a YAML-like front-matter block (scalars, quoted strings, lists of scalars, lists of flat maps) and a Markdown body. The body hash is stored in the front-matter; bodies are not rewritten.
Evidence refs are project:<relative path>, ssd:<relative path>, room:<name>#<seq>, url:<https url>, or note:<text>. Absolute home paths and secrets are refused at write time.
Ids: <prefix>-<YYYYMMDD>-<4 hex> with prefixes dec, req, fact, les, glo, src, ret, note.
Files: <YYYY-MM-DD>_<title-slug>_<id-suffix>.md. Superseded records move to superseded/ with the body hash still valid.
Library layout
Keeping the library on an SSD, using it unplugged, and moving it between Macs: docs/SSD.md.
Develop
Python 3.9+, standard library only. See CONTRIBUTING.md and CHANGELOG.md.
Apache-2.0, copyright KE Studios. SECURITY.md for reports.
ContextLib is the open library layer of AgentBrain (agentrooms.io).
Run with Docker
The image is published at ghcr.io/willykeenan/agentbrain-contextlib for Apple silicon and Intel. Mount your library at /library:
来源:README.md,提交 f373be1
工具
0版本历史
1- v0.1.0最新Sep 27, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
