@amoree-code/ocean 2.23.0 → 3.0.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 (380) hide show
  1. package/README.md +46 -53
  2. package/dist/application/clients/bundles.js +1 -1
  3. package/dist/application/clients/client-detect.js +291 -0
  4. package/dist/application/clients/clients.js +104 -25
  5. package/dist/application/clients/desktop-link.js +40 -0
  6. package/dist/application/clients/desktop-watcher.js +6 -4
  7. package/dist/application/clients/hook-trust.js +106 -0
  8. package/dist/application/clients/hooks.js +7 -1
  9. package/dist/application/clients/mcp-schema-cost.js +74 -0
  10. package/dist/application/clients/native.js +38 -2
  11. package/dist/application/clients/registry.js +51 -9
  12. package/dist/application/clients/status.js +7 -2
  13. package/dist/application/gateway/webhook-gateway.js +1 -1
  14. package/dist/application/integrations/charter-copies.js +1 -1
  15. package/dist/application/integrations/engine-entry-repair.js +4 -3
  16. package/dist/application/integrations/skill-auto-sync.js +2 -2
  17. package/dist/application/integrations/skill-filter.js +1 -1
  18. package/dist/application/integrations/skill-router.js +134 -90
  19. package/dist/application/layout/layout-apply.js +1 -1
  20. package/dist/application/layout/workspace-template.js +1 -1
  21. package/dist/application/onboarding/steps.js +121 -30
  22. package/dist/application/profiles/profile-doctor.js +118 -0
  23. package/dist/application/profiles/profile-migration-service.js +208 -0
  24. package/dist/application/profiles/profile-suggestion.js +3 -7
  25. package/dist/application/profiles/profile-upgrade-service.js +98 -86
  26. package/dist/application/pull/history-index.js +1 -1
  27. package/dist/application/pull/project-match.js +3 -3
  28. package/dist/application/pull/pull.js +1 -1
  29. package/dist/application/pull/server-capture.js +92 -9
  30. package/dist/application/scheduler/local-scheduler.js +2 -2
  31. package/dist/application/spend/claude-prices.js +55 -0
  32. package/dist/application/spend/claude-spend.js +365 -0
  33. package/dist/application/uninstall/uninstall.js +25 -3
  34. package/dist/application/upkeep/nightly-upkeep.js +4 -4
  35. package/dist/composition/runtime.js +2 -2
  36. package/dist/infrastructure/desktop/claude-export.js +1 -1
  37. package/dist/infrastructure/desktop/desktop-chat.js +60 -13
  38. package/dist/infrastructure/desktop/indexeddb.js +4 -4
  39. package/dist/infrastructure/desktop/leveldb.js +2 -2
  40. package/dist/infrastructure/filesystem/profile-loader.js +3 -45
  41. package/dist/infrastructure/filesystem/runtime-config-loader.js +1 -1
  42. package/dist/infrastructure/observability/runtime-logger.js +1 -1
  43. package/dist/infrastructure/process/agent-tool-executor.js +3 -3
  44. package/dist/infrastructure/process/process-supervisor.js +1 -1
  45. package/dist/infrastructure/process/service.js +8 -8
  46. package/dist/infrastructure/providers/openai-compatible.js +2 -2
  47. package/dist/infrastructure/providers/provider-invocation.js +1 -1
  48. package/dist/infrastructure/providers/session-facts-completer.js +78 -5
  49. package/dist/interfaces/cli/auth-command.js +2 -2
  50. package/dist/interfaces/cli/brief-command.js +1 -1
  51. package/dist/interfaces/cli/browser-command.js +6 -6
  52. package/dist/interfaces/cli/browser-findings.js +6 -9
  53. package/dist/interfaces/cli/browser-settings.js +10 -10
  54. package/dist/interfaces/cli/capture-command.js +6 -6
  55. package/dist/interfaces/cli/client-test-command.js +3 -3
  56. package/dist/interfaces/cli/clients-command.js +33 -6
  57. package/dist/interfaces/cli/command-aliases.js +56 -0
  58. package/dist/interfaces/cli/command-registry.js +48 -1414
  59. package/dist/interfaces/cli/commands/browser.js +5 -0
  60. package/dist/interfaces/cli/commands/capture.js +19 -0
  61. package/dist/interfaces/cli/commands/catalog.js +9 -0
  62. package/dist/interfaces/cli/commands/client.js +135 -0
  63. package/dist/interfaces/cli/commands/clients.js +33 -0
  64. package/dist/interfaces/cli/commands/connectors.js +14 -0
  65. package/dist/interfaces/cli/commands/context.js +9 -0
  66. package/dist/interfaces/cli/commands/cost.js +15 -0
  67. package/dist/interfaces/cli/commands/daily.js +11 -0
  68. package/dist/interfaces/cli/commands/day.js +25 -0
  69. package/dist/interfaces/cli/commands/dispatch.js +31 -0
  70. package/dist/interfaces/cli/commands/doctor.js +60 -0
  71. package/dist/interfaces/cli/commands/env.js +5 -0
  72. package/dist/interfaces/cli/commands/gateway.js +16 -0
  73. package/dist/interfaces/cli/commands/handoff.js +11 -0
  74. package/dist/interfaces/cli/commands/health.js +17 -0
  75. package/dist/interfaces/cli/commands/hook.js +142 -0
  76. package/dist/interfaces/cli/commands/idea.js +11 -0
  77. package/dist/interfaces/cli/commands/install.js +31 -0
  78. package/dist/interfaces/cli/commands/intent.js +14 -0
  79. package/dist/interfaces/cli/commands/intercept.js +22 -0
  80. package/dist/interfaces/cli/commands/layout.js +11 -0
  81. package/dist/interfaces/cli/commands/lifecycle.js +5 -0
  82. package/dist/interfaces/cli/commands/loop.js +73 -0
  83. package/dist/interfaces/cli/commands/market.js +11 -0
  84. package/dist/interfaces/cli/commands/mcp.js +57 -0
  85. package/dist/interfaces/cli/commands/memory.js +5 -0
  86. package/dist/interfaces/cli/commands/migrate.js +5 -0
  87. package/dist/interfaces/cli/commands/observe.js +11 -0
  88. package/dist/interfaces/cli/commands/obsidian.js +111 -0
  89. package/dist/interfaces/cli/commands/operate.js +7 -0
  90. package/dist/interfaces/cli/commands/policy.js +16 -0
  91. package/dist/interfaces/cli/commands/project.js +207 -0
  92. package/dist/interfaces/cli/commands/repair.js +20 -0
  93. package/dist/interfaces/cli/commands/run.js +52 -0
  94. package/dist/interfaces/cli/commands/schedule.js +58 -0
  95. package/dist/interfaces/cli/commands/service.js +21 -0
  96. package/dist/interfaces/cli/commands/session.js +182 -0
  97. package/dist/interfaces/cli/commands/sessions.js +12 -0
  98. package/dist/interfaces/cli/commands/setup.js +21 -0
  99. package/dist/interfaces/cli/commands/skill.js +159 -0
  100. package/dist/interfaces/cli/commands/tasks.js +10 -0
  101. package/dist/interfaces/cli/commands/update-remove.js +25 -0
  102. package/dist/interfaces/cli/connectors-command.js +150 -0
  103. package/dist/interfaces/cli/context-command.js +39 -3
  104. package/dist/interfaces/cli/cost-command.js +104 -0
  105. package/dist/interfaces/cli/curator-command.js +1 -1
  106. package/dist/interfaces/cli/daily-command.js +7 -1
  107. package/dist/interfaces/cli/desktop-command.js +43 -7
  108. package/dist/interfaces/cli/distill-command.js +7 -2
  109. package/dist/interfaces/cli/express-command.js +1 -1
  110. package/dist/interfaces/cli/failures-command.js +4 -4
  111. package/dist/interfaces/cli/gateway-findings.js +2 -2
  112. package/dist/interfaces/cli/governance-command.js +23 -16
  113. package/dist/interfaces/cli/handoff-command.js +1 -1
  114. package/dist/interfaces/cli/harvest-command.js +2 -2
  115. package/dist/interfaces/cli/help-command.js +53 -169
  116. package/dist/interfaces/cli/hygiene-command.js +1 -1
  117. package/dist/interfaces/cli/idea-command.js +1 -1
  118. package/dist/interfaces/cli/intercept-command.js +8 -7
  119. package/dist/interfaces/cli/interests-command.js +1 -1
  120. package/dist/interfaces/cli/layout-command.js +2 -0
  121. package/dist/interfaces/cli/market-command.js +9 -9
  122. package/dist/interfaces/cli/mcp-gateway-command.js +124 -7
  123. package/dist/interfaces/cli/mcp-probe-command.js +186 -0
  124. package/dist/interfaces/cli/mcp-status-command.js +5 -5
  125. package/dist/interfaces/cli/memory-command.js +41 -7
  126. package/dist/interfaces/cli/migrate-command.js +2 -2
  127. package/dist/interfaces/cli/note-command.js +1 -1
  128. package/dist/interfaces/cli/onboard-command.js +14 -0
  129. package/dist/interfaces/cli/operate-command.js +5 -5
  130. package/dist/interfaces/cli/profiles-command.js +61 -1
  131. package/dist/interfaces/cli/rhythm-command.js +11 -5
  132. package/dist/interfaces/cli/running-server-findings.js +1 -1
  133. package/dist/interfaces/cli/scorecard-command.js +8 -8
  134. package/dist/interfaces/cli/session-facts-command.js +2 -2
  135. package/dist/interfaces/cli/sessions-command.js +145 -0
  136. package/dist/interfaces/cli/setup-command.js +15 -2
  137. package/dist/interfaces/cli/tasks-command.js +63 -13
  138. package/dist/interfaces/cli/telemetry-command.js +4 -4
  139. package/dist/interfaces/cli/uninstall-command.js +1 -1
  140. package/dist/interfaces/cli/week-failures.js +32 -0
  141. package/dist/main.js +12 -0
  142. package/node_modules/@ocean/brain/dist/{infrastructure/brain/brain-index.js → brain-index.js} +2 -2
  143. package/node_modules/@ocean/brain/dist/{brain/brain-markdown.js → brain-markdown.js} +1 -1
  144. package/node_modules/@ocean/brain/dist/{brain/brain-service.js → brain-service.js} +12 -2
  145. package/node_modules/@ocean/brain/dist/memory/brain-dump.js +92 -16
  146. package/node_modules/@ocean/brain/dist/memory/extraction-log.js +125 -0
  147. package/node_modules/@ocean/brain/dist/memory/extraction-retry.js +54 -0
  148. package/node_modules/@ocean/brain/dist/memory/fact-routing.js +44 -1
  149. package/node_modules/@ocean/brain/dist/memory/lesson-activation.js +2 -2
  150. package/node_modules/@ocean/brain/dist/memory/lesson-learning.js +2 -2
  151. package/node_modules/@ocean/brain/dist/memory/lessons.js +1 -1
  152. package/node_modules/@ocean/brain/dist/memory/memory-audit.js +2 -2
  153. package/node_modules/@ocean/brain/dist/memory/memory-harvest.js +1 -1
  154. package/node_modules/@ocean/brain/dist/memory/memory-paths.js +8 -0
  155. package/node_modules/@ocean/brain/dist/memory/memory-review.js +31 -3
  156. package/node_modules/@ocean/brain/dist/memory/memory-trash.js +29 -0
  157. package/node_modules/@ocean/brain/dist/memory/memory-write.js +4 -2
  158. package/node_modules/@ocean/brain/dist/memory/model-narrative.js +2 -2
  159. package/node_modules/@ocean/brain/dist/memory/profile-facts.js +1 -1
  160. package/node_modules/@ocean/brain/dist/memory/routing.json +6 -6
  161. package/node_modules/@ocean/{market/dist/skills → brain/dist/memory}/signal-detection.js +1 -1
  162. package/node_modules/@ocean/brain/dist/{memory → people}/people.js +1 -1
  163. package/node_modules/@ocean/brain/dist/sessions-capture/session-facts.js +625 -0
  164. package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-promotion.js +7 -15
  165. package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-summary.js +1 -1
  166. package/node_modules/@ocean/brain/dist/sessions-capture/session-triage.js +52 -0
  167. package/node_modules/@ocean/brain/package.json +1 -1
  168. package/node_modules/@ocean/connect/dist/connectors/connector-hub.js +173 -0
  169. package/node_modules/@ocean/{market → connect}/dist/install/default-marketplace.js +6 -2
  170. package/node_modules/@ocean/{market → connect}/dist/install/marketplace-service.js +1 -1
  171. package/node_modules/@ocean/connect/dist/mcp/mcp-gateway.js +987 -0
  172. package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-launch.js +102 -5
  173. package/node_modules/@ocean/{market → connect}/dist/registry/official-registry.js +1 -1
  174. package/node_modules/@ocean/{market → connect}/dist/security/permissions.js +1 -1
  175. package/node_modules/@ocean/{market → connect}/dist/skills/skill-hub.js +104 -6
  176. package/node_modules/@ocean/{market → connect}/package.json +2 -2
  177. package/node_modules/@ocean/context/dist/{context/context-ladder.js → context-ladder.js} +3 -3
  178. package/node_modules/@ocean/context/dist/{context/context-references.js → context-references.js} +5 -4
  179. package/node_modules/@ocean/context/dist/{context/context-cost.js → context-size.js} +6 -6
  180. package/node_modules/@ocean/context/dist/{context/intent-router.js → intent-router.js} +1 -1
  181. package/node_modules/@ocean/context/dist/{context/resource-injection.js → resource-injection.js} +3 -1
  182. package/node_modules/@ocean/context/package.json +1 -1
  183. package/node_modules/@ocean/core/dist/domain/brain/brain-record.js +1 -1
  184. package/node_modules/@ocean/core/dist/domain/capabilities/capability-manifest.js +5 -5
  185. package/node_modules/@ocean/core/dist/domain/connector-entry.js +86 -0
  186. package/node_modules/@ocean/core/dist/domain/context/context.js +1 -1
  187. package/node_modules/@ocean/core/dist/domain/context/project-id.js +8 -2
  188. package/node_modules/@ocean/core/dist/domain/{evidence/evidence.js → evidence.js} +1 -1
  189. package/node_modules/@ocean/core/dist/domain/mcp/memory-contract.js +4 -1
  190. package/node_modules/@ocean/core/dist/domain/ports/brain-index-port.js +1 -1
  191. package/node_modules/@ocean/core/dist/domain/profiles/profile-markdown.js +40 -0
  192. package/node_modules/@ocean/core/dist/domain/profiles/profile-resolution.js +276 -0
  193. package/node_modules/@ocean/core/dist/domain/profiles/profile-selection.js +23 -60
  194. package/node_modules/@ocean/core/dist/domain/profiles/profile-upgrade.js +2 -2
  195. package/node_modules/@ocean/core/dist/domain/profiles/profile.js +66 -6
  196. package/node_modules/@ocean/core/dist/domain/profiles/runtime-config.js +1 -1
  197. package/node_modules/@ocean/core/dist/domain/runs/agent-tools.js +2 -2
  198. package/node_modules/@ocean/core/dist/domain/sessions/session-identity.js +53 -0
  199. package/node_modules/@ocean/core/dist/domain/sessions/session-metadata.js +208 -0
  200. package/node_modules/@ocean/core/dist/domain/{tasks/task-id.js → task-id.js} +2 -2
  201. package/node_modules/@ocean/core/dist/profiles/profile-files.js +57 -0
  202. package/node_modules/@ocean/core/dist/profiles/profile-loader.js +97 -0
  203. package/node_modules/@ocean/core/dist/profiles/project-profile-fill.js +33 -0
  204. package/node_modules/@ocean/core/dist/profiles/session-profile.js +158 -0
  205. package/node_modules/@ocean/core/dist/shared/charter.js +110 -0
  206. package/node_modules/@ocean/core/dist/shared/context-ack.js +1 -1
  207. package/node_modules/@ocean/core/dist/shared/context-triggers.js +67 -0
  208. package/node_modules/@ocean/core/dist/shared/paths.js +6 -6
  209. package/node_modules/@ocean/core/dist/shared/project-legacy.js +232 -0
  210. package/node_modules/@ocean/core/dist/shared/project-manifest.js +308 -0
  211. package/node_modules/@ocean/core/dist/shared/project-names.js +87 -0
  212. package/node_modules/@ocean/core/dist/shared/project-register.js +560 -0
  213. package/node_modules/@ocean/core/dist/shared/project-resolution.js +83 -861
  214. package/node_modules/@ocean/core/dist/shared/repo-signals.js +45 -0
  215. package/node_modules/@ocean/core/dist/shared/task-reference.js +1 -1
  216. package/node_modules/@ocean/core/dist/shared/text-tokens.js +37 -0
  217. package/node_modules/@ocean/core/dist/shared/tool-groups.js +224 -0
  218. package/node_modules/@ocean/core/package.json +4 -1
  219. package/node_modules/@ocean/services/dist/day/day.js +45 -3
  220. package/node_modules/@ocean/services/dist/{distill → day}/distill.js +29 -3
  221. package/node_modules/@ocean/services/dist/{harvest → day}/harvest.js +54 -14
  222. package/node_modules/@ocean/services/dist/{brief → day}/interest-discovery.js +3 -3
  223. package/node_modules/@ocean/services/dist/day/note.js +2 -2
  224. package/node_modules/@ocean/services/dist/{onboarding → day}/onboarding.js +1 -1
  225. package/node_modules/@ocean/services/dist/day/patterns.js +68 -0
  226. package/node_modules/@ocean/services/dist/{curator → health}/curator.js +5 -5
  227. package/node_modules/@ocean/services/dist/{journey → health}/failures.js +7 -5
  228. package/node_modules/@ocean/services/dist/{hygiene → health}/hygiene.js +2 -2
  229. package/node_modules/@ocean/services/dist/{journey → health}/lesson-effect.js +1 -1
  230. package/node_modules/@ocean/services/dist/{scorecard → health}/scorecard.js +3 -3
  231. package/node_modules/@ocean/services/dist/{upkeep → health}/upkeep.js +2 -2
  232. package/node_modules/@ocean/services/dist/{doctor → health}/workspace-doctor.js +57 -17
  233. package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-session.js +1 -1
  234. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/call-ledger.js +3 -0
  235. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-client.js +19 -3
  236. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/obsidian-server.js +4 -4
  237. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/ocean-server.js +423 -34
  238. package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/conflict-log.js +1 -1
  239. package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/folder-templates.js +8 -5
  240. package/node_modules/@ocean/services/dist/projects/project-doctor.js +173 -0
  241. package/node_modules/@ocean/services/dist/projects/project-snippet.js +9 -0
  242. package/node_modules/@ocean/services/dist/projects/projects-overview.js +2 -2
  243. package/node_modules/@ocean/services/package.json +1 -1
  244. package/node_modules/@ocean/{loop/dist/loops → work/dist/runs}/guard-runtime.js +3 -3
  245. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/memory-knowledge-operations.js +4 -12
  246. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-contract.js +2 -2
  247. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/project-operations.js +2 -1
  248. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/task-operations.js +4 -4
  249. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/write-guard.js +1 -1
  250. package/node_modules/@ocean/{loop → work}/dist/runs/prompt-assembly.js +2 -2
  251. package/node_modules/@ocean/{loop → work}/dist/runs/run-agent.js +4 -4
  252. package/node_modules/@ocean/{loop → work}/dist/runs/tool-loop.js +4 -4
  253. package/node_modules/@ocean/work/dist/sessions/hooks/desktop-facts.js +309 -0
  254. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-end-hook.js +36 -5
  255. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-facts-hook.js +144 -14
  256. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-start-hook.js +129 -12
  257. package/node_modules/@ocean/work/dist/sessions/hooks/start-brief.js +110 -0
  258. package/node_modules/@ocean/work/dist/sessions/hooks/unlinked-warning.js +68 -0
  259. package/node_modules/@ocean/{loop → work}/dist/sessions/session-closeout.js +4 -4
  260. package/node_modules/@ocean/{loop → work}/dist/sessions/session-projects.js +13 -3
  261. package/node_modules/@ocean/work/dist/sessions/session-relink.js +300 -0
  262. package/node_modules/@ocean/{loop → work}/dist/sessions/session-retention.js +1 -1
  263. package/node_modules/@ocean/{loop → work}/dist/tasks/list-tasks.js +7 -2
  264. package/node_modules/@ocean/{loop → work}/dist/tasks/renumber-tasks.js +4 -2
  265. package/node_modules/@ocean/{loop → work}/dist/tasks/session-task.js +2 -2
  266. package/node_modules/@ocean/{loop → work}/dist/tasks/sync-task-prs.js +77 -7
  267. package/node_modules/@ocean/work/dist/tasks/task-git.js +63 -0
  268. package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop.js +4 -4
  269. package/node_modules/@ocean/{loop → work}/dist/tasks/verification-readiness.js +1 -1
  270. package/node_modules/@ocean/{loop → work}/dist/tasks/verify-task.js +1 -1
  271. package/node_modules/@ocean/{loop → work}/package.json +2 -2
  272. package/ocean-marketplace.json +41 -41
  273. package/package.json +12 -11
  274. package/skills/core/daily-harvest/SKILL.md +1 -1
  275. package/skills/core/ocean-memory/SKILL.md +4 -0
  276. package/skills/core/use-browser/SKILL.md +30 -7
  277. package/skills/index.json +1 -1
  278. package/templates/profiles/default.md +44 -0
  279. package/templates/profiles/developer.md +45 -0
  280. package/templates/profiles/reviewer.md +44 -0
  281. package/templates/profiles/strategist.md +44 -0
  282. package/templates/profiles-v3/analysis.md +16 -0
  283. package/templates/profiles-v3/backend.md +16 -0
  284. package/templates/profiles-v3/base.md +57 -0
  285. package/templates/profiles-v3/code-review.md +16 -0
  286. package/templates/profiles-v3/devops.md +16 -0
  287. package/templates/profiles-v3/docs-office.md +16 -0
  288. package/templates/profiles-v3/frontend.md +16 -0
  289. package/templates/profiles-v3/learning.md +16 -0
  290. package/templates/profiles-v3/marketing-ads.md +16 -0
  291. package/templates/profiles-v3/marketing-content-seo.md +16 -0
  292. package/templates/profiles-v3/ocean-ops.md +16 -0
  293. package/templates/profiles-v3/product-strategy.md +16 -0
  294. package/templates/profiles-v3/qa-testing.md +16 -0
  295. package/templates/profiles-v3/security.md +16 -0
  296. package/templates/workspace/MANIFEST.json +1 -0
  297. package/templates/workspace/charter/core.md +22 -90
  298. package/templates/workspace/charter/policies/README.md +7 -1
  299. package/templates/workspace/charter/policies/claude-code-context.md +6 -1
  300. package/templates/workspace/charter/policies/concise-output.md +5 -0
  301. package/templates/workspace/charter/policies/context.md +5 -0
  302. package/templates/workspace/charter/policies/contracts/task.md +2 -2
  303. package/templates/workspace/charter/policies/git.md +5 -0
  304. package/templates/workspace/charter/policies/graph.md +6 -1
  305. package/templates/workspace/charter/policies/knowledge.md +11 -4
  306. package/templates/workspace/charter/policies/layout.md +23 -0
  307. package/templates/workspace/charter/policies/lifecycle.md +5 -0
  308. package/templates/workspace/charter/policies/memory.md +5 -0
  309. package/templates/workspace/charter/policies/minimal-change.md +5 -0
  310. package/templates/workspace/charter/policies/models.md +5 -0
  311. package/templates/workspace/charter/policies/response.md +5 -0
  312. package/templates/workspace/charter/policies/skill-observer.md +12 -0
  313. package/templates/workspace/charter/policies/stack.md +5 -0
  314. package/templates/workspace/charter/policies/task.md +17 -3
  315. package/templates/workspace/charter/policies/verification.md +5 -0
  316. package/node_modules/@ocean/brain/dist/evidence/verification-report.js +0 -13
  317. package/node_modules/@ocean/brain/dist/memory/daily-narrative.js +0 -142
  318. package/node_modules/@ocean/brain/dist/memory/session-facts.js +0 -283
  319. package/node_modules/@ocean/context/dist/context/context-compression.js +0 -66
  320. package/node_modules/@ocean/loop/dist/hooks/desktop-facts.js +0 -174
  321. package/node_modules/@ocean/loop/dist/operations/task-linker.js +0 -40
  322. package/node_modules/@ocean/loop/dist/sessions/session-pointer.js +0 -133
  323. package/node_modules/@ocean/loop/dist/tasks/task-git.js +0 -28
  324. package/node_modules/@ocean/market/dist/mcp/mcp-gateway.js +0 -533
  325. package/templates/profiles/default.json +0 -51
  326. package/templates/profiles/developer.json +0 -51
  327. package/templates/profiles/reviewer.json +0 -51
  328. package/templates/profiles/strategist.json +0 -51
  329. /package/node_modules/@ocean/brain/dist/{brain/brain-eval.js → brain-eval.js} +0 -0
  330. /package/node_modules/@ocean/brain/dist/{brain/brain-reindex.js → brain-reindex.js} +0 -0
  331. /package/node_modules/@ocean/brain/dist/{capture → sessions-capture}/inbox-sync.js +0 -0
  332. /package/node_modules/@ocean/{market → connect}/dist/adapters/mcp-adapter.js +0 -0
  333. /package/node_modules/@ocean/{market → connect}/dist/adapters/owned-directory.js +0 -0
  334. /package/node_modules/@ocean/{market → connect}/dist/adapters/plugin-adapter.js +0 -0
  335. /package/node_modules/@ocean/{market → connect}/dist/adapters/skill-adapter.js +0 -0
  336. /package/node_modules/@ocean/{market → connect}/dist/capability/adapter.js +0 -0
  337. /package/node_modules/@ocean/{market → connect}/dist/capability/catalog.js +0 -0
  338. /package/node_modules/@ocean/{market → connect}/dist/capability/content-digest.js +0 -0
  339. /package/node_modules/@ocean/{market → connect}/dist/capability/registry.js +0 -0
  340. /package/node_modules/@ocean/{market → connect}/dist/install/lock.js +0 -0
  341. /package/node_modules/@ocean/{market → connect}/dist/install/own-server.js +0 -0
  342. /package/node_modules/@ocean/{market → connect}/dist/mcp/chrome-debugging.js +0 -0
  343. /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-connection.js +0 -0
  344. /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-runner.js +0 -0
  345. /package/node_modules/@ocean/{market → connect}/dist/security/description-scan.js +0 -0
  346. /package/node_modules/@ocean/{market → connect}/dist/security/secrets.js +0 -0
  347. /package/node_modules/@ocean/{market → connect}/dist/skills/core-skill-sync.js +0 -0
  348. /package/node_modules/@ocean/context/dist/{context/context-packet.js → context-packet.js} +0 -0
  349. /package/node_modules/@ocean/core/dist/domain/{process/process-events.js → process-events.js} +0 -0
  350. /package/node_modules/@ocean/core/dist/domain/{redaction/redaction.js → redaction.js} +0 -0
  351. /package/node_modules/@ocean/services/dist/{brief → day}/brief.js +0 -0
  352. /package/node_modules/@ocean/services/dist/{express → day}/express.js +0 -0
  353. /package/node_modules/@ocean/services/dist/{brief → day}/source-registry.json +0 -0
  354. /package/node_modules/@ocean/services/dist/{journey → health}/telemetry.js +0 -0
  355. /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-service.js +0 -0
  356. /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-task-runner.js +0 -0
  357. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-session.js +0 -0
  358. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/server-version.js +0 -0
  359. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/tool-registry.js +0 -0
  360. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/inbox-promotion.js +0 -0
  361. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-discovery.js +0 -0
  362. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-ingestion.js +0 -0
  363. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-sync.js +0 -0
  364. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-writer.js +0 -0
  365. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-scope.js +0 -0
  366. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-io.js +0 -0
  367. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-operations.js +0 -0
  368. /package/node_modules/@ocean/{loop → work}/dist/runs/run-authorization.js +0 -0
  369. /package/node_modules/@ocean/{loop → work}/dist/runs/session-tokens.js +0 -0
  370. /package/node_modules/@ocean/{loop/dist/handoff → work/dist/sessions}/handoff-service.js +0 -0
  371. /package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/lifecycle-hooks.js +0 -0
  372. /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-store.js +0 -0
  373. /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-validator.js +0 -0
  374. /package/node_modules/@ocean/{loop → work}/dist/tasks/archive-tasks.js +0 -0
  375. /package/node_modules/@ocean/{loop → work}/dist/tasks/checkpoint-task.js +0 -0
  376. /package/node_modules/@ocean/{loop → work}/dist/tasks/claim-task.js +0 -0
  377. /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/iteration-graph.js +0 -0
  378. /package/node_modules/@ocean/{loop → work}/dist/tasks/new-task.js +0 -0
  379. /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop-record.js +0 -0
  380. /package/node_modules/@ocean/{loop → work}/dist/tasks/task-verification.js +0 -0
