ARTICLE DETAIL

资讯详情

深耕网站视觉设计与运营推广的一线实战洞察。

Memory — <name> (<id>)

Memory — <name> (<id>) Memory — ( )【免费下载链接】munder-difflinA local multi-agent harness that works with your existing Claude Code, Codex subscriptions, allows you to run an office of agents项目地址: https://gitcode.com/GitHub_Trending/mu/munder-difflinAppend durable facts, decisions, and context below.同时写入 cursor.json{ lastProcessed: null }用于跨会话记录“我已经处理到哪条消息”。这些就是技能文档第 1、2、4 步所操作的物理文件。 ## 第一步Read memory —— 为什么记忆必须是“文件优先” 技能要求第一步读取 $AGENT_DIR/memory.md。这套“markdown-first memory”是 HIVE 层锁定的设计决策之一见 [HIVE.md](https://link.gitcode.com/i/ea09aed93720f6b625d4a379ad9d7c4e) 第 2 节每个 Agent 有一份自管理的长期记忆文件会话开始时读取、学习时追加。5~15 个 Agent 的规模下重量级向量记忆层Letta/Mem0/Zep 这类反而是架构错误——它们想接管 Agent 运行时而 Munder Difflin 的运行时是独立的 claude CLI 进程因此记忆必须落在普通文件里。 md-hive-sync 的存在让“读记忆”不再依赖运气而是成为**每个任务起始的强制步骤**你上一轮会话里写下的决策、约束、坑会通过这个文件完整地传递给下一轮会话的“未来的你”。 记忆文件本身也可以被团队共享检索。当环境变量 MEMPALACE_PALACE_PATH 存在时即安装了 mempalace CLI[src/main/hive.ts](https://link.gitcode.com/i/0563f3fceefa077f1598ad46639b72d2) 中的 PROTOCOL_MD 提示 Agent 使用 mempalace search query 与 mempalace wake-up 进行语义检索而你的 memory.md 会被自动 mining 进共享 palace——你在第 4 步写入的持久化事实因此成为整个团队可搜索的知识。 ## 第二步Check inbox —— 收件箱与 .done/ 归档语义 技能的第二步是收件箱处理列出 $AGENT_DIR/inbox/ 中所有**不在** inbox/.done/ 中的文件逐个处理处理完成后用 mv 移入 inbox/.done/。 这套“处理→移动”的语义背后有三个关键设计 - **消息即文件且单写者**hive 的每条消息是一个独立的 JSON 文件ts-msgid.json通过 temp-file 原子 rename 写入绝不存在多个进程共同编辑同一个共享邮箱文件的问题[HIVE.md](https://link.gitcode.com/i/ea09aed93720f6b625d4a379ad9d7c4e) 第 3 节。消息由**路由器router**从发送者的 outbox/ 移入接收者的 inbox/Agent 从不直接写别人的目录——这就是“single-writer-per-file”约束。 - **.done/ 是审计而非垃圾桶**处理过的消息保留在原处供审计追溯而不是删除。配合 cursor.json 的 lastProcessed 游标保证重复读到已处理消息是 no-op不会二次处理。 - **收件箱非空即唤醒**从渲染层源码看[src/renderer/src/hooks/queueDelivery.ts](https://link.gitcode.com/i/1939aa7687c86df6c7030c9016126630)对应测试 [test/queue-delivery.test.cjs](https://link.gitcode.com/i/7a1d3ea5c6550471f75ecf710d53cf55)对空闲/停滞 Agent 的“inbox-wake”消息带有一个 inbox-nonempty 前置条件只有收件箱在投递那一刻仍然非空才会真正送达如果 Agent 在同一轮里已清空收件箱则直接丢弃——避免浪费一整轮去发现无事可读。 消息文件遵循 FIPA-lite 的语义字段[HIVE.md](https://link.gitcode.com/i/ea09aed93720f6b625d4a379ad9d7c4e) 第 4 节id、conversation、in_reply_to、from、to、act、subject、body、hops、requires_reply、needs_human、created_at。其中 act 的取值request | inform | propose | query | agree | refuse | done在 [src/main/hive.ts](https://link.gitcode.com/i/0563f3fceefa077f1598ad46639b72d2) 中被定义为 MessageAct 联合类型且只有 request、query、propose 强制要求回复inform 与 done 是终止性的——这直接呼应了技能中“逐个处理消息”时该有的克制不要对终止性消息回复否则两个 Agent 会无限对谈。 ### 消息怎么写向 hive 发送 JSON 处理收件箱时如果发现需要把信息转交他人技能隐含的下一步是“写 outbox”。PROTOCOL_MD[src/main/hive.ts](https://link.gitcode.com/i/0563f3fceefa077f1598ad46639b72d2) 中常量给出了 Agent 发送消息的确切格式——在 outbox/ 下写任意 .json 文件 json { to: agent-id | god | broadcast, act: request | inform | propose | query | agree | refuse | done, subject: one-line summary, body: the details, conversation: carry this across a thread (optional), in_reply_to: message id youre replying to (optional) }id、from、hops与时间戳由 harness 自动补全。这保证了md-hive-sync查收件箱时读到的每个消息都是结构完整、可追溯的。第三步Report —— 会话起始的情境感知第三步要求 Agent 总结记忆里有什么、收件箱里有哪些新消息、有哪些指派给自己的任务或对当前会话重要的信息。这一步是把“文件状态”变成“行动上下文”的桥梁。值得注意的是Munder Difflin 的 god 编排者orchestrator还有一层更强的机制LIVE ROSTER会被推送进 god 的上下文SessionStart 与每次 prompt 时而不是等它自己去读。测试 test/hive-roster-injection.test.cjs 验证了这条链路花名册以单行紧凑格式注入812k tok、$4.22、inbox 2、breaker warn并标记SUPERSEDES以覆盖 god 记忆中可能过期的团队状态近满上下文窗口的 Agentctx 99%会被明确标注给 god 作为路由信号。对普通 Agent 而言md-hive-sync的汇报步骤就是它的轻量版情境感知不需要读整个 fleet只需把“我的记忆 我的收件箱”压缩成一份开工简报。第四步End-of-task reminder —— 让“未来的你”记住技能的最后一步是会话结束前必须执行的回写把持久化事实、决策与结果追加到$AGENT_DIR/memory.md。追加而非覆盖记忆文件的写入约定是 append-only。初始模板明确写着_Append durable facts, decisions, and context below._保证历史决策链条完整保留。不写别人的目录Agent 只写自己的memory.md跨 Agent 的认知传递通过 outbox→router→inbox 完成PROTOCOL_MD 中的铁律Never write into another agents folder。被自动索引如第一步所述memory.md会被mempalace自动 mining 进共享 palacemtime 门控你追加的持久化事实会成为全团队的语义记忆。为保证索引干净hive 还会在每个 Agent 目录维护.gitignore排除settings.json、cursor.json、inbox/、outbox/、.codex/这类非记忆文件见 src/main/hive.ts 的ensureMineIgnore。技能如何进入 Agentbundled skills 的注入机制md-hive-sync不是用户手工粘贴的提示词而是随应用分发的捆绑技能在每次 spawn 时被自动复制进 Agent 的工作区。在 src/main/hive.ts 中ensureAgent()会执行if (opts.skillsDir) this.copyBundledSkills(opts.skillsDir, join(dir, .claude, skills));copyBundledSkills递归地把skills/源目录整树复制到每个 Agent 的.claude/skills/与identity.md相同的“每次 spawn 刷新”策略仓库中对应的源目录正是resources/skills/其中md-hive-sync/与capabilities/、md-audit/、md-fetch-summarize/、各 temporal 技能today、thisWeek、lastMonth等并列。技能的 frontmatter 定义了它的元数据与允许工具--- name: md-hive-sync version: 1.0.0 description: | Munder Difflin hive sync — runs the start-of-task hive protocol steps: reads memory.md, checks inbox/ for new messages, and reminds you to record durable facts in memory.md and write coordination files before ending. Use when asked to sync with the hive, check my inbox, hive status, or hive sync. Proactively suggest at the start of a new task if you havent checked your hive inbox in this conversation. (munder-difflin) allowed-tools: - Read - Bash ---【免费下载链接】munder-difflinA local multi-agent harness that works with your existing Claude Code, Codex subscriptions, allows you to run an office of agents项目地址: https://gitcode.com/GitHub_Trending/mu/munder-difflin创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表