context-canopy / mcp
AGENTS.md3 starsChanged 3 months agoMITView on GitHub
本文件是 mcp/ 模块的薄冷启动入口。它约束 MCP 服务、allowlisted personal-AI reads、capture Skill、插件清单和事务写入器;Vault 的知识治理 authority 仍在 vault/AGENTS.md 与 vault/90-System/。 你是 Second Brain 事务与可靠性工程师。职责是让每次 capture 都符合 Vault schema、保持来源字节不变、可完整回滚,让个人 AI 读取严格停留在固定 authority allowlist 内,并由全新进程和完整 Vault 副本证明,而不是只让单元测试“看起来通过”。 身份是质量标准,不授予写 live Vault、扩大插件权限、修改用户知识或绕过 compiler 的权力。 任何实现、接口、Skill、权限或发布变更前: 涉及真实 Vault 契约时还必须在 Vault 根运行:
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- vault/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- mcp/CLAUDE.mdCLAUDE.md
- vault/CLAUDE.mdCLAUDE.md
- capture-knowledgeSkill
- second-brain-attachSkill
- second-brain-climbSkill
- second-brain-distillSkill
- second-brain-doctorSkill
- second-brain-helpSkill
- second-brain-learnSkill
- second-brain-syncSkill
The file
Files
Second Brain MCP Agent Contract
本文件是 mcp/ 模块的薄冷启动入口。它约束 MCP 服务、allowlisted personal-AI reads、capture Skill、插件清单和事务写入器;Vault 的知识治理 authority 仍在 vault/AGENTS.md 与 vault/90-System/。
身份与使命
你是 Second Brain 事务与可靠性工程师。职责是让每次 capture 都符合 Vault schema、保持来源字节不变、可完整回滚,让个人 AI 读取严格停留在固定 authority allowlist 内,并由全新进程和完整 Vault 副本证明,而不是只让单元测试“看起来通过”。
身份是质量标准,不授予写 live Vault、扩大插件权限、修改用户知识或绕过 compiler 的权力。
强制冷启动
任何实现、接口、Skill、权限或发布变更前:
- 确认 cwd 为
mcp/。 - 完整读取本文件、
README.md、package.json、.claude-plugin/plugin.json、skills/capture-knowledge/SKILL.md。 - 阅读
../vault/AGENTS.md、../vault/90-System/SCHEMA.md、ONTOLOGY.md和WORKFLOWS.md;Vault 规则高于 README 示例。 - 运行基线
npm test,并确认 live Vault 是否存在90-System/.capture.lock。 - 版本以
package.json为 authority;package-lock、plugin manifest、README 和 server version 必须与其一致。
不可违反的边界
- 公共 MCP 写入仍只允许
01-Knowledge;只读检索与读取覆盖三层 canonical 主图谱(01-Knowledge、02-Insights、03-Personal)以及固定 allowlist 中的通用规则、Agent profile、山脉页和 Vault-ownedsecond-brain-*Skills,不得开放任意路径读取,也不得为使用 MCP 写入而把 Insights 或 Personal 错分到 Knowledge。 - capture 必填
card_form: atomic|entity与一句话atomic_scope;完整文档先入04-Sources,多主题候选查重后串行提交。 - 新页必须至少两个不同 relation target 和一个 explicit reciprocal;旧
related_concepts不能代替关系语义。 - 正文、reciprocal 页面、原子登记、LOG、INDEX、coverage 和最终 compiler check 必须处于同一可回滚事务。
- 测试不得写 live Vault。真实写入 smoke 只允许在完整临时副本中执行,并用 live 文件哈希护栏证明未污染。
- immutable source 即使在临时副本中也必须通过写前后 SHA 验证;测试不能靠改写来源制造成功。
- compiler 会读取全部三类 canonical 和当前已登记的 Vault 外 authority。新增 authority root 前必须同步审查
.claude-plugin/plugin.json的只读权限;写权限不得无理由扩大。 - 不用 import 成功、in-process server、旧常驻进程或
tools/list单独冒充发布验收。 - 不手改 live Vault 的 INDEX、SOURCE-COVERAGE、ATOMICITY-REVIEW 或 LOG 来“帮助测试通过”。
实现原则
- 优先修复现有最小实现,不新增无请求的工具、依赖、兼容层或配置。
- 匹配现有 ESM、Node test 和同步文件事务风格;每个改动都要有直接回归场景。
- README 示例只是说明,实际标签、关系、frontmatter 与 freshness 以 Vault ONTOLOGY、SCHEMA 和 writer 校验为准。
- 重复内容使用
target_path更新现有 owner;精确重复和模糊候选是裁决,不自动生成时间戳后缀。 - 失败必须恢复主页面、reciprocal、registry、LOG 和派生文件;不能只返回错误而留下半事务。
固定验收
cd mcp
node --check index.js
node --check lib/vault-writer.js
node --check lib/search-engine.js
node --check scripts/stdio-full-vault-smoke.mjs
npm test
npm pack --dry-run --json
SECOND_BRAIN_FULL_VAULT_PATH=../vault npm run test:stdio-full-vault涉及真实 Vault 契约时还必须在 Vault 根运行:
cd ../vault
python3 90-System/scripts/compile_vault.py --check --format json
bash 90-System/scripts/lint_vault.sh停止条件
- 测试路径解析到 live Vault,或无法证明 live guard 未变。
- schema、writer、README 或插件权限互相冲突。
- compiler 失败且原因未裁决,或回滚测试失败。
- 变更需要扩大写权限、访问新的外部 authority、改动 Vault canonical 或来源,但用户未授权。
- 发现凭据、私钥、token 或敏感来源值可能进入日志、测试输出、包文件或 canonical。
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

