@amoree-code/ocean 1.6.2 → 1.8.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 (84) hide show
  1. package/README.md +10 -1
  2. package/dist/application/clients/desktop-watcher.js +234 -0
  3. package/dist/application/clients/opencode-plugin.js +4 -3
  4. package/dist/application/layout/layout-plan.js +1 -0
  5. package/dist/application/onboarding/steps.js +20 -1
  6. package/dist/infrastructure/desktop/claude-export.js +84 -0
  7. package/dist/infrastructure/desktop/desktop-chat.js +165 -0
  8. package/dist/infrastructure/desktop/indexeddb.js +158 -0
  9. package/dist/infrastructure/desktop/leveldb.js +247 -0
  10. package/dist/infrastructure/desktop/snappy.js +74 -0
  11. package/dist/infrastructure/process/service.js +8 -0
  12. package/dist/interfaces/cli/brief-command.js +17 -0
  13. package/dist/interfaces/cli/capture-command.js +1 -1
  14. package/dist/interfaces/cli/clients-command.js +15 -2
  15. package/dist/interfaces/cli/command-registry.js +31 -2
  16. package/dist/interfaces/cli/desktop-command.js +124 -0
  17. package/dist/interfaces/cli/distill-command.js +36 -0
  18. package/dist/interfaces/cli/express-command.js +18 -0
  19. package/dist/interfaces/cli/harvest-command.js +58 -0
  20. package/dist/interfaces/cli/help-command.js +34 -2
  21. package/dist/interfaces/cli/interests-command.js +33 -0
  22. package/dist/interfaces/cli/memory-command.js +37 -3
  23. package/dist/interfaces/cli/note-command.js +7 -0
  24. package/dist/interfaces/cli/setup-command.js +2 -1
  25. package/dist/interfaces/cli/telemetry-command.js +23 -0
  26. package/node_modules/@ocean/brain/dist/brain/brain-reindex.js +4 -1
  27. package/node_modules/@ocean/brain/dist/brain/brain-service.js +11 -1
  28. package/node_modules/@ocean/brain/dist/memory/brain-dump.js +73 -24
  29. package/node_modules/@ocean/brain/dist/memory/fact-routing.js +54 -0
  30. package/node_modules/@ocean/brain/dist/memory/frontmatter-flatten.js +89 -0
  31. package/node_modules/@ocean/brain/dist/memory/lessons.js +20 -0
  32. package/node_modules/@ocean/brain/dist/memory/memory-paths.js +3 -1
  33. package/node_modules/@ocean/brain/dist/memory/memory-review.js +19 -2
  34. package/node_modules/@ocean/brain/dist/memory/memory-write.js +45 -3
  35. package/node_modules/@ocean/brain/dist/memory/people.js +70 -0
  36. package/node_modules/@ocean/brain/dist/memory/routing.json +39 -0
  37. package/node_modules/@ocean/brain/dist/memory/session-facts.js +7 -1
  38. package/node_modules/@ocean/brain/dist/memory/session-promotion.js +1 -1
  39. package/node_modules/@ocean/brain/package.json +1 -1
  40. package/node_modules/@ocean/context/package.json +1 -1
  41. package/node_modules/@ocean/core/dist/shared/paths.js +7 -0
  42. package/node_modules/@ocean/core/package.json +1 -1
  43. package/node_modules/@ocean/loop/dist/handoff/handoff-service.js +5 -1
  44. package/node_modules/@ocean/loop/dist/hooks/desktop-facts.js +154 -0
  45. package/node_modules/@ocean/loop/dist/hooks/session-end-hook.js +1 -1
  46. package/node_modules/@ocean/loop/package.json +1 -1
  47. package/node_modules/@ocean/market/package.json +1 -1
  48. package/node_modules/@ocean/services/dist/brief/brief.js +218 -0
  49. package/node_modules/@ocean/services/dist/brief/interest-discovery.js +236 -0
  50. package/node_modules/@ocean/services/dist/brief/source-registry.json +35 -0
  51. package/node_modules/@ocean/services/dist/distill/distill.js +258 -0
  52. package/node_modules/@ocean/services/dist/doctor/workspace-doctor.js +129 -8
  53. package/node_modules/@ocean/services/dist/express/express.js +99 -0
  54. package/node_modules/@ocean/services/dist/harvest/harvest.js +453 -0
  55. package/node_modules/@ocean/services/dist/infrastructure/mcp/ocean-server.js +17 -1
  56. package/node_modules/@ocean/services/dist/journey/telemetry.js +81 -0
  57. package/node_modules/@ocean/services/dist/obsidian/folder-templates.js +82 -0
  58. package/node_modules/@ocean/services/dist/onboarding/onboarding.js +62 -0
  59. package/node_modules/@ocean/services/package.json +1 -1
  60. package/ocean-marketplace.json +82 -28
  61. package/package.json +7 -7
  62. package/skills/core/daily-harvest/SKILL.md +72 -0
  63. package/skills/core/memory-review/SKILL.md +53 -0
  64. package/skills/core/weekly-review/SKILL.md +24 -0
  65. package/skills/index.json +18 -0
  66. package/templates/workspace/02-personal/education/study/study.base +15 -0
  67. package/templates/workspace/02-personal/milestones/milestones.base +14 -0
  68. package/templates/workspace/02-personal/people/people.base +18 -0
  69. package/templates/workspace/06-templates/TEMPLATES.md +12 -0
  70. package/templates/workspace/06-templates/capture.md +9 -0
  71. package/templates/workspace/06-templates/daily.md +13 -0
  72. package/templates/workspace/06-templates/decision.md +8 -0
  73. package/templates/workspace/06-templates/failure.md +13 -0
  74. package/templates/workspace/06-templates/intelligence.md +7 -0
  75. package/templates/workspace/06-templates/interest.md +13 -0
  76. package/templates/workspace/06-templates/lesson.md +16 -0
  77. package/templates/workspace/06-templates/milestone.md +10 -0
  78. package/templates/workspace/06-templates/note.md +8 -0
  79. package/templates/workspace/06-templates/person.md +15 -0
  80. package/templates/workspace/06-templates/session.md +10 -0
  81. package/templates/workspace/06-templates/solution.md +14 -0
  82. package/templates/workspace/06-templates/study.md +14 -0
  83. package/templates/workspace/07-notes/.gitkeep +0 -0
  84. package/templates/workspace/MANIFEST.json +14 -0