@@ -1,27 +1,173 @@
1
- import { readdir, readFile } from "node:fs/promises";
1
+ import { spawn } from "node:child_process";
2
+ import { mkdirSync, watch } from "node:fs";
3
+ import { readFile } from "node:fs/promises";
2
4
  import path from "node:path";
3
- import { brainNeighbors, brainRead, brainSearch, } from "@ocean/brain/brain/brain-service.js";
5
+ import { brainNeighbors, brainRead, brainSearch, } from "@ocean/brain/brain-service.js";
4
6
  import { memorySettings } from "@ocean/brain/memory/memory-audit.js";
5
7
  import { fileProposal, } from "@ocean/brain/memory/memory-review.js";
6
8
  import { deleteMemoryRecord, memoryHistory, restoreMemory, } from "@ocean/brain/memory/memory-trash.js";
7
9
  import { proposeMemory, readMemoryRecord, writeMemoryRecord, } from "@ocean/brain/memory/memory-write.js";
8
- import { lookupPerson } from "@ocean/brain/memory/people.js";
9
- import { promoteSessionToKnowledge } from "@ocean/brain/memory/session-promotion.js";
10
+ import { lookupPerson } from "@ocean/brain/people/people.js";
11
+ import { promoteSessionToKnowledge } from "@ocean/brain/sessions-capture/session-promotion.js";
10
12
  import { isValidProjectId } from "@ocean/core/domain/context/project-id.js";
