@amoree-code/ocean 2.22.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 (382) hide show
  1. package/README.md +46 -53
  2. package/dist/application/clients/bundles.js +220 -0
  3. package/dist/application/clients/chat-plugin.js +4 -42
  4. package/dist/application/clients/client-detect.js +291 -0
  5. package/dist/application/clients/clients.js +104 -25
  6. package/dist/application/clients/desktop-link.js +40 -0
  7. package/dist/application/clients/desktop-watcher.js +6 -4
  8. package/dist/application/clients/hook-trust.js +106 -0
  9. package/dist/application/clients/hooks.js +7 -1
  10. package/dist/application/clients/mcp-schema-cost.js +74 -0
  11. package/dist/application/clients/native.js +38 -2
  12. package/dist/application/clients/registry.js +51 -9
  13. package/dist/application/clients/status.js +7 -2
  14. package/dist/application/clients/zip.js +44 -0
  15. package/dist/application/gateway/webhook-gateway.js +1 -1
  16. package/dist/application/integrations/charter-copies.js +1 -1
  17. package/dist/application/integrations/engine-entry-repair.js +4 -3
  18. package/dist/application/integrations/skill-auto-sync.js +2 -2
  19. package/dist/application/integrations/skill-filter.js +1 -1
  20. package/dist/application/integrations/skill-router.js +134 -90
  21. package/dist/application/layout/layout-apply.js +1 -1
  22. package/dist/application/layout/workspace-template.js +1 -1
  23. package/dist/application/onboarding/steps.js +121 -30
  24. package/dist/application/profiles/profile-doctor.js +118 -0
  25. package/dist/application/profiles/profile-migration-service.js +208 -0
  26. package/dist/application/profiles/profile-suggestion.js +3 -7
  27. package/dist/application/profiles/profile-upgrade-service.js +98 -86
  28. package/dist/application/pull/history-index.js +1 -1
  29. package/dist/application/pull/project-match.js +3 -3
  30. package/dist/application/pull/pull.js +1 -1
  31. package/dist/application/pull/server-capture.js +92 -9
  32. package/dist/application/scheduler/local-scheduler.js +2 -2
  33. package/dist/application/spend/claude-prices.js +55 -0
  34. package/dist/application/spend/claude-spend.js +365 -0
  35. package/dist/application/uninstall/uninstall.js +25 -3
  36. package/dist/application/upkeep/nightly-upkeep.js +4 -4
  37. package/dist/composition/runtime.js +2 -2
  38. package/dist/infrastructure/desktop/claude-export.js +1 -1
  39. package/dist/infrastructure/desktop/desktop-chat.js +60 -13
  40. package/dist/infrastructure/desktop/indexeddb.js +4 -4
  41. package/dist/infrastructure/desktop/leveldb.js +2 -2
  42. package/dist/infrastructure/filesystem/profile-loader.js +3 -45
  43. package/dist/infrastructure/filesystem/runtime-config-loader.js +1 -1
  44. package/dist/infrastructure/observability/runtime-logger.js +1 -1
  45. package/dist/infrastructure/process/agent-tool-executor.js +3 -3
  46. package/dist/infrastructure/process/process-supervisor.js +1 -1
  47. package/dist/infrastructure/process/service.js +8 -8
  48. package/dist/infrastructure/providers/openai-compatible.js +2 -2
  49. package/dist/infrastructure/providers/provider-invocation.js +1 -1
  50. package/dist/infrastructure/providers/session-facts-completer.js +78 -5
  51. package/dist/interfaces/cli/auth-command.js +2 -2
  52. package/dist/interfaces/cli/brief-command.js +1 -1
  53. package/dist/interfaces/cli/browser-command.js +6 -6
  54. package/dist/interfaces/cli/browser-findings.js +6 -9
  55. package/dist/interfaces/cli/browser-settings.js +10 -10
  56. package/dist/interfaces/cli/capture-command.js +6 -6
  57. package/dist/interfaces/cli/client-test-command.js +3 -3
  58. package/dist/interfaces/cli/clients-command.js +55 -6
  59. package/dist/interfaces/cli/command-aliases.js +56 -0
  60. package/dist/interfaces/cli/command-registry.js +48 -1414
  61. package/dist/interfaces/cli/commands/browser.js +5 -0
  62. package/dist/interfaces/cli/commands/capture.js +19 -0
  63. package/dist/interfaces/cli/commands/catalog.js +9 -0
  64. package/dist/interfaces/cli/commands/client.js +135 -0
  65. package/dist/interfaces/cli/commands/clients.js +33 -0
  66. package/dist/interfaces/cli/commands/connectors.js +14 -0
  67. package/dist/interfaces/cli/commands/context.js +9 -0
  68. package/dist/interfaces/cli/commands/cost.js +15 -0
  69. package/dist/interfaces/cli/commands/daily.js +11 -0
  70. package/dist/interfaces/cli/commands/day.js +25 -0
  71. package/dist/interfaces/cli/commands/dispatch.js +31 -0
  72. package/dist/interfaces/cli/commands/doctor.js +60 -0
  73. package/dist/interfaces/cli/commands/env.js +5 -0
  74. package/dist/interfaces/cli/commands/gateway.js +16 -0
  75. package/dist/interfaces/cli/commands/handoff.js +11 -0
  76. package/dist/interfaces/cli/commands/health.js +17 -0
  77. package/dist/interfaces/cli/commands/hook.js +142 -0
  78. package/dist/interfaces/cli/commands/idea.js +11 -0
  79. package/dist/interfaces/cli/commands/install.js +31 -0
  80. package/dist/interfaces/cli/commands/intent.js +14 -0
  81. package/dist/interfaces/cli/commands/intercept.js +22 -0
  82. package/dist/interfaces/cli/commands/layout.js +11 -0
  83. package/dist/interfaces/cli/commands/lifecycle.js +5 -0
  84. package/dist/interfaces/cli/commands/loop.js +73 -0
  85. package/dist/interfaces/cli/commands/market.js +11 -0
  86. package/dist/interfaces/cli/commands/mcp.js +57 -0
  87. package/dist/interfaces/cli/commands/memory.js +5 -0
  88. package/dist/interfaces/cli/commands/migrate.js +5 -0
  89. package/dist/interfaces/cli/commands/observe.js +11 -0
  90. package/dist/interfaces/cli/commands/obsidian.js +111 -0
  91. package/dist/interfaces/cli/commands/operate.js +7 -0
  92. package/dist/interfaces/cli/commands/policy.js +16 -0
  93. package/dist/interfaces/cli/commands/project.js +207 -0
  94. package/dist/interfaces/cli/commands/repair.js +20 -0
  95. package/dist/interfaces/cli/commands/run.js +52 -0
  96. package/dist/interfaces/cli/commands/schedule.js +58 -0
  97. package/dist/interfaces/cli/commands/service.js +21 -0
  98. package/dist/interfaces/cli/commands/session.js +182 -0
  99. package/dist/interfaces/cli/commands/sessions.js +12 -0
  100. package/dist/interfaces/cli/commands/setup.js +21 -0
  101. package/dist/interfaces/cli/commands/skill.js +159 -0
  102. package/dist/interfaces/cli/commands/tasks.js +10 -0
  103. package/dist/interfaces/cli/commands/update-remove.js +25 -0
  104. package/dist/interfaces/cli/connectors-command.js +150 -0
  105. package/dist/interfaces/cli/context-command.js +39 -3
  106. package/dist/interfaces/cli/cost-command.js +104 -0
  107. package/dist/interfaces/cli/curator-command.js +1 -1
  108. package/dist/interfaces/cli/daily-command.js +7 -1
  109. package/dist/interfaces/cli/desktop-command.js +43 -7
  110. package/dist/interfaces/cli/distill-command.js +7 -2
  111. package/dist/interfaces/cli/express-command.js +1 -1
  112. package/dist/interfaces/cli/failures-command.js +4 -4
  113. package/dist/interfaces/cli/gateway-findings.js +2 -2
  114. package/dist/interfaces/cli/governance-command.js +23 -16
  115. package/dist/interfaces/cli/handoff-command.js +1 -1
  116. package/dist/interfaces/cli/harvest-command.js +2 -2
  117. package/dist/interfaces/cli/help-command.js +53 -169
  118. package/dist/interfaces/cli/hygiene-command.js +1 -1
  119. package/dist/interfaces/cli/idea-command.js +1 -1
  120. package/dist/interfaces/cli/intercept-command.js +8 -7
  121. package/dist/interfaces/cli/interests-command.js +1 -1
  122. package/dist/interfaces/cli/layout-command.js +2 -0
  123. package/dist/interfaces/cli/market-command.js +9 -9
  124. package/dist/interfaces/cli/mcp-gateway-command.js +124 -7
  125. package/dist/interfaces/cli/mcp-probe-command.js +186 -0
  126. package/dist/interfaces/cli/mcp-status-command.js +5 -5
  127. package/dist/interfaces/cli/memory-command.js +41 -7
  128. package/dist/interfaces/cli/migrate-command.js +2 -2
  129. package/dist/interfaces/cli/note-command.js +1 -1
  130. package/dist/interfaces/cli/onboard-command.js +14 -0
  131. package/dist/interfaces/cli/operate-command.js +5 -5
  132. package/dist/interfaces/cli/profiles-command.js +61 -1
  133. package/dist/interfaces/cli/rhythm-command.js +11 -5
  134. package/dist/interfaces/cli/running-server-findings.js +1 -1
  135. package/dist/interfaces/cli/scorecard-command.js +8 -8
  136. package/dist/interfaces/cli/session-facts-command.js +2 -2
  137. package/dist/interfaces/cli/sessions-command.js +145 -0
  138. package/dist/interfaces/cli/setup-command.js +15 -2
  139. package/dist/interfaces/cli/tasks-command.js +63 -13
  140. package/dist/interfaces/cli/telemetry-command.js +4 -4
  141. package/dist/interfaces/cli/uninstall-command.js +1 -1
  142. package/dist/interfaces/cli/week-failures.js +32 -0
  143. package/dist/main.js +12 -0
  144. package/node_modules/@ocean/brain/dist/{infrastructure/brain/brain-index.js → brain-index.js} +2 -2
  145. package/node_modules/@ocean/brain/dist/{brain/brain-markdown.js → brain-markdown.js} +1 -1
  146. package/node_modules/@ocean/brain/dist/{brain/brain-service.js → brain-service.js} +12 -2
  147. package/node_modules/@ocean/brain/dist/memory/brain-dump.js +92 -16
  148. package/node_modules/@ocean/brain/dist/memory/extraction-log.js +125 -0
  149. package/node_modules/@ocean/brain/dist/memory/extraction-retry.js +54 -0
  150. package/node_modules/@ocean/brain/dist/memory/fact-routing.js +44 -1
  151. package/node_modules/@ocean/brain/dist/memory/lesson-activation.js +2 -2
  152. package/node_modules/@ocean/brain/dist/memory/lesson-learning.js +2 -2
  153. package/node_modules/@ocean/brain/dist/memory/lessons.js +1 -1
  154. package/node_modules/@ocean/brain/dist/memory/memory-audit.js +2 -2
  155. package/node_modules/@ocean/brain/dist/memory/memory-harvest.js +1 -1
  156. package/node_modules/@ocean/brain/dist/memory/memory-paths.js +8 -0
  157. package/node_modules/@ocean/brain/dist/memory/memory-review.js +31 -3
  158. package/node_modules/@ocean/brain/dist/memory/memory-trash.js +29 -0
  159. package/node_modules/@ocean/brain/dist/memory/memory-write.js +4 -2
  160. package/node_modules/@ocean/brain/dist/memory/model-narrative.js +2 -2
  161. package/node_modules/@ocean/brain/dist/memory/profile-facts.js +1 -1
  162. package/node_modules/@ocean/brain/dist/memory/routing.json +6 -6
  163. package/node_modules/@ocean/{market/dist/skills → brain/dist/memory}/signal-detection.js +1 -1
  164. package/node_modules/@ocean/brain/dist/{memory → people}/people.js +1 -1
  165. package/node_modules/@ocean/brain/dist/sessions-capture/session-facts.js +625 -0
  166. package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-promotion.js +7 -15
  167. package/node_modules/@ocean/brain/dist/{memory → sessions-capture}/session-summary.js +1 -1
  168. package/node_modules/@ocean/brain/dist/sessions-capture/session-triage.js +52 -0
  169. package/node_modules/@ocean/brain/package.json +1 -1
  170. package/node_modules/@ocean/connect/dist/connectors/connector-hub.js +173 -0
  171. package/node_modules/@ocean/{market → connect}/dist/install/default-marketplace.js +6 -2
  172. package/node_modules/@ocean/{market → connect}/dist/install/marketplace-service.js +1 -1
  173. package/node_modules/@ocean/connect/dist/mcp/mcp-gateway.js +987 -0
  174. package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-launch.js +102 -5
  175. package/node_modules/@ocean/{market → connect}/dist/registry/official-registry.js +1 -1
  176. package/node_modules/@ocean/{market → connect}/dist/security/permissions.js +1 -1
  177. package/node_modules/@ocean/{market → connect}/dist/skills/skill-hub.js +104 -6
  178. package/node_modules/@ocean/{market → connect}/package.json +2 -2
  179. package/node_modules/@ocean/context/dist/{context/context-ladder.js → context-ladder.js} +3 -3
  180. package/node_modules/@ocean/context/dist/{context/context-references.js → context-references.js} +5 -4
  181. package/node_modules/@ocean/context/dist/{context/context-cost.js → context-size.js} +6 -6
  182. package/node_modules/@ocean/context/dist/{context/intent-router.js → intent-router.js} +1 -1
  183. package/node_modules/@ocean/context/dist/{context/resource-injection.js → resource-injection.js} +3 -1
  184. package/node_modules/@ocean/context/package.json +1 -1
  185. package/node_modules/@ocean/core/dist/domain/brain/brain-record.js +1 -1
  186. package/node_modules/@ocean/core/dist/domain/capabilities/capability-manifest.js +5 -5
  187. package/node_modules/@ocean/core/dist/domain/connector-entry.js +86 -0
  188. package/node_modules/@ocean/core/dist/domain/context/context.js +1 -1
  189. package/node_modules/@ocean/core/dist/domain/context/project-id.js +8 -2
  190. package/node_modules/@ocean/core/dist/domain/{evidence/evidence.js → evidence.js} +1 -1
  191. package/node_modules/@ocean/core/dist/domain/mcp/memory-contract.js +4 -1
  192. package/node_modules/@ocean/core/dist/domain/ports/brain-index-port.js +1 -1
  193. package/node_modules/@ocean/core/dist/domain/profiles/profile-markdown.js +40 -0
  194. package/node_modules/@ocean/core/dist/domain/profiles/profile-resolution.js +276 -0
  195. package/node_modules/@ocean/core/dist/domain/profiles/profile-selection.js +23 -60
  196. package/node_modules/@ocean/core/dist/domain/profiles/profile-upgrade.js +2 -2
  197. package/node_modules/@ocean/core/dist/domain/profiles/profile.js +66 -6
  198. package/node_modules/@ocean/core/dist/domain/profiles/runtime-config.js +1 -1
  199. package/node_modules/@ocean/core/dist/domain/runs/agent-tools.js +2 -2
  200. package/node_modules/@ocean/core/dist/domain/sessions/session-identity.js +53 -0
  201. package/node_modules/@ocean/core/dist/domain/sessions/session-metadata.js +208 -0
  202. package/node_modules/@ocean/core/dist/domain/{tasks/task-id.js → task-id.js} +2 -2
  203. package/node_modules/@ocean/core/dist/profiles/profile-files.js +57 -0
  204. package/node_modules/@ocean/core/dist/profiles/profile-loader.js +97 -0
  205. package/node_modules/@ocean/core/dist/profiles/project-profile-fill.js +33 -0
  206. package/node_modules/@ocean/core/dist/profiles/session-profile.js +158 -0
  207. package/node_modules/@ocean/core/dist/shared/charter.js +110 -0
  208. package/node_modules/@ocean/core/dist/shared/context-ack.js +1 -1
  209. package/node_modules/@ocean/core/dist/shared/context-triggers.js +67 -0
  210. package/node_modules/@ocean/core/dist/shared/paths.js +6 -6
  211. package/node_modules/@ocean/core/dist/shared/project-legacy.js +232 -0
  212. package/node_modules/@ocean/core/dist/shared/project-manifest.js +308 -0
  213. package/node_modules/@ocean/core/dist/shared/project-names.js +87 -0
  214. package/node_modules/@ocean/core/dist/shared/project-register.js +560 -0
  215. package/node_modules/@ocean/core/dist/shared/project-resolution.js +83 -861
  216. package/node_modules/@ocean/core/dist/shared/repo-signals.js +45 -0
  217. package/node_modules/@ocean/core/dist/shared/task-reference.js +1 -1
  218. package/node_modules/@ocean/core/dist/shared/text-tokens.js +37 -0
  219. package/node_modules/@ocean/core/dist/shared/tool-groups.js +224 -0
  220. package/node_modules/@ocean/core/package.json +4 -1
  221. package/node_modules/@ocean/services/dist/day/day.js +45 -3
  222. package/node_modules/@ocean/services/dist/{distill → day}/distill.js +29 -3
  223. package/node_modules/@ocean/services/dist/{harvest → day}/harvest.js +54 -14
  224. package/node_modules/@ocean/services/dist/{brief → day}/interest-discovery.js +3 -3
  225. package/node_modules/@ocean/services/dist/day/note.js +2 -2
  226. package/node_modules/@ocean/services/dist/{onboarding → day}/onboarding.js +1 -1
  227. package/node_modules/@ocean/services/dist/day/patterns.js +68 -0
  228. package/node_modules/@ocean/services/dist/{curator → health}/curator.js +5 -5
  229. package/node_modules/@ocean/services/dist/{journey → health}/failures.js +7 -5
  230. package/node_modules/@ocean/services/dist/{hygiene → health}/hygiene.js +2 -2
  231. package/node_modules/@ocean/services/dist/{journey → health}/lesson-effect.js +1 -1
  232. package/node_modules/@ocean/services/dist/{scorecard → health}/scorecard.js +3 -3
  233. package/node_modules/@ocean/services/dist/{upkeep → health}/upkeep.js +2 -2
  234. package/node_modules/@ocean/services/dist/{doctor → health}/workspace-doctor.js +57 -17
  235. package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-session.js +1 -1
  236. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/call-ledger.js +3 -0
  237. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-client.js +19 -3
  238. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/obsidian-server.js +4 -4
  239. package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/ocean-server.js +423 -34
  240. package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/conflict-log.js +1 -1
  241. package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/folder-templates.js +8 -5
  242. package/node_modules/@ocean/services/dist/projects/project-doctor.js +173 -0
  243. package/node_modules/@ocean/services/dist/projects/project-snippet.js +9 -0
  244. package/node_modules/@ocean/services/dist/projects/projects-overview.js +2 -2
  245. package/node_modules/@ocean/services/package.json +1 -1
  246. package/node_modules/@ocean/{loop/dist/loops → work/dist/runs}/guard-runtime.js +3 -3
  247. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/memory-knowledge-operations.js +4 -12
  248. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-contract.js +2 -2
  249. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/project-operations.js +2 -1
  250. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/task-operations.js +4 -4
  251. package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/write-guard.js +1 -1
  252. package/node_modules/@ocean/{loop → work}/dist/runs/prompt-assembly.js +2 -2
  253. package/node_modules/@ocean/{loop → work}/dist/runs/run-agent.js +4 -4
  254. package/node_modules/@ocean/{loop → work}/dist/runs/tool-loop.js +4 -4
  255. package/node_modules/@ocean/work/dist/sessions/hooks/desktop-facts.js +309 -0
  256. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-end-hook.js +36 -5
  257. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-facts-hook.js +144 -14
  258. package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/session-start-hook.js +129 -12
  259. package/node_modules/@ocean/work/dist/sessions/hooks/start-brief.js +110 -0
  260. package/node_modules/@ocean/work/dist/sessions/hooks/unlinked-warning.js +68 -0
  261. package/node_modules/@ocean/{loop → work}/dist/sessions/session-closeout.js +4 -4
  262. package/node_modules/@ocean/{loop → work}/dist/sessions/session-projects.js +13 -3
  263. package/node_modules/@ocean/work/dist/sessions/session-relink.js +300 -0
  264. package/node_modules/@ocean/{loop → work}/dist/sessions/session-retention.js +1 -1
  265. package/node_modules/@ocean/{loop → work}/dist/tasks/list-tasks.js +7 -2
  266. package/node_modules/@ocean/{loop → work}/dist/tasks/renumber-tasks.js +4 -2
  267. package/node_modules/@ocean/{loop → work}/dist/tasks/session-task.js +2 -2
  268. package/node_modules/@ocean/{loop → work}/dist/tasks/sync-task-prs.js +77 -7
  269. package/node_modules/@ocean/work/dist/tasks/task-git.js +63 -0
  270. package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop.js +4 -4
  271. package/node_modules/@ocean/{loop → work}/dist/tasks/verification-readiness.js +1 -1
  272. package/node_modules/@ocean/{loop → work}/dist/tasks/verify-task.js +1 -1
  273. package/node_modules/@ocean/{loop → work}/package.json +2 -2
  274. package/ocean-marketplace.json +41 -41
  275. package/package.json +12 -11
  276. package/skills/core/daily-harvest/SKILL.md +1 -1
  277. package/skills/core/ocean-memory/SKILL.md +4 -0
  278. package/skills/core/use-browser/SKILL.md +30 -7
  279. package/skills/index.json +1 -1
  280. package/templates/profiles/default.md +44 -0
  281. package/templates/profiles/developer.md +45 -0
  282. package/templates/profiles/reviewer.md +44 -0
  283. package/templates/profiles/strategist.md +44 -0
  284. package/templates/profiles-v3/analysis.md +16 -0
  285. package/templates/profiles-v3/backend.md +16 -0
  286. package/templates/profiles-v3/base.md +57 -0
  287. package/templates/profiles-v3/code-review.md +16 -0
  288. package/templates/profiles-v3/devops.md +16 -0
  289. package/templates/profiles-v3/docs-office.md +16 -0
  290. package/templates/profiles-v3/frontend.md +16 -0
  291. package/templates/profiles-v3/learning.md +16 -0
  292. package/templates/profiles-v3/marketing-ads.md +16 -0
  293. package/templates/profiles-v3/marketing-content-seo.md +16 -0
  294. package/templates/profiles-v3/ocean-ops.md +16 -0
  295. package/templates/profiles-v3/product-strategy.md +16 -0
  296. package/templates/profiles-v3/qa-testing.md +16 -0
  297. package/templates/profiles-v3/security.md +16 -0
  298. package/templates/workspace/MANIFEST.json +1 -0
  299. package/templates/workspace/charter/core.md +22 -90
  300. package/templates/workspace/charter/policies/README.md +7 -1
  301. package/templates/workspace/charter/policies/claude-code-context.md +6 -1
  302. package/templates/workspace/charter/policies/concise-output.md +5 -0
  303. package/templates/workspace/charter/policies/context.md +5 -0
  304. package/templates/workspace/charter/policies/contracts/task.md +2 -2
  305. package/templates/workspace/charter/policies/git.md +5 -0
  306. package/templates/workspace/charter/policies/graph.md +6 -1
  307. package/templates/workspace/charter/policies/knowledge.md +11 -4
  308. package/templates/workspace/charter/policies/layout.md +23 -0
  309. package/templates/workspace/charter/policies/lifecycle.md +5 -0
  310. package/templates/workspace/charter/policies/memory.md +5 -0
  311. package/templates/workspace/charter/policies/minimal-change.md +5 -0
  312. package/templates/workspace/charter/policies/models.md +5 -0
  313. package/templates/workspace/charter/policies/response.md +5 -0
  314. package/templates/workspace/charter/policies/skill-observer.md +12 -0
  315. package/templates/workspace/charter/policies/stack.md +5 -0
  316. package/templates/workspace/charter/policies/task.md +17 -3
  317. package/templates/workspace/charter/policies/verification.md +5 -0
  318. package/node_modules/@ocean/brain/dist/evidence/verification-report.js +0 -13
  319. package/node_modules/@ocean/brain/dist/memory/daily-narrative.js +0 -142
  320. package/node_modules/@ocean/brain/dist/memory/session-facts.js +0 -283
  321. package/node_modules/@ocean/context/dist/context/context-compression.js +0 -66
  322. package/node_modules/@ocean/loop/dist/hooks/desktop-facts.js +0 -174
  323. package/node_modules/@ocean/loop/dist/operations/task-linker.js +0 -40
  324. package/node_modules/@ocean/loop/dist/sessions/session-pointer.js +0 -133
  325. package/node_modules/@ocean/loop/dist/tasks/task-git.js +0 -28
  326. package/node_modules/@ocean/market/dist/mcp/mcp-gateway.js +0 -533
  327. package/templates/profiles/default.json +0 -51
  328. package/templates/profiles/developer.json +0 -51
  329. package/templates/profiles/reviewer.json +0 -51
  330. package/templates/profiles/strategist.json +0 -51
  331. /package/node_modules/@ocean/brain/dist/{brain/brain-eval.js → brain-eval.js} +0 -0
  332. /package/node_modules/@ocean/brain/dist/{brain/brain-reindex.js → brain-reindex.js} +0 -0
  333. /package/node_modules/@ocean/brain/dist/{capture → sessions-capture}/inbox-sync.js +0 -0
  334. /package/node_modules/@ocean/{market → connect}/dist/adapters/mcp-adapter.js +0 -0
  335. /package/node_modules/@ocean/{market → connect}/dist/adapters/owned-directory.js +0 -0
  336. /package/node_modules/@ocean/{market → connect}/dist/adapters/plugin-adapter.js +0 -0
  337. /package/node_modules/@ocean/{market → connect}/dist/adapters/skill-adapter.js +0 -0
  338. /package/node_modules/@ocean/{market → connect}/dist/capability/adapter.js +0 -0
  339. /package/node_modules/@ocean/{market → connect}/dist/capability/catalog.js +0 -0
  340. /package/node_modules/@ocean/{market → connect}/dist/capability/content-digest.js +0 -0
  341. /package/node_modules/@ocean/{market → connect}/dist/capability/registry.js +0 -0
  342. /package/node_modules/@ocean/{market → connect}/dist/install/lock.js +0 -0
  343. /package/node_modules/@ocean/{market → connect}/dist/install/own-server.js +0 -0
  344. /package/node_modules/@ocean/{market → connect}/dist/mcp/chrome-debugging.js +0 -0
  345. /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-connection.js +0 -0
  346. /package/node_modules/@ocean/{market → connect}/dist/mcp/mcp-runner.js +0 -0
  347. /package/node_modules/@ocean/{market → connect}/dist/security/description-scan.js +0 -0
  348. /package/node_modules/@ocean/{market → connect}/dist/security/secrets.js +0 -0
  349. /package/node_modules/@ocean/{market → connect}/dist/skills/core-skill-sync.js +0 -0
  350. /package/node_modules/@ocean/context/dist/{context/context-packet.js → context-packet.js} +0 -0
  351. /package/node_modules/@ocean/core/dist/domain/{process/process-events.js → process-events.js} +0 -0
  352. /package/node_modules/@ocean/core/dist/domain/{redaction/redaction.js → redaction.js} +0 -0
  353. /package/node_modules/@ocean/services/dist/{brief → day}/brief.js +0 -0
  354. /package/node_modules/@ocean/services/dist/{express → day}/express.js +0 -0
  355. /package/node_modules/@ocean/services/dist/{brief → day}/source-registry.json +0 -0
  356. /package/node_modules/@ocean/services/dist/{journey → health}/telemetry.js +0 -0
  357. /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-service.js +0 -0
  358. /package/node_modules/@ocean/services/dist/{browser → integrations/browser}/browser-task-runner.js +0 -0
  359. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/mcp-session.js +0 -0
  360. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/server-version.js +0 -0
  361. /package/node_modules/@ocean/services/dist/{infrastructure → integrations}/mcp/tool-registry.js +0 -0
  362. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/inbox-promotion.js +0 -0
  363. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-discovery.js +0 -0
  364. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-ingestion.js +0 -0
  365. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-sync.js +0 -0
  366. /package/node_modules/@ocean/services/dist/{obsidian → integrations/obsidian}/vault-writer.js +0 -0
  367. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/operation-scope.js +0 -0
  368. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-io.js +0 -0
  369. /package/node_modules/@ocean/{loop/dist → work/dist/runs}/operations/record-operations.js +0 -0
  370. /package/node_modules/@ocean/{loop → work}/dist/runs/run-authorization.js +0 -0
  371. /package/node_modules/@ocean/{loop → work}/dist/runs/session-tokens.js +0 -0
  372. /package/node_modules/@ocean/{loop/dist/handoff → work/dist/sessions}/handoff-service.js +0 -0
  373. /package/node_modules/@ocean/{loop/dist → work/dist/sessions}/hooks/lifecycle-hooks.js +0 -0
  374. /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-store.js +0 -0
  375. /package/node_modules/@ocean/{loop/dist/infrastructure/persistence → work/dist/sessions}/session-validator.js +0 -0
  376. /package/node_modules/@ocean/{loop → work}/dist/tasks/archive-tasks.js +0 -0
  377. /package/node_modules/@ocean/{loop → work}/dist/tasks/checkpoint-task.js +0 -0
  378. /package/node_modules/@ocean/{loop → work}/dist/tasks/claim-task.js +0 -0
  379. /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/iteration-graph.js +0 -0
  380. /package/node_modules/@ocean/{loop → work}/dist/tasks/new-task.js +0 -0
  381. /package/node_modules/@ocean/{loop/dist/loops → work/dist/tasks}/task-loop-record.js +0 -0
  382. /package/node_modules/@ocean/{loop → work}/dist/tasks/task-verification.js +0 -0
