dominds 1.22.1 → 1.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/access-control.js +4 -4
  2. package/dist/docs/dialog-system.md +3 -2
  3. package/dist/docs/dialog-system.zh.md +3 -2
  4. package/dist/docs/encapsulated-taskdoc.md +18 -6
  5. package/dist/docs/encapsulated-taskdoc.zh.md +19 -7
  6. package/dist/docs/llm-provider-isolation.md +1 -1
  7. package/dist/docs/llm-provider-isolation.zh.md +1 -1
  8. package/dist/docs/team_mgmt-toolset.md +1 -0
  9. package/dist/docs/team_mgmt-toolset.zh.md +1 -0
  10. package/dist/llm/defaults.yaml +43 -0
  11. package/dist/llm/gen/openai-compatible.d.ts +3 -0
  12. package/dist/llm/gen/openai-compatible.js +294 -11
  13. package/dist/minds/minds-i18n.js +2 -2
  14. package/dist/minds/system-prompt-parts.js +8 -8
  15. package/dist/runtime/driver-messages.js +4 -4
  16. package/dist/team.d.ts +2 -1
  17. package/dist/team.js +11 -1
  18. package/dist/tools/ctrl.d.ts +1 -1
  19. package/dist/tools/ctrl.js +67 -28
  20. package/dist/tools/prompts/control/en/principles.md +3 -3
  21. package/dist/tools/prompts/control/en/scenarios.md +25 -0
  22. package/dist/tools/prompts/control/en/tools.md +18 -6
  23. package/dist/tools/prompts/control/zh/principles.md +3 -3
  24. package/dist/tools/prompts/control/zh/scenarios.md +25 -0
  25. package/dist/tools/prompts/control/zh/tools.md +18 -6
  26. package/dist/tools/team_mgmt-manual.js +2 -2
  27. package/dist/tools/team_mgmt.js +2 -2
  28. package/dist/utils/task-package.d.ts +16 -0
  29. package/dist/utils/task-package.js +131 -55
  30. package/dist/utils/taskdoc.js +12 -12
  31. package/package.json +1 -1
  32. package/webapp/dist/assets/{_basePickBy-DUbW5G8a.js → _basePickBy-C3SVVywm.js} +3 -3
  33. package/webapp/dist/assets/{_basePickBy-DUbW5G8a.js.map → _basePickBy-C3SVVywm.js.map} +1 -1
  34. package/webapp/dist/assets/{_baseUniq-vou1IeXB.js → _baseUniq-egNq6cCa.js} +2 -2
  35. package/webapp/dist/assets/{_baseUniq-vou1IeXB.js.map → _baseUniq-egNq6cCa.js.map} +1 -1
  36. package/webapp/dist/assets/{arc-D_O9oO0B.js → arc-CASAlRvm.js} +2 -2
  37. package/webapp/dist/assets/{arc-D_O9oO0B.js.map → arc-CASAlRvm.js.map} +1 -1
  38. package/webapp/dist/assets/{architectureDiagram-2XIMDMQ5-B7k9SWSL.js → architectureDiagram-2XIMDMQ5-B6n5FQmS.js} +7 -7
  39. package/webapp/dist/assets/{architectureDiagram-2XIMDMQ5-B7k9SWSL.js.map → architectureDiagram-2XIMDMQ5-B6n5FQmS.js.map} +1 -1
  40. package/webapp/dist/assets/{blockDiagram-WCTKOSBZ-e3xTmffi.js → blockDiagram-WCTKOSBZ-D2UGGjic.js} +7 -7
  41. package/webapp/dist/assets/{blockDiagram-WCTKOSBZ-e3xTmffi.js.map → blockDiagram-WCTKOSBZ-D2UGGjic.js.map} +1 -1
  42. package/webapp/dist/assets/{c4Diagram-IC4MRINW-DVvi-N2o.js → c4Diagram-IC4MRINW-BOY_bQFP.js} +3 -3
  43. package/webapp/dist/assets/{c4Diagram-IC4MRINW-DVvi-N2o.js.map → c4Diagram-IC4MRINW-BOY_bQFP.js.map} +1 -1
  44. package/webapp/dist/assets/{channel-CH387UD2.js → channel-CZ_X09H1.js} +2 -2
  45. package/webapp/dist/assets/{channel-CH387UD2.js.map → channel-CZ_X09H1.js.map} +1 -1
  46. package/webapp/dist/assets/{chunk-4BX2VUAB-BOo0Xj3m.js → chunk-4BX2VUAB-BIwyAzZQ.js} +2 -2
  47. package/webapp/dist/assets/{chunk-4BX2VUAB-BOo0Xj3m.js.map → chunk-4BX2VUAB-BIwyAzZQ.js.map} +1 -1
  48. package/webapp/dist/assets/{chunk-55IACEB6-CI4uRAx_.js → chunk-55IACEB6-zSjTFoCX.js} +2 -2
  49. package/webapp/dist/assets/{chunk-55IACEB6-CI4uRAx_.js.map → chunk-55IACEB6-zSjTFoCX.js.map} +1 -1
  50. package/webapp/dist/assets/{chunk-FMBD7UC4-C4N1ovxD.js → chunk-FMBD7UC4-CTpuRfdB.js} +2 -2
  51. package/webapp/dist/assets/{chunk-FMBD7UC4-C4N1ovxD.js.map → chunk-FMBD7UC4-CTpuRfdB.js.map} +1 -1
  52. package/webapp/dist/assets/{chunk-JSJVCQXG-5U4Hu7pC.js → chunk-JSJVCQXG-CJ3DM4in.js} +2 -2
  53. package/webapp/dist/assets/{chunk-JSJVCQXG-5U4Hu7pC.js.map → chunk-JSJVCQXG-CJ3DM4in.js.map} +1 -1
  54. package/webapp/dist/assets/{chunk-KX2RTZJC-BXPDNuct.js → chunk-KX2RTZJC-B97EakhO.js} +2 -2
  55. package/webapp/dist/assets/{chunk-KX2RTZJC-BXPDNuct.js.map → chunk-KX2RTZJC-B97EakhO.js.map} +1 -1
  56. package/webapp/dist/assets/{chunk-NQ4KR5QH-oVsExnnn.js → chunk-NQ4KR5QH-5o1o5x0z.js} +4 -4
  57. package/webapp/dist/assets/{chunk-NQ4KR5QH-oVsExnnn.js.map → chunk-NQ4KR5QH-5o1o5x0z.js.map} +1 -1
  58. package/webapp/dist/assets/{chunk-QZHKN3VN-C6FzEv2C.js → chunk-QZHKN3VN-D33FSIEb.js} +2 -2
  59. package/webapp/dist/assets/{chunk-QZHKN3VN-C6FzEv2C.js.map → chunk-QZHKN3VN-D33FSIEb.js.map} +1 -1
  60. package/webapp/dist/assets/{chunk-WL4C6EOR-Ir7e_B7t.js → chunk-WL4C6EOR-C2InqFin.js} +6 -6
  61. package/webapp/dist/assets/{chunk-WL4C6EOR-Ir7e_B7t.js.map → chunk-WL4C6EOR-C2InqFin.js.map} +1 -1
  62. package/webapp/dist/assets/{classDiagram-VBA2DB6C-CPYs_LAr.js → classDiagram-VBA2DB6C-BfLZmK48.js} +7 -7
  63. package/webapp/dist/assets/{classDiagram-VBA2DB6C-CPYs_LAr.js.map → classDiagram-VBA2DB6C-BfLZmK48.js.map} +1 -1
  64. package/webapp/dist/assets/{classDiagram-v2-RAHNMMFH-CPYs_LAr.js → classDiagram-v2-RAHNMMFH-BfLZmK48.js} +7 -7
  65. package/webapp/dist/assets/{classDiagram-v2-RAHNMMFH-CPYs_LAr.js.map → classDiagram-v2-RAHNMMFH-BfLZmK48.js.map} +1 -1
  66. package/webapp/dist/assets/{clone-CToca8rS.js → clone-BSCHnHfl.js} +2 -2
  67. package/webapp/dist/assets/{clone-CToca8rS.js.map → clone-BSCHnHfl.js.map} +1 -1
  68. package/webapp/dist/assets/{cose-bilkent-S5V4N54A-DLNtqY7a.js → cose-bilkent-S5V4N54A-CeQ1jAJJ.js} +2 -2
  69. package/webapp/dist/assets/{cose-bilkent-S5V4N54A-DLNtqY7a.js.map → cose-bilkent-S5V4N54A-CeQ1jAJJ.js.map} +1 -1
  70. package/webapp/dist/assets/{dagre-KLK3FWXG-Bkt-O9uW.js → dagre-KLK3FWXG-WUuNYzcK.js} +7 -7
  71. package/webapp/dist/assets/{dagre-KLK3FWXG-Bkt-O9uW.js.map → dagre-KLK3FWXG-WUuNYzcK.js.map} +1 -1
  72. package/webapp/dist/assets/{diagram-E7M64L7V-B4JR_u4V.js → diagram-E7M64L7V-jOVCIExP.js} +8 -8
  73. package/webapp/dist/assets/{diagram-E7M64L7V-B4JR_u4V.js.map → diagram-E7M64L7V-jOVCIExP.js.map} +1 -1
  74. package/webapp/dist/assets/{diagram-IFDJBPK2-D9zRh8b7.js → diagram-IFDJBPK2-cCeQqotA.js} +7 -7
  75. package/webapp/dist/assets/{diagram-IFDJBPK2-D9zRh8b7.js.map → diagram-IFDJBPK2-cCeQqotA.js.map} +1 -1
  76. package/webapp/dist/assets/{diagram-P4PSJMXO-CAaXVWnX.js → diagram-P4PSJMXO-DjAYFRLv.js} +7 -7
  77. package/webapp/dist/assets/{diagram-P4PSJMXO-CAaXVWnX.js.map → diagram-P4PSJMXO-DjAYFRLv.js.map} +1 -1
  78. package/webapp/dist/assets/{erDiagram-INFDFZHY-DDeoaSkJ.js → erDiagram-INFDFZHY-Dl_6U5fV.js} +5 -5
  79. package/webapp/dist/assets/{erDiagram-INFDFZHY-DDeoaSkJ.js.map → erDiagram-INFDFZHY-Dl_6U5fV.js.map} +1 -1
  80. package/webapp/dist/assets/{flowDiagram-PKNHOUZH-DEYqzSEJ.js → flowDiagram-PKNHOUZH-D80nrZ3S.js} +7 -7
  81. package/webapp/dist/assets/{flowDiagram-PKNHOUZH-DEYqzSEJ.js.map → flowDiagram-PKNHOUZH-D80nrZ3S.js.map} +1 -1
  82. package/webapp/dist/assets/{ganttDiagram-A5KZAMGK-BuLOSh0d.js → ganttDiagram-A5KZAMGK-T3WdMrgj.js} +3 -3
  83. package/webapp/dist/assets/{ganttDiagram-A5KZAMGK-BuLOSh0d.js.map → ganttDiagram-A5KZAMGK-T3WdMrgj.js.map} +1 -1
  84. package/webapp/dist/assets/{gitGraphDiagram-K3NZZRJ6-CBrwZvBf.js → gitGraphDiagram-K3NZZRJ6-ifV-jkKL.js} +8 -8
  85. package/webapp/dist/assets/{gitGraphDiagram-K3NZZRJ6-CBrwZvBf.js.map → gitGraphDiagram-K3NZZRJ6-ifV-jkKL.js.map} +1 -1
  86. package/webapp/dist/assets/{graph-fX6cvjwR.js → graph-D5jmnb35.js} +3 -3
  87. package/webapp/dist/assets/{graph-fX6cvjwR.js.map → graph-D5jmnb35.js.map} +1 -1
  88. package/webapp/dist/assets/{index-B3WzTLcD.js → index-CGbZlct2.js} +622 -160
  89. package/webapp/dist/assets/index-CGbZlct2.js.map +1 -0
  90. package/webapp/dist/assets/{infoDiagram-LFFYTUFH-Ci3XYvve.js → infoDiagram-LFFYTUFH-C340CY5x.js} +6 -6
  91. package/webapp/dist/assets/{infoDiagram-LFFYTUFH-Ci3XYvve.js.map → infoDiagram-LFFYTUFH-C340CY5x.js.map} +1 -1
  92. package/webapp/dist/assets/{ishikawaDiagram-PHBUUO56-DOH5ua9R.js → ishikawaDiagram-PHBUUO56-Bu4RsELK.js} +2 -2
  93. package/webapp/dist/assets/{ishikawaDiagram-PHBUUO56-DOH5ua9R.js.map → ishikawaDiagram-PHBUUO56-Bu4RsELK.js.map} +1 -1
  94. package/webapp/dist/assets/{journeyDiagram-4ABVD52K-DM_fiZlj.js → journeyDiagram-4ABVD52K-Dvv3ypKA.js} +5 -5
  95. package/webapp/dist/assets/{journeyDiagram-4ABVD52K-DM_fiZlj.js.map → journeyDiagram-4ABVD52K-Dvv3ypKA.js.map} +1 -1
  96. package/webapp/dist/assets/{kanban-definition-K7BYSVSG-CSh2hqc2.js → kanban-definition-K7BYSVSG-D_rsetjW.js} +3 -3
  97. package/webapp/dist/assets/{kanban-definition-K7BYSVSG-CSh2hqc2.js.map → kanban-definition-K7BYSVSG-D_rsetjW.js.map} +1 -1
  98. package/webapp/dist/assets/{layout-yZEK1LgL.js → layout-CLmOfwnS.js} +5 -5
  99. package/webapp/dist/assets/{layout-yZEK1LgL.js.map → layout-CLmOfwnS.js.map} +1 -1
  100. package/webapp/dist/assets/{linear-m76SmdtZ.js → linear-DFAmViqi.js} +2 -2
  101. package/webapp/dist/assets/{linear-m76SmdtZ.js.map → linear-DFAmViqi.js.map} +1 -1
  102. package/webapp/dist/assets/{mindmap-definition-YRQLILUH-NiwP-SLH.js → mindmap-definition-YRQLILUH-Ce3_czeS.js} +4 -4
  103. package/webapp/dist/assets/{mindmap-definition-YRQLILUH-NiwP-SLH.js.map → mindmap-definition-YRQLILUH-Ce3_czeS.js.map} +1 -1
  104. package/webapp/dist/assets/{pieDiagram-SKSYHLDU-CSCapDSD.js → pieDiagram-SKSYHLDU-U6_un5Sc.js} +8 -8
  105. package/webapp/dist/assets/{pieDiagram-SKSYHLDU-CSCapDSD.js.map → pieDiagram-SKSYHLDU-U6_un5Sc.js.map} +1 -1
  106. package/webapp/dist/assets/{quadrantDiagram-337W2JSQ-CbDGQH91.js → quadrantDiagram-337W2JSQ-DmVJQItS.js} +3 -3
  107. package/webapp/dist/assets/{quadrantDiagram-337W2JSQ-CbDGQH91.js.map → quadrantDiagram-337W2JSQ-DmVJQItS.js.map} +1 -1
  108. package/webapp/dist/assets/{requirementDiagram-Z7DCOOCP-CeG2yodp.js → requirementDiagram-Z7DCOOCP-BkNhSY-g.js} +4 -4
  109. package/webapp/dist/assets/{requirementDiagram-Z7DCOOCP-CeG2yodp.js.map → requirementDiagram-Z7DCOOCP-BkNhSY-g.js.map} +1 -1
  110. package/webapp/dist/assets/{sankeyDiagram-WA2Y5GQK-B_l8tKqa.js → sankeyDiagram-WA2Y5GQK-E3UEy5SX.js} +2 -2
  111. package/webapp/dist/assets/{sankeyDiagram-WA2Y5GQK-B_l8tKqa.js.map → sankeyDiagram-WA2Y5GQK-E3UEy5SX.js.map} +1 -1
  112. package/webapp/dist/assets/{sequenceDiagram-2WXFIKYE-Dc5gBIi5.js → sequenceDiagram-2WXFIKYE-k0w9WKAO.js} +4 -4
  113. package/webapp/dist/assets/{sequenceDiagram-2WXFIKYE-Dc5gBIi5.js.map → sequenceDiagram-2WXFIKYE-k0w9WKAO.js.map} +1 -1
  114. package/webapp/dist/assets/{stateDiagram-RAJIS63D-DMYeNS1r.js → stateDiagram-RAJIS63D-DRgdJrlx.js} +9 -9
  115. package/webapp/dist/assets/{stateDiagram-RAJIS63D-DMYeNS1r.js.map → stateDiagram-RAJIS63D-DRgdJrlx.js.map} +1 -1
  116. package/webapp/dist/assets/{stateDiagram-v2-FVOUBMTO-MfUJuUEe.js → stateDiagram-v2-FVOUBMTO-edtkX9x6.js} +5 -5
  117. package/webapp/dist/assets/{stateDiagram-v2-FVOUBMTO-MfUJuUEe.js.map → stateDiagram-v2-FVOUBMTO-edtkX9x6.js.map} +1 -1
  118. package/webapp/dist/assets/{timeline-definition-YZTLITO2-Ci2CZEky.js → timeline-definition-YZTLITO2-D0zyXyNL.js} +3 -3
  119. package/webapp/dist/assets/{timeline-definition-YZTLITO2-Ci2CZEky.js.map → timeline-definition-YZTLITO2-D0zyXyNL.js.map} +1 -1
  120. package/webapp/dist/assets/{treemap-KZPCXAKY-CNgzp4sT.js → treemap-KZPCXAKY-CglsYqbQ.js} +5 -5
  121. package/webapp/dist/assets/{treemap-KZPCXAKY-CNgzp4sT.js.map → treemap-KZPCXAKY-CglsYqbQ.js.map} +1 -1
  122. package/webapp/dist/assets/{vennDiagram-LZ73GAT5-BYxtNx2s.js → vennDiagram-LZ73GAT5-DsUizzvt.js} +2 -2
  123. package/webapp/dist/assets/{vennDiagram-LZ73GAT5-BYxtNx2s.js.map → vennDiagram-LZ73GAT5-DsUizzvt.js.map} +1 -1
  124. package/webapp/dist/assets/{xychartDiagram-JWTSCODW-BUS3bn9p.js → xychartDiagram-JWTSCODW-DvYQ4zKY.js} +3 -3
  125. package/webapp/dist/assets/{xychartDiagram-JWTSCODW-BUS3bn9p.js.map → xychartDiagram-JWTSCODW-DvYQ4zKY.js.map} +1 -1
  126. package/webapp/dist/index.html +1 -1
  127. package/webapp/dist/assets/index-B3WzTLcD.js.map +0 -1