11
13
  import { actionFingerprint, mcpApprovalSchema, } from "@ocean/core/domain/mcp/mcp-contract.js";
12
14
  import { MEMORY_AUTHORITY_LINE, MEMORY_CONTRACT_VERSION, MEMORY_INSTRUCTIONS, MemoryContractError, } from "@ocean/core/domain/mcp/memory-contract.js";
13
- import { redactSecrets } from "@ocean/core/domain/redaction/redaction.js";
15
+ import { redactSecrets } from "@ocean/core/domain/redaction.js";
16
+ import { profileBundle, profileCatalog, sessionProfile, } from "@ocean/core/profiles/session-profile.js";
17
+ import { readRules } from "@ocean/core/shared/charter.js";
14
18
  import { ackIssued } from "@ocean/core/shared/context-ack.js";
15
19
  import { enginePath, oceanPath, oceanRoot, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
16
- import { findProject, folderProject, scanProjectManifests, } from "@ocean/core/shared/project-resolution.js";
17
- import { createHandoff, getHandoff, getTask, listHandoffs, } from "@ocean/loop/handoff/handoff-service.js";
18
- import { oceanContext } from "@ocean/loop/hooks/session-start-hook.js";
19
- import { openSessionStoreReadOnly } from "@ocean/loop/infrastructure/persistence/session-store.js";
20
- import { listTasksForFolder } from "@ocean/loop/tasks/list-tasks.js";
21
- import { hasFailures, workspaceReport } from "../../doctor/workspace-doctor.js";
20
+ import { listProjectManifests, scanProjectManifests, suggestProjects, } from "@ocean/core/shared/project-manifest.js";
21
+ import { findProject, registerNamedProject, } from "@ocean/core/shared/project-register.js";
22
+ import { folderProject, resolveProject, } from "@ocean/core/shared/project-resolution.js";
23
+ import { CORE_TOOLS, clientRelists, GROUP_NAMES, PROFILE_DEFAULT_GROUPS, readToolSelection, selectionPath, TOOL_GROUPS, } from "@ocean/core/shared/tool-groups.js";
24
+ import { createHandoff, getHandoff, getTask, listHandoffs, } from "@ocean/work/sessions/handoff-service.js";
25
+ import { oceanContext } from "@ocean/work/sessions/hooks/session-start-hook.js";
26
+ import { openSessionStoreReadOnly } from "@ocean/work/sessions/session-store.js";
27
+ import { listTasksForFolder } from "@ocean/work/tasks/list-tasks.js";
28
+ import { hasFailures, workspaceReport } from "../../health/workspace-doctor.js";
22
29
  import { recordMcpCall } from "./call-ledger.js";
23
30
  import { installedVersion, serverVersion } from "./server-version.js";
24
31
  import { McpToolRegistry } from "./tool-registry.js";
32
+ // Ocean's tools (T-339 P2, after T-338 P5's core/ops split): eight core tools are listed to every
33
+ // client; every other tool sits in a group (`@ocean/core/shared/tool-groups`) that is listed once
34
+ // opened — by the session's profile (`tools:` and the profile's default groups), by the prompt
35
+ // hook's selection file for this folder, by `ocean_tools`, or by OCEAN_MCP_TOOLS=all. A tool off
36
+ // the list still answers `tools/call`, and `ocean_call` runs one for a client that refuses names
37
+ // it was not shown. Opening a group sends `notifications/tools/list_changed`.
38
+ const OPS_PROFILE = "ocean-ops";
39
+ // undefined until the first tools/list resolves it from the session's folder.
40
+ let openGroups;
41
+ // Writes a server-initiated message (a list_changed notification) to the client, when one is open.
42
+ let notifyClient;
43
+ async function resolveOpenGroups(cwd) {
44
+ if (process.env.OCEAN_MCP_TOOLS === "all")
45
+ return new Set(GROUP_NAMES);
46
+ const open = new Set();
47
+ // Desktop launches at the filesystem root: no project, so the base profile.
48
+ if (cwd === "/" || /^[A-Za-z]:\\?$/.test(cwd))
49
+ return open;
50
+ try {
51
+ const [catalog, selection] = await Promise.all([
52
+ profileCatalog(),
53
+ readToolSelection(cwd),
54
+ ]);
55
+ const project = await resolveProject(cwd).catch(() => undefined);
56
+ const session = await sessionProfile({
57
+ projectId: project?.status === "bound" ? project.projectId : undefined,
58
+ cwd,
59
+ catalog,
60
+ });
61
+ for (const name of [session.primary, ...session.secondary]) {
62
+ const profile = catalog.profiles.find((entry) => entry.name === name);
63
+ for (const group of [
64
+ ...(profile?.tools ?? []),
65
+ ...(PROFILE_DEFAULT_GROUPS[name] ?? []),
66
+ ])
67
+ if (group in TOOL_GROUPS)
68
+ open.add(group);
69
+ }
70
+ for (const group of selection?.groups ?? [])
71
+ if (group in TOOL_GROUPS)
72
+ open.add(group);
73
+ }
74
+ catch {
75
+ // The core set alone.
76
+ }
77
+ return open;
78
+ }
79
+ function listedNames(open) {
80
+ const names = new Set(CORE_TOOLS);
81
+ for (const group of open)
82
+ for (const tool of TOOL_GROUPS[group]?.tools ?? [])
83
+ names.add(tool);
84
+ return names;
85
+ }
86
+ async function listedTools() {
87
+ openGroups ??= await resolveOpenGroups(process.cwd());
88
+ const names = listedNames(openGroups);
89
+ return tools.list().filter((tool) => names.has(tool.name));
90
+ }
91
+ // Opens groups for the rest of this connection; tells the client when the list grew.
92
+ async function openToolGroups(groups) {
93
+ openGroups ??= await resolveOpenGroups(process.cwd());
94
+ const added = groups.filter((group) => group in TOOL_GROUPS && !openGroups?.has(group));
95
+ for (const group of added)
96
+ openGroups.add(group);
97
+ if (added.length)
98
+ notifyClient?.({
99
+ jsonrpc: "2.0",
100
+ method: "notifications/tools/list_changed",
101
+ });
102
+ return added;
103
+ }
104
+ // The hook writes this folder's selection file as a conversation moves on; a server follows it
105
+ // (debounced) and opens what it names. Best-effort: no watcher, no harm — `ocean_tools` remains.
106
+ function watchToolSelection(cwd) {
107
+ if (process.env.OCEAN_MCP_TOOLS === "all")
108
+ return;
109
+ const file = selectionPath(cwd);
110
+ let timer;
111
+ try {
112
+ mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
113
+ const watcher = watch(path.dirname(file), (_event, changed) => {
114
+ if (changed && String(changed) !== path.basename(file))
115
+ return;
116
+ clearTimeout(timer);
117
+ timer = setTimeout(() => {
118
+ readToolSelection(cwd)
119
+ .then((selection) => selection ? openToolGroups(selection.groups) : [])
120
+ .catch(() => { });
121
+ }, 250);
122
+ timer.unref?.();
123
+ });
124
+ watcher.unref?.();
125
+ watcher.on("error", () => watcher.close());
126
+ }
127
+ catch {
128
+ // No watch on this filesystem.
129
+ }
130
+ }
131
+ // `ocean_tools`: the groups and what each holds; with `open`, opens them and returns their tools'
132
+ // definitions, so a client that never refreshes its list still has the schemas for `ocean_call`.
133
+ async function toolsTool(args) {
134
+ const wanted = (Array.isArray(args.open)
135
+ ? args.open
136
+ : typeof args.open === "string"
137
+ ? args.open.split(",")
138
+ : [])
139
+ .map((item) => String(item).trim())
140
+ .filter(Boolean);
141
+ const unknown = wanted.filter((group) => !(group in TOOL_GROUPS));
142
+ if (unknown.length)
143
+ throw new Error(`Unknown tool group: ${unknown.join(", ")}. Groups: ${GROUP_NAMES.join(", ")}`);
144
+ if (!wanted.length) {
145
+ openGroups ??= await resolveOpenGroups(process.cwd());
146
+ return {
147
+ core: [...CORE_TOOLS],
148
+ groups: GROUP_NAMES.map((name) => ({
149
+ name,
150
+ open: openGroups?.has(name) ?? false,
151
+ tools: TOOL_GROUPS[name]?.tools ?? [],
152
+ })),
153
+ };
154
+ }
155
+ const opened = await openToolGroups(wanted);
156
+ const names = new Set(wanted.flatMap((group) => TOOL_GROUPS[group]?.tools ?? []));
157
+ return {
158
+ opened,
159
+ tools: withContextAck(tools.list())
160
+ .filter((tool) => names.has(tool.name))
161
+ .map(({ name, description, inputSchema }) => ({
162
+ name,
163
+ description,
164
+ inputSchema,
165
+ })),
166
+ call: clientRelists(clientName) === false
167
+ ? "This client does not re-list tools: call these through ocean_call {name, arguments}."
168
+ : "Call one directly, or through ocean_call {name, arguments}.",
169
+ };
170
+ }
25
171
  // Every tool takes an optional contextAck: the ack=<hash> from the Ocean start line, echoed on a
26
172
  // client's first Ocean call (T-319 CONTEXT-ACK). The server takes it off before the tool runs.
27
173
  function withContextAck(list) {
@@ -35,13 +181,101 @@ function withContextAck(list) {
35
181
  ...schema?.properties,
36
182
  contextAck: {
37
183
  type: "string",
38
- description: "The ack=<hash> value from the Ocean start line; pass it on your first Ocean call.",
184
+ description: "Start-line ack; first call only.",
39
185
  },
40
186
  },
41
187
  },
42
188
  };