@@ -1,9 +1,12 @@
1
1
  import { stat } from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { DEFAULT_CONTEXT_BUDGET, measureContextCost, } from "@ocean/context/context/context-cost.js";
3
+ import { DEFAULT_CONTEXT_BUDGET, measureContextCost, } from "@ocean/context/context-size.js";
4
4
  import { BRAIN_RECORD_DIRS, oceanRoot, PERSONAL_DIR, PROJECTS_DIR, projectDir, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
5
- import { projectRules, projectVerify, readProjectManifest, resolveProject, } from "@ocean/core/shared/project-resolution.js";
5
+ import { projectRules, projectVerify, readProjectManifest, } from "@ocean/core/shared/project-manifest.js";
6
+ import { resolveProject } from "@ocean/core/shared/project-resolution.js";
6
7
  import { z } from "zod";
8
+ import { GATEWAY_COMMAND, readGatewayClients, } from "../../application/clients/clients.js";
9
+ import { measureMcpSchemas, } from "../../application/clients/mcp-schema-cost.js";
7
10
  import { oceanVersion } from "../../version.js";
8
11
  import { listTasks } from "./tasks-command.js";
9
12
  // The MEMORY.md files a session in this project reads: the personal index, then the project's.
@@ -133,8 +136,31 @@ export async function runContextCostCommand(args) {
133
136
  projectDir: options.project,
134
137
  budget: options.budget,
135
138
  });
