@amoree-code/ocean 1.6.1 → 1.7.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.
- package/README.md +9 -1
- package/dist/application/clients/desktop-watcher.js +234 -0
- package/dist/application/clients/opencode-plugin.js +4 -3
- package/dist/application/layout/layout-plan.js +1 -0
- package/dist/application/onboarding/steps.js +20 -1
- package/dist/infrastructure/desktop/claude-export.js +84 -0
- package/dist/infrastructure/desktop/desktop-chat.js +165 -0
- package/dist/infrastructure/desktop/indexeddb.js +158 -0
- package/dist/infrastructure/desktop/leveldb.js +247 -0
- package/dist/infrastructure/desktop/snappy.js +74 -0
- package/dist/infrastructure/providers/claude-sdk.js +16 -0
- package/dist/infrastructure/providers/session-facts-completer.js +3 -0
- package/dist/interfaces/cli/brief-command.js +17 -0
- package/dist/interfaces/cli/capture-command.js +1 -1
- package/dist/interfaces/cli/clients-command.js +15 -2
- package/dist/interfaces/cli/command-registry.js +29 -2
- package/dist/interfaces/cli/desktop-command.js +124 -0
- package/dist/interfaces/cli/distill-command.js +36 -0
- package/dist/interfaces/cli/express-command.js +18 -0
- package/dist/interfaces/cli/help-command.js +30 -2
- package/dist/interfaces/cli/interests-command.js +33 -0
- package/dist/interfaces/cli/memory-command.js +37 -3
- package/dist/interfaces/cli/note-command.js +7 -0
- package/dist/interfaces/cli/setup-command.js +2 -1
- package/dist/interfaces/cli/telemetry-command.js +23 -0
- package/node_modules/@ocean/brain/dist/brain/brain-reindex.js +4 -1
- package/node_modules/@ocean/brain/dist/brain/brain-service.js +11 -1
- package/node_modules/@ocean/brain/dist/memory/brain-dump.js +73 -24
- package/node_modules/@ocean/brain/dist/memory/fact-routing.js +54 -0
- package/node_modules/@ocean/brain/dist/memory/frontmatter-flatten.js +89 -0
- package/node_modules/@ocean/brain/dist/memory/lessons.js +20 -0
- package/node_modules/@ocean/brain/dist/memory/memory-paths.js +3 -1
- package/node_modules/@ocean/brain/dist/memory/memory-review.js +19 -2
- package/node_modules/@ocean/brain/dist/memory/memory-write.js +45 -3
- package/node_modules/@ocean/brain/dist/memory/people.js +70 -0
- package/node_modules/@ocean/brain/dist/memory/routing.json +39 -0
- package/node_modules/@ocean/brain/dist/memory/session-facts.js +7 -1
- package/node_modules/@ocean/brain/dist/memory/session-promotion.js +1 -1
- package/node_modules/@ocean/brain/package.json +1 -1
- package/node_modules/@ocean/context/package.json +1 -1
- package/node_modules/@ocean/core/dist/shared/paths.js +7 -0
- package/node_modules/@ocean/core/package.json +1 -1
- package/node_modules/@ocean/loop/dist/handoff/handoff-service.js +5 -1
- package/node_modules/@ocean/loop/dist/hooks/desktop-facts.js +154 -0
- package/node_modules/@ocean/loop/dist/hooks/session-end-hook.js +1 -1
- package/node_modules/@ocean/loop/package.json +1 -1
- package/node_modules/@ocean/market/package.json +1 -1
- package/node_modules/@ocean/services/dist/brief/brief.js +218 -0
- package/node_modules/@ocean/services/dist/brief/interest-discovery.js +236 -0
- package/node_modules/@ocean/services/dist/brief/source-registry.json +35 -0
- package/node_modules/@ocean/services/dist/distill/distill.js +258 -0
- package/node_modules/@ocean/services/dist/doctor/workspace-doctor.js +129 -8
- package/node_modules/@ocean/services/dist/express/express.js +99 -0
- package/node_modules/@ocean/services/dist/infrastructure/mcp/ocean-server.js +17 -1
- package/node_modules/@ocean/services/dist/journey/telemetry.js +81 -0
- package/node_modules/@ocean/services/dist/obsidian/folder-templates.js +82 -0
- package/node_modules/@ocean/services/dist/onboarding/onboarding.js +62 -0
- package/node_modules/@ocean/services/package.json +1 -1
- package/ocean-marketplace.json +46 -28
- package/package.json +7 -7
- package/skills/core/weekly-review/SKILL.md +24 -0
- package/skills/index.json +6 -0
- package/templates/workspace/02-personal/education/study/study.base +15 -0
- package/templates/workspace/02-personal/milestones/milestones.base +14 -0
- package/templates/workspace/02-personal/people/people.base +18 -0
- package/templates/workspace/06-templates/TEMPLATES.md +12 -0
- package/templates/workspace/06-templates/capture.md +9 -0
- package/templates/workspace/06-templates/daily.md +13 -0
- package/templates/workspace/06-templates/decision.md +8 -0
- package/templates/workspace/06-templates/failure.md +13 -0
- package/templates/workspace/06-templates/intelligence.md +7 -0
- package/templates/workspace/06-templates/interest.md +13 -0
- package/templates/workspace/06-templates/lesson.md +16 -0
- package/templates/workspace/06-templates/milestone.md +10 -0
- package/templates/workspace/06-templates/note.md +8 -0
- package/templates/workspace/06-templates/person.md +15 -0
- package/templates/workspace/06-templates/session.md +10 -0
- package/templates/workspace/06-templates/solution.md +14 -0
- package/templates/workspace/06-templates/study.md +14 -0
- package/templates/workspace/07-notes/.gitkeep +0 -0
- 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,22 @@ 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 { runExpressCommand } from "./express-command.js";
|
|
54
60
|
import { gatewayFindings } from "./gateway-findings.js";
|
|
55
61
|
import { runLifecycleCommand, runPolicyCommand } from "./governance-command.js";
|
|
56
62
|
import { runHandoffCommand } from "./handoff-command.js";
|
|
57
63
|
import { runIdeaCommand } from "./idea-command.js";
|
|
58
64
|
import { intercept } from "./intercept-command.js";
|
|
65
|
+
import { runInterestsCommand } from "./interests-command.js";
|
|
59
66
|
import { runLayoutCommand } from "./layout-command.js";
|
|
60
67
|
import { runMarketCommand } from "./market-command.js";
|
|
61
68
|
import { runMcpGatewayCommand } from "./mcp-gateway-command.js";
|
|
62
69
|
import { runMcpStatusCommand } from "./mcp-status-command.js";
|
|
63
70
|
import { runMemoryCommand } from "./memory-command.js";
|
|
64
71
|
import { runMigrateCommand } from "./migrate-command.js";
|
|
72
|
+
import { runNoteCommand } from "./note-command.js";
|
|
65
73
|
import { runObserveCommand } from "./observe-command.js";
|
|
66
74
|
import { manageClients, runOnboardCommand } from "./onboard-command.js";
|
|
67
75
|
import { runOperateCommand } from "./operate-command.js";
|
|
@@ -71,6 +79,7 @@ import { runningServerFindings } from "./running-server-findings.js";
|
|
|
71
79
|
import { insideFactsCall, runSessionFactsCommand, startSessionFacts, } from "./session-facts-command.js";
|
|
72
80
|
import { parseSetupArgs, SETUP_USAGE, setup } from "./setup-command.js";
|
|
73
81
|
import { runTasksCommand } from "./tasks-command.js";
|
|
82
|
+
import { runTelemetryCommand } from "./telemetry-command.js";
|
|
74
83
|
// brain_search over MCP uses vectors when the local embedder answers (T-307), and full text when
|
|
75
84
|
// it does not; a working embedder is kept, a failure is retried on the next search.
|
|
76
85
|
function mcpEmbedder() {
|
|
@@ -354,16 +363,27 @@ async function commandObsidian() {
|
|
|
354
363
|
"connect",
|
|
355
364
|
"discover",
|
|
356
365
|
"sync",
|
|
366
|
+
"templates",
|
|
357
367
|
"watch",
|
|
358
368
|
"inbox",
|
|
359
369
|
"write",
|
|
360
370
|
"conflicts",
|
|
361
371
|
].includes(action)) {
|
|
362
|
-
console.error("Usage: ocean obsidian connect <vault-path> [--read-write]|discover|sync|watch|inbox|write|conflicts resolve <id> --keep=vault|ocean");
|
|
372
|
+
console.error("Usage: ocean obsidian connect <vault-path> [--read-write]|discover|sync|templates [--yes]|watch|inbox|write|conflicts resolve <id> --keep=vault|ocean");
|
|
363
373
|
process.exitCode = 1;
|
|
364
374
|
}
|
|
365
375
|
else {
|
|
366
376
|
try {
|
|
377
|
+
if (action === "templates") {
|
|
378
|
+
// T-314: Templater folder templates generated from routing.json; a dry run until --yes.
|
|
379
|
+
const result = await syncFolderTemplates({
|
|
380
|
+
apply: process.argv.includes("--yes"),
|
|
381
|
+
});
|
|
382
|
+
console.log(JSON.stringify(result, null, 2));
|
|
383
|
+
if (!result.written)
|
|
384
|
+
console.error("Dry run: pass --yes to write the Templater config.");
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
367
387
|
if (action === "connect") {
|
|
368
388
|
const vaultPath = process.argv[4];
|
|
369
389
|
if (!vaultPath)
|
|
@@ -950,7 +970,7 @@ async function commandUpdateOrRemove(command) {
|
|
|
950
970
|
async function commandDoctor() {
|
|
951
971
|
const report = await workspaceReport(defaultWrapperManager);
|
|
952
972
|
// 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()));
|
|
973
|
+
report.findings.push(...(await clientFindings()), ...(await desktopWatcherFindings()), ...(await nativeFindings()), ...(await browserFindings()), ...(await gatewayFindings()), ...(await runningServerFindings()));
|
|
954
974
|
if (process.argv.includes("--json"))
|
|
955
975
|
console.log(JSON.stringify(report, null, 2));
|
|
956
976
|
else
|
|
@@ -1204,6 +1224,7 @@ export const commandRegistry = {
|
|
|
1204
1224
|
layout: commandLayout,
|
|
1205
1225
|
memory: commandMemory,
|
|
1206
1226
|
pull: () => runPullCommand(process.argv.slice(3)),
|
|
1227
|
+
desktop: () => runDesktopCommand(process.argv.slice(3)),
|
|
1207
1228
|
mcp: commandMcp,
|
|
1208
1229
|
market: commandMarket,
|
|
1209
1230
|
obsidian: commandObsidian,
|
|
@@ -1215,6 +1236,12 @@ export const commandRegistry = {
|
|
|
1215
1236
|
intent: commandIntent,
|
|
1216
1237
|
operate: commandOperate,
|
|
1217
1238
|
idea: commandIdea,
|
|
1239
|
+
note: () => runNoteCommand(process.argv.slice(3)),
|
|
1240
|
+
brief: () => runBriefCommand(process.argv.slice(3)),
|
|
1241
|
+
interests: () => runInterestsCommand(process.argv.slice(3)),
|
|
1242
|
+
distill: () => runDistillCommand(process.argv.slice(3)),
|
|
1243
|
+
telemetry: () => runTelemetryCommand(process.argv.slice(3)),
|
|
1244
|
+
express: () => runExpressCommand(process.argv.slice(3)),
|
|
1218
1245
|
daily: commandDaily,
|
|
1219
1246
|
schedule: commandSchedule,
|
|
1220
1247
|
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
|
|
@@ -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, 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,30 @@ 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
|
+
telemetry: [
|
|
168
|
+
"Find recurring errors and failing providers in recent sessions; propose them as backlog lines.",
|
|
169
|
+
"ocean telemetry [--days N] [--yes]",
|
|
170
|
+
],
|
|
171
|
+
express: [
|
|
172
|
+
"Draft a CV section, LinkedIn post or scholarship paragraph from your milestones into 00-inbox/drafts/.",
|
|
173
|
+
"ocean express cv|linkedin|scholarship [--dry-run]",
|
|
174
|
+
],
|
|
175
|
+
note: [
|
|
176
|
+
"Capture a thought into 00-inbox/captures with the capture frontmatter.",
|
|
177
|
+
'ocean note "<text>"',
|
|
178
|
+
],
|
|
151
179
|
handoff: [
|
|
152
180
|
"Create, show and list handoffs between sessions.",
|
|
153
181
|
"ocean handoff create [--task <id>] [--session <id>] [--next <action>]|show <id>|context <id>|list [--task <id>] [--project <id>]",
|
|
@@ -170,7 +198,7 @@ export const commandHelp = {
|
|
|
170
198
|
],
|
|
171
199
|
obsidian: [
|
|
172
200
|
"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",
|
|
201
|
+
"ocean obsidian connect <vault-path> [--read-write]|discover|sync|templates [--yes]|watch|inbox|write|conflicts resolve <id> --keep=vault|ocean",
|
|
174
202
|
],
|
|
175
203
|
hook: [
|
|
176
204
|
"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({
|
|
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
|
-
|
|
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]) => ({
|
|
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;
|