@geminilight/mindos 0.1.0

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 (282) hide show
  1. package/.env.local.example +38 -0
  2. package/LICENSE +21 -0
  3. package/README.md +423 -0
  4. package/README_zh.md +423 -0
  5. package/app/README.md +152 -0
  6. package/app/app/api/ask/route.ts +170 -0
  7. package/app/app/api/ask-sessions/route.ts +90 -0
  8. package/app/app/api/auth/route.ts +37 -0
  9. package/app/app/api/backlinks/route.ts +22 -0
  10. package/app/app/api/bootstrap/route.ts +37 -0
  11. package/app/app/api/extract-pdf/route.ts +82 -0
  12. package/app/app/api/file/route.ts +138 -0
  13. package/app/app/api/files/route.ts +12 -0
  14. package/app/app/api/git/route.ts +42 -0
  15. package/app/app/api/graph/route.ts +113 -0
  16. package/app/app/api/recent-files/route.ts +10 -0
  17. package/app/app/api/search/route.ts +17 -0
  18. package/app/app/api/settings/reset-token/route.ts +21 -0
  19. package/app/app/api/settings/route.ts +123 -0
  20. package/app/app/error.tsx +33 -0
  21. package/app/app/globals.css +368 -0
  22. package/app/app/icon.svg +35 -0
  23. package/app/app/layout.tsx +103 -0
  24. package/app/app/login/page.tsx +120 -0
  25. package/app/app/page.tsx +12 -0
  26. package/app/app/view/[...path]/ViewPageClient.tsx +343 -0
  27. package/app/app/view/[...path]/error.tsx +33 -0
  28. package/app/app/view/[...path]/loading.tsx +15 -0
  29. package/app/app/view/[...path]/page.tsx +93 -0
  30. package/app/components/AskFab.tsx +59 -0
  31. package/app/components/AskModal.tsx +398 -0
  32. package/app/components/Backlinks.tsx +75 -0
  33. package/app/components/Breadcrumb.tsx +31 -0
  34. package/app/components/CsvView.tsx +325 -0
  35. package/app/components/DirView.tsx +138 -0
  36. package/app/components/Editor.tsx +124 -0
  37. package/app/components/EditorWrapper.tsx +17 -0
  38. package/app/components/ErrorBoundary.tsx +53 -0
  39. package/app/components/FileTree.tsx +369 -0
  40. package/app/components/HomeContent.tsx +262 -0
  41. package/app/components/JsonView.tsx +27 -0
  42. package/app/components/MarkdownEditor.tsx +95 -0
  43. package/app/components/MarkdownView.tsx +118 -0
  44. package/app/components/SearchModal.tsx +193 -0
  45. package/app/components/SettingsModal.tsx +237 -0
  46. package/app/components/Sidebar.tsx +136 -0
  47. package/app/components/SidebarLayout.tsx +36 -0
  48. package/app/components/TableOfContents.tsx +150 -0
  49. package/app/components/ThemeToggle.tsx +34 -0
  50. package/app/components/WysiwygEditor.tsx +75 -0
  51. package/app/components/ask/FileChip.tsx +30 -0
  52. package/app/components/ask/MentionPopover.tsx +52 -0
  53. package/app/components/ask/MessageList.tsx +126 -0
  54. package/app/components/ask/SessionHistory.tsx +49 -0
  55. package/app/components/renderers/AgentInspectorRenderer.tsx +277 -0
  56. package/app/components/renderers/BacklinksRenderer.tsx +147 -0
  57. package/app/components/renderers/ConfigRenderer.tsx +236 -0
  58. package/app/components/renderers/CsvRenderer.tsx +77 -0
  59. package/app/components/renderers/DiffRenderer.tsx +310 -0
  60. package/app/components/renderers/GraphRenderer.tsx +428 -0
  61. package/app/components/renderers/SummaryRenderer.tsx +251 -0
  62. package/app/components/renderers/TimelineRenderer.tsx +213 -0
  63. package/app/components/renderers/TodoRenderer.tsx +474 -0
  64. package/app/components/renderers/WorkflowRenderer.tsx +404 -0
  65. package/app/components/renderers/csv/BoardView.tsx +146 -0
  66. package/app/components/renderers/csv/ConfigPanel.tsx +117 -0
  67. package/app/components/renderers/csv/EditableCell.tsx +43 -0
  68. package/app/components/renderers/csv/GalleryView.tsx +40 -0
  69. package/app/components/renderers/csv/TableView.tsx +164 -0
  70. package/app/components/renderers/csv/types.ts +87 -0
  71. package/app/components/settings/AiTab.tsx +111 -0
  72. package/app/components/settings/AppearanceTab.tsx +101 -0
  73. package/app/components/settings/KnowledgeTab.tsx +157 -0
  74. package/app/components/settings/PluginsTab.tsx +82 -0
  75. package/app/components/settings/Primitives.tsx +60 -0
  76. package/app/components/settings/ShortcutsTab.tsx +22 -0
  77. package/app/components/settings/types.ts +41 -0
  78. package/app/components/ui/button.tsx +60 -0
  79. package/app/components/ui/dialog.tsx +157 -0
  80. package/app/components/ui/input.tsx +20 -0
  81. package/app/components/ui/scroll-area.tsx +55 -0
  82. package/app/components/ui/toggle.tsx +44 -0
  83. package/app/components/ui/tooltip.tsx +66 -0
  84. package/app/components.json +25 -0
  85. package/app/data/pages/home-dark.png +0 -0
  86. package/app/data/pages/home-mobile-crop.png +0 -0
  87. package/app/data/pages/home-mobile.png +0 -0
  88. package/app/data/pages/home.png +0 -0
  89. package/app/data/pages/view-dir.png +0 -0
  90. package/app/data/pages/view-file-bot.png +0 -0
  91. package/app/data/pages/view-file-dark-crop.png +0 -0
  92. package/app/data/pages/view-file-dark.png +0 -0
  93. package/app/data/pages/view-file-mobile.png +0 -0
  94. package/app/data/pages/view-file-sm.png +0 -0
  95. package/app/data/pages/view-file-top.png +0 -0
  96. package/app/data/pages/view-file.png +0 -0
  97. package/app/eslint.config.mjs +18 -0
  98. package/app/hooks/useAskSession.ts +181 -0
  99. package/app/hooks/useFileUpload.ts +126 -0
  100. package/app/hooks/useMention.ts +65 -0
  101. package/app/lib/LocaleContext.tsx +40 -0
  102. package/app/lib/actions.ts +40 -0
  103. package/app/lib/agent/index.ts +3 -0
  104. package/app/lib/agent/model.ts +18 -0
  105. package/app/lib/agent/prompt.ts +32 -0
  106. package/app/lib/agent/tools.ts +151 -0
  107. package/app/lib/api.ts +55 -0
  108. package/app/lib/core/backlinks.ts +40 -0
  109. package/app/lib/core/csv.ts +28 -0
  110. package/app/lib/core/fs-ops.ts +118 -0
  111. package/app/lib/core/git.ts +50 -0
  112. package/app/lib/core/index.ts +58 -0
  113. package/app/lib/core/lines.ts +89 -0
  114. package/app/lib/core/search.ts +79 -0
  115. package/app/lib/core/security.ts +43 -0
  116. package/app/lib/core/tree.ts +113 -0
  117. package/app/lib/core/types.ts +40 -0
  118. package/app/lib/fs.ts +467 -0
  119. package/app/lib/i18n.ts +300 -0
  120. package/app/lib/jwt.ts +58 -0
  121. package/app/lib/renderers/index.ts +79 -0
  122. package/app/lib/renderers/registry.ts +70 -0
  123. package/app/lib/settings.ts +150 -0
  124. package/app/lib/types.ts +32 -0
  125. package/app/lib/utils.ts +34 -0
  126. package/app/next-env.d.ts +6 -0
  127. package/app/next.config.ts +10 -0
  128. package/app/package-lock.json +15306 -0
  129. package/app/package.json +71 -0
  130. package/app/postcss.config.mjs +7 -0
  131. package/app/proxy.ts +64 -0
  132. package/app/public/file.svg +1 -0
  133. package/app/public/globe.svg +1 -0
  134. package/app/public/landing/index.html +353 -0
  135. package/app/public/landing/style.css +216 -0
  136. package/app/public/logo-square.svg +37 -0
  137. package/app/public/logo.svg +37 -0
  138. package/app/public/next.svg +1 -0
  139. package/app/public/vercel.svg +1 -0
  140. package/app/public/window.svg +1 -0
  141. package/app/scripts/extract-pdf.cjs +56 -0
  142. package/app/tsconfig.json +34 -0
  143. package/app/vitest.config.ts +14 -0
  144. package/assets/demo-flow-zh.html +622 -0
  145. package/assets/images/demo-flow-dark.png +0 -0
  146. package/assets/images/demo-flow-light.png +0 -0
  147. package/assets/images/demo-flow-zh-dark.png +0 -0
  148. package/assets/images/demo-flow-zh-light.png +0 -0
  149. package/assets/images/gui-sync-cv.png +0 -0
  150. package/assets/logo-square.svg +37 -0
  151. package/bin/cli.js +894 -0
  152. package/mcp/README.md +113 -0
  153. package/mcp/package-lock.json +1717 -0
  154. package/mcp/package.json +18 -0
  155. package/mcp/src/index.ts +494 -0
  156. package/mcp/tsconfig.json +13 -0
  157. package/package.json +49 -0
  158. package/scripts/setup.js +675 -0
  159. package/scripts/upgrade-prompt.md +147 -0
  160. package/skills/mindos/SKILL.md +319 -0
  161. package/skills/mindos-zh/SKILL.md +318 -0
  162. package/templates/README.md +31 -0
  163. package/templates/empty/CHANGELOG.md +9 -0
  164. package/templates/empty/CONFIG.json +197 -0
  165. package/templates/empty/CONFIG.md +73 -0
  166. package/templates/empty/INSTRUCTION.md +177 -0
  167. package/templates/empty/README.md +27 -0
  168. package/templates/en/CHANGELOG.md +9 -0
  169. package/templates/en/CONFIG.json +197 -0
  170. package/templates/en/CONFIG.md +73 -0
  171. package/templates/en/INSTRUCTION.md +177 -0
  172. package/templates/en/README.md +27 -0
  173. package/templates/en/TODO.md +13 -0
  174. package/templates/en//360/237/221/244 Profile/INSTRUCTION.md" +21 -0
  175. package/templates/en//360/237/221/244 Profile/README.md" +15 -0
  176. package/templates/en//360/237/221/244 Profile//342/232/231/357/270/217 Preferences.md" +21 -0
  177. package/templates/en//360/237/221/244 Profile//360/237/216/257 Focus.md" +31 -0
  178. package/templates/en//360/237/221/244 Profile//360/237/221/244 Identity.md" +22 -0
  179. package/templates/en//360/237/223/232 Resources/INSTRUCTION.md" +29 -0
  180. package/templates/en//360/237/223/232 Resources/README.md" +21 -0
  181. package/templates/en//360/237/223/232 Resources//360/237/247/276 AI Influencers.csv" +1 -0
  182. package/templates/en//360/237/223/232 Resources//360/237/247/276 AI Products.csv" +1 -0
  183. package/templates/en//360/237/223/232 Resources//360/237/247/276 AI Scholars.csv" +1 -0
  184. package/templates/en//360/237/223/232 Resources//360/237/247/276 AI Tools.csv" +1 -0
  185. package/templates/en//360/237/223/235 Notes/INSTRUCTION.md" +31 -0
  186. package/templates/en//360/237/223/235 Notes/Ideas/README.md" +8 -0
  187. package/templates/en//360/237/223/235 Notes/Ideas//360/237/247/252_example_product_idea.md" +16 -0
  188. package/templates/en//360/237/223/235 Notes/Inbox/README.md" +8 -0
  189. package/templates/en//360/237/223/235 Notes/Inbox//360/237/247/252_example_quick_capture.md" +14 -0
  190. package/templates/en//360/237/223/235 Notes/Meetings/README.md" +8 -0
  191. package/templates/en//360/237/223/235 Notes/Meetings//360/237/247/252_example_meeting_note.md" +17 -0
  192. package/templates/en//360/237/223/235 Notes/README.md" +24 -0
  193. package/templates/en//360/237/223/235 Notes/Waiting/README.md" +8 -0
  194. package/templates/en//360/237/223/235 Notes/Waiting//360/237/247/252_example_blocked_item.md" +16 -0
  195. package/templates/en//360/237/224/204 Workflows/Configurations/README.md" +3 -0
  196. package/templates/en//360/237/224/204 Workflows/Configurations//360/237/247/252_example_config_update_sop.md" +14 -0
  197. package/templates/en//360/237/224/204 Workflows/INSTRUCTION.md" +21 -0
  198. package/templates/en//360/237/224/204 Workflows/Information/README.md" +16 -0
  199. package/templates/en//360/237/224/204 Workflows/Information//360/237/247/252_example_info_capture_sop.md" +13 -0
  200. package/templates/en//360/237/224/204 Workflows/Media/README.md" +16 -0
  201. package/templates/en//360/237/224/204 Workflows/Media//360/237/247/252_example_content_publish_sop.md" +13 -0
  202. package/templates/en//360/237/224/204 Workflows/README.md" +22 -0
  203. package/templates/en//360/237/224/204 Workflows/Research/README.md" +16 -0
  204. package/templates/en//360/237/224/204 Workflows/Research//360/237/247/252_example_lit_review_sop.md" +16 -0
  205. package/templates/en//360/237/224/204 Workflows/Startup/README.md" +3 -0
  206. package/templates/en//360/237/224/204 Workflows/Startup//360/237/247/252_example_weekly_founder_ops.md" +22 -0
  207. package/templates/en//360/237/224/227 Connections/Classmates/README.md" +11 -0
  208. package/templates/en//360/237/224/227 Connections/Classmates//360/237/247/252_example_leo_chen.md" +16 -0
  209. package/templates/en//360/237/224/227 Connections/Colleagues/README.md" +11 -0
  210. package/templates/en//360/237/224/227 Connections/Colleagues//360/237/247/252_example_ethan_zhao.md" +16 -0
  211. package/templates/en//360/237/224/227 Connections/Connections Overview.csv" +5 -0
  212. package/templates/en//360/237/224/227 Connections/Family/README.md" +11 -0
  213. package/templates/en//360/237/224/227 Connections/Family//360/237/247/252_example_james_wang.md" +16 -0
  214. package/templates/en//360/237/224/227 Connections/Friends/README.md" +11 -0
  215. package/templates/en//360/237/224/227 Connections/Friends//360/237/247/252_example_lily_lin.md" +16 -0
  216. package/templates/en//360/237/224/227 Connections/INSTRUCTION.md" +56 -0
  217. package/templates/en//360/237/224/227 Connections/README.md" +20 -0
  218. package/templates/en//360/237/232/200 Projects/Archived/README.md" +9 -0
  219. package/templates/en//360/237/232/200 Projects/Archived//360/237/247/252_example_archived_project_note.md" +14 -0
  220. package/templates/en//360/237/232/200 Projects/INSTRUCTION.md" +29 -0
  221. package/templates/en//360/237/232/200 Projects/Products/README.md" +16 -0
  222. package/templates/en//360/237/232/200 Projects/Products//360/237/247/252_example_product_project_brief.md" +20 -0
  223. package/templates/en//360/237/232/200 Projects/README.md" +21 -0
  224. package/templates/en//360/237/232/200 Projects/Research/README.md" +16 -0
  225. package/templates/en//360/237/232/200 Projects/Research//360/237/247/252_example_research_project_brief.md" +16 -0
  226. package/templates/template-generation-skill.md +79 -0
  227. package/templates/zh/CHANGELOG.md +9 -0
  228. package/templates/zh/CONFIG.json +197 -0
  229. package/templates/zh/CONFIG.md +66 -0
  230. package/templates/zh/INSTRUCTION.md +177 -0
  231. package/templates/zh/README.md +27 -0
  232. package/templates/zh/TODO.md +13 -0
  233. package/templates/zh//360/237/221/244 /347/224/273/345/203/217/INSTRUCTION.md" +28 -0
  234. package/templates/zh//360/237/221/244 /347/224/273/345/203/217/README.md" +20 -0
  235. package/templates/zh//360/237/221/244 /347/224/273/345/203/217//342/232/231/357/270/217 Preferences.md" +21 -0
  236. package/templates/zh//360/237/221/244 /347/224/273/345/203/217//360/237/216/257 Focus.md" +31 -0
  237. package/templates/zh//360/237/221/244 /347/224/273/345/203/217//360/237/221/244 Identity.md" +22 -0
  238. package/templates/zh//360/237/223/232 /350/265/204/346/272/220/INSTRUCTION.md" +29 -0
  239. package/templates/zh//360/237/223/232 /350/265/204/346/272/220/README.md" +21 -0
  240. package/templates/zh//360/237/223/232 /350/265/204/346/272/220//360/237/247/276 AI Inferencers.csv" +1 -0
  241. package/templates/zh//360/237/223/232 /350/265/204/346/272/220//360/237/247/276 AI /344/272/247/345/223/201.csv" +1 -0
  242. package/templates/zh//360/237/223/232 /350/265/204/346/272/220//360/237/247/276 AI /345/255/246/350/200/205/346/270/205/345/215/225.csv" +1 -0
  243. package/templates/zh//360/237/223/232 /350/265/204/346/272/220//360/237/247/276 AI /345/267/245/345/205/267/346/270/205/345/215/225.csv" +1 -0
  244. package/templates/zh//360/237/223/235 /347/254/224/350/256/260/INSTRUCTION.md" +31 -0
  245. package/templates/zh//360/237/223/235 /347/254/224/350/256/260/README.md" +24 -0
  246. package/templates/zh//360/237/223/235 /347/254/224/350/256/260//344/274/232/350/256/256/README.md" +8 -0
  247. package/templates/zh//360/237/223/235 /347/254/224/350/256/260//344/274/232/350/256/256//360/237/247/252_example_/344/274/232/350/256/256/347/272/252/350/246/201.md" +17 -0
  248. package/templates/zh//360/237/223/235 /347/254/224/350/256/260//345/276/205/345/217/215/351/246/210/README.md" +8 -0
  249. package/templates/zh//360/237/223/235 /347/254/224/350/256/260//345/276/205/345/217/215/351/246/210//360/237/247/252_example_/345/276/205/345/217/215/351/246/210/344/272/213/351/241/271.md" +16 -0
  250. package/templates/zh//360/237/223/235 /347/254/224/350/256/260//346/203/263/346/263/225/README.md" +8 -0
  251. package/templates/zh//360/237/223/235 /347/254/224/350/256/260//346/203/263/346/263/225//360/237/247/252_example_/344/272/247/345/223/201/346/203/263/346/263/225.md" +16 -0
  252. package/templates/zh//360/237/223/235 /347/254/224/350/256/260//346/224/266/344/273/266/347/256/261/README.md" +8 -0
  253. package/templates/zh//360/237/223/235 /347/254/224/350/256/260//346/224/266/344/273/266/347/256/261//360/237/247/252_example_/344/270/264/346/227/266/351/200/237/350/256/260.md" +13 -0
  254. package/templates/zh//360/237/224/204 /346/265/201/347/250/213/INSTRUCTION.md" +29 -0
  255. package/templates/zh//360/237/224/204 /346/265/201/347/250/213/README.md" +21 -0
  256. package/templates/zh//360/237/224/204 /346/265/201/347/250/213//344/277/241/346/201/257/README.md" +16 -0
  257. package/templates/zh//360/237/224/204 /346/265/201/347/250/213//344/277/241/346/201/257//360/237/247/252_example_/344/277/241/346/201/257/351/207/207/351/233/206/346/265/201/347/250/213.md" +13 -0
  258. package/templates/zh//360/237/224/204 /346/265/201/347/250/213//345/252/222/344/275/223/README.md" +16 -0
  259. package/templates/zh//360/237/224/204 /346/265/201/347/250/213//345/252/222/344/275/223//360/237/247/252_example_/345/206/205/345/256/271/345/217/221/345/270/203/346/265/201/347/250/213.md" +13 -0
  260. package/templates/zh//360/237/224/204 /346/265/201/347/250/213//347/247/221/347/240/224/README.md" +16 -0
  261. package/templates/zh//360/237/224/204 /346/265/201/347/250/213//347/247/221/347/240/224//360/237/247/252_example_/346/226/207/347/214/256/347/273/274/350/277/260/346/265/201/347/250/213.md" +16 -0
  262. package/templates/zh//360/237/224/204 /346/265/201/347/250/213//351/205/215/347/275/256/README.md" +3 -0
  263. package/templates/zh//360/237/224/204 /346/265/201/347/250/213//351/205/215/347/275/256//360/237/247/252_example_/351/205/215/347/275/256/346/233/264/346/226/260/346/265/201/347/250/213.md" +26 -0
  264. package/templates/zh//360/237/224/227 /345/205/263/347/263/273/INSTRUCTION.md" +62 -0
  265. package/templates/zh//360/237/224/227 /345/205/263/347/263/273/README.md" +20 -0
  266. package/templates/zh//360/237/224/227 /345/205/263/347/263/273//345/205/263/347/263/273/346/200/273/350/247/210.csv" +5 -0
  267. package/templates/zh//360/237/224/227 /345/205/263/347/263/273//345/220/214/344/272/213/README.md" +11 -0
  268. package/templates/zh//360/237/224/227 /345/205/263/347/263/273//345/220/214/344/272/213//360/237/247/252_example_/345/220/214/344/272/213/350/265/265/344/270/200/350/276/260.md" +16 -0
  269. package/templates/zh//360/237/224/227 /345/205/263/347/263/273//345/220/214/345/255/246/README.md" +11 -0
  270. package/templates/zh//360/237/224/227 /345/205/263/347/263/273//345/220/214/345/255/246//360/237/247/252_example_/345/220/214/345/255/246/351/231/210/347/253/213/346/254/247.md" +16 -0
  271. package/templates/zh//360/237/224/227 /345/205/263/347/263/273//345/256/266/344/272/272/README.md" +11 -0
  272. package/templates/zh//360/237/224/227 /345/205/263/347/263/273//345/256/266/344/272/272//360/237/247/252_example_/345/256/266/344/272/272/347/216/213/345/273/272/345/233/275.md" +16 -0
  273. package/templates/zh//360/237/224/227 /345/205/263/347/263/273//346/234/213/345/217/213/README.md" +11 -0
  274. package/templates/zh//360/237/224/227 /345/205/263/347/263/273//346/234/213/345/217/213//360/237/247/252_example_/346/234/213/345/217/213/346/236/227/345/260/217/344/270/275.md" +16 -0
  275. package/templates/zh//360/237/232/200 /351/241/271/347/233/256/INSTRUCTION.md" +31 -0
  276. package/templates/zh//360/237/232/200 /351/241/271/347/233/256/README.md" +21 -0
  277. package/templates/zh//360/237/232/200 /351/241/271/347/233/256//344/272/247/345/223/201/README.md" +16 -0
  278. package/templates/zh//360/237/232/200 /351/241/271/347/233/256//344/272/247/345/223/201//360/237/247/252_example_/344/272/247/345/223/201/351/241/271/347/233/256/347/256/200/346/212/245.md" +20 -0
  279. package/templates/zh//360/237/232/200 /351/241/271/347/233/256//345/267/262/345/275/222/346/241/243/README.md" +9 -0
  280. package/templates/zh//360/237/232/200 /351/241/271/347/233/256//345/267/262/345/275/222/346/241/243//360/237/247/252_example_/345/275/222/346/241/243/351/241/271/347/233/256/350/256/260/345/275/225.md" +15 -0
  281. package/templates/zh//360/237/232/200 /351/241/271/347/233/256//347/247/221/347/240/224/README.md" +16 -0
  282. package/templates/zh//360/237/232/200 /351/241/271/347/233/256//347/247/221/347/240/224//360/237/247/252_example_/347/247/221/347/240/224/351/241/271/347/233/256/347/256/200/346/212/245.md" +16 -0