139
+ // MCP schemas (T-338 P5): Ocean's servers as a session in this folder sees them, and as
140
+ // Claude Desktop sees them (it starts at the filesystem root, so the base profile). A client
141
+ // wired per-server instead of to the gateway is charged Ocean's server only.
142
+ const oceanCommand = [process.execPath, process.argv[1] ?? ""];
143
+ const [folder, desktop] = await Promise.all([
144
+ measureMcpSchemas(options.project, oceanCommand, GATEWAY_COMMAND),
145
+ measureMcpSchemas("/", oceanCommand, GATEWAY_COMMAND),
146
+ ]);
147
+ const gatewayClients = readGatewayClients();
148
+ const adapterId = (client) => client === "claude" ? "claude-code" : client;
149
+ const bytesOf = (listing) => listing?.bytes ?? 0;
150
+ const mcpBytes = (client) => client === "agents"
151
+ ? null
152
+ : bytesOf(folder.ocean) +
153
+ (gatewayClients.has(adapterId(client)) ? bytesOf(folder.gateway) : 0);
154
+ const mcp = {
155
+ folder,
156
+ desktop: {
157
+ ...desktop,
158
+ gatewayWired: gatewayClients.has("claude-desktop"),
159
+ },
160
+ clients: Object.fromEntries(report.clients.map((client) => [client.client, mcpBytes(client.client)])),
161
+ };
136
162
  if (options.json) {
137
- console.log(JSON.stringify(report, null, 2));
163
+ console.log(JSON.stringify({ ...report, mcp }, null, 2));
138
164
  return;
139
165
  }
