@geminilight/mindos 0.7.2 → 0.7.4

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 (254) hide show
  1. package/_standalone/.mindos-build-version +1 -1
  2. package/_standalone/.next/BUILD_ID +1 -1
  3. package/_standalone/.next/app-path-routes-manifest.json +19 -19
  4. package/_standalone/.next/build-manifest.json +3 -3
  5. package/_standalone/.next/cache/.previewinfo +1 -1
  6. package/_standalone/.next/cache/.rscinfo +1 -1
  7. package/_standalone/.next/cache/config.json +3 -3
  8. package/_standalone/.next/prerender-manifest.json +3 -3
  9. package/_standalone/.next/react-loadable-manifest.json +4 -4
  10. package/_standalone/.next/server/app/.well-known/agent-card.json/route_client-reference-manifest.js +1 -1
  11. package/_standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  12. package/_standalone/.next/server/app/_global-error.html +2 -2
  13. package/_standalone/.next/server/app/_global-error.rsc +1 -1
  14. package/_standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  15. package/_standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  16. package/_standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  17. package/_standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  18. package/_standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  19. package/_standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/_standalone/.next/server/app/_not-found/page.js +1 -1
  21. package/_standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/_standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/_standalone/.next/server/app/agents/[agentKey]/page.js +1 -1
  24. package/_standalone/.next/server/app/agents/[agentKey]/page.js.nft.json +1 -1
  25. package/_standalone/.next/server/app/agents/[agentKey]/page_client-reference-manifest.js +1 -1
  26. package/_standalone/.next/server/app/agents/page.js +1 -1
  27. package/_standalone/.next/server/app/agents/page.js.nft.json +1 -1
  28. package/_standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  29. package/_standalone/.next/server/app/api/a2a/agents/route_client-reference-manifest.js +1 -1
  30. package/_standalone/.next/server/app/api/a2a/delegations/route_client-reference-manifest.js +1 -1
  31. package/_standalone/.next/server/app/api/a2a/discover/route_client-reference-manifest.js +1 -1
  32. package/_standalone/.next/server/app/api/a2a/route_client-reference-manifest.js +1 -1
  33. package/_standalone/.next/server/app/api/acp/config/route_client-reference-manifest.js +1 -1
  34. package/_standalone/.next/server/app/api/acp/detect/route_client-reference-manifest.js +1 -1
  35. package/_standalone/.next/server/app/api/acp/install/route_client-reference-manifest.js +1 -1
  36. package/_standalone/.next/server/app/api/acp/registry/route_client-reference-manifest.js +1 -1
  37. package/_standalone/.next/server/app/api/acp/session/route_client-reference-manifest.js +1 -1
  38. package/_standalone/.next/server/app/api/agent-activity/route_client-reference-manifest.js +1 -1
  39. package/_standalone/.next/server/app/api/agents/copy-skill/route_client-reference-manifest.js +1 -1
  40. package/_standalone/.next/server/app/api/agents/custom/detect/route_client-reference-manifest.js +1 -1
  41. package/_standalone/.next/server/app/api/agents/custom/route_client-reference-manifest.js +1 -1
  42. package/_standalone/.next/server/app/api/ask/route.js +4 -4
  43. package/_standalone/.next/server/app/api/ask/route_client-reference-manifest.js +1 -1
  44. package/_standalone/.next/server/app/api/ask-sessions/route_client-reference-manifest.js +1 -1
  45. package/_standalone/.next/server/app/api/auth/route_client-reference-manifest.js +1 -1
  46. package/_standalone/.next/server/app/api/backlinks/route_client-reference-manifest.js +1 -1
  47. package/_standalone/.next/server/app/api/bootstrap/route_client-reference-manifest.js +1 -1
  48. package/_standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
  49. package/_standalone/.next/server/app/api/channels/verify/route_client-reference-manifest.js +1 -1
  50. package/_standalone/.next/server/app/api/connect/route_client-reference-manifest.js +1 -1
  51. package/_standalone/.next/server/app/api/embedding/route_client-reference-manifest.js +1 -1
  52. package/_standalone/.next/server/app/api/export/route_client-reference-manifest.js +1 -1
  53. package/_standalone/.next/server/app/api/extract-docx/route_client-reference-manifest.js +1 -1
  54. package/_standalone/.next/server/app/api/extract-pdf/route_client-reference-manifest.js +1 -1
  55. package/_standalone/.next/server/app/api/file/import/route_client-reference-manifest.js +1 -1
  56. package/_standalone/.next/server/app/api/file/raw/route_client-reference-manifest.js +1 -1
  57. package/_standalone/.next/server/app/api/file/route_client-reference-manifest.js +1 -1
  58. package/_standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
  59. package/_standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  60. package/_standalone/.next/server/app/api/graph/route_client-reference-manifest.js +1 -1
  61. package/_standalone/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  62. package/_standalone/.next/server/app/api/im/activity/route_client-reference-manifest.js +1 -1
  63. package/_standalone/.next/server/app/api/im/config/route_client-reference-manifest.js +1 -1
  64. package/_standalone/.next/server/app/api/im/feishu/long-connection/event/route_client-reference-manifest.js +1 -1
  65. package/_standalone/.next/server/app/api/im/feishu/long-connection/route_client-reference-manifest.js +1 -1
  66. package/_standalone/.next/server/app/api/im/status/route_client-reference-manifest.js +1 -1
  67. package/_standalone/.next/server/app/api/im/test/route_client-reference-manifest.js +1 -1
  68. package/_standalone/.next/server/app/api/im/webhook/feishu/route_client-reference-manifest.js +1 -1
  69. package/_standalone/.next/server/app/api/im/webhook-status/route_client-reference-manifest.js +1 -1
  70. package/_standalone/.next/server/app/api/inbox/clip/route_client-reference-manifest.js +1 -1
  71. package/_standalone/.next/server/app/api/inbox/route_client-reference-manifest.js +1 -1
  72. package/_standalone/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  73. package/_standalone/.next/server/app/api/lint/route_client-reference-manifest.js +1 -1
  74. package/_standalone/.next/server/app/api/mcp/agents/route_client-reference-manifest.js +1 -1
  75. package/_standalone/.next/server/app/api/mcp/direct-tools/route_client-reference-manifest.js +1 -1
  76. package/_standalone/.next/server/app/api/mcp/install/route_client-reference-manifest.js +1 -1
  77. package/_standalone/.next/server/app/api/mcp/install-skill/route_client-reference-manifest.js +1 -1
  78. package/_standalone/.next/server/app/api/mcp/restart/route_client-reference-manifest.js +1 -1
  79. package/_standalone/.next/server/app/api/mcp/status/route_client-reference-manifest.js +1 -1
  80. package/_standalone/.next/server/app/api/mcp/tools/route_client-reference-manifest.js +1 -1
  81. package/_standalone/.next/server/app/api/mcp/uninstall/route_client-reference-manifest.js +1 -1
  82. package/_standalone/.next/server/app/api/monitoring/route_client-reference-manifest.js +1 -1
  83. package/_standalone/.next/server/app/api/obsidian/compat-report/route_client-reference-manifest.js +1 -1
  84. package/_standalone/.next/server/app/api/obsidian/import/route_client-reference-manifest.js +1 -1
  85. package/_standalone/.next/server/app/api/recent-files/route_client-reference-manifest.js +1 -1
  86. package/_standalone/.next/server/app/api/restart/route_client-reference-manifest.js +1 -1
  87. package/_standalone/.next/server/app/api/search/prewarm/route_client-reference-manifest.js +1 -1
  88. package/_standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
  89. package/_standalone/.next/server/app/api/settings/list-models/route_client-reference-manifest.js +1 -1
  90. package/_standalone/.next/server/app/api/settings/reset-token/route_client-reference-manifest.js +1 -1
  91. package/_standalone/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
  92. package/_standalone/.next/server/app/api/settings/test-key/route_client-reference-manifest.js +1 -1
  93. package/_standalone/.next/server/app/api/setup/check-path/route_client-reference-manifest.js +1 -1
  94. package/_standalone/.next/server/app/api/setup/check-port/route_client-reference-manifest.js +1 -1
  95. package/_standalone/.next/server/app/api/setup/generate-token/route_client-reference-manifest.js +1 -1
  96. package/_standalone/.next/server/app/api/setup/ls/route_client-reference-manifest.js +1 -1
  97. package/_standalone/.next/server/app/api/setup/route_client-reference-manifest.js +1 -1
  98. package/_standalone/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  99. package/_standalone/.next/server/app/api/space-overview/route_client-reference-manifest.js +1 -1
  100. package/_standalone/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
  101. package/_standalone/.next/server/app/api/tree-version/route_client-reference-manifest.js +1 -1
  102. package/_standalone/.next/server/app/api/uninstall/route_client-reference-manifest.js +1 -1
  103. package/_standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  104. package/_standalone/.next/server/app/api/update-check/route_client-reference-manifest.js +1 -1
  105. package/_standalone/.next/server/app/api/update-status/route_client-reference-manifest.js +1 -1
  106. package/_standalone/.next/server/app/api/workflows/route_client-reference-manifest.js +1 -1
  107. package/_standalone/.next/server/app/capture/history/page.js +1 -1
  108. package/_standalone/.next/server/app/capture/history/page.js.nft.json +1 -1
  109. package/_standalone/.next/server/app/capture/history/page_client-reference-manifest.js +1 -1
  110. package/_standalone/.next/server/app/capture/page.js +1 -1
  111. package/_standalone/.next/server/app/capture/page.js.nft.json +1 -1
  112. package/_standalone/.next/server/app/capture/page_client-reference-manifest.js +1 -1
  113. package/_standalone/.next/server/app/changelog/page.js +1 -1
  114. package/_standalone/.next/server/app/changelog/page.js.nft.json +1 -1
  115. package/_standalone/.next/server/app/changelog/page_client-reference-manifest.js +1 -1
  116. package/_standalone/.next/server/app/changes/page.js +1 -1
  117. package/_standalone/.next/server/app/changes/page.js.nft.json +1 -1
  118. package/_standalone/.next/server/app/changes/page_client-reference-manifest.js +1 -1
  119. package/_standalone/.next/server/app/echo/[segment]/page.js +1 -1
  120. package/_standalone/.next/server/app/echo/[segment]/page.js.nft.json +1 -1
  121. package/_standalone/.next/server/app/echo/[segment]/page_client-reference-manifest.js +1 -1
  122. package/_standalone/.next/server/app/echo/page.js +1 -1
  123. package/_standalone/.next/server/app/echo/page.js.nft.json +1 -1
  124. package/_standalone/.next/server/app/echo/page_client-reference-manifest.js +1 -1
  125. package/_standalone/.next/server/app/explore/page.js +1 -1
  126. package/_standalone/.next/server/app/explore/page.js.nft.json +1 -1
  127. package/_standalone/.next/server/app/explore/page_client-reference-manifest.js +1 -1
  128. package/_standalone/.next/server/app/help/page.js +1 -1
  129. package/_standalone/.next/server/app/help/page.js.nft.json +1 -1
  130. package/_standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
  131. package/_standalone/.next/server/app/inbox/history/page.js +1 -1
  132. package/_standalone/.next/server/app/inbox/history/page.js.nft.json +1 -1
  133. package/_standalone/.next/server/app/inbox/history/page_client-reference-manifest.js +1 -1
  134. package/_standalone/.next/server/app/login/page.js +1 -1
  135. package/_standalone/.next/server/app/login/page.js.nft.json +1 -1
  136. package/_standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  137. package/_standalone/.next/server/app/page.js +1 -1
  138. package/_standalone/.next/server/app/page.js.nft.json +1 -1
  139. package/_standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  140. package/_standalone/.next/server/app/setup/page.js +1 -1
  141. package/_standalone/.next/server/app/setup/page.js.nft.json +1 -1
  142. package/_standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  143. package/_standalone/.next/server/app/todo/page.js +1 -1
  144. package/_standalone/.next/server/app/todo/page.js.nft.json +1 -1
  145. package/_standalone/.next/server/app/todo/page_client-reference-manifest.js +1 -1
  146. package/_standalone/.next/server/app/trash/page.js +2 -2
  147. package/_standalone/.next/server/app/trash/page_client-reference-manifest.js +1 -1
  148. package/_standalone/.next/server/app/view/[...path]/page.js +2 -2
  149. package/_standalone/.next/server/app/view/[...path]/page.js.nft.json +1 -1
  150. package/_standalone/.next/server/app/view/[...path]/page_client-reference-manifest.js +1 -1
  151. package/_standalone/.next/server/app/wiki/page.js +2 -0
  152. package/_standalone/.next/server/app/wiki/page.js.nft.json +1 -0
  153. package/_standalone/.next/server/app/wiki/page_client-reference-manifest.js +1 -0
  154. package/_standalone/.next/server/app-paths-manifest.json +19 -19
  155. package/_standalone/.next/server/chunks/2250.js +1 -1
  156. package/_standalone/.next/server/chunks/{1057.js → 3861.js} +2 -2
  157. package/_standalone/.next/server/chunks/4802.js +30 -30
  158. package/_standalone/.next/server/chunks/8388.js +1 -1
  159. package/_standalone/.next/server/middleware-build-manifest.js +1 -1
  160. package/_standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
  161. package/_standalone/.next/server/pages/500.html +2 -2
  162. package/_standalone/.next/server/server-reference-manifest.js +1 -1
  163. package/_standalone/.next/server/server-reference-manifest.json +1 -1
  164. package/_standalone/.next/static/chunks/{5581-bae715e40d227b5f.js → 5581-beecbc4ca5625aa9.js} +2 -2
  165. package/_standalone/.next/static/chunks/6762.c871d0bf3f45ba87.js +1 -0
  166. package/_standalone/.next/static/chunks/{8064-e65acd2762132099.js → 8064-acac37daf946082b.js} +1 -1
  167. package/_standalone/.next/static/chunks/{3985.695651f6b5cd768c.js → 8984.91fb8cde1983c564.js} +2 -2
  168. package/_standalone/.next/static/chunks/app/{layout-0cf6f2a65f605a0d.js → layout-20faba3bc0af7cd2.js} +19 -19
  169. package/_standalone/.next/static/chunks/app/trash/page-0c2c67929b71ef71.js +1 -0
  170. package/_standalone/.next/static/chunks/app/view/[...path]/not-found-fd06cc989103ebe7.js +1 -0
  171. package/_standalone/.next/static/chunks/app/view/[...path]/page-dba70888697ba910.js +12 -0
  172. package/_standalone/.next/static/chunks/app/wiki/page-9bc1fec84d343290.js +14 -0
  173. package/_standalone/.next/static/chunks/webpack-3c1d0331f1da64b8.js +1 -0
  174. package/_standalone/.next/trace +97 -97
  175. package/_standalone/MINDOS_ARCHITECTURE_DIAGRAM.md +488 -0
  176. package/_standalone/MINDOS_EXPLORATION_SUMMARY.md +229 -0
  177. package/_standalone/MINDOS_INFRASTRUCTURE_ANALYSIS.md +732 -0
  178. package/_standalone/__tests__/api/mcp-install.test.ts +8 -2
  179. package/_standalone/__tests__/core/embedding-provider.test.ts +78 -0
  180. package/_standalone/__tests__/skills/mindos-skill-copy-alignment.test.ts +10 -4
  181. package/_standalone/components/ask/AskHeader.tsx +25 -18
  182. package/_standalone/components/ask/SessionHistoryPanel.tsx +21 -12
  183. package/_standalone/components/settings/AiTab.tsx +3 -0
  184. package/_standalone/data/skills/mindos/SKILL.md +269 -0
  185. package/_standalone/data/skills/mindos/references/write-supplement.md +119 -0
  186. package/_standalone/data/skills/mindos-zh/SKILL.md +227 -0
  187. package/_standalone/data/skills/mindos-zh/references/write-supplement.md +119 -0
  188. package/app/__tests__/api/mcp-install.test.ts +8 -2
  189. package/app/__tests__/core/embedding-provider.test.ts +78 -0
  190. package/app/__tests__/skills/mindos-skill-copy-alignment.test.ts +10 -4
  191. package/app/app/api/ask/route.ts +14 -9
  192. package/app/app/view/[...path]/ViewPageClient.tsx +15 -12
  193. package/app/app/view/[...path]/not-found.tsx +9 -5
  194. package/app/components/ask/AskHeader.tsx +25 -18
  195. package/app/components/ask/SessionHistoryPanel.tsx +21 -12
  196. package/app/components/settings/AiTab.tsx +3 -0
  197. package/app/eslint.config.mjs +18 -0
  198. package/app/lib/core/embedding-provider.ts +12 -4
  199. package/app/lib/i18n/modules/settings.ts +2 -0
  200. package/app/package-lock.json +20214 -0
  201. package/app/tsconfig.tsbuildinfo +1 -0
  202. package/app/vitest.config.ts +14 -0
  203. package/assets/demo-flow-zh.html +622 -0
  204. package/assets/images/demo-flow-dark.png +0 -0
  205. package/assets/images/demo-flow-dark.webp +0 -0
  206. package/assets/images/demo-flow-light.png +0 -0
  207. package/assets/images/demo-flow-light.webp +0 -0
  208. package/assets/images/demo-flow-zh-dark.png +0 -0
  209. package/assets/images/demo-flow-zh-dark.webp +0 -0
  210. package/assets/images/demo-flow-zh-light.png +0 -0
  211. package/assets/images/demo-flow-zh-light.webp +0 -0
  212. package/assets/images/gui-sync-cv.png +0 -0
  213. package/assets/images/gui-sync-cv.webp +0 -0
  214. package/assets/images/mindos-chat.png +0 -0
  215. package/assets/images/mindos-chat.webp +0 -0
  216. package/assets/images/mindos-dashboard.png +0 -0
  217. package/assets/images/mindos-dashboard.webp +0 -0
  218. package/assets/images/mindos-echo.png +0 -0
  219. package/assets/images/mindos-echo.webp +0 -0
  220. package/assets/images/mindos-home.png +0 -0
  221. package/assets/images/mindos-home.webp +0 -0
  222. package/assets/images/wechat-qr.png +0 -0
  223. package/bin/lib/mcp-build.js +8 -0
  224. package/mcp/package-lock.json +2202 -0
  225. package/mcp/src/index.ts +783 -0
  226. package/package.json +13 -1
  227. package/.env.local.example +0 -38
  228. package/.playwright-cli/page-2026-04-12T12-26-53-393Z.yml +0 -6
  229. package/.playwright-cli/page-2026-04-12T12-27-20-256Z.yml +0 -120
  230. package/.syncinclude +0 -105
  231. package/MINDOS_SEARCH_DIAGRAM.txt +0 -243
  232. package/_standalone/.next/static/chunks/576.3cae31209383ddbd.js +0 -1
  233. package/_standalone/.next/static/chunks/app/trash/page-085f121c0815d542.js +0 -1
  234. package/_standalone/.next/static/chunks/app/view/[...path]/not-found-2a6eec67e91eaaf9.js +0 -1
  235. package/_standalone/.next/static/chunks/app/view/[...path]/page-faeaf8c09c1c6d7c.js +0 -12
  236. package/_standalone/.next/static/chunks/webpack-a1bb35f2d540e463.js +0 -1
  237. package/scripts/build-runtime-archive.sh +0 -151
  238. package/scripts/fix-postcss-deps.cjs +0 -75
  239. package/scripts/gen-renderer-index.js +0 -64
  240. package/scripts/hooks/block-public-merge.sh +0 -42
  241. package/scripts/hooks/pre-merge-commit +0 -4
  242. package/scripts/hooks/pre-push +0 -37
  243. package/scripts/hooks/prepare-commit-msg +0 -12
  244. package/scripts/migrate-agent-audit-log.js +0 -170
  245. package/scripts/migrate-agent-diff.js +0 -146
  246. package/scripts/parse-syncinclude.sh +0 -92
  247. package/scripts/prepare-standalone.mjs +0 -83
  248. package/scripts/release.sh +0 -145
  249. package/scripts/setup.js +0 -1427
  250. package/scripts/test-oss-upload.sh +0 -100
  251. package/scripts/verify-standalone.mjs +0 -129
  252. package/scripts/write-build-stamp.js +0 -40
  253. /package/_standalone/.next/static/{q5RP_Mx8BrCfvVDnLpRRc → 0UlbV2rA2i4B-8YYg41wQ}/_buildManifest.js +0 -0
  254. /package/_standalone/.next/static/{q5RP_Mx8BrCfvVDnLpRRc → 0UlbV2rA2i4B-8YYg41wQ}/_ssgManifest.js +0 -0