@@ -18,7 +18,7 @@
18
18
  * - change_mind: Main Dialog only; update a `.tsk/` Taskdoc section without starting a new course
19
19
  * - mind_more: Main Dialog only; append entries to a `.tsk/` Taskdoc section without starting a new course
20
20
  * - never_mind: Main Dialog only; delete a `.tsk/` Taskdoc section file without starting a new course
21
- * - recall_taskdoc: Read a Taskdoc section from `*.tsk/` by (category, selector)
21
+ * - recall_taskdoc: Read a Taskdoc section from `*.tsk/` by selector and optional category
22
22
  *
23
23
  * USAGE CONTEXT:
24
24
  * Can both be triggered by an agent autonomously, or by human with role='user' msg,
@@ -370,13 +370,21 @@ function getCtrlMessages(language) {
370
370
  invalidReminderPosition: (positionHuman, totalPlusOne) => `位置 ${positionHuman} 无效。有效范围:1-${totalPlusOne}`,
371
371
  invalidFormatUpdate: '参数格式不对。用法:update_reminder({ reminder_id: string, content: string })',
372
372
  invalidFormatDoMind: '参数格式不对。用法:do_mind({ selector: string, category?: string, content: string })',
373
- invalidFormatChangeMind: '参数格式不对。用法:change_mind({ selector: string, category?: string, content: string })',
374
- tooManyArgsChangeMind: '参数格式不对。用法:change_mind({ selector: string, category?: string, content: string })',
373
+ invalidFormatChangeMind: '参数格式不对。用法:change_mind({ selector: string, category?: string, content: string, previous_content_hash: string })',
374
+ tooManyArgsChangeMind: '参数格式不对。用法:change_mind({ selector: string, category?: string, content: string, previous_content_hash: string })',
375
+ taskDocPreviousContentHashRequired: '错误:change_mind 需要 previous_content_hash。请先调用 recall_taskdoc 显式取得当前章节的 content_hash,合并原有内容后再整段替换;没有把握时用 mind_more 追加小条目。',
376
+ taskDocPreviousContentHashInvalid: '错误:previous_content_hash 格式无效。它必须是 recall_taskdoc 返回的 crc32:<8位十六进制> content_hash。',
377
+ taskDocContentHashMismatch: (relativePath, currentContentHash) => `错误:${relativePath} 的内容哈希不匹配,说明该章节已变化或你没有基于当前内容改写。\n` +
378
+ `当前 content_hash:${currentContentHash}\n\n` +
379
+ `请重新读取/回顾当前章节内容,并只在已充分合并原有内容后重试。若新内容会冲掉、删除或实质替换原有内容,必须满足其一:\n` +
380
+ `- 获得人类对该替换的直接、针对性确认;或\n` +
381
+ `- 依据人类认可的明确 SOP/验收标准,已经充分考虑原有内容且该替换合规。\n` +
382
+ `否则不要覆盖;优先使用 mind_more 追加或向人类确认。`,
375
383
  invalidFormatMindMore: '参数格式不对。用法:mind_more({ items: string[], sep?: string, selector?: string, category?: string })(selector 默认 progress)',
376
384
  invalidFormatNeverMind: '参数格式不对。用法:never_mind({ selector: string, category?: string })',
377
385
  mindMoreItemsRequired: '需要提供要追加的条目(items),且每一项都必须是非空字符串。\n' +
378
386
  '示例:mind_more({"items":["- 下一步:复核验证结果(详见 <文档路径>#<章节>)","- 阻塞:等待 API 验收口径确认"]})',
379
- invalidFormatRecallTaskdoc: '参数格式不对。用法:recall_taskdoc({ category: string, selector: string })',
387
+ invalidFormatRecallTaskdoc: '参数格式不对。用法:recall_taskdoc({ selector: string, category?: string })',
380
388
  taskDocContentRequired: '需要提供差遣牒内容(content)。\n' +
381
389
  '示例:\n' +
382
390
  '```json\n' +
@@ -389,15 +397,14 @@ function getCtrlMessages(language) {
389
397
  pathMustBeWithinWorkspace: '路径必须位于 rtws(运行时工作区)内',
390
398
  invalidTaskDocPath: (taskDocPath) => `差遣牒路径 '${taskDocPath}' 无效。应为 *.tsk/ 目录。`,
391
399
  selectorRequired: '需要提供选择器(selector)。',
392
- categoryRequired: '需要提供章节目录(category)。',
393
400
  invalidSelector: (selector) => `选择器 '${selector}' 无效。可用:顶层 goals | constraints | progress;bearinmind 下 contracts | acceptance | grants | runbook | decisions | risks;或任意标识符(如 ux.checklist)。`,
394
401
  invalidCategory: (category) => `目录名 '${category}' 无效。需匹配 ^[a-zA-Z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]*)*$。`,
395
402
  invalidCategorySelector: (selector) => `选择器 '${selector}' 无效。需匹配 ^[a-zA-Z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]*)*$。`,
396
403
  topLevelSelectorRequiresNoCategory: (category, selector) => `选择器 '${selector}' 是顶层保留分段(goals/constraints/progress),不能与 category='${category}' 一起用。`,
397
404
  bearInMindSelectorRequiresBearInMindCategory: (category, selector) => `选择器 '${selector}' 只能在 category='bearinmind' 下用(当前 category='${category}')。`,
398
- taskDocSectionAlreadyExists: (relativePath) => `无法新增:${relativePath} 已存在。若确有把握要改写已有章节,请使用 change_mind({ ... })。`,
405
+ taskDocSectionAlreadyExists: (relativePath) => `无法新增:${relativePath} 已存在。若确有把握要改写已有章节,请先用 recall_taskdoc 取得当前 content_hash,再使用 change_mind({"selector":"<selector>","content":"...","previous_content_hash":"crc32:..."})。`,
399
406
  taskDocSectionChangeMissing: (relativePath) => `无法修改:${relativePath} 不存在。若要新增章节,请使用 do_mind({ ... })。`,
400
- taskDocSectionMissing: (relativePath) => `未找到:${relativePath}。\n\n新增章节请使用 do_mind;已有章节追加小条目用 mind_more;改写已有章节用 change_mind:\n- do_mind({"category":"<category>","selector":"<selector>","content":"..."})\n- mind_more({"category":"<category>","selector":"<selector>","items":["..."]})\n- change_mind({"category":"<category>","selector":"<selector>","content":"..."})`,
407
+ taskDocSectionMissing: (relativePath) => `未找到:${relativePath}。\n\n新增章节请使用 do_mind;已有章节追加小条目用 mind_more;改写已有章节时先用 recall_taskdoc 取得当前 content_hash,再用 change_mind 带上它:\n- do_mind({"category":"<category>","selector":"<selector>","content":"..."})\n- mind_more({"category":"<category>","selector":"<selector>","items":["..."]})\n- recall_taskdoc({"category":"<category>","selector":"<selector>"})\n- change_mind({"category":"<category>","selector":"<selector>","content":"...","previous_content_hash":"crc32:..."})`,
401
408
  taskDocSectionDeleteMissing: (relativePath) => `无法删除:${relativePath} 不存在。请先确认要删除的差遣牒章节。`,
402
409
  clearedCoursePrompt: (nextCourse) => (0, driver_messages_1.formatNewCourseStartPrompt)('zh', { nextCourse, source: 'clear_mind' }),
403
410
  };
@@ -412,13 +419,21 @@ function getCtrlMessages(language) {
412
419
  invalidReminderPosition: (positionHuman, totalPlusOne) => `Error: Invalid reminder position ${positionHuman}. Valid range: 1-${totalPlusOne}`,
413
420
  invalidFormatUpdate: 'Error: Invalid args. Use: update_reminder({ reminder_id: string, content: string })',
414
421
  invalidFormatDoMind: 'Error: Invalid args. Use: do_mind({ selector: string, category?: string, content: string })',
415
- invalidFormatChangeMind: 'Error: Invalid args. Use: change_mind({ selector: string, category?: string, content: string })',
416
- tooManyArgsChangeMind: 'Error: Invalid args. Use: change_mind({ selector: string, category?: string, content: string })',
422
+ invalidFormatChangeMind: 'Error: Invalid args. Use: change_mind({ selector: string, category?: string, content: string, previous_content_hash: string })',
423
+ tooManyArgsChangeMind: 'Error: Invalid args. Use: change_mind({ selector: string, category?: string, content: string, previous_content_hash: string })',
424
+ taskDocPreviousContentHashRequired: 'Error: change_mind requires previous_content_hash. Call recall_taskdoc first to get the current section content_hash, merge the existing content, then replace the full section. If unsure, use mind_more for small append-only updates.',
425
+ taskDocPreviousContentHashInvalid: 'Error: invalid previous_content_hash. It must be the crc32:<8 hex chars> content_hash returned by recall_taskdoc.',
426
+ taskDocContentHashMismatch: (relativePath, currentContentHash) => `Error: content hash mismatch for \`${relativePath}\`; the section changed or your replacement was not based on the current content.\n` +
427
+ `Current content_hash: ${currentContentHash}\n\n` +
428
+ `Re-read/review the current section and retry only after fully merging existing content. If the new content would overwrite, delete, or materially replace existing content, one of these must be true:\n` +
429
+ `- A human gave direct, targeted confirmation for this replacement; or\n` +
430
+ `- A human-approved explicit SOP/acceptance standard authorizes the replacement, and you have considered the existing content under that standard.\n` +
431
+ `Otherwise do not overwrite; prefer mind_more or ask the human to confirm.`,
417
432
  invalidFormatMindMore: 'Error: Invalid args. Use: mind_more({ items: string[], sep?: string, selector?: string, category?: string }) (selector defaults to progress).',
418
433
  invalidFormatNeverMind: 'Error: Invalid args. Use: never_mind({ selector: string, category?: string })',
419
434
  mindMoreItemsRequired: 'Error: items are required, and every item must be a non-empty string.\n' +
420
435
  'Example: mind_more({"items":["- Next: review verification results (details: <doc-path>#<section>)","- Blocker: API acceptance criteria pending"]})',
421
- invalidFormatRecallTaskdoc: 'Error: Invalid args. Use: recall_taskdoc({ category: string, selector: string })',
436
+ invalidFormatRecallTaskdoc: 'Error: Invalid args. Use: recall_taskdoc({ selector: string, category?: string })',
422
437
  taskDocContentRequired: 'Error: Taskdoc content is required (content).\n' +
423
438
  'Copy/paste example:\n' +
424
439
  '```json\n' +
@@ -431,15 +446,14 @@ function getCtrlMessages(language) {
431
446
  pathMustBeWithinWorkspace: 'Error: Path must be within rtws (runtime workspace)',
432
447
  invalidTaskDocPath: (taskDocPath) => `Error: Invalid Taskdoc path '${taskDocPath}'. Expected a \`*.tsk/\` directory.`,
433
448
  selectorRequired: 'Error: selector is required.',
434
- categoryRequired: 'Error: category is required.',
435
449
  invalidSelector: (selector) => `Error: Invalid selector '${selector}'. Use: top-level goals|constraints|progress; under bearinmind: contracts|acceptance|grants|runbook|decisions|risks; or any identifier (e.g. \`ux.checklist\`).`,
436
450
  invalidCategory: (category) => `Error: Invalid category '${category}'. Must match \`^[a-zA-Z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]+)*$\`.`,
437
451
  invalidCategorySelector: (selector) => `Error: Invalid category selector '${selector}'. Must match \`^[a-zA-Z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]+)*$\`.`,
438
452
  topLevelSelectorRequiresNoCategory: (category, selector) => `Error: Selector '${selector}' is reserved for top-level sections (goals/constraints/progress) and must not be used with category='${category}'.`,
439
453
  bearInMindSelectorRequiresBearInMindCategory: (category, selector) => `Error: Selector '${selector}' is only valid under category='bearinmind' (got category='${category}').`,
440
- taskDocSectionAlreadyExists: (relativePath) => `Cannot add: \`${relativePath}\` already exists. If you are sure you need to rewrite an existing section, use \`change_mind({ ... })\`.`,
454
+ taskDocSectionAlreadyExists: (relativePath) => `Cannot add: \`${relativePath}\` already exists. If you are sure you need to rewrite an existing section, call \`recall_taskdoc\` for the current content_hash first, then use \`change_mind({"selector":"<selector>","content":"...","previous_content_hash":"crc32:..."})\`.`,
441
455
  taskDocSectionChangeMissing: (relativePath) => `Cannot change: \`${relativePath}\` does not exist. To create a new section, use \`do_mind({ ... })\`.`,
442
- taskDocSectionMissing: (relativePath) => `Not found: \`${relativePath}\`.\n\nUse \`do_mind\` to create a section, \`mind_more\` for small append-only updates to existing sections, and \`change_mind\` to rewrite existing sections:\n- \`do_mind({\"category\":\"<category>\",\"selector\":\"<selector>\",\"content\":\"...\"})\`\n- \`mind_more({\"category\":\"<category>\",\"selector\":\"<selector>\",\"items\":[\"...\"]})\`\n- \`change_mind({\"category\":\"<category>\",\"selector\":\"<selector>\",\"content\":\"...\"})\``,
456
+ taskDocSectionMissing: (relativePath) => `Not found: \`${relativePath}\`.\n\nUse \`do_mind\` to create a section, \`mind_more\` for small append-only updates to existing sections, and \`recall_taskdoc\` then \`change_mind\` with the current content_hash to rewrite existing sections:\n- \`do_mind({\"category\":\"<category>\",\"selector\":\"<selector>\",\"content\":\"...\"})\`\n- \`mind_more({\"category\":\"<category>\",\"selector\":\"<selector>\",\"items\":[\"...\"]})\`\n- \`recall_taskdoc({\"category\":\"<category>\",\"selector\":\"<selector>\"})\`\n- \`change_mind({\"category\":\"<category>\",\"selector\":\"<selector>\",\"content\":\"...\",\"previous_content_hash\":\"crc32:...\"})\``,
443
457
  taskDocSectionDeleteMissing: (relativePath) => `Cannot delete: \`${relativePath}\` does not exist. Check the Taskdoc section target first.`,
444
458
  clearedCoursePrompt: (nextCourse) => (0, driver_messages_1.formatNewCourseStartPrompt)('en', { nextCourse, source: 'clear_mind' }),
445
459
  };
@@ -721,7 +735,7 @@ exports.changeMindTool = {
721
735
  parameters: {
722
736
  type: 'object',
723
737
  additionalProperties: false,
724
- required: ['selector', 'content'],
738
+ required: ['selector', 'content', 'previous_content_hash'],
725
739
  properties: {
726
740
  selector: {
727
741
  type: 'string',
@@ -732,6 +746,10 @@ exports.changeMindTool = {
732
746
  description: 'Optional category directory within the Taskdoc package. When present, selector targets <category>/<selector>.md.',
733
747
  },
734
748
  content: { type: 'string', description: 'New section content.' },
749
+ previous_content_hash: {
750
+ type: 'string',
751
+ description: 'Content hash of the current section being replaced. Call recall_taskdoc first and use the returned content_hash.',
752
+ },
735
753
  },
736
754
  },
737
755
  argsValidation: 'dominds',
@@ -760,6 +778,13 @@ exports.changeMindTool = {
760
778
  const newTaskDocContent = typeof contentValue === 'string' ? contentValue.trim() : '';
761
779
  if (!newTaskDocContent)
762
780
  return (0, tool_1.toolFailure)(t.taskDocContentRequired);
781
+ const previousContentHashValue = args['previous_content_hash'];
782
+ const previousContentHash = typeof previousContentHashValue === 'string' ? previousContentHashValue.trim() : '';
783
+ if (!previousContentHash)
784
+ return (0, tool_1.toolFailure)(t.taskDocPreviousContentHashRequired);
785
+ if (!/^crc32:[0-9a-f]{8}$/u.test(previousContentHash)) {
786
+ return (0, tool_1.toolFailure)(t.taskDocPreviousContentHashInvalid);
787
+ }
763
788
  // Taskdoc path is immutable for the dialog lifecycle.
764
789
  const taskDocPath = dlg.taskDocPath;
765
790
  if (!taskDocPath)
@@ -799,6 +824,7 @@ exports.changeMindTool = {
799
824
  taskPackageDirFullPath: fullPath,
800
825
  target: parsed.target,
801
826
  content: newTaskDocContent,
827
+ previousContentHash,
802
828
  updatedBy: caller.id,
803
829
  });
804
830
  switch (result.kind) {
@@ -806,6 +832,8 @@ exports.changeMindTool = {
806
832
  return (0, tool_result_messages_1.formatToolActionResult)(language, 'mindChanged');
807
833
  case 'missing':
808
834
  return (0, tool_1.toolFailure)(t.taskDocSectionChangeMissing((0, task_package_1.taskPackageRelativePathForChangeMindTarget)(parsed.target)));
835
+ case 'content_hash_mismatch':
836
+ return (0, tool_1.toolFailure)(t.taskDocContentHashMismatch((0, task_package_1.taskPackageRelativePathForChangeMindTarget)(parsed.target), result.currentContentHash));
809
837
  default: {
810
838
  const _exhaustive = result;
811
839
  return _exhaustive;
@@ -1136,18 +1164,24 @@ exports.mindMoreTool = {
1136
1164
  exports.recallTaskdocTool = {
1137
1165
  type: 'func',
1138
1166
  name: 'recall_taskdoc',
1139
- description: 'Read one Taskdoc section by (category, selector).',
1167
+ description: 'Read one Taskdoc section and return its content_hash.',
1140
1168
  descriptionI18n: {
1141
- en: 'Read one Taskdoc section by (category, selector).',
1142
- zh: ' (category, selector) 读取一段差遣牒章节。',
1169
+ en: 'Read one Taskdoc section and return its content_hash.',
1170
+ zh: '读取一段差遣牒章节并返回 content_hash。',
1143
1171
  },
1144
1172
  parameters: {
1145
1173
  type: 'object',
1146
1174
  additionalProperties: false,
1147
- required: ['category', 'selector'],
1175
+ required: ['selector'],
1148
1176
  properties: {
1149
- category: { type: 'string', description: 'Category directory within the Taskdoc.' },
1150
- selector: { type: 'string', description: 'Section selector within the category.' },
1177
+ category: {
1178
+ type: 'string',
1179
+ description: 'Optional category directory within the Taskdoc. Omit for top-level goals|constraints|progress.',
1180
+ },
1181
+ selector: {
1182
+ type: 'string',
1183
+ description: 'Section selector. Top-level: goals|constraints|progress. With category: selector within that category.',
1184
+ },
1151
1185
  },
1152
1186
  },
1153
1187
  argsValidation: 'dominds',
@@ -1155,9 +1189,10 @@ exports.recallTaskdocTool = {
1155
1189
  const language = (0, work_language_1.getWorkLanguage)();
1156
1190
  const t = getCtrlMessages(language);
1157
1191
  const categoryValue = args['category'];
1158
- const category = typeof categoryValue === 'string' ? categoryValue.trim() : '';
1159
- if (category === '')
1160
- return (0, tool_1.toolFailure)(t.categoryRequired);
1192
+ if (categoryValue !== undefined && typeof categoryValue !== 'string') {
1193
+ return (0, tool_1.toolFailure)(t.invalidFormatRecallTaskdoc);
1194
+ }
1195
+ const category = typeof categoryValue === 'string' ? categoryValue.trim() : undefined;
1161
1196
  const selectorValue = args['selector'];
1162
1197
  const selector = typeof selectorValue === 'string' ? selectorValue.trim() : '';
1163
1198
  if (selector === '')
@@ -1198,9 +1233,6 @@ exports.recallTaskdocTool = {
1198
1233
  }
1199
1234
  }
1200
1235
  const target = parsed.target;
1201
- if (target.kind === 'top_level') {
1202
- return (0, tool_1.toolFailure)(t.invalidFormatRecallTaskdoc);
1203
- }
1204
1236
  const relPath = (0, task_package_1.taskPackageRelativePathForChangeMindTarget)(target);
1205
1237
  const sectionPath = path.resolve(fullPath, relPath);
1206
1238
  if (!isPathWithinDirectory(sectionPath, fullPath)) {
@@ -1221,7 +1253,14 @@ exports.recallTaskdocTool = {
1221
1253
  }
1222
1254
  throw err;
1223
1255
  }
1224
- const content = await fs.promises.readFile(sectionPath, 'utf8');
1256
+ const current = await (0, task_package_1.readTaskPackageByChangeMindTarget)({
1257
+ taskPackageDirFullPath: fullPath,
1258
+ target,
1259
+ });
1260
+ if (current.kind === 'missing') {
1261
+ return (0, tool_1.toolFailure)(t.taskDocSectionMissing(relPath));
1262
+ }
1263
+ const content = current.content;
1225
1264
  const bytes = Buffer.byteLength(content, 'utf8');
1226
1265
  const maxSize = 100 * 1024;
1227
1266
  const clipped = bytes > maxSize ? content.slice(0, maxSize) : content;
@@ -1231,6 +1270,6 @@ exports.recallTaskdocTool = {
1231
1270
  : `\n\n⚠️ Truncated: content is too large (${bytes} bytes); showing first ${maxSize} bytes.`
1232
1271
  : '';
1233
1272
  const closingSeparatorPrefix = clipped.endsWith('\n') ? '' : '\n';
1234
- return (0, tool_1.toolSuccess)(`**recall_taskdoc:** \`${relPath}\`\n\n---\n${clipped}${closingSeparatorPrefix}---${note}`);
1273
+ return (0, tool_1.toolSuccess)(`**recall_taskdoc:** \`${relPath}\`\ncontent_hash: \`${current.contentHash}\`\n\n---\n${clipped}${closingSeparatorPrefix}---${note}`);
1235
1274
  },
1236
1275
  };
@@ -132,8 +132,8 @@ Taskdoc is a **task contract** and the task's **team-shared source of current tr
132
132
 
133
133
  - Keep concise: reminders are often 1-3 items; prefer `update_reminder` to compress/merge
134
134
  - Separate carriers: information that must synchronize the team's current effective state, key decisions, next steps, or still-active blockers belongs in `progress`, the quasi-real-time task bulletin board; reminders keep local resume details
135
- - Team-facing: keep `progress` scannable and centered on what is still effective now; do not let it degrade into a personal log, raw chronology, scratchpad, or stale history pile. Use `mind_more` for small additions and `change_mind` when cleanup/reordering/compression is needed
136
- - Condense when needed: `mind_more` is not the default bookkeeping move. If one topic already has several phase notes, prefer `change_mind` to merge them into the current summary; put the detailed expansion in formal rtws documentation and keep a document pointer in Taskdoc
135
+ - Team-facing: keep `progress` scannable and centered on what is still effective now; do not let it degrade into a personal log, raw chronology, scratchpad, or stale history pile. Use `mind_more` for small additions; when cleanup/reordering/compression is needed, call `recall_taskdoc` first and then use `change_mind` with the returned `content_hash` as `previous_content_hash`
136
+ - Condense when needed: `mind_more` is not the default bookkeeping move. If one topic already has several phase notes, prefer `change_mind` to merge them into the current summary; put the detailed expansion in formal rtws documentation and keep a document pointer in Taskdoc. If the replacement would overwrite existing content, proceed only with direct human confirmation or after applying a human-approved SOP/acceptance standard that considers the existing content
137
137
  - Collapse before clearing: the Main Dialog first records undocumented discussion details the next course needs to know into the appropriate Taskdoc sections, then creates a structured continuation-package reminder; a Side Dialog must not maintain Taskdoc or draft Taskdoc update proposals, and should directly maintain sufficiently detailed continuation-package reminders. If the current course is already under system remediation, rough multi-reminder carry-over is acceptable but must be reconciled first in the new course
138
138
  - Avoid raw-material dumps: do not paste long logs or large tool outputs into reminders
139
139
  - Documentation layering: Taskdoc says “what the team should sync on / do next now”; formal rtws documentation carries “why, how, detailed evidence, and the full process”. When Taskdoc references formal rtws documentation, use a stable path/section name/relevant command instead of copying the full content
@@ -156,7 +156,7 @@ Taskdoc is a **task contract** and the task's **team-shared source of current tr
156
156
  ## Limitations and Notes
157
157
 
158
158
  1. `dialog` reminders end with the dialog; `personal` reminders stay visible in all later dialogs you lead
159
- 2. Use `do_mind` to create missing Taskdoc sections; use `mind_more` for small Taskdoc additions; use `change_mind` for full-section replacement of existing sections and merge existing content first; use `never_mind` when a whole section file should be deleted. Do not treat `mind_more` as a chronology tool; when cleanup, stale-entry removal, or same-topic consolidation is needed, use `change_mind`
159
+ 2. Use `do_mind` to create missing Taskdoc sections; use `mind_more` for small Taskdoc additions; use `change_mind` for full-section replacement of existing sections only after merging existing content and calling `recall_taskdoc` for the current `content_hash`; use `never_mind` when a whole section file should be deleted. Do not treat `mind_more` as a chronology tool; when cleanup, stale-entry removal, or same-topic consolidation is needed, use `recall_taskdoc` then `change_mind`
160
160
  3. `do_mind` / `mind_more` / `change_mind` / `never_mind` do not start a new course
161
161
  4. A continuation-package reminder should keep only details still not covered by Taskdoc but easy to lose during resume; in the Main Dialog, undocumented discussion details from current dialog history that the next course needs to know should be written to the appropriate Taskdoc sections first; in a Side Dialog under caution/critical remediation, maintain sufficiently detailed continuation-package reminders only
162
162
  5. Do not turn `personal` reminders into a long-term fact dump; move durable knowledge into `personal_memory`
@@ -130,10 +130,15 @@ mind_more({
130
130
  });
131
131
 
132
132
  // Full-section replacement when cleanup, reordering, same-topic consolidation, or chronology compression is needed
133
+ recall_taskdoc({
134
+ selector: 'progress',
135
+ });
136
+
133
137
  change_mind({
134
138
  selector: 'progress',
135
139
  content:
136
140
  '## Progress\n\n### Current Effective State\n- The memory-carrier boundary cleanup is complete; next we strengthen the Taskdoc bulletin-board semantics; details: <doc-path>#<section>\n\n### Decisions In Effect\n- `personal_memory` is no longer treated as a short-term junk drawer\n- `team_memory` now carries only long-lived team conventions and invariants\n\n### Next Step\n- Add stronger `progress` bulletin-board guidance in control / team_mgmt manuals\n\n### Still-Active Blockers\n- None',
141
+ previous_content_hash: 'crc32:...',
137
142
  });
138
143
  ```
139
144
 
@@ -146,10 +151,15 @@ Update task objectives.
146
151
  ### Example
147
152
 
148
153
  ```typescript
154
+ recall_taskdoc({
155
+ selector: 'goals',
156
+ });
157
+
149
158
  change_mind({
150
159
  selector: 'goals',
151
160
  content:
152
161
  '## Goals\n\n- [ ] Create all toolset manuals\n - [x] ws_mod\n - [x] team_mgmt\n - [x] personal_memory\n - [ ] control (In Progress)\n- [ ] Write tool descriptions',
162
+ previous_content_hash: 'crc32:...',
153
163
  });
154
164
  ```
155
165
 
@@ -162,10 +172,15 @@ Update task constraints.
162
172
  ### Example
163
173
 
164
174
  ```typescript
175
+ recall_taskdoc({
176
+ selector: 'constraints',
177
+ });
178
+
165
179
  change_mind({
166
180
  selector: 'constraints',
167
181
  content:
168
182
  '## Constraints\n\n- man function must dynamically filter toolsets based on team.yaml\n- Runtime effective: Changes to team.yaml immediately visible\n- Toolset names use underscore format\n- New constraint: Each toolset needs 5 topics × 2 languages',
183
+ previous_content_hash: 'crc32:...',
169
184
  });
170
185
  ```
171
186
 
@@ -178,6 +193,11 @@ Read taskdoc chapter content.
178
193
  ### Example
179
194
 
180
195
  ```typescript
196
+ // Top-level sections are injected as content, but recall_taskdoc returns their content_hash
197
+ recall_taskdoc({
198
+ selector: 'progress',
199
+ });
200
+
181
201
  // Read bearinmind runbook
182
202
  recall_taskdoc({
183
203
  category: 'bearinmind',
@@ -201,9 +221,14 @@ Maintain taskdoc integrity and consistency, and keep `progress` as a team-scanna
201
221
 
202
222
  ```typescript
203
223
  // Update progress (keep goals / constraints / progress consistent)
224
+ recall_taskdoc({
225
+ selector: 'progress',
226
+ });
227
+
204
228
  change_mind({
205
229
  selector: 'progress',
206
230
  content:
207
231
  '## Progress\n\n### Current Effective State\n- The boundary wording has been propagated into handbook sources and tests; details: <doc-path>#<section>\n\n### Decisions In Effect\n- role assets / personal_memory / team_memory / Taskdoc-progress / reminders now have separated responsibilities\n\n### Next Step\n- Re-verify control manual wording, Taskdoc display text, and boundary tests\n\n### Still-Active Blockers\n- None',
232
+ previous_content_hash: 'crc32:...',
208
233
  });
209
234
  ```
@@ -150,7 +150,7 @@ Create a new Taskdoc section. It fails if the target section already exists.
150
150
 
151
151
  - Create-only: it does not overwrite existing content
152
152
  - Use this for missing resident sections or new extra sections that preserve details without touching existing Taskdoc text
153
- - If the target already exists and only needs small additions, use `mind_more`; if it needs a full rewrite/merge, use `change_mind`
153
+ - If the target already exists and only needs small additions, use `mind_more`; if it needs a full rewrite/merge, call `recall_taskdoc` first and then use `change_mind` with the returned `content_hash` as `previous_content_hash`
154
154
  - Does not start a new course
155
155
  - Changes visible to all teammates
156
156
 
@@ -163,6 +163,7 @@ Update taskdoc chapter.
163
163
  - `selector` (required): Chapter selector (goals/constraints/progress)
164
164
  - `category` (optional): Extra section directory; with `selector`, targets `<category>/<selector>.md`
165
165
  - `content` (required): New content (full section replacement)
166
+ - `previous_content_hash` (required): The current section `content_hash` returned by `recall_taskdoc`
166
167
 
167
168
  **Returns:**
168
169
 
@@ -175,6 +176,7 @@ updated_at: <update timestamp>
175
176
  **Characteristics:**
176
177
 
177
178
  - Each call replaces an existing entire chapter; it does not create missing sections
179
+ - The replacement is rejected if `previous_content_hash` does not match the current section content hash
178
180
  - Does not start a new course
179
181
  - Changes visible to all teammates
180
182
  - Constraint rule: `constraints` must include only task-specific hard requirements; do not repeat global rules. If a duplicate is found, delete it and inform the user
@@ -206,7 +208,7 @@ mind_more({
206
208
  - Append-only: it does not deduplicate, rewrite, or compress old content
207
209
  - Good for adding one or two still-effective states, decisions, next steps, or blockers to `progress`
208
210
  - Not for appending every investigation step, long log, full plan, or acceptance record as a chronology; those details belong in formal rtws documentation, while Taskdoc keeps the summary and document pointer
209
- - If stale entries must be removed, reordered, or compressed, use `change_mind` for a full-section replacement; if a whole section file should be deleted, use `never_mind`
211
+ - If stale entries must be removed, reordered, or compressed, call `recall_taskdoc` first and then use `change_mind` with the returned `content_hash` as `previous_content_hash` for a full-section replacement; if a whole section file should be deleted, use `never_mind`
210
212
  - When one topic already has several phase notes, prefer `change_mind` to merge them into a concise current announcement instead of continuing to call `mind_more`
211
213
 
212
214
  ### 8. never_mind
@@ -221,7 +223,7 @@ Delete a Taskdoc section file.
221
223
  **Characteristics:**
222
224
 
223
225
  - Deletes only the whole section file; it does not edit content
224
- - Use it only when the whole section is no longer valid. If you only need to remove stale entries or compress structure, prefer `change_mind` with the cleaned full section
226
+ - Use it only when the whole section is no longer valid. If you only need to remove stale entries or compress structure, prefer `recall_taskdoc` followed by `change_mind` with the cleaned full section and returned `content_hash` as `previous_content_hash`
225
227
  - Does not start a new course
226
228
 
227
229
  ### 9. recall_taskdoc
@@ -230,15 +232,16 @@ Read taskdoc chapter.
230
232
 
231
233
  **Parameters:**
232
234
 
233
- - `category` (required): Category directory
234
- - `selector` (required): Chapter selector
235
+ - `selector` (required): Chapter selector. Omit `category` for top-level sections (`goals` / `constraints` / `progress`)
236
+ - `category` (optional): Category directory. Use `bearinmind` for fixed bear-in-mind sections, or an extra section directory
235
237
 
236
238
  **Returns:**
237
239
 
238
240
  ```yaml
239
241
  status: ok|error
240
- category: <category>
241
242
  selector: <selector>
243
+ category: <category, when supplied>
244
+ content_hash: <crc32 checksum>
242
245
  content: <chapter content>
243
246
  retrieved_at: <retrieval timestamp>
244
247
  ```
@@ -305,16 +308,25 @@ mind_more({
305
308
  ### Replace Taskdoc Progress
306
309
 
307
310
  ```typescript
311
+ recall_taskdoc({
312
+ selector: 'progress',
313
+ });
314
+
308
315
  change_mind({
309
316
  selector: 'progress',
310
317
  content:
311
318
  '## Progress\n\n### Current Effective State\n- The handbook boundary split is now agreed: role assets / personal long-lived experience / Taskdoc-progress / reminders; details: <doc-path>#<section>\n\n### Decisions In Effect\n- `persona / knowhow / pitfalls` no longer absorb daily member experience\n- `personal_memory` is reserved for one member\\'s reusable long-lived experience\n\n### Next Step\n- Strengthen the bulletin-board semantics of Taskdoc `progress`\n\n### Still-Active Blockers\n- None',
319
+ previous_content_hash: 'crc32:...',
312
320
  });
313
321
  ```
314
322
 
315
323
  ### Read Taskdoc Chapter
316
324
 
317
325
  ```typescript
326
+ recall_taskdoc({
327
+ selector: 'progress',
328
+ });
329
+
318
330
  recall_taskdoc({
319
331
  category: 'bearinmind',
320
332
  selector: 'runbook',
@@ -132,8 +132,8 @@
132
132
 
133
133
  - 保持简洁:默认提醒项常见 1–3 条,优先 `update_reminder` 压缩/合并
134
134
  - 区分载体:需要向全队同步的当前有效状态、关键决策、下一步与仍成立阻塞,写入 `progress` 这一准实时任务公告牌;提醒项只留个人/当前对话恢复所需细节
135
- - 面向全队:`progress` 应保持可扫读、以“当前仍有效”为准,不要退化成个人日志、流水账、临时便签或历史残影堆积;少量新增用 `mind_more`,需要清旧/重排/压缩时用 `change_mind`
136
- - 按需整理:`mind_more` 不是默认记账动作。若同一主题已有多条阶段性记录,优先用 `change_mind` 合并成当前摘要;把细节放进 rtws 正式文档,并在差遣牒里保留文档定位 pointer
135
+ - 面向全队:`progress` 应保持可扫读、以“当前仍有效”为准,不要退化成个人日志、流水账、临时便签或历史残影堆积;少量新增用 `mind_more`,需要清旧/重排/压缩时先调用 `recall_taskdoc`,再用 `change_mind` 并携带返回的 `content_hash` 作为 `previous_content_hash`
136
+ - 按需整理:`mind_more` 不是默认记账动作。若同一主题已有多条阶段性记录,优先用 `change_mind` 合并成当前摘要;把细节放进 rtws 正式文档,并在差遣牒里保留文档定位 pointer。若会冲掉原有内容,必须有直接人类确认,或已按人类认可 SOP/验收标准充分考虑原有内容后再改写
137
137
  - 换程前收束:主线对话先把尚未落实到文档、且下一程需要知会的讨论细节写入差遣牒合适章节,再整理结构化接续包提醒项;支线对话不要维护差遣牒,也不要整理差遣牒更新提案,直接维护足够详尽的接续包提醒项。若系统已把当前程切到吃紧/告急处置态,则先保留多条粗略提醒项过桥也可以;当前程只做落文档/保信息 + `clear_mind`(支线只做保信息 + `clear_mind`),系统真正开启新一程后第一步再收敛
138
138
  - 拒绝原料堆积:不要把长日志/大段 tool output 直接塞进提醒项
139
139
  - 文档分层:差遣牒写“现在应如何同步/推进”,正式文档写“为什么、怎么做、详细证据和完整过程”。差遣牒需要引用正式文档时,写稳定路径/章节名/相关命令,而不是复制整段内容
@@ -156,7 +156,7 @@
156
156
  ## 限制与注意事项
157
157
 
158
158
  1. `dialog` 提醒会随对话结束而结束;`personal` 提醒会在所有由你主理的后续对话里继续可见
159
- 2. 缺失差遣牒章节用 `do_mind` 创建;差遣牒少量新增可用 `mind_more` 追加;已有章节整段替换用 `change_mind`,请确保合并已有内容;确需删除整章文件时用 `never_mind`。不要把 `mind_more` 当流水账工具;需要整理、去旧、合并同主题记录时直接 `change_mind`
159
+ 2. 缺失差遣牒章节用 `do_mind` 创建;差遣牒少量新增可用 `mind_more` 追加;已有章节整段替换用 `change_mind`,请确保合并已有内容,并先调用 `recall_taskdoc` 取得当前 `content_hash` 作为 `previous_content_hash`;确需删除整章文件时用 `never_mind`。不要把 `mind_more` 当流水账工具;需要整理、去旧、合并同主题记录时先 `recall_taskdoc` 再 `change_mind`
160
160
  3. `do_mind` / `mind_more` / `change_mind` / `never_mind` 不开启新 course
161
161
  4. 接续包提醒项只保留差遣牒仍未覆盖、但恢复工作容易丢的细节;主线对话应先把当前对话历史中应由下一程知会的未落文档讨论细节写入差遣牒合适章节;支线对话在吃紧/告急时只维护足够详尽的接续包提醒项
162
162
  5. 不要把 `personal` 提醒堆成长期事实仓库;耐久知识应迁到 `personal_memory`
@@ -127,10 +127,15 @@ mind_more({
127
127
  });
128
128
 
129
129
  // 需要清理旧项、重排、同主题合并或压缩流水账时,整章替换
130
+ recall_taskdoc({
131
+ selector: 'progress',
132
+ });
133
+
130
134
  change_mind({
131
135
  selector: 'progress',
132
136
  content:
133
137
  '## Progress\n\n### 当前有效状态\n- 已完成三类记忆载体边界收口,准备补 Taskdoc 公告牌属性;细节见 <文档路径>#<章节>\n\n### 已生效决策\n- `personal_memory` 不再作为短期杂物柜\n- `team_memory` 只承接团队长期共识与不变量\n\n### 下一步\n- 在 control / team_mgmt 手册中补强 `progress` 的公告牌语义\n\n### 仍成立阻塞\n- 无',
138
+ previous_content_hash: 'crc32:...',
134
139
  });
135
140
  ```
136
141
 
@@ -143,10 +148,15 @@ change_mind({
143
148
  ### 示例
144
149
 
145
150
  ```typescript
151
+ recall_taskdoc({
152
+ selector: 'goals',
153
+ });
154
+
146
155
  change_mind({
147
156
  selector: 'goals',
148
157
  content:
149
158
  '## Goals\n\n- [ ] 创建所有工具集手册\n - [x] ws_mod\n - [x] team_mgmt\n - [x] personal_memory\n - [ ] control (进行中)\n- [ ] 编写工具描述',
159
+ previous_content_hash: 'crc32:...',
150
160
  });
151
161
  ```
152
162
 
@@ -159,10 +169,15 @@ change_mind({
159
169
  ### 示例
160
170
 
161
171
  ```typescript
172
+ recall_taskdoc({
173
+ selector: 'constraints',
174
+ });
175
+
162
176
  change_mind({
163
177
  selector: 'constraints',
164
178
  content:
165
179
  '## Constraints\n\n- man 函数必须根据 team.yaml 动态过滤工具集\n- 运行时生效:team.yaml 配置变更后立即可见\n- 工具集名称使用下划线格式\n- 新增约束:每个工具集需要 5 个 topic × 2 个语言',
180
+ previous_content_hash: 'crc32:...',
166
181
  });
167
182
  ```
168
183
 
@@ -175,6 +190,11 @@ change_mind({
175
190
  ### 示例
176
191
 
177
192
  ```typescript
193
+ // 顶层章节正文会自动注入,但 content_hash 由 recall_taskdoc 返回
194
+ recall_taskdoc({
195
+ selector: 'progress',
196
+ });
197
+
178
198
  // 读取 bearinmind/runbook
179
199
  recall_taskdoc({
180
200
  category: 'bearinmind',
@@ -198,9 +218,14 @@ recall_taskdoc({
198
218
 
199
219
  ```typescript
200
220
  // 更新 progress(保持 goals / constraints / progress 一致)
221
+ recall_taskdoc({
222
+ selector: 'progress',
223
+ });
224
+
201
225
  change_mind({
202
226
  selector: 'progress',
203
227
  content:
204
228
  '## Progress\n\n### 当前有效状态\n- 边界口径已统一到手册源头与测试;细节见 <文档路径>#<章节>\n\n### 已生效决策\n- 角色级资产 / personal_memory / team_memory / Taskdoc-progress / reminders 的职责已经切开\n\n### 下一步\n- 复验 control 手册、Taskdoc 展示文案与边界测试\n\n### 仍成立阻塞\n- 无',
229
+ previous_content_hash: 'crc32:...',
205
230
  });
206
231
  ```
@@ -150,7 +150,7 @@ status: ok|error
150
150
 
151
151
  - 只创建,不覆盖已有内容
152
152
  - 适合创建缺失的常驻章节,或新增额外章节来保留细节,同时不触碰已有差遣牒正文
153
- - 若目标已存在且只需少量补充,用 `mind_more`;若需要整章改写/合并,用 `change_mind`
153
+ - 若目标已存在且只需少量补充,用 `mind_more`;若需要整章改写/合并,先调用 `recall_taskdoc`,再用 `change_mind` 并带上返回的 `content_hash` 作为 `previous_content_hash`
154
154
  - 不开启新 course
155
155
  - 变更对所有队友可见
156
156
 
@@ -163,6 +163,7 @@ status: ok|error
163
163
  - `selector`(必需):章节选择器(goals/constraints/progress)
164
164
  - `category`(可选):额外章节目录;与 `selector` 组合定位 `<category>/<selector>.md`
165
165
  - `content`(必需):新内容(整段替换)
166
+ - `previous_content_hash`(必需):`recall_taskdoc` 返回的当前章节 `content_hash`
166
167
 
167
168
  **返回:**
168
169
 
@@ -175,6 +176,7 @@ updated_at: <更新时间戳>
175
176
  **特点:**
176
177
 
177
178
  - 每次调用替换已有的整个章节;不会创建缺失章节
179
+ - 若 `previous_content_hash` 与当前章节内容哈希不匹配,替换会被拒绝
178
180
  - 不开启新 course
179
181
  - 变更对所有队友可见
180
182
  - 约束规则:`constraints` 只写任务特有硬要求,不得重复系统提示/工具文档中的全局规则;一经发现重复,必须删除并告知用户
@@ -203,7 +205,7 @@ mind_more({
203
205
  - 只追加,不会自动去重、改写或压缩旧内容
204
206
  - 适合给 `progress` 补一两条当前仍有效的状态、决策、下一步或阻塞
205
207
  - 不适合把每一步调查过程、长日志、完整方案或验收记录当流水账追加进去;这些细节应写入 rtws 正式文档,差遣牒只写摘要和文档定位 pointer
206
- - 若需要删除陈旧项、重排结构或压缩公告牌,仍使用 `change_mind` 做整章替换;若要删除整个章节文件,使用 `never_mind`
208
+ - 若需要删除陈旧项、重排结构或压缩公告牌,先调用 `recall_taskdoc`,再使用带返回 `content_hash` 作为 `previous_content_hash` 的 `change_mind` 做整章替换;若要删除整个章节文件,使用 `never_mind`
207
209
  - 当同一主题已经有多条阶段记录时,优先 `change_mind` 合并成当前仍有效的简明公告,而不是继续 `mind_more`
208
210
 
209
211
  ### 8. never_mind
@@ -218,7 +220,7 @@ mind_more({
218
220
  **特点:**
219
221
 
220
222
  - 只删除整章文件,不做内容编辑
221
- - 仅用于章节整体不再成立;如果只是删除几条陈旧项或压缩结构,优先用 `change_mind` 写回整理后的全文
223
+ - 仅用于章节整体不再成立;如果只是删除几条陈旧项或压缩结构,优先先 `recall_taskdoc`,再用带返回 `content_hash` 作为 `previous_content_hash` 的 `change_mind` 写回整理后的全文
222
224
  - 不开启新 course
223
225
 
224
226
  ### 9. recall_taskdoc
@@ -227,15 +229,16 @@ mind_more({
227
229
 
228
230
  **参数:**
229
231
 
230
- - `category`(必需):类别目录
231
- - `selector`(必需):章节选择器
232
+ - `selector`(必需):章节选择器。顶层章节(`goals` / `constraints` / `progress`)省略 `category`
233
+ - `category`(可选):类别目录。固定 bear-in-mind 章节使用 `bearinmind`,其他额外章节使用对应目录
232
234
 
233
235
  **返回:**
234
236
 
235
237
  ```yaml
236
238
  status: ok|error
237
- category: <类别>
238
239
  selector: <选择器>
240
+ category: <传入 category 时返回>
241
+ content_hash: <crc32 校验值>
239
242
  content: <章节内容>
240
243
  retrieved_at: <读取时间戳>
241
244
  ```
@@ -298,16 +301,25 @@ mind_more({
298
301
  ### 整章替换差遣牒进度
299
302
 
300
303
  ```typescript
304
+ recall_taskdoc({
305
+ selector: 'progress',
306
+ });
307
+
301
308
  change_mind({
302
309
  selector: 'progress',
303
310
  content:
304
311
  '## Progress\n\n### 当前有效状态\n- 手册边界方案已确定:角色级资产 / 个人长期经验 / Taskdoc-progress / reminders 分流;细节见 <文档路径>#<章节>\n\n### 已生效决策\n- `persona / knowhow / pitfalls` 不承接成员日常经验\n- `personal_memory` 只承接成员自己的长期可复用经验\n\n### 下一步\n- 补齐 Taskdoc `progress` 的公告牌属性说明\n\n### 仍成立阻塞\n- 无',
312
+ previous_content_hash: 'crc32:...',
305
313
  });
306
314
  ```
307
315
 
308
316
  ### 读取差遣牒章节
309
317
 
310
318
  ```typescript
319
+ recall_taskdoc({
320
+ selector: 'progress',
321
+ });
322
+
311
323
  recall_taskdoc({
312
324
  category: 'bearinmind',
313
325
  selector: 'runbook',
@@ -114,7 +114,7 @@ async function renderTeamMgmtGuideContent(language, topicsRaw = []) {
114
114
  '`model_param_options` 可选:用于记录该 provider 支持的 `.minds/team.yaml model_params` 选项(文档用途)。',
115
115
  '`apiQuirks` 可选:写在 `providers.<providerKey>.apiQuirks`,类型是 `string|string[]`;需要多个 quirk 时用数组,例如 `apiQuirks: [same-context-empty-response]`。它是 provider 级 transport / 网关兼容开关,用来描述“这个供应商/网关的 API 有非标准行为”,不是 `.minds/team.yaml` 的成员参数,也不是 `model_params`。',
116
116
  '使用原则:只有在你确认某个上游网关确实偏离了标准协议,而且 Dominds 已为这个偏差实现了命名 quirk 时才配置;不要把它当作随意调参入口。当前实现里,未知 quirk 值通常不会报错,但也不会带来任何效果。',
117
- '当前已知示例:OpenAI Responses 包装层支持 `apiQuirks: xcode.best`(或数组里包含它),用于识别 vendor keepalive、处理 xcode.best 特有的失败模式,以及把网关返回的 HTML 版 502 Bad Gateway 错误页和 `500 auth_unavailable: no auth available` 这类基础设施失败归类为 conservative 策略重试。OpenAI-compatible Chat Completions 包装层支持 `apiQuirks: same-context-empty-response`,用于“同一对话 generation 上下文连续返回 empty response”时先做少量临时重试;如果在同一 generation 上下文里连续达到阈值,就判定为 provider same-context deadlock,并停止继续沿用同一上下文自动重试。最小示例:\n```yaml\nproviders:\n my_gateway:\n apiType: openai-compatible\n baseUrl: https://example.invalid/v1\n apiKeyEnvVar: MY_GATEWAY_API_KEY\n apiQuirks: same-context-empty-response\n models:\n my_model: { name: "upstream-model-id" }\n```',
117
+ '当前已知示例:OpenAI Responses 包装层支持 `apiQuirks: xcode.best`(或数组里包含它),用于识别 vendor keepalive、处理 xcode.best 特有的失败模式,以及把网关返回的 HTML 版 502 Bad Gateway 错误页和 `500 auth_unavailable: no auth available` 这类基础设施失败归类为 conservative 策略重试。OpenAI-compatible Chat Completions 包装层支持 `apiQuirks: same-context-empty-response`,用于“同一对话 generation 上下文连续返回 empty response”时先做少量临时重试;也支持内置 `kimi-code` provider 使用的 `apiQuirks: kimi-code`,用于 Kimi Code 专用 User-Agent、`prompt_cache_key` 和 `thinking`/`reasoning_effort` 请求整形。最小示例:\n```yaml\nproviders:\n my_gateway:\n apiType: openai-compatible\n baseUrl: https://example.invalid/v1\n apiKeyEnvVar: MY_GATEWAY_API_KEY\n apiQuirks: same-context-empty-response\n models:\n my_model: { name: "upstream-model-id" }\n```',
118
118
  '边界提醒:`apiQuirks` 只影响实现里显式消费它的 provider/generator。就当前实现看,OpenAI Responses 与 OpenAI-compatible 路径会读取它;不要假设所有 `apiType` 都支持或需要它。若配置后行为仍异常,应继续检查上游网关文档、抓流事件类型,并结合 `team_mgmt_check_provider(...)` / 运行日志排查。',
119
119
  ])
120
120
  : fmtHeader('.minds/llm.yaml') +
@@ -128,7 +128,7 @@ async function renderTeamMgmtGuideContent(language, topicsRaw = []) {
128
128
  'Optional: `model_param_options` documents `.minds/team.yaml model_params` knobs (documentation only).',
129
129
  '`apiQuirks` is optional under `providers.<providerKey>.apiQuirks`, with type `string|string[]`; use an array for multiple quirks, for example `apiQuirks: [same-context-empty-response]`. It is a provider-level transport / gateway compatibility switch for non-standard upstream API behavior. It is not a `.minds/team.yaml` member field and not part of `model_params`.',
130
130
  'Use it only when you have confirmed that an upstream gateway deviates from the expected protocol and Dominds has an explicitly named quirk for that deviation. Do not treat it as a generic tuning field. In the current implementation, unknown quirk values are usually ignored rather than rejected, so a typo may silently do nothing.',
131
- 'Known current example: the OpenAI Responses wrapper supports `apiQuirks: xcode.best` (or an array containing it) for vendor keepalive recognition, xcode.best-specific failures, and gateway-returned HTML 502 Bad Gateway plus `500 auth_unavailable: no auth available` infrastructure failures. The OpenAI-compatible Chat Completions wrapper supports `apiQuirks: same-context-empty-response` for repeated empty responses in the same dialog generation context: it tries a short burst first, then treats the streak as a provider-side same-context deadlock and stops repeating the same automatic retry path. Minimal example:\n```yaml\nproviders:\n my_gateway:\n apiType: openai-compatible\n baseUrl: https://example.invalid/v1\n apiKeyEnvVar: MY_GATEWAY_API_KEY\n apiQuirks: same-context-empty-response\n models:\n my_model: { name: "upstream-model-id" }\n```',
131
+ 'Known current example: the OpenAI Responses wrapper supports `apiQuirks: xcode.best` (or an array containing it) for vendor keepalive recognition, xcode.best-specific failures, and gateway-returned HTML 502 Bad Gateway plus `500 auth_unavailable: no auth available` infrastructure failures. The OpenAI-compatible Chat Completions wrapper supports `apiQuirks: same-context-empty-response` for repeated empty responses in the same dialog generation context, and `apiQuirks: kimi-code` for the built-in Kimi Code provider request shaping: Dominds User-Agent, `prompt_cache_key`, and `thinking`/`reasoning_effort`. Minimal example:\n```yaml\nproviders:\n my_gateway:\n apiType: openai-compatible\n baseUrl: https://example.invalid/v1\n apiKeyEnvVar: MY_GATEWAY_API_KEY\n apiQuirks: same-context-empty-response\n models:\n my_model: { name: "upstream-model-id" }\n```',
132
132
  'Boundary reminder: `apiQuirks` only affects providers/generators that explicitly read it in code. In the current implementation, the OpenAI Responses and OpenAI-compatible paths consume it; do not assume every `apiType` supports or needs it. If behavior is still wrong after setting it, continue with upstream gateway docs, raw stream event inspection, and `team_mgmt_check_provider(...)` / runtime logs.',
133
133
  ]);
134
134
  }