140
166
  const sum = (files) => files.reduce((total, file) => total + file.bytes, 0);
@@ -146,6 +172,7 @@ export async function runContextCostCommand(args) {
146
172
  "skill-fm",
147
173
  "skill-body",
148
174
  "always-on",
175
+ "mcp",
149
176
  "status",
150
177
  ];
151
178
  const rows = report.clients.map((client) => [
@@ -156,6 +183,9 @@ export async function runContextCostCommand(args) {
156
183
  String(client.skills.frontmatterBytes),
157
184
  String(client.skills.bodyBytes),
158
185
  String(client.alwaysOnBytes),
186
+ costStatus(client) === "absent"
187
+ ? "-"
188
+ : String(mcpBytes(client.client) ?? "-"),
159
189
  costStatus(client),
160
190
  ]);
161
191
  const widths = header.map((title, column) => Math.max(title.length, ...rows.map((row) => row[column].length)));
@@ -170,5 +200,11 @@ export async function runContextCostCommand(args) {
170
200
  for (const note of client.notes)
171
201
  console.log(` note: ${note}`);
172
202
  });
203
+ const listing = (name, value) => value
204
+ ? `${name} ${value.bytes} (${value.tools} tools)`
205
+ : `${name} did not answer`;
206
+ console.log("MCP schemas from Ocean's servers (tools/list bytes, per request)");
207
+ console.log(` this folder: ${listing("ocean", folder.ocean)}, ${listing("gateway", folder.gateway)}`);
208
+ console.log(` claude-desktop (/): ${listing("ocean", desktop.ocean)}, ${listing("gateway", desktop.gateway)}${mcp.desktop.gatewayWired ? "" : " (not gateway-wired)"}`);
173
209
  }