package/README_zh.md ADDED
@@ -0,0 +1,423 @@
1
+ <p align="center">
2
+ <img src="assets/logo-square.svg" alt="MindOS" width="100" />
3
+ </p>
4
+
5
+ <h1 align="center">MindOS</h1>
6
+
7
+ <p align="center">
8
+ <strong>人类在此思考,Agent 依此行动。</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="README.md">English</a> | <a href="README_zh.md">中文</a>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://tianfuwang.tech/MindOS"><img src="https://img.shields.io/badge/Website-MindOS-0ea5e9.svg?style=for-the-badge" alt="Website"></a>
17
+ <a href="https://deepwiki.com/GeminiLight/MindOS"><img src="https://img.shields.io/badge/DeepWiki-MindOS-blue.svg?style=for-the-badge" alt="DeepWiki"></a>
18
+ <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge" alt="MIT License"></a>
19
+ </p>
20
+
21
+ MindOS 是一个**人机协同心智系统**——基于本地优先的协作知识库,让你的笔记、工作流、个人上下文既对人类阅读友好,也能直接被 AI Agent 调用和执行。**为所有 Agents 全局同步你的心智,透明可控,共生演进。**
22
+
23
+ ---
24
+
25
+ <p align="center">
26
+ <picture>
27
+ <source media="(prefers-color-scheme: dark)" srcset="assets/images/demo-flow-zh-dark.png" />
28
+ <source media="(prefers-color-scheme: light)" srcset="assets/images/demo-flow-zh-light.png" />
29
+ <img src="assets/images/demo-flow-zh-light.png" alt="MindOS:从灵感到执行到复盘" width="960" />
30
+ </picture>
31
+ </p>
32
+
33
+ > [!IMPORTANT]
34
+ > **⭐ 一键安装:** 把这句话发给你的 Agent(Claude Code、Cursor 等),自动完成全部安装:
35
+ > ```
36
+ > 帮我从 https://github.com/GeminiLight/MindOS 安装 MindOS,包含 MCP 和 Skills,使用中文模板。
37
+ > ```
38
+ >
39
+ > **✨ 立即体验:** 安装完成后,不妨试试:
40
+ > ```
41
+ > 读一下我的 MindOS 知识库,看看里面有什么,然后帮我把自我介绍写进 Profile。
42
+ > ```
43
+ > ```
44
+ > 帮我把这次对话的经验沉淀到 MindOS,形成一个可复用的工作流。
45
+ > ```
46
+ > ```
47
+ > 帮我执行 MindOS 里的 XXX 工作流。
48
+ > ```
49
+
50
+ ## 🧠 核心价值:人机共享心智
51
+
52
+ **1. 全局同步 — 打破心智孤岛**
53
+
54
+ 传统笔记分散在不同工具和接口中,Agent 在关键时刻拿不到你的真实上下文。MindOS 把本地知识统一为 MCP 可读的单一来源,让所有 Agent 同步你的 Profile、SOP 与实时记忆。
55
+
56
+ **2. 透明可控 — 消除记忆黑箱**
57
+
58
+ 多数助手记忆封闭在黑箱里,人类难以审查和纠正决策过程。MindOS 将检索与执行轨迹沉淀为本地纯文本,让你可以持续审计、干预与优化。
59
+
60
+ **3. 共生演进 — 动态指令流转**
61
+
62
+ 静态文档难同步,也难在真实人机协作中承担执行系统角色。MindOS 以 Prompt-Native 与引用链接组织知识,让日常记录自然变成可执行工作流并持续进化。
63
+
64
+ > **底层原则:** 默认本地优先,全部数据以本地纯文本保存,兼顾隐私、主权与性能。
65
+
66
+ ## ✨ 功能特性
67
+
68
+ ### 人类侧
69
+
70
+ - **GUI 协作工作台**:以统一入口高效浏览、编辑与搜索(`⌘K` / `⌘/`)。
71
+ - **内置 Agent 助手**:在上下文中对话,编辑内容可持续沉淀为可管理知识。
72
+ - **插件视图**:按场景使用 TODO、看板、时间线等视图。
73
+
74
+ ### Agent 侧
75
+
76
+ - **MCP Server + Skills**:让兼容 Agent 统一接入读写、搜索与工作流执行。
77
+ - **结构化模板**:通过 Profile、Workflows、Configurations 快速冷启动。
78
+ - **经验自动沉淀**:将日常记录自动化沉淀为可执行 SOP 经验。
79
+
80
+ ### 基础设施
81
+
82
+ - **引用同步**:通过引用与反向链接保持跨文件状态一致。
83
+ - **知识图谱**:可视化笔记间关系与依赖。
84
+ - **Git 时光机**:记录修改历史,支持审计与安全回滚。
85
+
86
+ **即将到来:**
87
+
88
+ - [ ] ACP(Agent Communication Protocol):连接外部 Agent(如 Claude Code、Cursor),让知识库成为多 Agent 协作的中枢
89
+ - [ ] RAG 深度集成:基于知识库内容的检索增强生成,让 AI 回答更精准、更有上下文
90
+ - [ ] 反向链接视图(Backlinks):展示所有引用当前文件的反向链接,理解笔记在知识网络中的位置
91
+ - [ ] Agent 审计面板(Agent Inspector):将 Agent 操作日志渲染为可筛选的时间线,审查每次工具调用的详情
92
+
93
+ ---
94
+
95
+ ## 🚀 快速开始
96
+
97
+ > [!IMPORTANT]
98
+ > **用 Agent 一键安装:** 将以下指令粘贴到任意支持 MCP 的 Agent(Claude Code、Cursor 等),即可自动完成安装,然后跳到[第 4 步](#4-通过-mindos-agent-注入你的个人心智):
99
+ > ```
100
+ > 帮我从 https://github.com/GeminiLight/MindOS 安装 MindOS,包含 MCP 和 Skills,使用中文模板。
101
+ > ```
102
+
103
+ > 已有知识库?直接跳到[第 5 步](#5-让任意-agent-可用mcp--skills)配置 MCP + Skills。
104
+
105
+ ### 1. 安装
106
+
107
+ **方式 A:npm 安装(推荐)**
108
+
109
+ ```bash
110
+ npm install -g @geminilight/mindos@latest
111
+ ```
112
+
113
+ **方式 B:克隆源码**
114
+
115
+ ```bash
116
+ git clone https://github.com/GeminiLight/MindOS
117
+ cd MindOS
118
+ npm install
119
+ npm link # 将 mindos 命令注册为全局命令
120
+ ```
121
+
122
+ ### 2. 交互式配置
123
+
124
+ ```bash
125
+ mindos onboard --install-daemon # 初始化 + 安装并启动后台服务
126
+ ```
127
+
128
+ 配置向导将引导你完成:
129
+ 1. 知识库路径 → 默认 `~/.mindos/my-mind`
130
+ 2. 选择模板语言(en / zh / empty)
131
+ 3. 可选 Auth token,保护你的 API
132
+ 4. 配置 AI Provider(Anthropic / OpenAI)+ API Key — 或选择 **skip**,稍后通过 `mindos config set` 补填
133
+ 5. 配置自动保存到 `~/.mindos/config.json`
134
+
135
+ > [!TIP]
136
+ > **For Agents:** 运行 onboard 前,如果用户未提供 LLM 配置,请询问:
137
+ > 1. AI Provider — `anthropic` 还是 `openai`(兼容)?
138
+ > 2. API Key — 对应 Provider 的密钥
139
+ > 3. 自定义 Base URL?— 仅代理或 OpenAI 兼容端点需要;使用官方 API 则跳过
140
+ > 4. Model ID — 或使用默认值
141
+ >
142
+ > 或跳过向导,手动编辑 `~/.mindos/config.json`(参考下方配置参考)。
143
+
144
+ <details>
145
+ <summary>配置参考(~/.mindos/config.json)</summary>
146
+
147
+ ```json
148
+ {
149
+ "mindRoot": "~/.mindos/my-mind",
150
+ "port": 3000,
151
+ "mcpPort": 8787,
152
+ "authToken": "",
153
+ "webPassword": "",
154
+ "ai": {
155
+ "provider": "anthropic",
156
+ "providers": {
157
+ "anthropic": { "apiKey": "sk-ant-...", "model": "claude-sonnet-4-6" },
158
+ "openai": { "apiKey": "sk-...", "model": "gpt-5.4", "baseUrl": "" }
159
+ }
160
+ }
161
+ }
162
+ ```
163
+
164
+ | 字段 | 默认值 | 说明 |
165
+ | :--- | :--- | :--- |
166
+ | `mindRoot` | `~/.mindos/my-mind` | **必填**。知识库根目录的绝对路径 |
167
+ | `port` | `3000` | 可选。Web 服务端口 |
168
+ | `mcpPort` | `8787` | 可选。MCP 服务端口 |
169
+ | `authToken` | — | 可选。保护 App `/api/*` 和 MCP `/mcp` 的 Bearer Token 认证。供 Agent / MCP 客户端使用,暴露到网络时建议设置 |
170
+ | `webPassword` | — | 可选。为 Web UI 添加登录密码保护。供浏览器访问,与 `authToken` 相互独立 |
171
+ | `ai.provider` | `anthropic` | 当前使用的 provider:`anthropic` 或 `openai` |
172
+ | `ai.providers.anthropic.apiKey` | — | Anthropic API Key |
173
+ | `ai.providers.anthropic.model` | `claude-sonnet-4-6` | Anthropic 模型 ID |
174
+ | `ai.providers.openai.apiKey` | — | OpenAI API Key |
175
+ | `ai.providers.openai.model` | `gpt-5.4` | OpenAI 模型 ID |
176
+ | `ai.providers.openai.baseUrl` | — | 可选。用于代理或 OpenAI 兼容 API 的自定义接口地址 |
177
+
178
+ 多个 provider 可以同时配置,切换时只需修改 `ai.provider` 字段,无需重新填写 API Key。Shell 环境变量(`ANTHROPIC_API_KEY`、`OPENAI_API_KEY` 等)优先级高于配置文件。
179
+
180
+ </details>
181
+
182
+ > [!NOTE]
183
+ > 如果你希望其他设备也能访问 MindOS GUI,请确保端口已在防火墙/安全组中放行,并绑定到可访问的主机地址/网卡。
184
+
185
+ ### 3. 启动
186
+
187
+ ```bash
188
+ mindos start # 启动 app + MCP 服务(生产模式,检测到新版本时自动重新构建)
189
+ ```
190
+
191
+ 启动后,MindOS 会自动打印 Web UI 地址、MCP 配置片段和 Auth token,直接复制到你的 Agent 即可。
192
+
193
+ > [!TIP]
194
+ > **升级?** 运行 `mindos update` — 自动安装最新版本,下次 start 时触发重建。
195
+
196
+ > [!TIP]
197
+ > 如果端口被占用,在 `mindos onboard` 时指定其他端口,或更新 `~/.mindos/config.json`,也可通过环境变量临时覆盖:
198
+ > ```bash
199
+ > MINDOS_WEB_PORT=3002 mindos
200
+ > ```
201
+
202
+ ### 4. 通过 MindOS Agent 注入你的个人心智
203
+
204
+ 1. 打开 MindOS GUI 中内置的 Agent 对话面板。
205
+ 2. 上传你的简历或任意个人/项目资料。
206
+ 3. 发送指令:`帮我把这些信息同步到我的 MindOS 知识库。`
207
+
208
+ <p align="center">
209
+ <img src="assets/images/gui-sync-cv.png" alt="同步简历示例" width="800" />
210
+ </p>
211
+
212
+ ### 5. 让任意 Agent 可用(MCP + Skills)
213
+
214
+ #### 5.1 配置 MindOS MCP
215
+
216
+ > [!TIP]
217
+ > **For Agents:** MindOS MCP 默认注册为全局(user-level)配置,使所有项目共享同一知识库。
218
+ > 每个 Agent 的 MCP 配置文件路径不同——详见下方 [支持的 Agent](#-支持的-agent) 表格中的 **MCP 配置文件路径** 列。
219
+
220
+ 将 MindOS MCP Server 注册到你的 Agent 客户端:
221
+
222
+ 运行 `mindos start` 或 `mindos dev` 时,MCP 服务自动随之启动。每次启动都会打印 MCP URL、Auth token 及可直接粘贴的配置片段。
223
+
224
+ > MCP 端口默认为 `8787`。如需修改,通过 `mindos onboard` 设置 `~/.mindos/config.json` 中的 `mcpPort`。
225
+
226
+ **方式 A:本机(同一台机器)**
227
+
228
+ 通过 stdio — 无需启动服务进程:
229
+
230
+ ```json
231
+ {
232
+ "mcpServers": {
233
+ "mindos": {
234
+ "type": "stdio",
235
+ "command": "mindos",
236
+ "args": ["mcp"],
237
+ "env": { "MCP_TRANSPORT": "stdio" }
238
+ }
239
+ }
240
+ }
241
+ ```
242
+
243
+ 或通过 URL:
244
+
245
+ ```json
246
+ {
247
+ "mcpServers": {
248
+ "mindos": {
249
+ "url": "http://localhost:8787/mcp",
250
+ "headers": { "Authorization": "Bearer your-token" }
251
+ }
252
+ }
253
+ }
254
+ ```
255
+
256
+ **方式 B:远程 URL(其他设备)**
257
+
258
+ > [!NOTE]
259
+ > 请确保端口 `8787` 已在防火墙/安全组中放行,远程客户端才能连接。
260
+
261
+ ```json
262
+ {
263
+ "mcpServers": {
264
+ "mindos": {
265
+ "url": "http://<服务器IP>:8787/mcp",
266
+ "headers": { "Authorization": "Bearer your-token" }
267
+ }
268
+ }
269
+ }
270
+ ```
271
+
272
+ #### 5.2 安装 MindOS Skills
273
+
274
+ | Skill | 说明 |
275
+ |-------|------|
276
+ | `mindos` | 知识库操作指南(英文)— 读写笔记、搜索、管理 SOP、维护 Profile |
277
+ | `mindos-zh` | 知识库操作指南(中文)— 相同能力,中文交互 |
278
+
279
+ 根据你的语言偏好选择其一安装即可:
280
+
281
+ ```bash
282
+ # 英文
283
+ npx skills add https://github.com/GeminiLight/MindOS --skill mindos -g -y
284
+
285
+ # 中文(可选)
286
+ npx skills add https://github.com/GeminiLight/MindOS --skill mindos-zh -g -y
287
+ ```
288
+
289
+ MCP = 连接能力,Skills = 工作流能力;两者都开启后体验完整。
290
+
291
+ #### 5.3 常见误区
292
+
293
+ - 只配 MCP,不装 Skills:能调用工具,但缺少最佳实践指引。
294
+ - 只装 Skills,不配 MCP:有流程提示,但无法操作本地知识库。
295
+ - `MIND_ROOT` 不是绝对路径:MCP 工具调用会失败。
296
+ - 未设置 `authToken`:API 和 MCP 服务暴露在网络上,存在安全风险。
297
+ - 未设置 `webPassword`:任何能访问服务器的人都可以打开 Web UI。
298
+
299
+ ## ⚙️ 运作机制
300
+
301
+ 一个零散想法如何变成所有 Agent 共享的智慧——三个联动飞轮:
302
+
303
+ ```mermaid
304
+ graph LR
305
+ H["👤 人类<br/><sub>思考 · 审查 · 进化</sub>"]
306
+ M[("📚 MindOS")]
307
+ A["🤖 Agent<br/><sub>执行 · 复盘 · 提炼 SOP</sub>"]
308
+ EXT["🌐 所有 Agent"]
309
+
310
+ H -- "想法 & 反馈" --> M
311
+ M -- "上下文 & 洞察" --> H
312
+ M -- "指令 & 上下文" --> A
313
+ A -- "结果 & SOP" --> M
314
+ M -. "via MCP" .-> EXT
315
+
316
+ style H fill:#f59e0b,stroke:#d97706,color:#fff,stroke-width:2px
317
+ style M fill:#10b981,stroke:#059669,color:#fff,stroke-width:2px
318
+ style A fill:#6366f1,stroke:#4f46e5,color:#fff,stroke-width:2px
319
+ style EXT fill:#64748b,stroke:#475569,color:#fff,stroke-dasharray:5 5
320
+ ```
321
+
322
+ > **双向进化。** 人类从积累的知识中获得新洞察;Agent 提炼 SOP 变得更强。MindOS 居中——随每次交互持续成长的共享第二大脑。
323
+
324
+ **协作闭环(人类 + 多 Agent)**
325
+
326
+ 1. 人类在 MindOS GUI 中审阅并更新笔记/SOP(单一事实来源)。
327
+ 2. 其他 Agent 客户端(OpenClaw、Claude Code、Cursor 等)通过 MCP 读取同一份记忆与上下文。
328
+ 3. 启用 Skills 后,Agent 按工作流指引执行任务与 SOP。
329
+ 4. 执行结果回写到 MindOS,供人类持续审查与迭代。
330
+
331
+ **适用人群:**
332
+
333
+ - **AI 独立开发者** — 将个人 SOP、技术栈偏好、项目上下文存入 MindOS,任何 Agent 即插即用你的工作习惯。
334
+ - **知识工作者** — 用双链笔记管理研究资料,AI 助手基于你的完整上下文回答问题,而非泛泛而谈。
335
+ - **团队协作** — 团队成员共享同一个 MindOS 知识库作为 Single Source of Truth,人与 Agent 读同一份剧本,保持对齐。
336
+ - **Agent 自动运维** — 将标准流程写成 Prompt-Driven 文档,Agent 直接执行,人类审计结果。
337
+
338
+ ---
339
+
340
+ ## 🤝 支持的 Agent
341
+
342
+ | Agent | MCP | Skills | MCP 配置文件路径 |
343
+ |:------|:---:|:------:|:-----------------|
344
+ | MindOS Agent | ✅ | ✅ | 内置(无需配置) |
345
+ | OpenClaw | ✅ | ✅ | `~/.openclaw/openclaw.json` 或 `~/.openclaw/mcp.json` |
346
+ | Claude Desktop | ✅ | ✅ | macOS: `~/Library/Application Support/Claude/claude_desktop_config.json` |
347
+ | Claude Code | ✅ | ✅ | `~/.claude.json`(全局)或 `.mcp.json`(项目级) |
348
+ | CodeBuddy | ✅ | ✅ | `~/.claude-internal/.claude.json`(全局) |
349
+ | Cursor | ✅ | ✅ | `~/.cursor/mcp.json`(全局)或 `.cursor/mcp.json`(项目级) |
350
+ | Windsurf | ✅ | ✅ | `~/.codeium/windsurf/mcp_config.json` |
351
+ | Cline | ✅ | ✅ | macOS: `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`;Linux: `~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` |
352
+ | Trae | ✅ | ✅ | `~/.trae/mcp.json`(全局)或 `.trae/mcp.json`(项目级) |
353
+ | Gemini CLI | ✅ | ✅ | `~/.gemini/settings.json`(全局)或 `.gemini/settings.json`(项目级) |
354
+ | GitHub Copilot | ✅ | ✅ | `.vscode/mcp.json`(项目级)或 VS Code 用户 `settings.json`(全局) |
355
+ | iFlow | ✅ | ✅ | iFlow 平台 MCP 配置面板 |
356
+
357
+ ---
358
+
359
+ ## 📁 项目架构
360
+
361
+ ```bash
362
+ MindOS/
363
+ ├── app/ # Next.js 16 前端 — 浏览、编辑、与 AI 交互
364
+ ├── mcp/ # MCP Server — 将工具映射到 App API 的 HTTP 适配器
365
+ ├── skills/ # MindOS Skills(`mindos`、`mindos-zh`)— Agent 工作流指南
366
+ ├── templates/ # 预设模板(`en/`、`zh/`、`empty/`)— onboard 时复制到知识库目录
367
+ ├── bin/ # CLI 入口(`mindos onboard`、`mindos start`、`mindos dev`、`mindos token`)
368
+ ├── scripts/ # 配置向导与辅助脚本
369
+ └── README.md
370
+
371
+ ~/.mindos/ # 用户数据目录(项目外,不会被提交)
372
+ ├── config.json # 所有配置(AI 密钥、端口、Auth token、知识库路径)
373
+ └── my-mind/ # 你的私有知识库(默认路径,onboard 时可自定义)
374
+ ```
375
+
376
+ ---
377
+
378
+ ## ⌨️ CLI 命令
379
+
380
+ | 命令 | 说明 |
381
+ | :--- | :--- |
382
+ | `mindos onboard` | 交互式初始化(生成配置、选择模板) |
383
+ | `mindos onboard --install-daemon` | 初始化 + 安装并启动后台服务 |
384
+ | `mindos start` | 前台启动 app + MCP 服务(生产模式) |
385
+ | `mindos start --daemon` | 安装并以后台 OS 服务方式启动(关闭终端仍运行,崩溃自动重启) |
386
+ | `mindos dev` | 启动 app + MCP 服务(开发模式,热更新) |
387
+ | `mindos dev --turbopack` | 开发模式 + Turbopack(更快的 HMR) |
388
+ | `mindos stop` | 停止正在运行的 MindOS 进程 |
389
+ | `mindos restart` | 停止后重新启动 |
390
+ | `mindos build` | 手动构建生产版本 |
391
+ | `mindos mcp` | 仅启动 MCP 服务 |
392
+ | `mindos token` | 查看当前 Auth token 及 MCP 配置片段 |
393
+ | `mindos gateway install` | 安装后台服务(Linux 用 systemd,macOS 用 LaunchAgent) |
394
+ | `mindos gateway uninstall` | 卸载后台服务 |
395
+ | `mindos gateway start` | 启动后台服务 |
396
+ | `mindos gateway stop` | 停止后台服务 |
397
+ | `mindos gateway status` | 查看后台服务状态 |
398
+ | `mindos gateway logs` | 实时查看服务日志 |
399
+ | `mindos doctor` | 健康检查(配置、端口、构建、daemon 状态) |
400
+ | `mindos update` | 更新 MindOS 到最新版本 |
401
+ | `mindos logs` | 实时查看服务日志(`~/.mindos/mindos.log`) |
402
+ | `mindos config show` | 查看当前配置(API Key 脱敏显示) |
403
+ | `mindos config validate` | 验证配置文件 |
404
+ | `mindos config set <key> <val>` | 更新单个配置字段 |
405
+ | `mindos` | 使用 `~/.mindos/config.json` 中保存的模式启动 |
406
+
407
+ ---
408
+
409
+ ## ⌨️ 快捷键指南
410
+
411
+ | 快捷键 | 功能 |
412
+ | :--- | :--- |
413
+ | `⌘ + K` | 全局搜索知识库 |
414
+ | `⌘ + /` | 唤起 AI 问答 / 侧边栏 |
415
+ | `E` | 在阅读界面按 `E` 快速进入编辑模式 |
416
+ | `⌘ + S` | 保存当前编辑 |
417
+ | `Esc` | 取消编辑 / 关闭弹窗 |
418
+
419
+ ---
420
+
421
+ ## 📄 License
422
+
423
+ MIT © GeminiLight
package/app/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # MindOS App
2
+
3
+ Next.js 16 (App Router) web application — browse, edit, and query your knowledge base in the browser.
4
+
5
+ Runs entirely on your local machine with direct filesystem access. No database, no cloud sync.
6
+
7
+ ## Quick Start
8
+
9
+ **Normal usage** — run via the MindOS CLI (config auto-loaded from `~/.mindos/config.json`):
10
+
11
+ ```bash
12
+ mindos dev # or: mindos start
13
+ ```
14
+
15
+ **Development / contributing** — run the app directly (requires env vars to be set manually):
16
+
17
+ ```bash
18
+ npm install
19
+ MIND_ROOT=~/.mindos/my-mind ANTHROPIC_API_KEY=sk-ant-... npm run dev
20
+ # Or copy .env.local.example to app/.env.local and fill in values
21
+ ```
22
+
23
+ Open [http://localhost:3000](http://localhost:3000).
24
+
25
+ ## Features
26
+
27
+ - **File browser** — sidebar file tree with collapsible directories, grid/list directory view
28
+ - **Markdown rendering** — GFM tables, syntax highlighting, copy button on code blocks
29
+ - **CSV viewer** — sortable, filterable table with virtual scrolling
30
+ - **JSON viewer** — syntax-highlighted, collapsible tree
31
+ - **Inline editor** — CodeMirror 6 + Tiptap WYSIWYG, `E` to edit, `⌘S` to save, `Esc` to cancel
32
+ - **Full-text search** — `⌘K` overlay with Fuse.js fuzzy search and snippet preview
33
+ - **Table of Contents** — floating TOC panel for Markdown headings
34
+ - **AI Agent** — `⌘/` to chat with an AI agent that can read/search your knowledge base, attach files via `@`-mention, upload local PDFs
35
+ - **Knowledge graph** — interactive node graph of backlinks between files
36
+ - **Backlinks** — related files panel shown at the bottom of each page
37
+ - **Dark / light mode** — follows system preference, togglable, with customizable prose font and content width
38
+ - **File management** — create, rename, delete files and directories from sidebar
39
+ - **Plugin renderers** — extensible file viewers (TODO, Kanban, Diff, Summary, Workflow, etc.)
40
+ - **Mobile support** — responsive layout with top navbar and drawer sidebar
41
+ - **i18n** — English and Chinese locale support
42
+
43
+ ## Environment Variables
44
+
45
+ Copy `.env.local.example` to `.env.local`:
46
+
47
+ | Variable | Default | Description |
48
+ |----------|---------|-------------|
49
+ | `MIND_ROOT` | `./my-mind` | Path to your knowledge base directory |
50
+ | `MINDOS_WEB_PORT` | `3000` | Dev/production server port |
51
+ | `AI_PROVIDER` | `anthropic` | `anthropic` or `openai` |
52
+ | `ANTHROPIC_API_KEY` | — | Required when `AI_PROVIDER=anthropic` |
53
+ | `ANTHROPIC_MODEL` | `claude-sonnet-4-6` | Anthropic model ID |
54
+ | `OPENAI_API_KEY` | — | Required when `AI_PROVIDER=openai` |
55
+ | `OPENAI_BASE_URL` | — | Optional: custom base URL for proxy or compatible API |
56
+ | `OPENAI_MODEL` | `gpt-5.4` | OpenAI model ID |
57
+ | `AUTH_TOKEN` | — | Optional: bearer token auth for all `/api/*` endpoints |
58
+
59
+ ## Architecture
60
+
61
+ ```
62
+ Request → middleware.ts (auth) → API route → lib/fs.ts (cache + mindRoot) → lib/core/* (pure fs) → filesystem
63
+ ```
64
+
65
+ - **`lib/core/`** — Pure business logic, no framework dependency. Security, fs-ops, search, lines, csv, git, backlinks.
66
+ - **`lib/fs.ts`** — App-level wrapper: injects `mindRoot`, manages in-memory cache, exposes Fuse.js fuzzy search.
67
+ - **`lib/agent/`** — AI agent system prompt, knowledge base tools (9 tools), model config.
68
+ - **`lib/api.ts`** — Typed `apiFetch()` wrapper with error handling and timeout.
69
+ - **`middleware.ts`** — Optional bearer token auth gate.
70
+
71
+ ## API Routes
72
+
73
+ | Method | Endpoint | Description |
74
+ |--------|----------|-------------|
75
+ | GET | `/api/files` | List all file paths |
76
+ | GET | `/api/file?path=...` | Read file content |
77
+ | GET | `/api/file?path=...&op=read_lines` | Read file as line array |
78
+ | POST | `/api/file` | File operations: `save_file`, `create_file`, `delete_file`, `rename_file`, `move_file`, `insert_lines`, `update_lines`, `append_to_file`, `insert_after_heading`, `update_section`, `append_csv` |
79
+ | GET | `/api/search?q=...` | Full-text fuzzy search |
80
+ | GET | `/api/recent-files?limit=...` | Recently modified files |
81
+ | GET | `/api/backlinks?path=...` | Find files that reference a given path |
82
+ | GET | `/api/bootstrap?target_dir=...` | Load startup context (INSTRUCTION, README, CONFIG) |
83
+ | GET | `/api/git?op=...` | Git operations: `is_repo`, `history`, `show` |
84
+ | GET | `/api/graph` | Knowledge graph (nodes + edges) |
85
+ | POST | `/api/ask` | AI agent streaming (SSE) |
86
+ | GET/POST | `/api/ask-sessions` | Chat session persistence |
87
+ | POST | `/api/extract-pdf` | PDF text extraction |
88
+ | GET/POST | `/api/settings` | User preferences |
89
+
90
+ ## Project Structure
91
+
92
+ ```
93
+ app/
94
+ ├── app/ # Next.js App Router
95
+ │ ├── layout.tsx # Root layout (fonts, providers, sidebar)
96
+ │ ├── page.tsx # Home page (recently modified files)
97
+ │ ├── view/[...path]/ # Dynamic file/directory viewer
98
+ │ └── api/ # 12 API route groups (see table above)
99
+ ├── components/ # React components
100
+ │ ├── ask/ # AI chat sub-components
101
+ │ ├── renderers/ # 10+ pluggable file renderers
102
+ │ ├── ui/ # Shared UI primitives (shadcn/ui)
103
+ │ └── *.tsx # Page-level components
104
+ ├── hooks/ # Custom React hooks
105
+ │ ├── useAskSession.ts # Chat session management
106
+ │ ├── useFileUpload.ts # File upload + PDF extraction
107
+ │ └── useMention.ts # @-mention autocomplete
108
+ ├── lib/
109
+ │ ├── core/ # Pure business logic (10 modules)
110
+ │ │ ├── security.ts # Path validation, write protection
111
+ │ │ ├── fs-ops.ts # CRUD: read, write, create, delete, rename, move
112
+ │ │ ├── lines.ts # Line-level operations
113
+ │ │ ├── search.ts # Literal string search
114
+ │ │ ├── csv.ts # CSV row append
115
+ │ │ ├── backlinks.ts # Wikilink/markdown link backlink detection
116
+ │ │ ├── git.ts # Git log, show, repo detection
117
+ │ │ ├── tree.ts # File tree builder
118
+ │ │ └── types.ts # Shared type definitions (source of truth)
119
+ │ ├── agent/ # AI agent system prompt + 9 tools
120
+ │ ├── renderers/ # Renderer plugin registry
121
+ │ ├── fs.ts # App-level fs wrapper (cache, mindRoot, Fuse.js search)
122
+ │ ├── api.ts # Typed fetch wrapper (apiFetch)
123
+ │ ├── types.ts # App types (re-exports core types + app-specific)
124
+ │ ├── settings.ts # Server settings (AI config, mindRoot)
125
+ │ ├── i18n.ts # Locale strings (en/zh)
126
+ │ └── utils.ts # Path encoding, helpers
127
+ ├── __tests__/ # Unit + API tests (vitest)
128
+ │ ├── core/ # Core logic tests (7 files)
129
+ │ └── api/ # API route tests (7 files)
130
+ ├── scripts/
131
+ │ └── extract-pdf.cjs # Standalone PDF extractor
132
+ ├── middleware.ts # Optional bearer token auth
133
+ └── .env.local.example # Environment variable template
134
+ ```
135
+
136
+ ## Testing
137
+
138
+ ```bash
139
+ npx vitest run # run all tests
140
+ npx vitest --watch # watch mode
141
+ ```
142
+
143
+ ## Production
144
+
145
+ ```bash
146
+ npm run build
147
+ npm start
148
+ ```
149
+
150
+ ## Tech Stack
151
+
152
+ Next.js 16 · React 19 · TypeScript · Tailwind CSS 4 · CodeMirror 6 · Tiptap · Fuse.js · react-markdown · Vercel AI SDK · shadcn/ui · pdfjs-dist