43
189
  });
44
190
  }
191
+ // The seconds the background capture waits first, so the app has written the turn that asked
192
+ // for the save to its local store before it is read.
193
+ const DESKTOP_SAVE_WAIT_SECONDS = 20;
194
+ // A detached `ocean desktop …` run, so a model call or a wait never holds the tool call open.
195
+ function startDesktop(args) {
196
+ try {
197
+ spawn(process.execPath, [process.argv[1] ?? "", "desktop", ...args], {
198
+ detached: true,
199
+ stdio: "ignore",
200
+ })
201
+ .on("error", () => { })
202
+ .unref();
203
+ return true;
204
+ }
205
+ catch {
206
+ return false;
207
+ }
208
+ }
209
+ // The project a tool argument names (T-333). A name no project answers to is refused with the
210
+ // projects it probably means, never guessed.
211
+ async function toolProject(ref) {
212
+ const manifests = await listProjectManifests();
213
+ const id = await findProject(ref);
214
+ if (id)
215
+ return id;
216
+ const near = [
217
+ ...new Set(suggestProjects(manifests, ref).map((each) => each.id)),
218
+ ];
219
+ throw new Error(`no project answers to '${ref}'${near.length ? `; did you mean ${near.join(", ")}?` : ""} (ocean_projects_list lists them)`);
220
+ }
221
+ // `ocean_session_save` (T-329): the capture is a model call, longer than a tool call should
222
+ // take, so it runs as its own detached `ocean desktop capture --latest`, like SessionEnd's. A
223
+ // project passed in binds the chat there first (T-333): explicit wins.
224
+ async function startDesktopSave(args) {
225
+ const project = typeof args.project === "string" && args.project.trim()
226
+ ? await toolProject(args.project.trim())
227
+ : undefined;
228
+ const started = startDesktop([
229
+ "capture",
230
+ "--latest",
231
+ ...(project ? ["--project", project] : []),
232
+ "--wait",
233
+ String(DESKTOP_SAVE_WAIT_SECONDS),
234
+ ]);
235
+ if (!started)
236
+ return {
237
+ status: "failed",
238
+ message: "The capture could not start. The conversation is still captured once it has been quiet for two hours.",
239
+ };
240
+ return {
241
+ status: "started",
242
+ ...(project ? { project } : {}),
243
+ message: "Saving this conversation to Ocean in the background. Its session record appears in sessions/ within a few minutes.",
244
+ };
245
+ }
246
+ // `ocean_project_link` (T-333): this Desktop chat, and the Claude project it sits in, belong to
247
+ // an Ocean project from now on. The project is found (or registered) now; the binding waits in
248
+ // the background until the app has written this chat to its store.
249
+ async function linkDesktopProject(args) {
250
+ const ref = typeof args.project === "string" ? args.project.trim() : "";
251
+ const name = typeof args.name === "string" ? args.name.trim() : "";
252
+ let project;
253
+ let created = false;
254
+ if (ref)
255
+ project = await toolProject(ref);
256
+ else if (name && args.create === true)
257
+ ({ id: project, created } = await registerNamedProject(name, [
258
+ "claude.ai",
259
+ ]));
260
+ else if (name)
261
+ project = await toolProject(name);
262
+ else
263
+ throw new Error("pass project, or name (with create: true for a new one)");
264
+ const started = startDesktop([
265
+ "link",
266
+ project,
267
+ "--wait",
268
+ String(DESKTOP_SAVE_WAIT_SECONDS),
269
+ ]);
270
+ return {
271
+ status: started ? "started" : "failed",
272
+ project,
273
+ created,
274
+ message: started
275
+ ? `This chat and its Claude project are being linked to '${project}' in the background.`
276
+ : `The link could not start; run: ocean desktop link ${project}`,
277
+ };
278
+ }
45
279
  const tools = new McpToolRegistry(withContextAck([
46
280
  {
47
281
  name: "ocean_status",
@@ -65,7 +299,7 @@ const tools = new McpToolRegistry(withContextAck([
65
299
  },
66
300
  {
67
301
  name: "ocean_profiles_list",
68
- description: "List available Ocean profiles.",
302
+ description: "List the Ocean profiles (domain bundles of skills and tools): name, kind, description and the triggers that point at each. Call ocean_profile_get for one when the request is clearly another profile's domain.",
69
303
  annotations: { readOnlyHint: true },
70
304
  inputSchema: {
71
305
  type: "object",
@@ -73,6 +307,16 @@ const tools = new McpToolRegistry(withContextAck([
73
307
  additionalProperties: false,
74
308
  },
75
309
  },
310
+ {
311
+ name: "ocean_profile_get",
312
+ description: "Read one Ocean profile's bundle (2 KB or less): its skills, gateway tools, connectors, Composio toolkits and instructions. Without name, the profile chosen for this session (the start line's profile=). Call it only when the one-line profile brief is not enough.",
313
+ annotations: { readOnlyHint: true },
314
+ inputSchema: {
315
+ type: "object",
316
+ properties: { name: { type: "string" }, cwd: { type: "string" } },
317
+ additionalProperties: false,
318
+ },
319
+ },
76
320
  {
77
321
  name: "ocean_tasks_list",
78
322
  description: "List Ocean tasks for the folder being worked in: that project's tasks, or every project's (labelled) when it has none or the folder is no project. Optionally filtered by state.",
@@ -183,9 +427,19 @@ const tools = new McpToolRegistry(withContextAck([
183
427
  additionalProperties: false,
184
428
  },
185
429
  },
430
+ {
431
+ name: "ocean_session_save",
432
+ description: "Claude Desktop chat only: save this conversation to Ocean now, instead of waiting for it to close. Call it when the user says save, remember this conversation, or is about to leave. It starts a background capture of the most recently updated Desktop conversation (its session record, facts and raw transcript) and returns at once; the record lands in sessions/ within a few minutes. Pass project (an Ocean project id or name) when the conversation is about one project: it files the record there. Claude Code and CLI sessions are captured at session end and need no call.",
433
+ annotations: { readOnlyHint: false, destructiveHint: false },
434
+ inputSchema: {
435
+ type: "object",
436
+ properties: { project: { type: "string" } },
437
+ additionalProperties: false,
438
+ },
439
+ },
186
440
  {
187
441
  name: "brain_search",
188
- description: "Call this first, before answering anything about the user or their world: a project, repo or code of theirs, a task ID, a person they name, a past decision or preference, or words like my, our, last time, as before. Also before planning, writing or reviewing anything for them. Ocean is their memory and the authority: asked where memory lives or what you remember, answer from Ocean, since this client's own memory is only a copy Ocean captures. Searches the markdown memory/knowledge index (hybrid FTS + vector when available); read only the results you need with brain_read and cite their paths. In a conversation about one project, pass its name or id as project: the search then covers that project and global records only. Otherwise the project bound to `cwd`; unbound sessions see global only.",
442
+ description: "Call this first, before answering anything about the user or their world: a project, repo or code of theirs, a task ID, a person they name, a past decision or preference, or words like my, our, last time, as before; and before planning, writing or reviewing for them. Asked where memory lives or what you remember, answer from Ocean, since this client's own memory is only a copy Ocean captures. Read only the results you need with brain_read and cite their paths. Pass project (name or id) for one project; otherwise the project bound to `cwd`.",
189
443
  annotations: { readOnlyHint: true },
190
444
  inputSchema: {
191
445
  type: "object",
@@ -201,6 +455,14 @@ const tools = new McpToolRegistry(withContextAck([
201
455
  type: "string",
202
456
  description: "YYYY-MM-DD: only facts valid on that day (valid_from / superseded_by)",
203
457
  },
458
+ task: {
459
+ type: "string",
460
+ description: 'A task id: only session records whose metadata names it (with types ["session"])',
461
+ },
462
+ branch: {
463
+ type: "string",
464
+ description: "A git branch: only session records made on it",
465
+ },
204
466
  project: { type: "string" },
205
467
  cwd: { type: "string" },
206
468
  },
@@ -300,7 +562,7 @@ const tools = new McpToolRegistry(withContextAck([
300
562
  },
301
563
  {
302
564
  name: "memory_propose",
303
- description: "Call this when the user states something worth keeping across sessions (a decision, preference, correction of how you work, or project fact) without asking you to remember it, for a fact you inferred, or for one imported from another tool's memory: it queues it for the user's review. It is not memory until approved. In a conversation about one project, pass its name (as the user's Claude project is called) or Ocean id as project, and kind instead of target: `fact` (a decision, preference or detail) or `doc` (a spec, brief or longer notes), each with a kebab-case name, is filed in that project's memory/ or docs/ — written at once when the user allows it; `todo` (work to do) waits for review as a backlog line. Optionally say why (reason). If the fact disagrees with one of the user's own notes in 02-personal/notes, pass that note's path as contradicts: the note is never edited, and the disagreement waits in 02-personal/CONFLICTS.md for the user.",
565
+ description: "Call this when the user states something worth keeping across sessions (a decision, preference, correction of how you work, or project fact) without asking you to remember it, or for a fact you inferred or imported: it queues it for review; not memory until approved. For one project pass project (name or Ocean id) and kind instead of target: `fact` or `doc` (with a kebab-case name) is filed in its memory/ or docs/, `todo` waits as a backlog line. Optional reason. If it disagrees with a note in 02-personal/notes, pass that path as contradicts.",
304
566
  annotations: { readOnlyHint: false, destructiveHint: false },
305
567
  inputSchema: {
306
568
  type: "object",
@@ -348,11 +610,52 @@ const tools = new McpToolRegistry(withContextAck([
348
610
  },
349
611
  {
350
612
  name: "ocean_context",
351
- description: "Call this once at the start of a conversation when no Ocean start line is already in your context (clients without a session-start hook). Returns the bounded Ocean start line (256 bytes or less: the project bound to cwd and the operations available). Holds no records; search for those.",
613
+ description: 'Call this once at the start of a conversation with no Ocean start line in context (no session-start hook): returns the start line, start brief, base working style and policy index. Pass project instead of cwd for one project. Pass policy ("core" for the hard rules, or an index name) for its full text.',
352
614
  annotations: { readOnlyHint: true },
353
615
  inputSchema: {
354
616
  type: "object",
355
- properties: { cwd: { type: "string" } },
617
+ properties: {
618
+ cwd: { type: "string" },
619
+ project: { type: "string" },
620
+ policy: { type: "string" },
621
+ },
622
+ additionalProperties: false,
623
+ },
624
+ },
625
+ {
626
+ name: "ocean_policy",
627
+ description: 'Read the user\'s own rules: name "core" (language, direction, working style) or a policy such as "response" (report shape). Same as ocean_context with policy.',
628
+ annotations: { readOnlyHint: true },
629
+ inputSchema: {
630
+ type: "object",
631
+ properties: { name: { type: "string" } },
632
+ required: ["name"],
633
+ additionalProperties: false,
634
+ },
635
+ },
636
+ {
637
+ name: "ocean_tools",
638
+ description: "Ocean lists eight core tools; the rest sit in groups (tasks, sessions, handoffs, projects, profiles, ops, people, memory-admin, brain-extra, skills). No arguments: the groups and what is open. open: group names to list them here and get their tools' schemas.",
639
+ annotations: { readOnlyHint: true },
640
+ inputSchema: {
641
+ type: "object",
642
+ properties: {
643
+ open: { type: "array", items: { type: "string" } },
644
+ },
645
+ additionalProperties: false,
646
+ },
647
+ },
648
+ {
649
+ name: "ocean_call",
650
+ description: "Run any Ocean tool by name, listed or not (for a client that will not call a name it was not shown): name and its arguments.",
651
+ annotations: { readOnlyHint: false },
652
+ inputSchema: {
653
+ type: "object",
654
+ properties: {
655
+ name: { type: "string" },
656
+ arguments: { type: "object" },
657
+ },
658
+ required: ["name"],
356
659
  additionalProperties: false,
357
660
  },
358
661
  },
@@ -366,6 +669,20 @@ const tools = new McpToolRegistry(withContextAck([
366
669
  additionalProperties: false,
367
670
  },
368
671
  },
672
+ {
673
+ name: "ocean_project_link",
674
+ description: "Claude Desktop chat only: link this conversation, and the Claude project it sits in, to an Ocean project, when the user says which project it belongs to. Pass project (an existing Ocean project id or name), or name with create: true to register a new project of that name. Its records, and the Claude project's later chats, are filed there from now on.",
675
+ annotations: { readOnlyHint: false, destructiveHint: false },
676
+ inputSchema: {
677
+ type: "object",
678
+ properties: {
679
+ project: { type: "string" },
680
+ name: { type: "string" },
681
+ create: { type: "boolean" },
682
+ },
683
+ additionalProperties: false,
684
+ },
685
+ },
369
686
  {
370
687
  name: "ocean_handoff_create",
371
688
  description: "Create a cross-client session handoff, only when the user explicitly asks for one: a short summary and the next action (4 KB at most in total; secrets are redacted). It always creates a new handoff and never changes an existing one; another client reads it with ocean_handoffs_list and ocean_handoff_get.",
@@ -409,8 +726,8 @@ const tools = new McpToolRegistry(withContextAck([
409
726
  // for the user: no API, deep link or MCP call. Chat can propose the skill itself, though: Claude
410
727
  // Desktop chat shows a skill card the user saves with one click (T-328, 2026-11-24), so the
411
728
  // click stays inside the chat; a .skill file is the fallback.
412
- export const CHAT_SKILL_DIR = "ocean-memory";
413
- export async function chatSkillInstall() {
729
+ const CHAT_SKILL_DIR = "ocean-memory";
730
+ async function chatSkillInstall() {
414
731
  const file = `${CHAT_SKILL_DIR}/SKILL.md`;
415
732
  return {
416
733
  skill: CHAT_SKILL_DIR,
@@ -475,17 +792,37 @@ function textResult(value) {
475
792
  };
476
793
  }
477
794
  async function profiles() {
478
- try {
479
- return (await readdir(oceanPath(SYSTEM_DIR, "profiles"), { withFileTypes: true }))
480
- .filter((entry) => entry.isFile() && entry.name.endsWith(".json"))
481
- .map((entry) => entry.name.slice(0, -5))
482
- .sort();
795
+ const catalog = await profileCatalog();
796
+ return {
797
+ profiles: catalog.profiles.map((profile) => ({
798
+ name: profile.name,
799
+ kind: profile.kind,
800
+ description: profile.description,
801
+ triggers: profile.triggers,
802
+ })),
803
+ ...(catalog.problems.length ? { problems: catalog.problems } : {}),
804
+ };
805
+ }
806
+ // A named profile, or the one this session's project and folder resolve to (T-338 P2).
807
+ async function profileGet(name, cwd) {
808
+ const catalog = await profileCatalog();
809
+ let wanted = name;
810
+ if (!wanted) {
811
+ const project = await resolveProject(cwd).catch(() => null);
812
+ wanted = (await sessionProfile({
813
+ projectId: project?.status === "bound" ? project.projectId : undefined,
814
+ cwd,
815
+ catalog,
816
+ })).primary;
483
817
  }
484
- catch (error) {
485
- if (error.code === "ENOENT")
486
- return [];
487
- throw error;
818
+ const profile = catalog.profiles.find((candidate) => candidate.name === wanted);
819
+ if (!profile) {
820
+ const problem = catalog.problems.find((candidate) => candidate.name === wanted);
821
+ throw new Error(problem
822
+ ? `profile ${wanted} does not load: ${problem.error}`
823
+ : `no profile named ${wanted}; ocean_profiles_list names them`);
488
824
  }
825
+ return profileBundle(profile);
489
826
  }
490
827
  const MUTATING_TOOLS = new Set([
491
828
  "memory_write",
@@ -526,7 +863,16 @@ async function callTool(name, args, ports) {
526
863
  };
527
864
  }
528
865
  if (name === "ocean_profiles_list")
529
- return { profiles: await profiles() };
866
+ return await profiles();
867
+ if (name === "ocean_profile_get") {
868
+ const wanted = typeof args.name === "string" && args.name.trim()
869
+ ? args.name.trim()
870
+ : undefined;
871
+ // Naming ocean-ops opens its groups for the rest of this connection.
872
+ if (wanted === OPS_PROFILE)
873
+ await openToolGroups(PROFILE_DEFAULT_GROUPS[OPS_PROFILE] ?? []);
874
+ return profileGet(wanted, typeof args.cwd === "string" && args.cwd ? args.cwd : process.cwd());
875
+ }
530
876
  if (name === "ocean_tasks_list") {
531
877
  const text = (key) => typeof args[key] === "string" && args[key] ? args[key] : undefined;
532
878
  return await listTasksForFolder({
@@ -601,15 +947,19 @@ async function callTool(name, args, ports) {
601
947
  store.close();
602
948
  }
603
949
  }
950
+ if (name === "ocean_session_save")
951
+ return startDesktopSave(args);
952
+ if (name === "ocean_project_link")
953
+ return linkDesktopProject(args);
604
954
  if (name === "ocean_session_promote") {
605
955
  const approval = mcpApprovalSchema.parse(args.approval);
606
956
  const actionArgs = {
607
957
  sessionId: args.sessionId,
608
- target: typeof args.target === "string" ? args.target : "knowledge/results",
958
+ target: typeof args.target === "string" ? args.target : "knowledge/lessons",
609
959
  };
610
960
  if (approval.fingerprint !== actionFingerprint(name, actionArgs))
611
961
  throw new Error("Session promotion approval does not match the requested action");
612
- return promoteSessionToKnowledge(requiredArgument(args, "sessionId"), ports.sessionStoreFactory, typeof args.target === "string" ? args.target : "knowledge/results", true);
962
+ return promoteSessionToKnowledge(requiredArgument(args, "sessionId"), ports.sessionStoreFactory, typeof args.target === "string" ? args.target : "knowledge/lessons", true);
613
963
  }
614
964
  if (name === "brain_search")
615
965
  return brainSearch({
@@ -623,6 +973,12 @@ async function callTool(name, args, ports) {
623
973
  : undefined,
624
974
  since: isoDay(args.since, "since"),
625
975
  asOf: isoDay(args.asOf, "asOf"),
976
+ ...(typeof args.task === "string" && args.task.trim()
977
+ ? { task: args.task }
978
+ : {}),
979
+ ...(typeof args.branch === "string" && args.branch.trim()
980
+ ? { branch: args.branch }
981
+ : {}),
626
982
  indexPort: ports.brainIndex,
627
983
  embedder: ports.embedder ? await ports.embedder() : null,
628
984
  });
@@ -666,7 +1022,29 @@ async function callTool(name, args, ports) {
666
1022
  writes: (await memorySettings()).mcpWrites,
667
1023
  };
668
1024
  if (name === "ocean_context")
669
- return oceanContext(typeof args.cwd === "string" && args.cwd ? args.cwd : process.cwd());
1025
+ return oceanContext(typeof args.cwd === "string" && args.cwd ? args.cwd : process.cwd(), typeof args.project === "string" && args.project.trim()
1026
+ ? args.project.trim()
1027
+ : undefined, typeof args.policy === "string" && args.policy.trim()
1028
+ ? args.policy.trim()
1029
+ : undefined);
1030
+ if (name === "ocean_policy")
1031
+ return readRules(requiredArgument(args, "name"));
1032
+ if (name === "ocean_tools")
1033
+ return toolsTool(args);
1034
+ if (name === "ocean_call") {
1035
+ const inner = requiredArgument(args, "name");
1036
+ if (inner === "ocean_call")
1037
+ throw new Error("ocean_call cannot call itself");
1038
+ if (!tools.has(inner))
1039
+ throw new Error(`Unknown tool: ${inner}`);
1040
+ const innerArgs = args.arguments &&
1041
+ typeof args.arguments === "object" &&
1042
+ !Array.isArray(args.arguments)
1043
+ ? args.arguments
1044
+ : {};
1045
+ const { contextAck: _ack, ...rest } = innerArgs;
1046
+ return callTool(inner, rest, ports);
1047
+ }
670
1048
  if (name === "ocean_projects_list")
671
1049
  return {
672
1050
  projects: (await scanProjectManifests()).manifests
@@ -866,12 +1244,17 @@ export async function handleOceanMcpRequest(request, ports) {
866
1244
  clientName = info.name;
867
1245
  contextAckChecked = false;
868
1246
  authoritySent = false;
1247
+ openGroups = undefined;
869
1248
  return {
870
1249
  jsonrpc: "2.0",
871
1250
  id: request.id,
872
1251
  result: {
873
1252
  protocolVersion: "2025-06-18",
874
- capabilities: { tools: {}, resources: {}, prompts: {} },
1253
+ capabilities: {
1254
+ tools: { listChanged: true },
1255
+ resources: {},
1256
+ prompts: {},
1257
+ },
875
1258
  // `name` is the machine id; `title` (MCP 2025-06-18) is the one display name every
876
1259
  // client shows, under the one config key `ocean` → tool prefix `mcp__ocean__` (T-328).
877
1260
  serverInfo: {
@@ -884,7 +1267,11 @@ export async function handleOceanMcpRequest(request, ports) {
884
1267
  };
885
1268
  }
886
1269
  if (request.method === "tools/list")
887
- return { jsonrpc: "2.0", id: request.id, result: { tools: tools.list() } };
1270
+ return {
1271
+ jsonrpc: "2.0",
1272
+ id: request.id,
1273
+ result: { tools: await listedTools() },
1274
+ };
888
1275
  if (request.method === "resources/list")
889
1276
  return { jsonrpc: "2.0", id: request.id, result: { resources } };
890
1277
  if (request.method === "resources/read") {
@@ -982,6 +1369,8 @@ export async function runOceanMcpServer(ports) {
982
1369
  let buffer = "";
983
1370
  // Requests still being answered when stdin ends: the connection's session closes after them.
984
1371
  const inFlight = new Set();
1372
+ notifyClient = (message) => process.stdout.write(`${JSON.stringify(message)}\n`);
1373
+ watchToolSelection(process.cwd());
985
1374
  process.stdin.setEncoding("utf8");
986
1375
  process.stdin.on("data", (chunk) => {
987
1376
  const work = handleChunk(chunk);
@@ -33,7 +33,7 @@ export async function appendConflict(input, directory = conflictsDirectory()) {
33
33
  });
34
34
  return file;
35
35
  }
36
- export function readConflictRecord(raw) {
36
+ function readConflictRecord(raw) {
37
37
  const record = raw;
38
38
  return { ...record, oceanSha256: record.oceanSha256 ?? null };
39
39
  }
@@ -1,10 +1,10 @@
1
1
  import { mkdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { RECORD_TYPES, recordFolder, } from "@ocean/brain/memory/fact-routing.js";
4
- import { redactSecrets } from "@ocean/core/domain/redaction/redaction.js";
4
+ import { redactSecrets } from "@ocean/core/domain/redaction.js";
5
5
  import { atomicWrite } from "@ocean/core/shared/fs-utils.js";
6
6
  import { INBOX_DIR, oceanPath, TEMPLATES_DIR, } from "@ocean/core/shared/paths.js";
7
- import { projectSlug } from "@ocean/core/shared/project-resolution.js";
7
+ import { projectSlug } from "@ocean/core/shared/project-manifest.js";
8
8
  const TEMPLATER_CONFIG = [
9
9
  ".obsidian",
10
10
  "plugins",
@@ -14,15 +14,18 @@ const TEMPLATER_CONFIG = [
14
14
  async function exists(file) {
15
15
  return readFile(file).then(() => true, () => false);
16
16
  }
17
- // One entry per routed type whose template exists in 06-templates; entries the owner made for
18
- // other folders are kept, and a routed folder's entry is replaced.
19
- export async function planFolderTemplates(current) {
17
+ // One entry per routed folder whose template exists in 06-templates; entries the owner made for
18
+ // other folders are kept, and a routed folder's entry is replaced. Several types share a folder
19
+ // (T-329: lessons/ holds solutions, failures, discoveries…): the first type routed there wins.
20
+ async function planFolderTemplates(current) {
20
21
  const routed = [];
21
22
  const missing = [];
22
23
  for (const type of RECORD_TYPES) {
23
24
  const folder = recordFolder(type)?.replace(/\/$/, "");
24
25
  if (!folder)
25
26
  continue;
27
+ if (routed.some((entry) => entry.folder === folder))
28
+ continue;
26
29
  const template = `${TEMPLATES_DIR}/${type}.md`;
27
30
  if (await exists(oceanPath(template)))
28
31
  routed.push({ folder, template });