174
210
  //# sourceMappingURL=context-command.js.map
@@ -0,0 +1,104 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { homedir } from "node:os";
3
+ import path from "node:path";
4
+ import { readExtractionLog } from "@ocean/brain/memory/extraction-log.js";
5
+ import { GROUPS, parseMeter, scanTranscripts, summarizeSpend, } from "../../application/spend/claude-spend.js";
6
+ const usage = "Usage: ocean cost [--days N] [--by day|hour|client|project|model|session|kind] [--json]";
7
+ // Where the Claude clients keep transcripts and the Desktop app keeps its plan meter. Both can
8
+ // be moved for a test or another machine.
9
+ const transcriptsRoot = () => process.env.OCEAN_CLAUDE_PROJECTS ??
10
+ path.join(homedir(), ".claude", "projects");
11
+ const meterFile = () => process.env.OCEAN_CLAUDE_METER ??
12
+ path.join(homedir(), "Library", "Application Support", "Claude", "plan-usage-history.json");
13
+ const money = (value) => `$${value.toFixed(2)}`;
14
+ const share = (part, whole) => whole > 0 ? `${Math.round((part / whole) * 100)}%` : "0%";
15
+ const scaled = (value, unit, suffix) => `${(value / unit).toFixed(1).replace(/\.0$/, "")}${suffix}`;
16
+ const compact = (value) => value >= 1_000_000
17
+ ? scaled(value, 1_000_000, "M")
18
+ : value >= 1_000
19
+ ? scaled(value, 1_000, "K")
20
+ : String(value);
21
+ function table(header, rows, total) {
22
+ const head = [header, "requests", "cost", "share", "out tokens"];
23
+ const lines = rows.map((row) => [
24
+ row.key,
25
+ row.requests.toLocaleString("en-US"),
26
+ money(row.cost),
27
+ share(row.cost, total),
28
+ compact(row.output),
29
+ ]);
30
+ const widths = head.map((cell, column) => Math.max(cell.length, ...lines.map((line) => line[column].length)));
31
+ const render = (cells) => ` ${cells
32
+ .map((cell, column) => column === 0
33
+ ? cell.padEnd(widths[column])
34
+ : cell.padStart(widths[column]))
35
+ .join(" ")}`;
36
+ return [render(head), ...lines.map(render)];
37
+ }
38
+ export function renderSpend(report) {
39
+ const { total } = report;
40
+ const lines = [
41
+ `Claude use ${report.since.slice(0, 10)} .. ${report.until.slice(0, 10)}, at API list price (prices as of ${report.pricesAsOf}; a subscription is not billed this way)`,
42
+ `Total ${money(total.cost)} over ${total.requests.toLocaleString("en-US")} requests: input ${compact(total.input)}, cache read ${compact(total.cacheRead)}, cache write ${compact(total.cacheWrite)}, output ${compact(total.output)} tokens`,
43
+ `By kind: ${report.kinds.map((kind) => `${kind.key} ${money(kind.cost)} (${share(kind.cost, total.cost)})`).join(", ") || "none"}`,
44
+ `Above ${compact(report.longContext.threshold)} tokens of context: ${share(report.longContext.requests, total.requests)} of requests, ${share(report.longContext.cost, total.cost)} of cost`,
45
+ "",
46
+ ...table(report.by, report.groups, total.cost),
47
+ ];
48
+ if (report.topSessions.length) {
49
+ lines.push("", "Top sessions:");
50
+ for (const session of report.topSessions)
51
+ lines.push(` ${money(session.cost).padStart(8)} ${session.key.slice(0, 8)} ${session.project} ${session.client} ${session.requests} requests`);
52
+ }
53
+ const { capture } = report;
54
+ const reasons = Object.entries(capture.failures)
55
+ .map(([reason, count]) => `${reason} ${count}`)
56
+ .join(", ");
57
+ lines.push("", `Session capture: ${capture.calls} calls, ${capture.ok} ok, ${capture.failed} failed${reasons ? ` (${reasons})` : ""}, ${capture.repeats} repeats skipped; ${money(capture.idleCost)} spent in hours with no session of yours`);
58
+ const { latest } = report.meter;
59
+ lines.push(latest
60
+ ? `Plan meter (Desktop app, ${new Date(latest.at).toLocaleString("en-GB")}): 5-hour ${latest.fiveHour}%, weekly ${latest.weekly}%; weekly rose ${report.meter.weeklyRise} points in this window`
61
+ : "Plan meter: no Desktop app samples in this window");
62
+ if (report.flags.length) {
63
+ lines.push("", "Flags:");
64
+ for (const flag of report.flags)
65
+ lines.push(` ! ${flag}`);
66
+ }
67
+ lines.push("", `Not counted: ${report.notCounted}`);
68
+ return lines.join("\n");
69
+ }
70
+ function option(args, flag) {
71
+ const index = args.indexOf(flag);
72
+ return index >= 0 ? args[index + 1] : undefined;
73
+ }
74
+ // `ocean cost` (T-340): what Claude use cost over the last N days, from local transcripts, the
75
+ // extraction log and the Desktop app's plan meter, with what looks wrong flagged.
76
+ export async function runCostCommand(args) {
77
+ const days = Number(option(args, "--days") ?? 7);
78
+ const by = (option(args, "--by") ?? "day");
79
+ const known = new Set(["--days", "--by", "--json"]);
80
+ const stray = args.filter((arg, index) => arg.startsWith("-") ? !known.has(arg) : !known.has(args[index - 1]));
81
+ if (!Number.isInteger(days) ||
82
+ days < 1 ||
83
+ days > 366 ||
84
+ !GROUPS.includes(by) ||
85
+ stray.length) {
86
+ console.error(usage);
87
+ process.exitCode = 1;
88
+ return;
89
+ }
90
+ const now = Date.now();
91
+ const records = await scanTranscripts(transcriptsRoot(), now - days * 86_400_000);
92
+ const meter = parseMeter(await readFile(meterFile(), "utf8").catch(() => ""));
93
+ const report = summarizeSpend(records, {
94
+ now,
95
+ days,
96
+ by,
97
+ capture: await readExtractionLog(),
98
+ meter,
99
+ });
100
+ console.log(args.includes("--json")
101
+ ? JSON.stringify(report, null, 2)
102
+ : renderSpend(report));
103
+ }
104
+ //# sourceMappingURL=cost-command.js.map
@@ -1,5 +1,5 @@
1
1
  import { localDate } from "@ocean/core/shared/local-date.js";