@@ -22,11 +22,13 @@ import { hasFailures, repairWorkspace, workspaceReport, } from "@ocean/services/
22
22
  import { runObsidianMcpServer } from "@ocean/services/infrastructure/mcp/obsidian-server.js";
23
23
  import { runOceanMcpServer } from "@ocean/services/infrastructure/mcp/ocean-server.js";
24
24
  import { parseConflictSide, resolveConflict, } from "@ocean/services/obsidian/conflict-log.js";
25
+ import { syncFolderTemplates } from "@ocean/services/obsidian/folder-templates.js";
25
26
  import { listInboxCandidates, promoteInboxNote, } from "@ocean/services/obsidian/inbox-promotion.js";
26
27
  import { connectObsidianVault, discoverObsidianVault, loadObsidianConnection, } from "@ocean/services/obsidian/vault-discovery.js";
27
28
  import { syncObsidianVault, watchObsidianVault, } from "@ocean/services/obsidian/vault-sync.js";
28
29
  import { writeObsidianNote } from "@ocean/services/obsidian/vault-writer.js";
29
30
  import { clientFindings, repairClients, } from "../../application/clients/clients.js";
31
+ import { desktopWatcherFindings } from "../../application/clients/desktop-watcher.js";
30
32
  import { nativeFindings } from "../../application/clients/native.js";
31
33
  import { createWebhookGateway } from "../../application/gateway/webhook-gateway.js";
32
34
  import { findInstallSpec, installPlan, installProvider, listInstallSpecs, removeInstalledProvider, updateProvider, } from "../../application/install/provider-installer.js";
@@ -43,6 +45,7 @@ import { createOllamaEmbedder } from "../../infrastructure/providers/ollama-embe
43
45
  import { loadProviderRegistry } from "../../infrastructure/providers/provider-registry.js";
44
46
  import { installShellPath, registerProvider, setProviderEnabled, syncProviderWrappers, wrapperDoctor, wrapperStatus, } from "../../infrastructure/wrappers/wrapper-manager.js";
45
47
  import { runAuthCommand } from "./auth-command.js";
48
+ import { runBriefCommand } from "./brief-command.js";
46
49
  import { runBrowserCommand } from "./browser-command.js";
47
50
  import { browserFindings } from "./browser-findings.js";
48
51
  import { runBrowserServiceCommand } from "./browser-service-command.js";
@@ -51,17 +54,23 @@ import { runClientTestCommand } from "./client-test-command.js";
51
54
  import { runClientsCommand } from "./clients-command.js";
52
55
  import { runContextCommand, runContextCostCommand } from "./context-command.js";
53
56
  import { runDailyCommand } from "./daily-command.js";
57
+ import { runDesktopCommand } from "./desktop-command.js";
58
+ import { runDistillCommand } from "./distill-command.js";
59
+ import { runHarvestCommand } from "./harvest-command.js";
60
+ import { runExpressCommand } from "./express-command.js";
54
61
  import { gatewayFindings } from "./gateway-findings.js";
55
62
  import { runLifecycleCommand, runPolicyCommand } from "./governance-command.js";
56
63
  import { runHandoffCommand } from "./handoff-command.js";
57
64
  import { runIdeaCommand } from "./idea-command.js";
58
65
  import { intercept } from "./intercept-command.js";
66
+ import { runInterestsCommand } from "./interests-command.js";
59
67
  import { runLayoutCommand } from "./layout-command.js";
60
68
  import { runMarketCommand } from "./market-command.js";
61
69
  import { runMcpGatewayCommand } from "./mcp-gateway-command.js";
62
70
  import { runMcpStatusCommand } from "./mcp-status-command.js";
63
71
  import { runMemoryCommand } from "./memory-command.js";
64
72
  import { runMigrateCommand } from "./migrate-command.js";
73
+ import { runNoteCommand } from "./note-command.js";
65
74
  import { runObserveCommand } from "./observe-command.js";
66
75
  import { manageClients, runOnboardCommand } from "./onboard-command.js";
67
76
  import { runOperateCommand } from "./operate-command.js";
@@ -71,6 +80,7 @@ import { runningServerFindings } from "./running-server-findings.js";
71
80
  import { insideFactsCall, runSessionFactsCommand, startSessionFacts, } from "./session-facts-command.js";
72
81
  import { parseSetupArgs, SETUP_USAGE, setup } from "./setup-command.js";
73
82
  import { runTasksCommand } from "./tasks-command.js";
