Mycelium 是一个通过 git notes 实现的文件级知识基底工具,笔记存储在 refs/notes/mycelium 引用下。项目将笔记称为“daimonic spores”(代蒙孢子),即写下笔记的智能体所脱落的灵魂本质碎片。其核心理念是:在开始处理某个文件之前,先检查它是否有笔记;在完成有意义的工作之后,留下一条笔记。
用途
Mycelium 用于在 git 仓库中为文件和提交附加结构化的知识笔记,帮助智能体或开发者记录决策理由、背景信息、警告、约束等,使这些知识能够跨会话、跨智能体保留,而不只是存在于提交信息中。
主要能力
- 笔记种类:支持多种笔记类型,包括 decision(为何选择某方案,其理由比提交信息更持久)、context(接触代码前需要的背景)、summary(文件或模块的功能)、warning(脆弱区域、陷阱、非显而易见的破坏)、constraint(硬性规则,如必须可重试、不得依赖 X)、observation(已注意到但尚未行动的事项)、value(文化原则,指导判断)、todo(计划中的工作,完成后可堆肥)。
- Subdaimon Slots:每个 subdaimon 写入自己的 slot 以保留身份。例如
mycelium.sh note src/auth.rs -k warning --slot bohen -m "Race condition in token refresh."和mycelium.sh note src/auth.rs -k decision --slot demiurge -m "Used mutex over channel."。context 会聚合所有 slot,read --slot <name> 则读取单个 slot。 - 质量门禁:写笔记前需验证:新颖性(是否已有类似笔记,可用
mycelium.sh read <file>检查)、具体性(是关于此文件还是整个项目,项目级应使用mycelium.sh note .)、持久性(两周后是否仍重要,短暂信息应放工作记忆而非 mycelium)、无秘密(不得包含 API 密钥、令牌、密码或 PII)。 - 堆肥(Composting):文件变更后笔记会过时,可在有意义的工作后堆肥:
mycelium.sh compost <file> --dry-run查看过时内容,mycelium.sh compost <oid> --compost吸收并归档,mycelium.sh compost <oid> --renew仍然为真则重新附加。constraint 和 value 笔记会优雅地老化,优先使用 --renew 而非 --compost。
使用方式
到达时:
mycelium.sh find constraint # 项目原则与规则
mycelium.sh find warning # 已知脆弱事项
mycelium.sh context <file> # 关于该文件的所有已知信息
工作后:
mycelium.sh note <file> -k <kind> --slot <your-name> -m "<insight>"
mycelium.sh note HEAD -k context -m "What I did and why."
命令参考:
mycelium.sh note [target] -k <kind> -m <body> Write a note
mycelium.sh read [target] Read a note
mycelium.sh follow [target] Read + resolve edges
mycelium.sh refs [target] All notes pointing at target
mycelium.sh context <path> All notes for a path
mycelium.sh find <kind> Find by kind
mycelium.sh compost [path|oid] [--dry-run] Triage stale notes
mycelium.sh doctor Graph health
mycelium.sh prime Full context for agents
设置(每个仓库一次):
mycelium.sh activate # notes visible in git log
mycelium.sh sync-init # notes travel with fetch/push
适用场景
适用于需要跨会话保留文件级知识的 git 仓库,尤其是多智能体协作或长期维护的项目,帮助记录决策理由、背景、警告和约束,避免重复踩坑。
限制
- Bash 3.2 兼容性:macOS 自带 bash 3.2,在 set -u 下空数组存在 bug。安装在 ~/.local/bin/ 的 mycelium.sh 已用
${array[@]+"${array[@]}"}模式打补丁以兼容。 - 笔记不得包含秘密(API 密钥、令牌、密码或 PII)。
- 短暂信息不应写入 mycelium,应放工作记忆。
- 项目级信息应使用
mycelium.sh note .而非针对单个文件。
其他功能、收费、价格、平台、效果或使用步骤暂未提供。