2
- import { curate, reviewCurated } from "@ocean/services/curator/curator.js";
2
+ import { curate, reviewCurated } from "@ocean/services/health/curator.js";
3
3
  const USAGE = "Usage: ocean curator [--yes] | review <lesson:id|skill:name>";
4
4
  // `ocean curator [--yes] | review <key>` (T-322): mark lessons and skills stale after 30 days
5
5
  // unused (or 90 unreviewed), archive after 90; `review` undoes a mark and stamps last_reviewed.
@@ -2,6 +2,7 @@ import { createInterface } from "node:readline/promises";
2
2
  import { listLessons, setLessonStatus } from "@ocean/brain/memory/lessons.js";
3
3
  import { localDate } from "@ocean/core/shared/local-date.js";
4
4
  import { prepareDay } from "@ocean/services/day/day.js";
5
+ import { readCallLedger } from "@ocean/services/integrations/mcp/call-ledger.js";
5
6
  /**
6
7
  * Interactive human-in-the-loop gate for candidate lessons (see lessons.ts). Only runs on a
7
8
  * real TTY, so headless and scheduled invocations of `ocean daily start` never block on input.
@@ -57,7 +58,12 @@ export async function runDailyCommand(action, args) {
57
58
  : "";
58
59
  // The morning half of the daily note (T-314): focus, coming up, open loops, hours, what
59
60
  // waits on you, and the brief — between markers, so a rerun replaces only that block.
60
- const plan = await prepareDay({ date: localDate(), apply, news });
61
+ const plan = await prepareDay({
62
+ date: localDate(),
63
+ apply,
64
+ news,
65
+ calls: readCallLedger,
66
+ });
61
67
  console.log(JSON.stringify({ apply, ...plan }, null, 2));
62
68
  if (!apply)
63
69
  console.error("Dry run: pass --apply to write it.");
@@ -1,8 +1,9 @@
1
- import { DEFAULT_QUIET_MS, recordDesktopRun, runDesktopFacts, } from "@ocean/loop/hooks/desktop-facts.js";
1
+ import { recordDesktopRun, runDesktopFacts, } from "@ocean/work/sessions/hooks/desktop-facts.js";
2
+ import { linkLatestDesktopChat, refreshClaudeConversations, } from "../../application/clients/desktop-link.js";
2
3
  import { ClaudeExportError, readExportChats, } from "../../infrastructure/desktop/claude-export.js";
3
4
  import { DesktopChatUnreadable, readDesktopChats, } from "../../infrastructure/desktop/desktop-chat.js";
4
5
  import { sessionFactsCompleter } from "../../infrastructure/providers/session-facts-completer.js";
5
- export const desktopUsage = "ocean desktop capture [--dry-run] [--export <folder>] [--since <date>] [--quiet <minutes>] [--json]";
6
+ const desktopUsage = "ocean desktop capture [--dry-run] [--export <folder>] [--since <date>] [--quiet <minutes>] [--latest [--project <id>]] [--wait <seconds>] [--json] | ocean desktop link <id> [--wait <seconds>]";
6
7
  function flagValue(args, flag) {
7
8
  const index = args.indexOf(flag);
8
9
  return index >= 0 ? args[index + 1] : undefined;
@@ -32,13 +33,34 @@ async function dryRun(source, json) {
32
33
  }
33
34
  // `ocean desktop capture` (T-315): Claude Desktop chat has no hooks, so this is what the
34
35
  // watcher runs. `--dry-run` lists the conversations Ocean can read, with message counts; the
35
- // real run sends the new turns of each quiet conversation to fact capture. Neither prints
36
+ // real run sends the new turns of each closed conversation to fact capture (T-329: quiet two
37
+ // hours, or ten minutes once a newer one has started); `--latest` reads the newest one now,
38
+ // after `--wait` seconds (`ocean_session_save`). Neither prints
36
39
  // message text; the run's outcome is kept for `ocean doctor`. `--export <folder>` reads an
37
40
  // unpacked claude.ai data export's conversations.json instead (every device's conversations),
38
41
  // with the same cursor, so a conversation already read from the app is not read again; an
39
42
  // export is static, so it has no quiet window, and its run is not the watcher's last run.
43
+ async function waitFor(args) {
44
+ const wait = Number(flagValue(args, "--wait") ?? 0);
45
+ if (Number.isFinite(wait) && wait > 0)
46
+ await new Promise((resolve) => setTimeout(resolve, Math.min(wait, 300) * 1000));
47
+ }
48
+ // `ocean desktop link <id>` (T-333): binds the newest Desktop chat and its Claude project to the
49
+ // project, after `--wait` seconds so the chat that asked is in the app's store.
50
+ async function runDesktopLink(rest) {
51
+ const [project] = rest;
52
+ if (!project || project.startsWith("--")) {
53
+ console.error(`Usage: ${desktopUsage}`);
54
+ process.exitCode = 1;
55
+ return;
56
+ }
57
+ await waitFor(rest);
58
+ console.log(JSON.stringify(await linkLatestDesktopChat({ project, read: () => readDesktopChats() }), null, 2));
59
+ }
40
60
  export async function runDesktopCommand(args) {
41
61
  const [action, ...rest] = args;
62
+ if (action === "link")
63
+ return runDesktopLink(rest);
42
64
  const since = flagValue(rest, "--since");
43
65
  const quiet = flagValue(rest, "--quiet");
44
66
  const sinceDate = since ? new Date(since) : undefined;
@@ -52,6 +74,14 @@ export async function runDesktopCommand(args) {
52
74
  return;
53
75
  }
54
76
  const json = rest.includes("--json");
77
+ const project = flagValue(rest, "--project");
78
+ if (rest.includes("--project") &&
79
+ (!project || project.startsWith("--") || !rest.includes("--latest"))) {
80
+ console.error(`Usage: ${desktopUsage}`);
81
+ process.exitCode = 1;
82
+ return;
83
+ }
84
+ await waitFor(rest);
55
85
  const exportDir = flagValue(rest, "--export");
56
86
  if (rest.includes("--export") && (!exportDir || exportDir.startsWith("--"))) {
57
87
  console.error(`Usage: ${desktopUsage}`);
@@ -66,22 +96,27 @@ export async function runDesktopCommand(args) {
66
96
  await dryRun(read, json);
67
97
  return;
68
98
  }
99
+ // The chat just used gets its title and Claude project on file first (T-333).
100
+ if (rest.includes("--latest") && !exportDir)
101
+ await refreshClaudeConversations();
69
102
  const run = await runDesktopFacts({
70
103
  read,
71
104
  complete: sessionFactsCompleter("claude"),
72
105
  since: sinceDate,
106
+ latest: rest.includes("--latest"),
107
+ project,
73
108
  quietMs: quietMinutes !== undefined
74
109
  ? quietMinutes * 60_000
75
110
  : exportDir
76
111
  ? 0
77
- : DEFAULT_QUIET_MS,
112
+ : undefined,
78
113
  });
79
114
  if (exportDir) {
80
115
  console.log(JSON.stringify(run, null, 2));
81
116
  return;
82
117
  }
83
- const candidates = run.status === "done"
84
- ? run.runs.reduce((sum, each) => sum + (each.candidates?.length ?? 0), 0)
118
+ const count = (key) => run.status === "done"
119
+ ? run.runs.reduce((sum, each) => sum + (each[key]?.length ?? 0), 0)
85
120
  : 0;
86
121
  await recordDesktopRun({
87
122
  at: new Date().toISOString(),
@@ -90,7 +125,8 @@ export async function runDesktopCommand(args) {
90
125
  ? {
91
126
  conversations: run.conversations,
92
127
  captured: run.runs.length,
93
- candidates,
128
+ candidates: count("candidates"),
129
+ filed: count("filed"),
94
130
  }
95
131
  : {}),
96
132
  });
@@ -1,5 +1,6 @@
1
1
  import { localDate } from "@ocean/core/shared/local-date.js";
2
- import { distillWeek, reviewMonth } from "@ocean/services/distill/distill.js";
2
+ import { distillWeek, reviewMonth } from "@ocean/services/day/distill.js";
3
+ import { weekFailures } from "./week-failures.js";
3
4
  const USAGE = "Usage: ocean distill --week [--date YYYY-MM-DD] [--yes] | --month [--month-of YYYY-MM] [--yes]";
4
5
  // `ocean distill --week` (T-314): the week's session records and briefs into one digest, its
5
6
  // decisions and lessons into candidates; a dry run until --yes.
@@ -22,7 +23,11 @@ export async function runDistillCommand(args) {
22
23
  const date = at >= 0 ? args[at + 1] : localDate();
23
24
  if (!date || !/^\d{4}-\d{2}-\d{2}$/.test(date))
24
25
  throw new Error(USAGE);
25
- const result = await distillWeek({ date, apply: args.includes("--yes") });
26
+ const result = await distillWeek({
27
+ date,
28
+ apply: args.includes("--yes"),
29
+ failures: weekFailures,
30
+ });
26
31
  console.log(JSON.stringify(result, null, 2));
27
32
  if (!args.includes("--yes"))
28
33
  console.error("Dry run: pass --yes to write.");
@@ -1,5 +1,5 @@
1
1
  import { localDate } from "@ocean/core/shared/local-date.js";
2
- import { EXPRESS_KINDS, writeDraft, } from "@ocean/services/express/express.js";
2
+ import { EXPRESS_KINDS, writeDraft, } from "@ocean/services/day/express.js";
3
3
  const USAGE = `Usage: ocean express ${EXPRESS_KINDS.join("|")} [--dry-run]`;
4
4
  // `ocean express <kind>` (T-314): a draft from the owner's milestones into 00-inbox/drafts/.
5
5
  export async function runExpressCommand(args) {
@@ -1,6 +1,6 @@
1
- import { openSessionStoreReadOnly } from "@ocean/loop/infrastructure/persistence/session-store.js";
2
- import { ABSORB_MECHANISMS, climbFailure, failureRecurrence, listFailures, openFailure, RECURRENCE_WINDOW_DAYS, setFailureStatus, } from "@ocean/services/journey/failures.js";
3
- import { signatureStats } from "@ocean/services/journey/telemetry.js";
1
+ import { ABSORB_MECHANISMS, climbFailure, failureRecurrence, listFailures, openFailure, RECURRENCE_WINDOW_DAYS, setFailureStatus, } from "@ocean/services/health/failures.js";
2
+ import { signatureStats } from "@ocean/services/health/telemetry.js";
3
+ import { openSessionStoreReadOnly } from "@ocean/work/sessions/session-store.js";
4
4
  const USAGE = [
5
5
  "Usage: ocean failures [list] [--json]",
6
6
  " ocean failures open <id> <signature> --title <text> --mechanism <why it happens> [--lesson <id>] [--rung lesson|doctor|test] [--fix <text>] [--guardrail <text>]",
@@ -11,7 +11,7 @@ function option(args, name) {
11
11
  const at = args.indexOf(name);
12
12
  return at >= 0 ? args[at + 1] : undefined;
13
13
  }
14
- // `ocean failures` (T-323): failure records in 05-knowledge/failures/, each tracked by its
14
+ // `ocean failures` (T-323): failure records in 05-knowledge/lessons/, each tracked by its
15
15
  // telemetry signature. Every change goes through code, one field at a time; `climb` is the
16
16
  // owner's approval of a guardrail climb that telemetry proposed.
17
17
  export async function runFailuresCommand(args) {
@@ -1,5 +1,5 @@
1
- import { marketplacePaths } from "@ocean/market/install/default-marketplace.js";
2
- import { readGatewayAccess } from "@ocean/market/mcp/mcp-gateway.js";
1
+ import { marketplacePaths } from "@ocean/connect/install/default-marketplace.js";
2
+ import { readGatewayAccess } from "@ocean/connect/mcp/mcp-gateway.js";
3
3
  import { readGatewayClients } from "../../application/clients/clients.js";
4
4
  // `ocean doctor` (T-309): which clients reach installed servers through the one gateway entry,
5
5
  // and whether the access file the gateway reads at start is valid; an invalid one stops the
@@ -1,23 +1,30 @@
1
- import { readdir, readFile } from "node:fs/promises";
2
- import { CHARTER_DIR, oceanPath, POLICIES_DIR, resolveWithin, } from "@ocean/core/shared/paths.js";
3
- const policyRoot = () => oceanPath(POLICIES_DIR);
4
- const rulesFile = () => oceanPath(CHARTER_DIR, "core.md");
5
- async function policyNames() {
6
- return (await readdir(policyRoot(), { withFileTypes: true }))
7
- .filter((entry) => entry.isFile() &&
8
- entry.name.endsWith(".md") &&
9
- entry.name !== "README.md")
10
- .map((entry) => entry.name.slice(0, -3))
11
- .sort();
12
- }
1
+ import { CORE_RULES, policyCatalog, policyNames, readCoreRules, readRules, } from "@ocean/core/shared/charter.js";
13
2
  export async function runPolicyCommand(name = "list") {
14
3
  const names = await policyNames();
15
4
  if (name === "list") {
16
- console.log(JSON.stringify({ policies: names }, null, 2));
5
+ // Name, triggers and digest: what the prompt hook routes on (T-339 P1).
6
+ const catalog = await policyCatalog();
7
+ console.log(JSON.stringify({
8
+ policies: catalog.map(({ name, triggers, digest }) => ({
9
+ name,
10
+ triggers,
11
+ digest,
12
+ })),
13
+ }, null, 2));
14
+ return;
15
+ }
16
+ if (name === "validate") {
17
+ // Every policy carries triggers and a digest of at most 200 bytes, or none is routed.
18
+ const problems = (await policyCatalog())
19
+ .filter((entry) => entry.problems.length)
20
+ .map(({ name, problems }) => ({ name, problems }));
21
+ console.log(JSON.stringify({ ok: problems.length === 0, policies: names.length, problems }, null, 2));
22
+ if (problems.length)
23
+ process.exitCode = 1;
17
24
  return;
18
25
  }
19
26
  if (name === "doctor") {
20
- const core = await readFile(rulesFile(), "utf8");
27
+ const core = (await readCoreRules()) ?? "";
21
28
  const referenced = new Set([...core.matchAll(/ocean policy ([a-z-]+)/g)]
22
29
  .map((match) => match[1])
23
30
  .filter((item) => item !== "list"));
@@ -27,9 +34,9 @@ export async function runPolicyCommand(name = "list") {
27
34
  process.exitCode = 1;
28
35
  return;
29
36
  }
30
- if (!/^[a-z][a-z-]*$/.test(name) || !names.includes(name))
37
+ if (name === CORE_RULES)
31
38
  throw new Error(`Unknown policy: ${name}`);
32
- process.stdout.write(await readFile(resolveWithin(policyRoot(), `${name}.md`), "utf8"));
39
+ process.stdout.write(await readRules(name));
33
40
  }
34
41
  export async function runLifecycleCommand(args) {
35
42
  const taskIndex = args.indexOf("--task");
@@ -1,4 +1,4 @@
1
- import { createHandoff, getHandoff, listHandoffs, } from "@ocean/loop/handoff/handoff-service.js";
1
+ import { createHandoff, getHandoff, listHandoffs, } from "@ocean/work/sessions/handoff-service.js";
2
2
  import { defaultSessionStoreFactory } from "../../composition/runtime.js";
3
3
  export async function runHandoffCommand(action, args) {
4
4
  if (action === "create") {
@@ -1,6 +1,6 @@
1
1
  import { localDate } from "@ocean/core/shared/local-date.js";
2
- import { openSessionStore } from "@ocean/loop/infrastructure/persistence/session-store.js";
3
- import { archiveHarvested, harvestDay, pendingDays, undoDay, } from "@ocean/services/harvest/harvest.js";
2
+ import { archiveHarvested, harvestDay, pendingDays, undoDay, } from "@ocean/services/day/harvest.js";
3
+ import { openSessionStore } from "@ocean/work/sessions/session-store.js";
4
4
  const USAGE = "Usage: ocean harvest [--date YYYY-MM-DD | --pending] [--yes] | archive [--days N] [--yes] | undo <YYYY-MM-DD>";
5
5
  const DATE = /^\d{4}-\d{2}-\d{2}$/;
6
6
  // `ocean harvest` (T-314): a day's sessions from every AI client into that day's summary, their