@@ -0,0 +1,119 @@
1
+ # MindOS Write & Workflow Supplement
2
+
3
+ <!-- Always injected alongside SKILL.md by route.ts for every request. -->
4
+ <!-- For read-only lookups, Q&A, and summarization this context is also available. -->
5
+
6
+ ---
7
+
8
+ ## NEVER do (write-path specific)
9
+
10
+ - **NEVER use `mindos_write_file` as your first move.** Writing without reading first means replacing content you haven't seen. Even when you "know" the file's content, read it — your assumption may be stale.
11
+ - **NEVER create a Mind Space with `mindos_create_file`.** That only creates a plain directory — no README, no INSTRUCTION scaffolding. A Space missing its governance files is broken from birth. Use `mindos_create_space`.
12
+ - **NEVER write immediately after bootstrap.** Bootstrap gives you the top-level structure; it does NOT tell you whether a local `INSTRUCTION.md` near your target overrides the root rules. Read local governance before touching anything.
13
+ - **NEVER execute multi-file writes without first showing the routing table.** Even when destinations seem obvious — the user's mental model diverges from yours more often than intuition suggests. Show the table, wait for confirmation.
14
+ - **NEVER use `mindos_append_to_file` on structured files.** Blind appending ignores section order. If the file has headings, required fields, or schema constraints, use `insert_after_heading` or `update_section` to land content in the right place.
15
+
16
+ ---
17
+
18
+ ## Write tool selection
19
+
20
+ | Intent | Best tool | Avoid |
21
+ |--------|-----------|-------|
22
+ | Small text edit | `mindos_update_section` / `mindos_update_lines` / `mindos_insert_after_heading` | `mindos_write_file` for small changes |
23
+ | Append to end | `mindos_append_to_file` | Rewriting entire file to add a line |
24
+ | Full file replacement | `mindos_write_file` | Using this when a section edit suffices |
25
+ | New file | `mindos_create_file` | Creates parent dirs but does NOT scaffold Space files |
26
+ | New Mind Space (zone + README + INSTRUCTION) | `mindos_create_space` | The only way to create a Space. `create_file` creates plain folders |
27
+ | Rename a Space directory | `mindos_rename_space` | `rename_file` (files only; does not rename folders) |
28
+ | Add CSV row | `mindos_append_csv` (validates header) | Manual string append without header check |
29
+ | Check impact before rename | `mindos_get_backlinks` | Renaming without checking references |
30
+ | Inspect recent changes | `mindos_get_recent` | Guessing what changed recently |
31
+ | Recover old version | `mindos_get_file_at_version` | Asking user to recall what was there |
32
+
33
+ **Fallback:** Line/section tools unavailable → read + constrained `mindos_write_file` (simulate minimal edit).
34
+
35
+ ---
36
+
37
+ ## Startup protocol
38
+
39
+ Run this before executing any write path:
40
+
41
+ 1. **Bootstrap** — `mindos_bootstrap` (preferred) or manually read root `INSTRUCTION.md` + `README.md`.
42
+ 2. **Discover structure**
43
+ - Only need top-level zones? → `mindos_list_spaces` (lighter; includes README blurbs)
44
+ - Need a specific file path? → confirm zone with `mindos_list_spaces`, then `mindos_list_files` inside that zone
45
+ - Know keywords? → fire 2-4 parallel `mindos_search_notes` covering CN/EN variants and abbreviations
46
+ - **Never assume top-level directory names** — the user's KB may use Chinese, pinyin, or unconventional hierarchy
47
+ 3. **Load local governance** — Read `README.md` / `INSTRUCTION.md` near the target path. Local conventions override global assumptions.
48
+ 4. **Match existing SOP** — If the task is procedural: scan tree for a procedure-holding directory (names like `Workflows/`, `SOPs/`, `流程/` are hints — don't assume). Search by keywords + `<!-- keywords: -->` metadata. If found, read and follow. If execution diverges, propose updating the SOP after.
49
+ 5. **Pre-write checks** — Confirm: target path exists or should be created; location is under a subdirectory (not root); current content is read; edit scope is minimal; backlink impact assessed for path changes.
50
+ 6. **Execute edits.**
51
+
52
+ If context is missing, continue with best effort and state assumptions.
53
+
54
+ ---
55
+
56
+ ## Execution patterns
57
+
58
+ | Pattern | When | Key steps |
59
+ |---------|------|-----------|
60
+ | **Single-file edit** | One clear target file | Startup → read target + local conventions → minimal edit → verify → summarize |
61
+ | **Multi-file routing** | Unstructured input, multiple destinations | Parse into semantic units → routing table → confirm → edit → summarize |
62
+ | **Conversation retrospective** | Distill / capture session | Confirm scope → extract decisions/pitfalls/actions → route → trace changes |
63
+ | **SOP execution** | Repeatable procedure | Read SOP fully → execute stepwise → update stale sections → propose SOP update if diverged |
64
+ | **Structural change** | Rename / move / delete | `get_backlinks` → impact report → confirm → execute → update refs → sync READMEs |
65
+ | **CSV append** | Add row to a table | Read header → validate fields → `mindos_append_csv` |
66
+ | **Cross-agent handoff** | Continue another agent's work | Read task state + decisions → continue without re-discovery → write back progress |
67
+ | **Periodic review** | Summarize recent changes | `get_recent`/`get_history` → read changed files → structured summary |
68
+ | **Handoff doc** | Create a briefing | Read sources → synthesize (background, decisions, status, open items) → place in project dir |
69
+
70
+ ---
71
+
72
+ ## Detailed execution steps
73
+
74
+ ### Single-file edit
75
+ Search → read target + read 1-2 sibling files for local conventions → apply minimal edit (prefer `update_section` / `update_lines` / `insert_after_heading` over full rewrite) → verify heading/style match → summarize what changed.
76
+
77
+ ### Multi-file routing
78
+ Parse unstructured input into discrete semantic units → for each unit: search 2-4 keyword variants to find best-fit file → **present routing table** (content snippet → target file → insertion point) → wait for user confirmation → execute edits one file at a time → summarize all changes with file paths.
79
+
80
+ ### Conversation retrospective
81
+ Confirm scope (which session? which topics?) → extract: decisions made, rationale, pitfalls encountered, next actions → for each artifact, find the best existing file via search → route each to the right place → append a one-line change trace per file touched.
82
+
83
+ ### SOP execution
84
+ Read the full SOP before starting (never skim) → execute step by step, checking off as you go → if a step is stale or diverges from current KB state, note it → after completion, propose a targeted SOP update for any diverged steps.
85
+ **Creating a new SOP** → first read [references/sop-template.md](./references/sop-template.md) for required structure.
86
+
87
+ ### Structural changes
88
+ `get_backlinks` on the path being changed → present impact report (N files will need updates) → wait for confirmation → execute rename/move/delete → update every backlink → sync affected `README.md` files.
89
+
90
+ ### Handoff / cross-agent continuation
91
+ Read the handoff document or last agent's progress notes → identify: current state, decisions already made, open items → continue from that state without re-running discovery already done → write progress back to the same handoff doc when done.
92
+
93
+ ---
94
+
95
+ ## Post-task hooks
96
+
97
+ After **write tasks** (not simple single-file edits or read-only), scan this table. If a condition matches, make a one-line proposal. At most 1 proposal; pick highest priority. Check `.mindos/user-preferences.md` suppression section first. Skip all if user asked for quiet mode.
98
+
99
+ | Hook | Priority | Condition |
100
+ |------|----------|-----------|
101
+ | Experience capture | high | Debugging, troubleshooting, or took multiple rounds |
102
+ | Consistency sync | high | Edited file A which has backlinks (check `get_backlinks`) |
103
+ | SOP drift | medium | Followed an SOP but execution diverged from its steps |
104
+ | Linked update | medium | Changed a CSV/TODO status and related docs exist |
105
+ | Structure classification | medium | Created a file in a temporary location or inbox |
106
+ | Pattern extraction | low | 3+ structurally similar operations this session |
107
+ | Conversation retrospective | low | Session >10 turns with decisions or trade-offs |
108
+
109
+ If a hook triggers → read [references/post-task-hooks.md](./references/post-task-hooks.md) for the propose format and any user-defined hooks. If nothing matches, end quietly — do not read the file.
110
+
111
+ ## Preference capture
112
+
113
+ When the user expresses a standing preference ("don't do X", "always put Y in Z"), read [references/preference-capture.md](./references/preference-capture.md) and follow the confirm-then-write flow to `.mindos/user-preferences.md`.
114
+ **Do NOT read** preference-capture unless the user actually expressed a preference to persist.
115
+
116
+ ## SOP authoring
117
+
118
+ When creating or rewriting a workflow SOP, **MANDATORY — read [references/sop-template.md](./references/sop-template.md)** for required structure (prerequisites, steps with branches, exit conditions, pitfall log).
119
+ **Do NOT read** sop-template for SOP execution (only for SOP creation/editing).
@@ -0,0 +1,227 @@
1
+ ---
2
+ name: mindos-zh
3
+ disable-model-invocation: true
4
+ description: >
5
+ MindOS 是用户的本地知识助手,也是跨会话、跨 Agent 共享的知识库。它保存决策记录、会议纪要、SOP、
6
+ 排错经验、架构选型、调研结论和偏好设置。
7
+ 仅 mindRoot 知识库内任务。不用于:改代码仓库、项目源码、KB 外路径。
8
+ 核心概念:空间、指令(INSTRUCTION.md)、技能(SKILL.md);笔记可承载指令与技能。
9
+
10
+ 触发场景:保存或记录任何内容、搜索历史笔记或上下文、更新或编辑文件、整理或重组文件结构、
11
+ 执行SOP或工作流、捕获对话中的决策、复盘或总结经验、追加表格或CSV数据、跨Agent交接上下文、
12
+ 提炼经验教训、同步关联文档、查找之前是否讨论过某事、查询历史决策、查找模板或SOP、
13
+ 为会议准备上下文、快速暂存到暂存台、整理暂存台、知识健康检查、检测知识冲突或矛盾、
14
+ 查找过期内容。
15
+ 触发词:帮我记下来、搜一下我的笔记、更新知识库、整理文件、执行工作流、保存到知识库、
16
+ 记录一下、整理笔记、复盘、提炼经验、同步文档、查一下之前的记录、有没有相关的笔记、
17
+ 我之前写过什么、把这个存起来、总结一下保存、交接给其他Agent、追加到表格、
18
+ 放到暂存台、整理暂存台、知识健康检查、检测知识冲突。
19
+ English triggers: save, record, search notes, organize, retrospective, handoff, lessons learned,
20
+ inbox, staging, knowledge health, detect conflicts.
21
+
22
+ 主动行为——不要等用户提到 MindOS:
23
+ (1) 用户的问题暗示可能存在历史记录(过去的决策、之前的讨论、会议纪要)→ 先搜 MindOS,
24
+ 即使没有明确提到知识库。
25
+ (2) 完成有价值的工作后(修了 bug、做了决策、总结了经验、选定了架构、开完了会)→
26
+ 主动提议保存到 MindOS,方便以后查阅。
27
+ (3) 经历了较长或多主题的对话后 → 建议把关键决策和上下文持久化。
28
+ ---
29
+
30
+ # MindOS 技能
31
+
32
+ <!-- version: 3.2.0 — CLI 优先,MCP 可选 -->
33
+
34
+ ## CLI 命令
35
+
36
+ 使用 `mindos file <子命令>` 完成所有知识库操作。加 `--json` 获取结构化输出。
37
+
38
+ | 操作 | 命令 |
39
+ |------|------|
40
+ | 列出文件 | `mindos file list` |
41
+ | 读取文件 | `mindos file read <路径>` |
42
+ | 写入/覆盖 | `mindos file write <路径> --content "..."` |
43
+ | 创建新文件 | `mindos file create <路径> --content "..."` |
44
+ | 追加内容 | `mindos file append <路径> --content "..."` |
45
+ | 编辑段落 | `mindos file edit-section <路径> -H "## 标题" --content "..."` |
46
+ | 标题后插入 | `mindos file insert-heading <路径> -H "## 标题" --content "..."` |
47
+ | 追加 CSV 行 | `mindos file append-csv <路径> --row "列1,列2,列3"` |
48
+ | 删除文件 | `mindos file delete <路径>` |
49
+ | 重命名/移动 | `mindos file rename <旧> <新>` |
50
+ | 搜索 | `mindos search "关键词"` |
51
+ | 反向链接 | `mindos file backlinks <路径>` |
52
+ | 最近文件 | `mindos file recent --limit 10` |
53
+ | Git 历史 | `mindos file history <路径>` |
54
+ | 列出空间 | `mindos space list` |
55
+ | 创建空间 | `mindos space create "名称"` |
56
+
57
+ > **MCP 用户:** 如果只有 MCP 工具(`mindos_*`),直接使用——工具的 schema 已自带说明。有 CLI 时优先用 CLI(更省 token)。
58
+
59
+ ### CLI 安装
60
+
61
+ ```bash
62
+ npm install -g @geminilight/mindos
63
+ # 远程模式:mindos config set url http://<IP>:<端口> && mindos config set authToken <token>
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 规则
69
+
70
+ 1. **先了解结构** — 列出知识库目录树,再搜索或写入。
71
+ 2. **默认只读。** 只有用户明确要求保存、记录、整理、编辑时才写入。
72
+ 3. **规则优先级**(从高到低):用户当前指令 → `.mindos/user-preferences.md` → 最近目录 `INSTRUCTION.md` → 根 `INSTRUCTION.md` → 本技能默认。
73
+ 4. **多文件编辑先出方案。** 展示完整变更列表,获批后再执行。
74
+ 5. 创建/删除/移动/重命名后 → **自动同步相关 README**。
75
+ 6. **写入前先读取。** 不基于假设写入。
76
+
77
+ ---
78
+
79
+ ## 禁止事项(血泪教训)
80
+
81
+ - **禁止写入知识库根目录**(除非明确要求)。根目录仅放治理文件,新内容放最合适的子目录。
82
+ - **禁止假设目录名。** 从实际目录树推断——知识库可能用中文名或扁平结构。
83
+ - **禁止用整文件覆盖做小修改。** 用 `mindos file edit-section` 或 `mindos file insert-heading` 做精准修改,整文件覆盖破坏 git diff。
84
+ - **禁止单关键词搜索。** 至少 2-4 个并行搜索(同义词、缩写、中英文变体)。
85
+ - **禁止未确认就修改 `INSTRUCTION.md` 或 `README.md`。** 治理文档——高敏感度。
86
+ - **禁止不看邻居就创建文件。** 先读目标目录 1-2 个文件,了解命名和风格。
87
+ - **禁止遗留孤立引用。** 重命名/移动后检查反向链接并更新所有引用。
88
+ - **禁止跳过多文件写入确认。** 用户的心理模型可能和你不同。
89
+
90
+ ---
91
+
92
+ ## MindOS 概念
93
+
94
+ - **空间 (Space)** — 按你的思维方式组织的知识分区。Agent 遵循相同结构。
95
+ - **指令 (Instruction)** — `INSTRUCTION.md`,所有连接的 Agent 都遵守的规则文件。
96
+ - **技能 (Skill)** — 教 Agent 如何读写和整理知识库。
97
+ - **暂存台 (Inbox)** — `Inbox/` 目录是快速捕获区。内容暂时找不到归属时先放这里,之后再统一整理——用户手动或 AI 辅助批量归类。
98
+
99
+ 笔记可以同时承载指令和技能——它们只是目录树中的 Markdown 文件。
100
+
101
+ ---
102
+
103
+ ## 决策树
104
+
105
+ ```
106
+ 用户请求
107
+
108
+ ├─ 查找 / 总结 / 引用?
109
+ │ └─ [只读路径]:搜索 → 读取 → 带引用回答。不写入。
110
+
111
+ ├─ 保存 / 记录 / 更新 / 整理具体内容?
112
+ │ ├─ 知道放哪 → [单文件编辑]
113
+ │ ├─ 不知道放哪 → [暂存台路径] — 存到 Inbox/,之后再归类
114
+ │ └─ 多文件或不确定 → [多文件路由] — 先出方案
115
+
116
+ ├─ 整理暂存台 / 归类暂存文件?
117
+ │ └─ [暂存台整理] — 读 Inbox/ 文件,提议目标位置,获批后移动
118
+
119
+ ├─ 结构变更(重命名 / 移动 / 删除 / 重组)?
120
+ │ └─ [结构路径] — 变更前后检查反向链接
121
+
122
+ ├─ 流程性 / 可重复任务?
123
+ │ └─ [SOP 路径] — 找到并执行现有 SOP,或创建新的
124
+
125
+ ├─ 复盘 / 提炼 / 交接?
126
+ │ └─ [复盘路径]
127
+
128
+ ├─ 知识健康检查 / 检测冲突?
129
+ │ └─ [健康检查路径] — 读取 references/knowledge-health.md
130
+
131
+ └─ 模糊?
132
+ └─ 提问。基于知识库状态提出 2-3 个具体选项。
133
+ ```
134
+
135
+ ---
136
+
137
+ ## 判断启发
138
+
139
+ **保存意图边界:**
140
+ - "帮我记下来" / "保存" = 写入
141
+ - "搜一下" / "总结" = 只读
142
+ - "整理一下" → 先问:仅展示,还是写回知识库?
143
+
144
+ **文件位置不确定:**
145
+ - 5 秒内定不了 → 存到 `Inbox/`,告知用户,之后提议归类
146
+ - "随便放哪" / "先放着" → 存到 `Inbox/`
147
+ - 用户拖拽文件或粘贴非结构化内容但没指定位置 → `Inbox/`
148
+
149
+ **范围蔓延:**
150
+ - 输入路由到 >5 个文件 → 暂停确认
151
+ - "全部更新" + 跨多个主题 → 分批确认
152
+
153
+ **引用规范:** 引用知识库内容必须附带文件路径。
154
+
155
+ ---
156
+
157
+ ## 任务后钩子
158
+
159
+ 写入任务(非简单读取)后扫描此表。最多 1 个提议;优先级最高的优先。先检查 `.mindos/user-preferences.md` 抑制项。
160
+
161
+ | 钩子 | 优先级 | 条件 |
162
+ |------|--------|------|
163
+ | 经验沉淀 | 高 | 调试、排错或多轮工作 |
164
+ | 一致性同步 | 高 | 编辑的文件有反向链接 |
165
+ | SOP 偏移 | 中 | 按 SOP 执行但实际偏离了步骤 |
166
+ | 关联更新 | 中 | 更改了 CSV/TODO 状态且有关联文档 |
167
+ | 结构分类 | 中 | 在临时位置或收件箱创建了文件 |
168
+ | 模式提取 | 低 | 本次会话中 3+ 个结构相似的操作 |
169
+
170
+ 触发时 → 读取 [references/post-task-hooks.md](./references/post-task-hooks.md)。
171
+
172
+ ## 偏好捕获
173
+
174
+ 用户表达持久偏好时 → 读取 [references/preference-capture.md](./references/preference-capture.md),按确认-写入流程操作。
175
+
176
+ ## SOP 编写
177
+
178
+ 创建/重写工作流 SOP 时 → 读取 [references/sop-template.md](./references/sop-template.md)。
179
+
180
+ ## 暂存台 (Inbox)
181
+
182
+ `Inbox/` 目录是知识库的快速捕获区,有自己的 `INSTRUCTION.md` 约束行为。
183
+
184
+ **何时使用暂存台:**
185
+ - 用户说"先存着" / "放到暂存台" / "随便放哪",没指定具体位置
186
+ - 内容明显不属于任何现有空间或目录
187
+ - 批量导入多个文件,需要逐个归类
188
+
189
+ **如何存到暂存台:**
190
+ ```bash
191
+ mindos file create "Inbox/<文件名>.md" --content "..."
192
+ ```
193
+
194
+ **如何整理暂存台:**
195
+ 1. 列出暂存文件:`mindos file list Inbox/`
196
+ 2. 读取每个文件,理解其内容
197
+ 3. 根据知识库结构,为每个文件提议最佳目标目录
198
+ 4. 向用户展示完整路由方案,获批后执行
199
+ 5. 移动文件:`mindos file rename "Inbox/<文件>" "<目标目录>/<文件>"`
200
+ 6. 移动后检查目标目录的 README 是否需要更新
201
+
202
+ **老化提醒:** Inbox 中超过 7 天的文件视为"老化"。如果在 bootstrap 时发现老化文件,主动提醒:
203
+ "暂存台有 N 个文件已经放了一周以上了,要我帮你整理一下吗?"
204
+
205
+ ## 知识健康检查
206
+
207
+ 用户要求检查知识库健康度、检测冲突、审计质量,或说"知识健康检查" / "检测冲突" / "check knowledge health" 时
208
+ → 读取 [references/knowledge-health.md](./references/knowledge-health.md) 获取完整流程。
209
+
210
+ 检查维度速览:
211
+ - **矛盾/冲突**:同一主题的不同文件说法互相矛盾
212
+ - **断裂链接**:引用了不存在的文件
213
+ - **过期内容**:带有过期日期标记的文件,或超过 6 个月未更新的活跃主题
214
+ - **重复内容**:两个文件覆盖同一主题且没有互相引用
215
+ - **孤立文件**:零反向链接,难以被发现
216
+ - **结构问题**:文件放错目录、缺少 README、暂存台老化文件
217
+
218
+ ---
219
+
220
+ ## 错误处理(CLI)
221
+
222
+ ```bash
223
+ "command not found: mindos" → npm install -g @geminilight/mindos
224
+ "Mind root not configured" → mindos onboard
225
+ "401 Unauthorized" → 检查 AUTH_TOKEN:在服务器运行 mindos token
226
+ "ECONNREFUSED" → 在服务器启动:mindos start
227
+ ```
@@ -0,0 +1,119 @@
1
+ # MindOS 写入与工作流补充
2
+
3
+ <!-- 随 SKILL.md 一起由 route.ts 注入到每次请求的上下文中。 -->
4
+ <!-- 只读查阅、问答、总结时此上下文同样可用。 -->
5
+
6
+ ---
7
+
8
+ ## 绝对不要(写路径专属)
9
+
10
+ - **绝不把 `mindos_write_file` 当第一步。** 没读过当前内容就覆写 = 在黑暗中操作。哪怕你"应该知道"文件里有什么,也先读——你的假设可能已过时。
11
+ - **绝不用 `mindos_create_file` 创建心智空间。** 这只会建一个普通目录,缺少 README + INSTRUCTION 脚手架。缺少治理文件的空间从诞生起就是残缺的。必须用 `mindos_create_space`。
12
+ - **绝不 bootstrap 后直接写入。** Bootstrap 告诉你顶层结构,不代表目标路径附近的局部 `INSTRUCTION.md` 没有覆盖全局规则。写入前必须读目标路径附近的治理文件。
13
+ - **绝不在没有展示路由表的情况下执行多文件写入。** 即使目标看起来显而易见——用户的心智模型和你的判断不一致的概率远高于你的直觉。展示路由表,等确认。
14
+ - **绝不把 `mindos_append_to_file` 用于有结构要求的文件。** 盲目追加会忽略章节顺序。如果文件有标题层级、必填字段或 schema 约束,用 `insert_after_heading` 或 `update_section` 把内容落在正确位置。
15
+
16
+ ---
17
+
18
+ ## 写入工具选型
19
+
20
+ | 意图 | 推荐工具 | 避免 |
21
+ |------|----------|------|
22
+ | 小范围文字修改 | `mindos_update_section` / `mindos_update_lines` / `mindos_insert_after_heading` | 小修改用 `mindos_write_file` |
23
+ | 追加到末尾 | `mindos_append_to_file` | 为了加一行重写整文件 |
24
+ | 整文件替换 | `mindos_write_file` | 用它做章节级编辑 |
25
+ | 新建文件 | `mindos_create_file` | 自动创建父目录,但不会生成空间脚手架文件 |
26
+ | 新建心智空间(目录 + README + INSTRUCTION)| `mindos_create_space` | 创建空间的唯一方式。`create_file` 只创建普通目录 |
27
+ | 重命名空间目录 | `mindos_rename_space` | `rename_file`(仅文件,不能重命名文件夹)|
28
+ | 追加 CSV | `mindos_append_csv`(校验表头)| 手动拼字符串不校验 |
29
+ | 重命名前查影响 | `mindos_get_backlinks` | 不查引用就重命名 |
30
+ | 查看近期变动 | `mindos_get_recent` | 猜最近改了什么 |
31
+ | 恢复历史版本 | `mindos_get_file_at_version` | 让用户回忆之前内容 |
32
+
33
+ **回退:** 行级/章节级工具不可用 → 读 + 受限 `mindos_write_file`(模拟最小修改)。
34
+
35
+ ---
36
+
37
+ ## 启动协议
38
+
39
+ 所有写入任务执行前运行:
40
+
41
+ 1. **Bootstrap** — `mindos_bootstrap`(首选),或手动读根 `INSTRUCTION.md` + `README.md`。
42
+ 2. **发现结构**
43
+ - 只需确认顶层分区 → `mindos_list_spaces`(更轻量,含 README 摘要)
44
+ - 需要找具体文件路径 → 先用 `mindos_list_spaces` 确认目标分区,再在该分区下 `mindos_list_files`
45
+ - 已知关键词 → 并行 2-4 条 `mindos_search_notes`,覆盖中英文和缩写变体
46
+ - **绝不假设顶层目录名**——用户可能用中文、拼音或自定义层级
47
+ 3. **加载局部治理** — 读取目标路径附近的 `README.md` / `INSTRUCTION.md`。局部约定覆盖全局假设。
48
+ 4. **匹配已有 SOP** — 任务偏流程时:从树中识别存放流程的目录(`Workflows/`、`SOPs/`、`流程/` 等仅为常见名,不假设一定存在)。用关键词 + `<!-- keywords: -->` 元数据搜索。找到则读取并执行;偏差则任务后提议更新。
49
+ 5. **写前检查** — 确认:路径存在或应创建;位置在子目录下(非根);现有内容已读;修改范围最小;路径变更的反链影响已评估。
50
+ 6. **执行编辑。**
51
+
52
+ 上下文缺失时,按最佳努力继续并明确写出假设。
53
+
54
+ ---
55
+
56
+ ## 执行模式
57
+
58
+ | 模式 | 适用场景 | 关键步骤 |
59
+ |------|----------|----------|
60
+ | **单文件编辑** | 目标文件明确 | 启动协议 → 读目标 + 局部约定 → 最小修改 → 验证 → 总结 |
61
+ | **多文件路由** | 非结构化输入,多个目的地 | 解析为语义单元 → 路由表 → 确认 → 编辑 → 汇总 |
62
+ | **对话复盘** | 提炼 / 沉淀会话 | 确认范围 → 抽取决策/踩坑/下一步 → 路由 → 记录变更 |
63
+ | **SOP 执行** | 可重复流程 | 完整读 SOP → 分步执行 → 更新过时段落 → 偏差则提议更新 |
64
+ | **结构变更** | 重命名 / 移动 / 删除 | `get_backlinks` → 影响报告 → 确认 → 执行 → 更新引用 → 同步 README |
65
+ | **CSV 追加** | 追加表格行 | 读表头 → 校验字段 → `mindos_append_csv` |
66
+ | **跨 Agent 接力** | 继续其他 Agent 的工作 | 读任务状态+决策 → 无需重新探索直接接续 → 回写进度 |
67
+ | **周期性回顾** | 汇总近期变动 | `get_recent`/`get_history` → 读变动文件 → 结构化总结 |
68
+ | **交接文档** | 创建简报 | 读来源 → 合成(背景、决策、状态、待办)→ 放项目目录 |
69
+
70
+ ---
71
+
72
+ ## 详细执行步骤
73
+
74
+ ### 单文件编辑
75
+ 搜索 → 读目标文件 + 读 1-2 个同目录文件了解本地约定 → 应用最小修改(优先 `update_section` / `update_lines` / `insert_after_heading`,避免整文件覆写)→ 验证标题/风格匹配 → 总结改了什么。
76
+
77
+ ### 多文件路由
78
+ 将非结构化输入拆解为离散语义单元 → 每个单元并行搜索 2-4 个关键词变体找最合适文件 → **展示路由表**(内容片段 → 目标文件 → 插入位置)→ 等用户确认 → 逐文件执行编辑 → 用文件路径汇总全部变更。
79
+
80
+ ### 对话复盘
81
+ 确认范围(哪次会话?哪些主题?)→ 抽取:已做决策、决策理由、遇到的坑、下一步行动 → 为每个产物通过搜索找最合适的现有文件 → 各归其位 → 每个改动文件追加一行变更说明。
82
+
83
+ ### SOP 执行
84
+ 开始前完整读 SOP(不要略读)→ 逐步执行,完成一步确认一步 → 遇到过时或与当前 KB 状态不符的步骤,记录下来 → 完成后,针对偏差步骤提议定向 SOP 更新。
85
+ **创建新 SOP** → 先读 [references/sop-template.md](./references/sop-template.md) 了解必需结构。
86
+
87
+ ### 结构变更
88
+ 对要变更的路径执行 `get_backlinks` → 展示影响报告(N 个文件需要更新)→ 等确认 → 执行重命名/移动/删除 → 更新每一条反链 → 同步受影响的 `README.md`。
89
+
90
+ ### 交接 / 跨 Agent 接力
91
+ 读交接文档或上一个 Agent 的进度记录 → 识别:当前状态、已做决策、待处理事项 → 从该状态直接接续,不重复已完成的探索 → 完成后将进度回写到同一份交接文档。
92
+
93
+ ---
94
+
95
+ ## 任务后 Hooks
96
+
97
+ **写入任务**完成后(简单单文件修改或只读查阅跳过),扫描下表。命中则发起一句话提议,最多 1 条,选优先级最高项。先查 `.mindos/user-preferences.md` 的抑制区;用户要求安静模式时全部跳过。
98
+
99
+ | Hook | 优先级 | 触发条件 |
100
+ |------|--------|---------|
101
+ | 经验沉淀 | 高 | 调试、排错、踩坑,或多轮才解决 |
102
+ | 一致性同步 | 高 | 编辑了有反链的文件(查 `get_backlinks`) |
103
+ | SOP 偏差 | 中 | 按 SOP 执行但实际步骤与文档不符 |
104
+ | 联动更新 | 中 | 改了 CSV/TODO 状态且存在关联文档 |
105
+ | 结构归类 | 中 | 在临时目录或收件箱新建了文件 |
106
+ | 模式提炼 | 低 | 本会话 3+ 次结构相似操作 |
107
+ | 对话复盘 | 低 | 会话 >10 轮且涉及决策或权衡 |
108
+
109
+ 有 hook 命中 → 读 [references/post-task-hooks.md](./references/post-task-hooks.md) 获取提议措辞和用户自定义 hooks。都不命中则安静结束,不读此文件。
110
+
111
+ ## 偏好捕获
112
+
113
+ 用户表达要长期记住的偏好(「以后不要…」「这个该放在…」)时,读 [references/preference-capture.md](./references/preference-capture.md) 并按确认后写入流程存入 `.mindos/user-preferences.md`。
114
+ **不要读** preference-capture 除非用户真的表达了要持久化的偏好。
115
+
116
+ ## SOP 编写
117
+
118
+ 创建或改写工作流 SOP 时,**必须 — 读 [references/sop-template.md](./references/sop-template.md)**(前置条件、分支步骤、退出条件、踩坑记录)。
119
+ **不要读** sop-template 用于 SOP 执行(仅用于 SOP 创建/编辑)。
@@ -179,7 +179,9 @@ describe('POST /api/mcp/install', () => {
179
179
  it('handles empty config file gracefully (e.g. fresh VS Code mcp.json)', async () => {
180
180
  const { POST } = await importInstallRoute();
181
181
  // Pre-create an empty config file (common with VS Code)
182
- const copilotDir = path.join(tempHome, '.config', 'Code', 'User');
182
+ const copilotDir = process.platform === 'darwin'
183
+ ? path.join(tempHome, 'Library', 'Application Support', 'Code', 'User')
184
+ : path.join(tempHome, '.config', 'Code', 'User');
183
185
  fs.mkdirSync(copilotDir, { recursive: true });
184
186
  fs.writeFileSync(path.join(copilotDir, 'mcp.json'), '', 'utf-8');
185
187
 
@@ -195,7 +197,11 @@ describe('POST /api/mcp/install', () => {
195
197
  const body = await res.json();
196
198
  expect(body.results[0].status).toBe('ok');
197
199
 
198
- const config = JSON.parse(fs.readFileSync(path.join(copilotDir, 'mcp.json'), 'utf-8'));
200
+ const configPath = path.join(copilotDir, 'mcp.json');
201
+ expect(fs.existsSync(configPath)).toBe(true);
202
+ const content = fs.readFileSync(configPath, 'utf-8');
203
+ expect(content.trim()).not.toBe(''); // Should have written valid JSON
204
+ const config = JSON.parse(content);
199
205
  expect(config.servers.mindos.type).toBe('stdio');
200
206
  });
201
207
 
@@ -8,6 +8,10 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
8
8
  // Mock @huggingface/transformers to avoid real downloads
9
9
  vi.mock('@huggingface/transformers', () => ({
10
10
  pipeline: vi.fn(),
11
+ env: {
12
+ remoteHost: '',
13
+ remotePathTemplate: '',
14
+ },
11
15
  }));
12
16
 
13
17
  describe('embedding-provider retry logic', () => {
@@ -21,6 +25,80 @@ describe('embedding-provider retry logic', () => {
21
25
  vi.clearAllMocks();
22
26
  });
23
27
 
28
+ describe('mirror configuration', () => {
29
+ it('should configure hf-mirror.com when HF_ENDPOINT is not set', async () => {
30
+ const originalEnv = process.env.HF_ENDPOINT;
31
+ delete process.env.HF_ENDPOINT;
32
+
33
+ const { pipeline, env } = await import('@huggingface/transformers');
34
+ // Reset env to simulate fresh state
35
+ env.remoteHost = '';
36
+ env.remotePathTemplate = '';
37
+
38
+ const mockPipeline = { mock: true };
39
+ vi.mocked(pipeline).mockResolvedValueOnce(mockPipeline);
40
+
41
+ const { downloadLocalModel } = await import('@/lib/core/embedding-provider');
42
+ await downloadLocalModel('test-model');
43
+
44
+ // Verify mirror was configured
45
+ expect(env.remoteHost).toBe('https://hf-mirror.com');
46
+ expect(env.remotePathTemplate).toBe('{model}/resolve/{revision}/{fileName}');
47
+
48
+ // Restore
49
+ if (originalEnv) process.env.HF_ENDPOINT = originalEnv;
50
+ });
51
+
52
+ it('should respect HF_ENDPOINT environment variable', async () => {
53
+ const originalEnv = process.env.HF_ENDPOINT;
54
+ process.env.HF_ENDPOINT = 'https://custom-mirror.com';
55
+
56
+ const { pipeline, env } = await import('@huggingface/transformers');
57
+ // Reset env to simulate fresh state
58
+ env.remoteHost = '';
59
+ env.remotePathTemplate = '';
60
+
61
+ const mockPipeline = { mock: true };
62
+ vi.mocked(pipeline).mockResolvedValueOnce(mockPipeline);
63
+
64
+ const { downloadLocalModel } = await import('@/lib/core/embedding-provider');
65
+ await downloadLocalModel('test-model');
66
+
67
+ // Verify custom mirror was NOT overridden (env.remoteHost should remain empty)
68
+ expect(env.remoteHost).toBe('');
69
+
70
+ // Restore
71
+ if (originalEnv) {
72
+ process.env.HF_ENDPOINT = originalEnv;
73
+ } else {
74
+ delete process.env.HF_ENDPOINT;
75
+ }
76
+ });
77
+
78
+ it('should not override if env.remoteHost is already set', async () => {
79
+ const originalEnv = process.env.HF_ENDPOINT;
80
+ delete process.env.HF_ENDPOINT;
81
+
82
+ const { pipeline, env } = await import('@huggingface/transformers');
83
+ // Simulate user has already configured a custom mirror
84
+ env.remoteHost = 'https://user-custom-mirror.com';
85
+ env.remotePathTemplate = 'custom/{model}/{fileName}';
86
+
87
+ const mockPipeline = { mock: true };
88
+ vi.mocked(pipeline).mockResolvedValueOnce(mockPipeline);
89
+
90
+ const { downloadLocalModel } = await import('@/lib/core/embedding-provider');
91
+ await downloadLocalModel('test-model');
92
+
93
+ // Verify user's custom mirror was NOT overridden
94
+ expect(env.remoteHost).toBe('https://user-custom-mirror.com');
95
+ expect(env.remotePathTemplate).toBe('custom/{model}/{fileName}');
96
+
97
+ // Restore
98
+ if (originalEnv) process.env.HF_ENDPOINT = originalEnv;
99
+ });
100
+ });
101
+
24
102
  describe('isRetryableError classification', () => {
25
103
  // These would be internal to the module, tested indirectly through loadLocalPipeline behavior
26
104
 
@@ -1,9 +1,10 @@
1
1
  import { describe, it, expect } from 'vitest';
2
- import { readFileSync } from 'node:fs';
2
+ import { readFileSync, existsSync } from 'node:fs';
3
3
  import path from 'node:path';
4
4
 
5
- const root = '/data/home/geminitwang/code/sop_note';
5
+ const root = path.resolve(__dirname, '../../..');
6
6
  const read = (relativePath: string) => readFileSync(path.join(root, relativePath), 'utf8');
7
+ const exists = (relativePath: string) => existsSync(path.join(root, relativePath));
7
8
 
8
9
  describe('MindOS skill copy alignment', () => {
9
10
  it('keeps source and app skill copies aligned for default skill', () => {
@@ -12,8 +13,13 @@ describe('MindOS skill copy alignment', () => {
12
13
  });
13
14
 
14
15
  it('keeps source and app skill copies aligned for max skill', () => {
15
- expect(read('skills/mindos-max/SKILL.md')).toBe(read('app/data/skills/mindos-max/SKILL.md'));
16
- expect(read('skills/mindos-max-zh/SKILL.md')).toBe(read('app/data/skills/mindos-max-zh/SKILL.md'));
16
+ // Only check if both source and app copies exist
17
+ if (exists('app/data/skills/mindos-max/SKILL.md')) {
18
+ expect(read('skills/mindos-max/SKILL.md')).toBe(read('app/data/skills/mindos-max/SKILL.md'));
19
+ }
20
+ if (exists('app/data/skills/mindos-max-zh/SKILL.md')) {
21
+ expect(read('skills/mindos-max-zh/SKILL.md')).toBe(read('app/data/skills/mindos-max-zh/SKILL.md'));
22
+ }
17
23
  });
18
24
 
19
25
  it('removes second-brain wording from aligned skill descriptions', () => {