83
+ import { runTelemetryCommand } from "./telemetry-command.js";
74
84
  // brain_search over MCP uses vectors when the local embedder answers (T-307), and full text when
75
85
  // it does not; a working embedder is kept, a failure is retried on the next search.
76
86
  function mcpEmbedder() {
@@ -354,16 +364,27 @@ async function commandObsidian() {
354
364
  "connect",
355
365
  "discover",
356
366
  "sync",
367
+ "templates",
357
368
  "watch",
358
369
  "inbox",
359
370
  "write",
360
371
  "conflicts",
361
372
  ].includes(action)) {
362
- console.error("Usage: ocean obsidian connect <vault-path> [--read-write]|discover|sync|watch|inbox|write|conflicts resolve <id> --keep=vault|ocean");
373
+ console.error("Usage: ocean obsidian connect <vault-path> [--read-write]|discover|sync|templates [--yes]|watch|inbox|write|conflicts resolve <id> --keep=vault|ocean");
363
374
  process.exitCode = 1;
364
375
  }
365
376
  else {
366
377
  try {
378
+ if (action === "templates") {
379
+ // T-314: Templater folder templates generated from routing.json; a dry run until --yes.
380
+ const result = await syncFolderTemplates({
381
+ apply: process.argv.includes("--yes"),
382
+ });
383
+ console.log(JSON.stringify(result, null, 2));
384
+ if (!result.written)
385
+ console.error("Dry run: pass --yes to write the Templater config.");
386
+ return;
387
+ }
367
388
  if (action === "connect") {
368
389
  const vaultPath = process.argv[4];
369
390
  if (!vaultPath)
@@ -950,7 +971,7 @@ async function commandUpdateOrRemove(command) {
950
971
  async function commandDoctor() {
951
972
  const report = await workspaceReport(defaultWrapperManager);
952
973
  // T-296: every installed AI client's `ocean` entry (supported fail, unknown warn).
953
- report.findings.push(...(await clientFindings()), ...(await nativeFindings()), ...(await browserFindings()), ...(await gatewayFindings()), ...(await runningServerFindings()));
974
+ report.findings.push(...(await clientFindings()), ...(await desktopWatcherFindings()), ...(await nativeFindings()), ...(await browserFindings()), ...(await gatewayFindings()), ...(await runningServerFindings()));
954
975
  if (process.argv.includes("--json"))
955
976
  console.log(JSON.stringify(report, null, 2));
956
977
  else
@@ -1204,6 +1225,7 @@ export const commandRegistry = {
1204
1225
  layout: commandLayout,
1205
1226
  memory: commandMemory,
1206
1227
  pull: () => runPullCommand(process.argv.slice(3)),
1228
+ desktop: () => runDesktopCommand(process.argv.slice(3)),
1207
1229
  mcp: commandMcp,
1208
1230
  market: commandMarket,
1209
1231
  obsidian: commandObsidian,
@@ -1215,6 +1237,13 @@ export const commandRegistry = {
1215
1237
  intent: commandIntent,
1216
1238
  operate: commandOperate,
1217
1239
  idea: commandIdea,
1240
+ note: () => runNoteCommand(process.argv.slice(3)),
1241
+ brief: () => runBriefCommand(process.argv.slice(3)),
1242
+ interests: () => runInterestsCommand(process.argv.slice(3)),
1243
+ distill: () => runDistillCommand(process.argv.slice(3)),
1244
+ harvest: () => runHarvestCommand(process.argv.slice(3)),
1245
+ telemetry: () => runTelemetryCommand(process.argv.slice(3)),
1246
+ express: () => runExpressCommand(process.argv.slice(3)),
1218
1247
  daily: commandDaily,
1219
1248
  schedule: commandSchedule,
1220
1249
  loop: commandLoop,
@@ -0,0 +1,124 @@
1
+ import { DEFAULT_QUIET_MS, recordDesktopRun, runDesktopFacts, } from "@ocean/loop/hooks/desktop-facts.js";
2
+ import { ClaudeExportError, readExportChats, } from "../../infrastructure/desktop/claude-export.js";
3
+ import { DesktopChatUnreadable, readDesktopChats, } from "../../infrastructure/desktop/desktop-chat.js";
4
+ 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
+ function flagValue(args, flag) {
7
+ const index = args.indexOf(flag);
8
+ return index >= 0 ? args[index + 1] : undefined;
9
+ }
10
+ async function dryRun(source, json) {
11
+ const read = await source();
12
+ if (read.status === "absent") {
13
+ if (json)
14
+ console.log(JSON.stringify({ status: "absent" }));
15
+ else
16
+ console.log("Claude Desktop's local chat store was not found.");
17
+ return;
18
+ }
19
+ const rows = read.conversations.map((conversation) => ({
20
+ uuid: conversation.uuid,
21
+ updatedAt: conversation.updatedAt,
22
+ messages: conversation.messageCount,
23
+ human: conversation.messages.filter((m) => m.sender === "human").length,
24
+ }));
25
+ if (json) {
26
+ console.log(JSON.stringify({ status: "ok", conversations: rows, skipped: read.skipped }, null, 2));
27
+ return;
28
+ }
29
+ console.log(`${rows.length} conversation(s) readable${read.skipped ? `, ${read.skipped} record(s) skipped` : ""}:`);
30
+ for (const row of rows)
31
+ console.log(` ${row.uuid} ${row.updatedAt} ${row.messages} messages (${row.human} yours)`);
32
+ }
33
+ // `ocean desktop capture` (T-315): Claude Desktop chat has no hooks, so this is what the
34
+ // 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
+ // message text; the run's outcome is kept for `ocean doctor`. `--export <folder>` reads an
37
+ // unpacked claude.ai data export's conversations.json instead (every device's conversations),
38
+ // with the same cursor, so a conversation already read from the app is not read again; an
39
+ // export is static, so it has no quiet window, and its run is not the watcher's last run.
40
+ export async function runDesktopCommand(args) {
41
+ const [action, ...rest] = args;
42
+ const since = flagValue(rest, "--since");
43
+ const quiet = flagValue(rest, "--quiet");
44
+ const sinceDate = since ? new Date(since) : undefined;
45
+ const quietMinutes = quiet === undefined ? undefined : Number(quiet);
46
+ if (action !== "capture" ||
47
+ (sinceDate && Number.isNaN(sinceDate.getTime())) ||
48
+ (quietMinutes !== undefined &&
49
+ !(Number.isFinite(quietMinutes) && quietMinutes >= 0))) {
50
+ console.error(`Usage: ${desktopUsage}`);
51
+ process.exitCode = 1;
52
+ return;
53
+ }
54
+ const json = rest.includes("--json");
55
+ const exportDir = flagValue(rest, "--export");
56
+ if (rest.includes("--export") && (!exportDir || exportDir.startsWith("--"))) {
57
+ console.error(`Usage: ${desktopUsage}`);
58
+ process.exitCode = 1;
59
+ return;
60
+ }
61
+ const read = exportDir
62
+ ? () => readExportChats(exportDir)
63
+ : () => readDesktopChats();
64
+ try {
65
+ if (rest.includes("--dry-run")) {
66
+ await dryRun(read, json);
67
+ return;
68
+ }
69
+ const run = await runDesktopFacts({
70
+ read,
71
+ complete: sessionFactsCompleter("claude"),
72
+ since: sinceDate,
73
+ quietMs: quietMinutes !== undefined
74
+ ? quietMinutes * 60_000
75
+ : exportDir
76
+ ? 0
77
+ : DEFAULT_QUIET_MS,
78
+ });
79
+ if (exportDir) {
80
+ console.log(JSON.stringify(run, null, 2));
81
+ return;
82
+ }
83
+ const candidates = run.status === "done"
84
+ ? run.runs.reduce((sum, each) => sum + (each.candidates?.length ?? 0), 0)
85
+ : 0;
86
+ await recordDesktopRun({
87
+ at: new Date().toISOString(),
88
+ status: run.status,
89
+ ...(run.status === "done"
90
+ ? {
91
+ conversations: run.conversations,
92
+ captured: run.runs.length,
93
+ candidates,
94
+ }
95
+ : {}),
96
+ });
97
+ console.log(JSON.stringify(run, null, 2));
98
+ }
99
+ catch (error) {
100
+ if (error instanceof ClaudeExportError) {
101
+ console.error(error.message);
102
+ process.exitCode = 1;
103
+ return;
104
+ }
105
+ if (!(error instanceof DesktopChatUnreadable))
106
+ throw error;
107
+ await recordDesktopRun({
108
+ at: new Date().toISOString(),
109
+ status: "unreadable",
110
+ code: error.code,
111
+ reason: error.message,
112
+ });
113
+ if (json)
114
+ console.log(JSON.stringify({
115
+ status: "unreadable",
116
+ code: error.code,
117
+ reason: error.message,
118
+ }));
119
+ else
120
+ console.error(`${error.code}: ${error.message}`);
121
+ process.exitCode = 1;
122
+ }
123
+ }
124
+ //# sourceMappingURL=desktop-command.js.map
@@ -0,0 +1,36 @@
1
+ import { localDate } from "@ocean/core/shared/local-date.js";
2
+ import { distillWeek, reviewMonth } from "@ocean/services/distill/distill.js";
3
+ const USAGE = "Usage: ocean distill --week [--date YYYY-MM-DD] [--yes] | --month [--month-of YYYY-MM] [--yes]";
4
+ // `ocean distill --week` (T-314): the week's session records and briefs into one digest, its
5
+ // decisions and lessons into candidates; a dry run until --yes.
6
+ export async function runDistillCommand(args) {
7
+ if (args.includes("--month")) {
8
+ // The month just ended by default: a review is written once the month is over.
9
+ const at = args.indexOf("--month-of");
10
+ const month = at >= 0 ? args[at + 1] : previousMonth(localDate());
11
+ if (!month || !/^\d{4}-\d{2}$/.test(month))
12
+ throw new Error(USAGE);
13
+ const result = await reviewMonth({ month, apply: args.includes("--yes") });
14
+ console.log(JSON.stringify(result, null, 2));
15
+ if (!args.includes("--yes"))
16
+ console.error("Dry run: pass --yes to write.");
17
+ return;
18
+ }
19
+ if (!args.includes("--week"))
20
+ throw new Error(USAGE);
21
+ const at = args.indexOf("--date");
22
+ const date = at >= 0 ? args[at + 1] : localDate();
23
+ if (!date || !/^\d{4}-\d{2}-\d{2}$/.test(date))
24
+ throw new Error(USAGE);
25
+ const result = await distillWeek({ date, apply: args.includes("--yes") });
26
+ console.log(JSON.stringify(result, null, 2));
27
+ if (!args.includes("--yes"))
28
+ console.error("Dry run: pass --yes to write.");
29
+ }
30
+ export function previousMonth(date) {
31
+ const [year, month] = date.split("-").map(Number);
32
+ return month === 1
33
+ ? `${year - 1}-12`
34
+ : `${year}-${String(month - 1).padStart(2, "0")}`;
35
+ }
36
+ //# sourceMappingURL=distill-command.js.map
@@ -0,0 +1,18 @@
1
+ import { localDate } from "@ocean/core/shared/local-date.js";
2
+ import { EXPRESS_KINDS, writeDraft, } from "@ocean/services/express/express.js";
3
+ const USAGE = `Usage: ocean express ${EXPRESS_KINDS.join("|")} [--dry-run]`;
4
+ // `ocean express <kind>` (T-314): a draft from the owner's milestones into 00-inbox/drafts/.
5
+ export async function runExpressCommand(args) {
6
+ const [kind] = args;
7
+ if (!EXPRESS_KINDS.includes(kind))
8
+ throw new Error(USAGE);
9
+ const result = await writeDraft({
10
+ kind: kind,
11
+ date: localDate(),
12
+ dryRun: args.includes("--dry-run"),
13
+ });
14
+ if (!result.milestones)
15
+ console.error("No milestones yet: add 02-personal/milestones/<name>.md (type: milestone).");
16
+ console.log(result.file ?? result.text);
17
+ }
18
+ //# sourceMappingURL=express-command.js.map
@@ -0,0 +1,58 @@
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";
4
+ const USAGE = "Usage: ocean harvest [--date YYYY-MM-DD | --pending] [--yes] | archive [--days N] [--yes] | undo <YYYY-MM-DD>";
5
+ const DATE = /^\d{4}-\d{2}-\d{2}$/;
6
+ // `ocean harvest` (T-316): a day's sessions from every AI client into that day's summary, their
7
+ // decisions, fixes and lessons into 05-knowledge on their own (undo per day), then archiving after
8
+ // 30 days. A dry run until --yes. The service runs `--pending --yes` once a day.
9
+ export async function runHarvestCommand(args) {
10
+ const apply = args.includes("--yes");
11
+ const [action] = args;
12
+ if (action === "undo") {
13
+ const date = args[1];
14
+ if (!date || !DATE.test(date))
15
+ throw new Error(USAGE);
16
+ console.log(JSON.stringify(await undoDay(date), null, 2));
17
+ return;
18
+ }
19
+ if (action === "archive") {
20
+ const at = args.indexOf("--days");
21
+ const days = at >= 0 ? Number(args[at + 1]) : 30;
22
+ if (!(days > 0))
23
+ throw new Error(USAGE);
24
+ const result = await archiveHarvested({ today: localDate(), days, apply });
25
+ console.log(JSON.stringify(result, null, 2));
26
+ if (!apply)
27
+ console.error("Dry run: pass --yes to move them.");
28
+ return;
29
+ }
30
+ const at = args.indexOf("--date");
31
+ const dates = args.includes("--pending")
32
+ ? await pendingDays(localDate())
33
+ : [at >= 0 ? args[at + 1] : localDate()];
34
+ if (dates.some((date) => !date || !DATE.test(date)))
35
+ throw new Error(USAGE);
36
+ const store = await openSessionStore();
37
+ try {
38
+ const sessions = store.list();
39
+ const results = [];
40
+ for (const date of dates)
41
+ results.push(await harvestDay({
42
+ date,
43
+ apply,
44
+ store: { sessions, eventsOf: (id) => store.listEvents(id) },
45
+ }));
46
+ // The daily run also archives what has been harvested for 30 days.
47
+ const archived = args.includes("--pending")
48
+ ? await archiveHarvested({ today: localDate(), apply })
49
+ : null;
50
+ console.log(JSON.stringify({ days: results, archived }, null, 2));
51
+ if (!apply)
52
+ console.error("Dry run: pass --yes to write.");
53
+ }
54
+ finally {
55
+ store.close();
56
+ }
57
+ }
58
+ //# sourceMappingURL=harvest-command.js.map
@@ -13,7 +13,7 @@ const commandGroups = [
13
13
  ],
14
14
  [
15
15
  "Knowledge",
16
- "memory, pull, observe, capture, handoff, idea, daily, skill, catalog",
16
+ "memory, pull, desktop, observe, capture, note, brief, interests, distill, harvest, telemetry, express, handoff, idea, daily, skill, catalog",
17
17
  ],
18
18
  ["Integrations", "obsidian, hook, migrate, layout, env"],
19
19
  ];
@@ -140,6 +140,10 @@ export const commandHelp = {
140
140
  "Pull what AI clients hold into Ocean as review candidates; a dry run until --yes.",
141
141
  "ocean pull [--yes] [--daily] | search [words…] [--project <id>] [--client <id>] [--limit N] [--json] | report",
142
142
  ],
143
+ desktop: [
144
+ "Capture facts from Claude Desktop's chat, read from the app's local store; --export reads an unpacked claude.ai data export; --dry-run lists conversations and message counts, never text.",
145
+ "ocean desktop capture [--dry-run] [--export <folder>] [--since <date>] [--quiet <minutes>] [--json]",
146
+ ],
143
147
  observe: [
144
148
  "Run a command and record its output, or show a recording.",
145
149
  "ocean observe -- <command> [args] | show <id> [--grep <pattern>]",
@@ -148,6 +152,34 @@ export const commandHelp = {
148
152
  "Capture ideas and promote or discard them.",
149
153
  "ocean capture add <idea>|scan [session-id]|list [status]|promote <id> <target>|discard <id>",
150
154
  ],
155
+ brief: [
156
+ "Write today's brief from your interests' feeds to 01-daily/briefs/ (high priority daily, all weekly).",
157
+ "ocean brief [--weekly] [--dry-run] [--date YYYY-MM-DD]",
158
+ ],
159
+ interests: [
160
+ "Propose interests from your projects' dependencies or topics recurring in your sessions (as candidates), decay unused ones, record keep/skip.",
161
+ "ocean interests discover [--yes] | signals [--weeks N] [--yes] | decay [--weeks N] [--yes] | keep <name> | skip <name>",
162
+ ],
163
+ distill: [
164
+ "Distill a week (digest in 01-daily/weekly/, decisions and lessons as candidates), or review last month against goals.md (01-daily/monthly/).",
165
+ "ocean distill --week [--date YYYY-MM-DD] [--yes] | --month [--month-of YYYY-MM] [--yes]",
166
+ ],
167
+ harvest: [
168
+ "Harvest a day's sessions from every AI client: the day's summary, decisions, fixes and lessons filed into 05-knowledge (undo per day), archive after 30 days.",
169
+ "ocean harvest [--date YYYY-MM-DD | --pending] [--yes] | archive [--days N] [--yes] | undo <YYYY-MM-DD>",
170
+ ],
171
+ telemetry: [
172
+ "Find recurring errors and failing providers in recent sessions; propose them as backlog lines.",
173
+ "ocean telemetry [--days N] [--yes]",
174
+ ],
175
+ express: [
176
+ "Draft a CV section, LinkedIn post or scholarship paragraph from your milestones into 00-inbox/drafts/.",
177
+ "ocean express cv|linkedin|scholarship [--dry-run]",
178
+ ],
179
+ note: [
180
+ "Capture a thought into 00-inbox/captures with the capture frontmatter.",
181
+ 'ocean note "<text>"',
182
+ ],
151
183
  handoff: [
152
184
  "Create, show and list handoffs between sessions.",
153
185
  "ocean handoff create [--task <id>] [--session <id>] [--next <action>]|show <id>|context <id>|list [--task <id>] [--project <id>]",
@@ -170,7 +202,7 @@ export const commandHelp = {
170
202
  ],
171
203
  obsidian: [
172
204
  "Connect, sync and write to an Obsidian vault (read-only unless --read-write).",
173
- "ocean obsidian connect <vault-path> [--read-write]|discover|sync|watch|inbox|write|conflicts resolve <id> --keep=vault|ocean",
205
+ "ocean obsidian connect <vault-path> [--read-write]|discover|sync|templates [--yes]|watch|inbox|write|conflicts resolve <id> --keep=vault|ocean",
174
206
  ],
175
207
  hook: [
176
208
  "Session hooks the AI clients call; session-end reads its payload from stdin.",
@@ -0,0 +1,33 @@
1
+ import { decayInterests, interestFeedback, proposeDiscoveredInterests, proposeSignalInterests, } from "@ocean/services/brief/interest-discovery.js";
2
+ const USAGE = "Usage: ocean interests discover [--yes] | signals [--weeks N] [--yes] | decay [--weeks N] [--yes] | keep <name> | skip <name>";
3
+ // `ocean interests` (T-314): discover candidate interests from registered projects, decay the
4
+ // ones with no signal, and record keep/skip feedback on brief items.
5
+ export async function runInterestsCommand(args) {
6
+ const [action, ...rest] = args;
7
+ const apply = args.includes("--yes");
8
+ let result;
9
+ if (action === "discover")
10
+ result = await proposeDiscoveredInterests({ apply });
11
+ else if (action === "signals") {
12
+ const at = args.indexOf("--weeks");
13
+ const weeks = at >= 0 ? Number(args[at + 1]) : undefined;
14
+ if (weeks !== undefined && !(weeks > 0))
15
+ throw new Error(USAGE);
16
+ result = await proposeSignalInterests({ apply, weeks });
17
+ }
18
+ else if (action === "decay") {
19
+ const at = args.indexOf("--weeks");
20
+ const weeks = at >= 0 ? Number(args[at + 1]) : undefined;
21
+ if (weeks !== undefined && !(weeks > 0))
22
+ throw new Error(USAGE);
23
+ result = await decayInterests({ apply, weeks });
24
+ }
25
+ else if ((action === "keep" || action === "skip") && rest.length)
26
+ result = await interestFeedback(rest.join(" "), action);
27
+ else
28
+ throw new Error(USAGE);
29
+ console.log(JSON.stringify(result, null, 2));
30
+ if (["discover", "signals", "decay"].includes(action) && !apply)
31
+ console.error("Dry run: pass --yes to apply.");
32
+ }
33
+ //# sourceMappingURL=interests-command.js.map
@@ -2,7 +2,10 @@ import { readFile } from "node:fs/promises";
2
2
  import { evaluateRecall, } from "@ocean/brain/brain/brain-eval.js";
3
3
  import { brainIndexPath, computeCorpusHash, reindexBrain, } from "@ocean/brain/brain/brain-reindex.js";
4
4
  import { brainNeighbors, brainRead, brainSearch, } from "@ocean/brain/brain/brain-service.js";
5
+ import { migrateBrainDumps } from "@ocean/brain/memory/brain-dump.js";
6
+ import { flattenWorkspace } from "@ocean/brain/memory/frontmatter-flatten.js";
5
7
  import { doctorMemoryIndexes, syncMemoryIndexes, } from "@ocean/brain/memory/index-sync.js";
8
+ import { archiveRetiredLessons } from "@ocean/brain/memory/lessons.js";
6
9
  import { memorySettings, sessionFactsEnabled, setSessionFacts, } from "@ocean/brain/memory/memory-audit.js";
7
10
  import { memoryDigest } from "@ocean/brain/memory/memory-digest.js";
8
11
  import { HARVEST_SOURCES, harvestMemory, importClaudeExport, } from "@ocean/brain/memory/memory-harvest.js";
@@ -207,12 +210,16 @@ async function runReview(args) {
207
210
  }
208
211
  if ((verb === "approve" || verb === "reject") && id) {
209
212
  const result = verb === "approve"
210
- ? await approveCandidate({ id, to: flagValue(args, "--to") })
213
+ ? await approveCandidate({
214
+ id,
215
+ to: flagValue(args, "--to"),
216
+ type: flagValue(args, "--type"),
217
+ })
211
218
  : await rejectCandidate(id);
212
219
  console.log(JSON.stringify(result, null, 2));
213
220
  return;
214
221
  }
215
- console.error("Usage: ocean memory review [list] [--project <id>] [--json] | approve <id> [--to <record path>] | reject <id>");
222
+ console.error("Usage: ocean memory review [list] [--project <id>] [--json] | approve <id> [--type <fact type> | --to <record path>] | reject <id>");
216
223
  process.exitCode = 1;
217
224
  }
218
225
  // Recall@k over a JSON list of {question, expect, project?}; fails below --min.
@@ -281,6 +288,32 @@ export async function runMemoryCommand(action, args) {
281
288
  }
282
289
  if (action === "eval")
283
290
  return runEval(args);
291
+ if (action === "archive-retired") {
292
+ // T-314: retired lessons out of the index, into lessons/archive/ (kept).
293
+ const moved = await archiveRetiredLessons({
294
+ apply: args.includes("--yes"),
295
+ });
296
+ console.log(JSON.stringify({ moved: moved.length, files: moved }, null, 2));
297
+ if (!args.includes("--yes"))
298
+ console.error("Dry run: pass --yes to move them to lessons/archive/.");
299
+ return;
300
+ }
301
+ if (action === "migrate-sessions") {
302
+ // T-314: brain-dump files become session records in 01-daily/sessions/YYYY-MM/.
303
+ const result = await migrateBrainDumps({ apply: args.includes("--yes") });
304
+ console.log(JSON.stringify(result, null, 2));
305
+ if (!args.includes("--yes"))
306
+ console.error("Dry run: pass --yes to move them (never deleted).");
307
+ return;
308
+ }
309
+ if (action === "flatten") {
310
+ // T-314: move nested `metadata:` frontmatter to top level, for Obsidian Properties/Bases.
311
+ const result = await flattenWorkspace({ apply: args.includes("--yes") });
312
+ console.log(JSON.stringify(result, null, 2));
313
+ if (!args.includes("--yes"))
314
+ console.error("Dry run: pass --yes to rewrite them (originals are copied to the archive).");
315
+ return;
316
+ }
284
317
  if (action === "digest") {
285
318
  const lines = await memoryDigest({ stale: await indexIsStale() });
286
319
  console.log(lines.length ? lines.join("\n") : "memory: nothing to review");
@@ -296,7 +329,8 @@ export async function runMemoryCommand(action, args) {
296
329
  return runFacts(args);
297
330
  if (action === "session-facts") {
298
331
  // Automatic fact capture from session transcripts (T-313): show or set the owner's answer.
299
- const choice = args[1];
332
+ // `args` starts after the action: `ocean memory session-facts on` → ["on"].
333
+ const choice = args[0];
300
334
  if (choice === "on" || choice === "off")
301
335
  await setSessionFacts(choice === "on");
302
336
  else if (choice !== undefined) {
@@ -0,0 +1,7 @@
1
+ import { writeCapture } from "@ocean/services/obsidian/folder-templates.js";
2
+ // `ocean note "<text>"` (T-314): capture a thought from the terminal into the inbox.
3
+ export async function runNoteCommand(args) {
4
+ const file = await writeCapture(args.join(" "));
5
+ console.log(file);
6
+ }
7
+ //# sourceMappingURL=note-command.js.map
@@ -2,7 +2,7 @@ import { chmod, mkdir, readdir, readFile, writeFile } from "node:fs/promises";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
4
  import { registryFile } from "@ocean/core/shared/fs-utils.js";
5
- import { DAILY_DIR, INBOX_DIR, KNOWLEDGE_DIR, liveEngineEntry, oceanPath, oceanRoot, PERSONAL_DIR, projectDir, REGISTRY_DIR, SYSTEM_DIR, TEMPLATES_DIR, WORKSPACE_PROJECT_ID, } from "@ocean/core/shared/paths.js";
5
+ import { DAILY_DIR, INBOX_DIR, KNOWLEDGE_DIR, liveEngineEntry, NOTES_DIR, oceanPath, oceanRoot, PERSONAL_DIR, projectDir, REGISTRY_DIR, SYSTEM_DIR, TEMPLATES_DIR, WORKSPACE_PROJECT_ID, } from "@ocean/core/shared/paths.js";
6
6
  import { connectObsidianVault } from "@ocean/services/obsidian/vault-discovery.js";
7
7
  import { seedWorkspaceTemplate } from "../../application/layout/workspace-template.js";
8
8
  import { installShellIntegration, syncProviderWrappers, } from "../../infrastructure/wrappers/wrapper-manager.js";
@@ -12,6 +12,7 @@ const personalDirectories = [
12
12
  DAILY_DIR,
13
13
  INBOX_DIR,
14
14
  TEMPLATES_DIR,
15
+ NOTES_DIR,
15
16
  ];
16
17
  const REGISTRY_FILES = [
17
18
  "providers.json",
@@ -0,0 +1,23 @@
1
+ import { openSessionStore } from "@ocean/loop/infrastructure/persistence/session-store.js";
2
+ import { analyzeSessions, proposeTelemetry, } from "@ocean/services/journey/telemetry.js";
3
+ // `ocean telemetry [--days N] [--yes]` (T-314): recurring errors and failing providers in the
4
+ // last N days (30) of sessions, proposed as backlog lines for review; a dry run until --yes.
5
+ export async function runTelemetryCommand(args) {
6
+ const at = args.indexOf("--days");
7
+ const days = at >= 0 ? Number(args[at + 1]) : 30;
8
+ if (!(days > 0))
9
+ throw new Error("Usage: ocean telemetry [--days N] [--yes]");
10
+ const since = new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString();
11
+ const store = await openSessionStore();
12
+ try {
13
+ const findings = analyzeSessions(store.list(), (id) => store.listEvents(id), since);
14
+ const result = await proposeTelemetry(findings, args.includes("--yes"));
15
+ console.log(JSON.stringify({ findings, proposed: result }, null, 2));
16
+ if (!args.includes("--yes"))
17
+ console.error("Dry run: pass --yes to propose them as backlog lines.");
18
+ }
19
+ finally {
20
+ store.close();
21
+ }
22
+ }
23
+ //# sourceMappingURL=telemetry-command.js.map
@@ -3,7 +3,7 @@ import { mkdir, readdir, readFile, stat, writeFile } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { INDEX_DIR, KNOWLEDGE_DIR, listProjectDirs, oceanRoot, resolveWithin, STORE_DIR, } from "@ocean/core/shared/paths.js";
5
5
  import { basenameStem, chunkBody, extractWikilinks, normalizeForSearch, normalizeRecord, } from "./brain-markdown.js";
6
- const STORES = ["memory", "knowledge"];
6
+ const STORES = ["memory", "knowledge", "notes", "sessions", "briefs"];
7
7
  const MAX_FILES = 10_000;
8
8
  async function walk(root, depth = 0) {
9
9
  if (depth === 0) {
@@ -112,6 +112,9 @@ export async function reindexBrain(options) {
112
112
  if (totalSeen > MAX_FILES)
113
113
  throw new Error(`brain reindex found more than ${MAX_FILES} markdown files — refusing to index an unbounded corpus`);
114
114
  const source = await readFile(file, "utf8");
115
+ // A retired record (a superseded lesson or decision) stays on disk but out of search (T-314).
116
+ if (/^status:\s*["']?retired["']?\s*$/m.test(source.split(/\r?\n---/, 1)[0]))
117
+ continue;
115
118
  const { record, conformance, body, rawScope } = normalizeRecord(relative, source);
116
119
  const links = extractWikilinks(body).map((link) => ({
117
120
  targetRaw: link.target,
@@ -14,6 +14,9 @@ function assertScoped(reader) {
14
14
  throw new BrainIndexStaleError(`brain index schema ${reader.meta.schemaVersion} predates record scopes — run \`ocean memory reindex\``);
15
15
  }
16
16
  const RRF_K = 60;
17
+ // The owner's own notes outrank what agents wrote on the same question (T-314).
18
+ const HUMAN_BOOST = 1.5;
19
+ const isHumanNote = (storePath) => storePath.startsWith("notes/");
17
20
  function snippetOf(text, maxLen = 240) {
18
21
  const trimmed = text.trim().replace(/\s+/g, " ");
19
22
  return trimmed.length > maxLen ? `${trimmed.slice(0, maxLen - 1)}…` : trimmed;
@@ -96,7 +99,13 @@ export async function brainSearch(options) {
96
99
  }
97
100
  }
98
101
  const ranked = [...byDoc.entries()]
99
- .map(([docId, entry]) => ({ docId, ...entry }))
102
+ .map(([docId, entry]) => ({
103
+ docId,
104
+ ...entry,
105
+ score: isHumanNote(String(reader.getDoc(docId)?.path ?? ""))
106
+ ? entry.score * HUMAN_BOOST
107
+ : entry.score,
108
+ }))
100
109
  .sort((a, b) => b.score - a.score || a.docId - b.docId);
101
110
  const results = [];
102
111
  for (const item of ranked) {
@@ -128,6 +137,7 @@ export async function brainSearch(options) {
128
137
  snippet: chunk ? snippetOf(String(chunk.text)) : "",
129
138
  score: Math.round(item.score * 1_000_000) / 1_000_000,
130
139
  matchedBy: item.fts && item.vec ? "both" : item.vec ? "vector" : "fts",
140
+ origin: isHumanNote(String(doc.path)) ? "human" : "agent",
131
141
  });
132
142
  if (results.length >= limit)
133
143
  break;