@amoree-code/ocean 2.21.0 → 2.23.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.
@@ -0,0 +1,220 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { mkdir, writeFile } from "node:fs/promises";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { crc32, deflateSync } from "node:zlib";
6
+ import { enginePath } from "@ocean/core/shared/paths.js";
7
+ import { oceanServerEntry } from "./clients.js";
8
+ import { storedZip } from "./zip.js";
9
+ // One-click bundles (T-328 phase 4): Ocean as a Claude Desktop Extension (`Ocean.mcpb`, the MCPB
10
+ // manifest 0.3 format: name, icon, a node server Desktop runs with its own Node) and as a Claude
11
+ // plugin (`ocean.plugin`: `.claude-plugin/plugin.json` plus the core `ocean-memory` skill) for the
12
+ // account's Customize → Plugins upload, which loads in chat, Cowork and Claude Code.
13
+ //
14
+ // Neither carries Ocean itself. The extension's server is a launcher that starts the Ocean already
15
+ // installed on this machine (`ocean mcp serve`), so the memory stays local and updates with Ocean.
16
+ // The plugin carries no connector or hook: Desktop chat and Cowork already reach Ocean through
17
+ // its config entry, Claude Code through its own, and a second copy would show every tool twice.
18
+ export const DESKTOP_EXTENSION_FILE = "Ocean.mcpb";
19
+ export const CLAUDE_PLUGIN_FILE = "ocean.plugin";
20
+ const AUTHOR = {
21
+ name: "AMEER ABDULKAREEM JABBAR LAMI",
22
+ url: "https://github.com/amoree-code",
23
+ };
24
+ const REPOSITORY = "https://github.com/amoree-code/ocean";
25
+ const DESCRIPTION = "Your local memory for every AI client: projects, tasks, decisions and preferences, kept on your computer.";
26
+ export const DESKTOP_EXTENSION_STEPS = [
27
+ `Double-click ${DESKTOP_EXTENSION_FILE}, or in Claude Desktop: Settings → Extensions → Advanced settings → Install Extension`,
28
+ "Install, then make sure Ocean's toggle is on",
29
+ ];
30
+ export const CLAUDE_PLUGIN_STEPS = [
31
+ "In Claude: Customize → Plugins → Add → Upload plugin",
32
+ `Pick ${CLAUDE_PLUGIN_FILE}; it reaches chat, Cowork and Claude Code under the name Ocean`,
33
+ "Skills need Settings → Capabilities → Code execution on",
34
+ ];
35
+ // The extension's server: starts the installed Ocean with the command baked in at build time
36
+ // and hands it stdio. Plain CommonJS so Desktop's bundled Node runs it with no package.json.
37
+ export const LAUNCHER = `"use strict";
38
+ // Ocean Desktop Extension launcher: starts the Ocean installed on this computer.
39
+ const { spawn } = require("node:child_process");
40
+ const env = { ...process.env };
41
+ const command = env.OCEAN_MCPB_COMMAND || "ocean";
42
+ let args = ["mcp", "serve"];
43
+ try {
44
+ if (env.OCEAN_MCPB_ARGS) args = JSON.parse(env.OCEAN_MCPB_ARGS);
45
+ } catch {}
46
+ delete env.OCEAN_MCPB_COMMAND;
47
+ delete env.OCEAN_MCPB_ARGS;
48
+ const child = spawn(command, args, {
49
+ env,
50
+ stdio: "inherit",
51
+ shell: process.platform === "win32" && command === "ocean",
52
+ });
53
+ child.on("error", (error) => {
54
+ process.stderr.write(
55
+ "Ocean: cannot start " + command + ": " + error.message +
56
+ "\\nInstall Ocean and run \`ocean setup\`, then build the extension again with \`ocean clients bundles\`.\\n",
57
+ );
58
+ process.exit(1);
59
+ });
60
+ child.on("exit", (code, signal) => process.exit(code ?? (signal ? 1 : 0)));
61
+ for (const signal of ["SIGINT", "SIGTERM"])
62
+ process.on(signal, () => child.kill(signal));
63
+ `;
64
+ export function desktopExtensionManifest(version, entry = oceanServerEntry()) {
65
+ return {
66
+ manifest_version: "0.3",
67
+ name: "ocean",
68
+ display_name: "Ocean",
69
+ version,
70
+ description: DESCRIPTION,
71
+ long_description: "Ocean keeps one memory on your computer that every AI client shares. This extension connects Claude Desktop to the Ocean installed here: its tools search and read your notes, tasks and past decisions, and propose new facts for your review.",
72
+ author: AUTHOR,
73
+ repository: { type: "git", url: `${REPOSITORY}.git` },
74
+ homepage: REPOSITORY,
75
+ documentation: `${REPOSITORY}/blob/main/kernel/docs/mcp.md`,
76
+ support: `${REPOSITORY}/issues`,
77
+ icon: "icon.png",
78
+ server: {
79
+ type: "node",
80
+ entry_point: "server/index.js",
81
+ mcp_config: {
82
+ command: "node",
83
+ // MCPB fills ${__dirname} with the extension folder; it is not a JS template.
84
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: MCPB placeholder
85
+ args: ["${__dirname}/server/index.js"],
86
+ env: {
87
+ OCEAN_MCPB_COMMAND: entry.command,
88
+ OCEAN_MCPB_ARGS: JSON.stringify(entry.args ?? []),
89
+ },
90
+ },
91
+ },
92
+ tools_generated: true,
93
+ keywords: ["memory", "knowledge", "local-first", "tasks", "notes"],
94
+ license: "MIT",
95
+ compatibility: { platforms: ["darwin", "win32", "linux"] },
96
+ };
97
+ }
98
+ function coreSkill() {
99
+ return readFileSync(path.join(enginePath("skills"), "core", "ocean-memory", "SKILL.md"));
100
+ }
101
+ const json = (value) => Buffer.from(`${JSON.stringify(value, null, 2)}\n`, "utf8");
102
+ export function desktopExtension(version, entry = oceanServerEntry()) {
103
+ return storedZip([
104
+ ["manifest.json", json(desktopExtensionManifest(version, entry))],
105
+ ["icon.png", oceanIcon()],
106
+ ["server/", Buffer.alloc(0)],
107
+ ["server/index.js", Buffer.from(LAUNCHER, "utf8")],
108
+ ]);
109
+ }
110
+ export function claudePluginManifest(version) {
111
+ return {
112
+ name: "ocean",
113
+ version,
114
+ description: DESCRIPTION,
115
+ author: AUTHOR,
116
+ homepage: REPOSITORY,
117
+ repository: REPOSITORY,
118
+ license: "MIT",
119
+ keywords: ["memory", "knowledge", "local-first"],
120
+ };
121
+ }
122
+ export function claudePlugin(version, skill = coreSkill()) {
123
+ return storedZip([
124
+ [".claude-plugin/", Buffer.alloc(0)],
125
+ [".claude-plugin/plugin.json", json(claudePluginManifest(version))],
126
+ ["skills/", Buffer.alloc(0)],
127
+ ["skills/ocean-memory/", Buffer.alloc(0)],
128
+ ["skills/ocean-memory/SKILL.md", skill],
129
+ ]);
130
+ }
131
+ export async function writeBundles(version, dir = path.join(os.homedir(), "Downloads")) {
132
+ await mkdir(dir, { recursive: true });
133
+ const extension = path.join(dir, DESKTOP_EXTENSION_FILE);
134
+ const plugin = path.join(dir, CLAUDE_PLUGIN_FILE);
135
+ await writeFile(extension, desktopExtension(version));
136
+ await writeFile(plugin, claudePlugin(version));
137
+ return { extension, plugin };
138
+ }
139
+ // True when Claude Desktop's own config already starts Ocean, so installing the extension too
140
+ // would give Desktop two Ocean servers.
141
+ export function desktopConfigHasOcean(home = os.homedir(), platform = process.platform) {
142
+ const base = platform === "darwin"
143
+ ? path.join(home, "Library", "Application Support", "Claude")
144
+ : platform === "win32"
145
+ ? path.join(process.env.APPDATA ?? path.join(home, "AppData", "Roaming"), "Claude")
146
+ : path.join(home, ".config", "Claude");
147
+ try {
148
+ const config = JSON.parse(readFileSync(path.join(base, "claude_desktop_config.json"), "utf8"));
149
+ return Boolean(config.mcpServers?.ocean);
150
+ }
151
+ catch {
152
+ return false;
153
+ }
154
+ }
155
+ // Ocean's icon, drawn here so the repository carries no binary: a rounded square in a deep-blue
156
+ // to teal gradient with two white waves, as an RGBA PNG.
157
+ export function oceanIcon(size = 512) {
158
+ const pixels = Buffer.alloc(size * size * 4);
159
+ const radius = size * 0.22;
160
+ const top = [11, 61, 145];
161
+ const bottom = [15, 163, 177];
162
+ const waves = [
163
+ { y: 0.42, amp: 0.06, len: 0.5, phase: 0, width: 0.055, alpha: 1 },
164
+ { y: 0.62, amp: 0.06, len: 0.5, phase: Math.PI, width: 0.055, alpha: 0.75 },
165
+ ];
166
+ const clamp = (v) => Math.max(0, Math.min(1, v));
167
+ for (let py = 0; py < size; py++)
168
+ for (let px = 0; px < size; px++) {
169
+ const x = px + 0.5;
170
+ const y = py + 0.5;
171
+ // Rounded-square coverage from the signed distance to its edge.
172
+ const qx = Math.abs(x - size / 2) - (size / 2 - radius);
173
+ const qy = Math.abs(y - size / 2) - (size / 2 - radius);
174
+ const outside = Math.hypot(Math.max(qx, 0), Math.max(qy, 0)) +
175
+ Math.min(Math.max(qx, qy), 0) -
176
+ radius;
177
+ const cover = clamp(0.5 - outside);
178
+ if (cover === 0)
179
+ continue;
180
+ const t = y / size;
181
+ let rgb = top.map((c, i) => c + (bottom[i] - c) * t);
182
+ for (const wave of waves) {
183
+ const k = (2 * Math.PI) / (wave.len * size);
184
+ const arg = k * x + wave.phase;
185
+ const curve = (wave.y + wave.amp * Math.sin(arg)) * size;
186
+ const slope = wave.amp * size * k * Math.cos(arg);
187
+ const distance = Math.abs(y - curve) / Math.sqrt(1 + slope * slope);
188
+ const ink = clamp((wave.width * size) / 2 - distance + 0.5) * wave.alpha;
189
+ rgb = rgb.map((c) => c + (255 - c) * ink);
190
+ }
191
+ const at = (py * size + px) * 4;
192
+ pixels[at] = Math.round(rgb[0]);
193
+ pixels[at + 1] = Math.round(rgb[1]);
194
+ pixels[at + 2] = Math.round(rgb[2]);
195
+ pixels[at + 3] = Math.round(cover * 255);
196
+ }
197
+ const rows = Buffer.alloc(size * (size * 4 + 1));
198
+ for (let row = 0; row < size; row++)
199
+ pixels.copy(rows, row * (size * 4 + 1) + 1, row * size * 4, (row + 1) * size * 4);
200
+ const chunk = (type, data) => {
201
+ const head = Buffer.alloc(8);
202
+ head.writeUInt32BE(data.length, 0);
203
+ head.write(type, 4, "ascii");
204
+ const crc = Buffer.alloc(4);
205
+ crc.writeUInt32BE(crc32(Buffer.concat([head.subarray(4), data])), 0);
206
+ return Buffer.concat([head, data, crc]);
207
+ };
208
+ const header = Buffer.alloc(13);
209
+ header.writeUInt32BE(size, 0);
210
+ header.writeUInt32BE(size, 4);
211
+ header[8] = 8; // bit depth
212
+ header[9] = 6; // RGBA
213
+ return Buffer.concat([
214
+ Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]),
215
+ chunk("IHDR", header),
216
+ chunk("IDAT", deflateSync(rows)),
217
+ chunk("IEND", Buffer.alloc(0)),
218
+ ]);
219
+ }
220
+ //# sourceMappingURL=bundles.js.map
@@ -2,8 +2,8 @@ import { execFileSync } from "node:child_process";
2
2
  import { mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
- import { crc32 } from "node:zlib";
6
5
  import { enginePath } from "@ocean/core/shared/paths.js";
6
+ import { storedZip } from "./zip.js";
7
7
  // Claude chat (Desktop, claude.ai, phone) runs on Anthropic's servers: it gets Ocean's tools from
8
8
  // the MCP entry Ocean writes, but it drops the server's `instructions` and runs no hooks. A skill
9
9
  // does reach it: a skill in the Claude account loads in chat, Cowork and the phone, and Claude
@@ -90,50 +90,12 @@ const run = (file, args, input) => {
90
90
  timeout: 10_000,
91
91
  });
92
92
  };
93
- // A zip of one folder holding SKILL.md, the shape Claude's skill upload takes. Stored, not
94
- // deflated: the file is small and every unzip reads method 0.
93
+ // A zip of one folder holding SKILL.md, the shape Claude's skill upload takes.
95
94
  export function chatSkillZip(skill = readFileSync(path.join(enginePath("skills"), "core", "ocean-memory", "SKILL.md"))) {
96
- const entries = [
95
+ return storedZip([
97
96
  ["ocean-memory/", Buffer.alloc(0)],
98
97
  ["ocean-memory/SKILL.md", skill],
99
- ];
100
- const local = [];
101
- const central = [];
102
- let offset = 0;
103
- for (const [name, data] of entries) {
104
- const file = Buffer.from(name, "utf8");
105
- const crc = crc32(data);
106
- const head = Buffer.alloc(30);
107
- head.writeUInt32LE(0x04034b50, 0);
108
- head.writeUInt16LE(20, 4); // version needed
109
- head.writeUInt16LE(0x0800, 6); // UTF-8 names
110
- head.writeUInt32LE(crc, 14);
111
- head.writeUInt32LE(data.length, 18);
112
- head.writeUInt32LE(data.length, 22);
113
- head.writeUInt16LE(file.length, 26);
114
- const dir = Buffer.alloc(46);
115
- dir.writeUInt32LE(0x02014b50, 0);
116
- dir.writeUInt16LE(20, 4);
117
- dir.writeUInt16LE(20, 6);
118
- dir.writeUInt16LE(0x0800, 8);
119
- dir.writeUInt32LE(crc, 16);
120
- dir.writeUInt32LE(data.length, 20);
121
- dir.writeUInt32LE(data.length, 24);
122
- dir.writeUInt16LE(file.length, 28);
123
- dir.writeUInt32LE(name.endsWith("/") ? 0x10 : 0, 38);
124
- dir.writeUInt32LE(offset, 42);
125
- local.push(head, file, data);
126
- central.push(dir, file);
127
- offset += head.length + file.length + data.length;
128
- }
129
- const centralSize = central.reduce((sum, part) => sum + part.length, 0);
130
- const end = Buffer.alloc(22);
131
- end.writeUInt32LE(0x06054b50, 0);
132
- end.writeUInt16LE(entries.length, 8);
133
- end.writeUInt16LE(entries.length, 10);
134
- end.writeUInt32LE(centralSize, 12);
135
- end.writeUInt32LE(offset, 16);
136
- return Buffer.concat([...local, ...central, end]);
98
+ ]);
137
99
  }
138
100
  // Saves the skill zip to Downloads, shows it in the file manager and brings Claude up, so the
139
101
  // step is an upload and a few clicks. Any part failing leaves the printed steps.
@@ -0,0 +1,44 @@
1
+ import { crc32 } from "node:zlib";
2
+ // A zip of the given files, each stored (method 0), not deflated: Ocean's bundles are small and
3
+ // every unzipper reads method 0. Names ending in "/" are folder entries. Claude's skill upload,
4
+ // plugin upload and Desktop Extension (.mcpb) all take this shape.
5
+ export function storedZip(entries) {
6
+ const local = [];
7
+ const central = [];
8
+ let offset = 0;
9
+ for (const [name, data] of entries) {
10
+ const file = Buffer.from(name, "utf8");
11
+ const crc = crc32(data);
12
+ const head = Buffer.alloc(30);
13
+ head.writeUInt32LE(0x04034b50, 0);
14
+ head.writeUInt16LE(20, 4); // version needed
15
+ head.writeUInt16LE(0x0800, 6); // UTF-8 names
16
+ head.writeUInt32LE(crc, 14);
17
+ head.writeUInt32LE(data.length, 18);
18
+ head.writeUInt32LE(data.length, 22);
19
+ head.writeUInt16LE(file.length, 26);
20
+ const dir = Buffer.alloc(46);
21
+ dir.writeUInt32LE(0x02014b50, 0);
22
+ dir.writeUInt16LE(20, 4);
23
+ dir.writeUInt16LE(20, 6);
24
+ dir.writeUInt16LE(0x0800, 8);
25
+ dir.writeUInt32LE(crc, 16);
26
+ dir.writeUInt32LE(data.length, 20);
27
+ dir.writeUInt32LE(data.length, 24);
28
+ dir.writeUInt16LE(file.length, 28);
29
+ dir.writeUInt32LE(name.endsWith("/") ? 0x10 : 0, 38);
30
+ dir.writeUInt32LE(offset, 42);
31
+ local.push(head, file, data);
32
+ central.push(dir, file);
33
+ offset += head.length + file.length + data.length;
34
+ }
35
+ const centralSize = central.reduce((sum, part) => sum + part.length, 0);
36
+ const end = Buffer.alloc(22);
37
+ end.writeUInt32LE(0x06054b50, 0);
38
+ end.writeUInt16LE(entries.length, 8);
39
+ end.writeUInt16LE(entries.length, 10);
40
+ end.writeUInt32LE(centralSize, 12);
41
+ end.writeUInt32LE(offset, 16);
42
+ return Buffer.concat([...local, ...central, end]);
43
+ }
44
+ //# sourceMappingURL=zip.js.map
@@ -3,6 +3,7 @@ import { memorySettings, setSessionFacts, } from "@ocean/brain/memory/memory-aud
3
3
  import { marketplacePaths } from "@ocean/market/install/default-marketplace.js";
4
4
  import { updateGatewayAccess } from "@ocean/market/mcp/mcp-gateway.js";
5
5
  import { readCallLedger, summarizeCallLedger, } from "@ocean/services/infrastructure/mcp/call-ledger.js";
6
+ import { CLAUDE_PLUGIN_STEPS, DESKTOP_EXTENSION_STEPS, desktopConfigHasOcean, writeBundles, } from "../../application/clients/bundles.js";
6
7
  import { CHAT_PLUGIN_STEPS, chatPluginAdded, openChatPluginSetup, } from "../../application/clients/chat-plugin.js";
7
8
  import { applyClients, attributeLedger, confirmClient, defaultClientEnv, gatewayDefault, planClients, readGatewayClients, recordVerification, repairClients, restoreClients, setGatewayClient, setGatewayDefault, temporaryEntryProblem, verifyClient, } from "../../application/clients/clients.js";
8
9
  import { applyDesktopWatcher, planDesktopWatcher, restoreDesktopWatcher, } from "../../application/clients/desktop-watcher.js";
@@ -10,7 +11,8 @@ import { applyHooks, planHooks, restoreHooks, } from "../../application/clients/
10
11
  import { applyNative, planNative, restoreNative, } from "../../application/clients/native.js";
11
12
  import { applyOpencodePlugin, planOpencodePlugin, restoreOpencodePlugin, } from "../../application/clients/opencode-plugin.js";
12
13
  import { buildClientStatus, formatClientStatus, } from "../../application/clients/status.js";
13
- const usage = "Usage: ocean clients status [--json] [--days <n>] | detect|plan [--json] | apply [--client <id>…] [--yes] [--session-facts on|off] | chat-plugin | verify [<id>…] | confirm <id>… --label in-app|headless|connected|blocked [--via <evidence>] [--reason <why>] | gateway [<id> on|off] [--default gateway|per-server] | allow|deny|unset <id> <server> | ledger | repair | restore [--batch <id>]";
14
+ import { oceanVersion } from "../../version.js";
15
+ const usage = "Usage: ocean clients status [--json] [--days <n>] | detect|plan [--json] | apply [--client <id>…] [--yes] [--session-facts on|off] | chat-plugin | bundles [--out <dir>] | verify [<id>…] | confirm <id>… --label in-app|headless|connected|blocked [--via <evidence>] [--reason <why>] | gateway [<id> on|off] [--default gateway|per-server] | allow|deny|unset <id> <server> | ledger | repair | restore [--batch <id>]";
14
16
  export const SESSION_FACTS_QUESTION = "Capture durable facts from your sessions automatically? It costs one small model call per session, run by the client the session was in. Every fact goes to your review queue; nothing is saved without your approval, even with auto-approve on. [y/N] ";
15
17
  // The session-facts answer, asked once (T-313): `--session-facts on|off` decides; otherwise a
16
18
  // terminal is asked; with no terminal and no saved answer it stays unset (off), and
@@ -178,6 +180,26 @@ export async function runClientsCommand(args) {
178
180
  }
179
181
  result = { added, ...(opened ?? {}) };
180
182
  }
183
+ else if (action === "bundles") {
184
+ // One-click bundles (T-328): the Claude Desktop Extension and the Claude plugin, written
185
+ // to Downloads (or --out) with the clicks to install each. Installing stays the user's.
186
+ const written = await writeBundles(await oceanVersion(), values("--out")[0]);
187
+ const duplicate = desktopConfigHasOcean();
188
+ if (!json) {
189
+ console.log(`Saved ${written.extension}`);
190
+ for (const step of DESKTOP_EXTENSION_STEPS)
191
+ console.log(` ${step}`);
192
+ if (duplicate)
193
+ console.log(" Ocean is already in claude_desktop_config.json: keep one of the two, or Desktop shows every Ocean tool twice");
194
+ console.log(`Saved ${written.plugin}`);
195
+ for (const step of CLAUDE_PLUGIN_STEPS)
196
+ console.log(` ${step}`);
197
+ if (chatPluginAdded() === true)
198
+ console.log(" An Ocean skill is already in your Claude account: remove the ocean-memory upload once the plugin is in, so the skill loads once");
199
+ return;
200
+ }
201
+ result = { ...written, desktopConfigHasOcean: duplicate };
202
+ }
181
203
  else if (action === "verify") {
182
204
  const ids = rest.filter((arg) => !arg.startsWith("--"));
183
205
  const targets = ids.length
@@ -9,6 +9,7 @@ import { resolveProfileName } from "@ocean/core/domain/profiles/runtime-config.j
9
9
  import { GUARD_FLAGS, parseGuardFlags, } from "@ocean/core/domain/runs/loop-guard.js";
10
10
  import { oceanEnv, oceanPath, oceanRoot, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
11
11
  import { autoRegisterProject, bindProject, createProject, findGitRoot, knownTaskPrefixes, listProjectBindings, migrateProjectBindings, moveProject, PROJECT_CATEGORIES, projectCategory, renameProject, renderProjectIndex, resolveProject, scanProjectManifests, unbindProjectPath, writeProjectIndex, } from "@ocean/core/shared/project-resolution.js";
12
+ import { recordSynced } from "@ocean/core/shared/visibility.js";
12
13
  import { claudeSessionEndHook, isSessionEndClient, SESSION_END_CLIENTS, } from "@ocean/loop/hooks/session-end-hook.js";
13
14
  import { isSessionStartClient, readBoundedStdin, SESSION_START_CLIENTS, sessionStartHookForClient, } from "@ocean/loop/hooks/session-start-hook.js";
14
15
  import { openSessionStore } from "@ocean/loop/infrastructure/persistence/session-store.js";
@@ -207,6 +208,8 @@ async function commandClient() {
207
208
  const clients = await repairClients().catch((error) => ({
208
209
  error: error instanceof Error ? error.message : String(error),
209
210
  }));
211
+ // T-328 phase 3: status lines show `synced <age>` from this stamp.
212
+ await recordSynced();
210
213
  console.log(JSON.stringify({
211
214
  directory: result.directory,
212
215
  providers: result.providers,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/brain",
3
- "version": "2.21.0",
3
+ "version": "2.23.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/context",
3
- "version": "2.21.0",
3
+ "version": "2.23.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -0,0 +1,68 @@
1
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { withFileLock } from "./fs-utils.js";
4
+ import { oceanPath, SYSTEM_DIR } from "./paths.js";
5
+ // VISIBILITY (T-328 phase 3): the owner can see Ocean is on without asking. A start hook notes
6
+ // which Ocean project each folder resolved to, and `ocean client sync` notes when it last ran.
7
+ // Status lines read this one small file with jq instead of starting the CLI on every refresh.
8
+ // It holds folder paths, project ids and timestamps only — never memory content.
9
+ export const VISIBILITY_MAX_FOLDERS = 50;
10
+ export function visibilityFile() {
11
+ return oceanPath(SYSTEM_DIR, "state", "visibility.json");
12
+ }
13
+ export function connectedLine(project) {
14
+ return `🌊 Ocean connected: ${project}`;
15
+ }
16
+ export async function readVisibility() {
17
+ try {
18
+ const value = JSON.parse(await readFile(visibilityFile(), "utf8"));
19
+ const folders = value?.folders && typeof value.folders === "object"
20
+ ? value.folders
21
+ : {};
22
+ return {
23
+ folders,
24
+ ...(typeof value?.syncedAt === "string"
25
+ ? { syncedAt: value.syncedAt }
26
+ : {}),
27
+ };
28
+ }
29
+ catch {
30
+ return { folders: {} };
31
+ }
32
+ }
33
+ // Never throws: a session starts and a sync finishes whether or not this could be noted.
34
+ async function updateVisibility(change) {
35
+ const file = visibilityFile();
36
+ try {
37
+ await mkdir(path.dirname(file), { recursive: true, mode: 0o700 });
38
+ await withFileLock(file, async () => {
39
+ const next = change(await readVisibility());
40
+ await writeFile(file, `${JSON.stringify(next, null, 2)}\n`, {
41
+ mode: 0o600,
42
+ });
43
+ });
44
+ }
45
+ catch {
46
+ // the next start or sync tries again
47
+ }
48
+ }
49
+ export async function recordConnected(cwd, project, now = new Date()) {
50
+ const folder = path.resolve(cwd);
51
+ await updateVisibility((state) => {
52
+ const folders = { ...state.folders };
53
+ delete folders[folder];
54
+ folders[folder] = { project, at: now.toISOString() };
55
+ // Newest last; keep only the most recent folders so the file stays small.
56
+ const kept = Object.entries(folders)
57
+ .sort(([, a], [, b]) => a.at.localeCompare(b.at))
58
+ .slice(-VISIBILITY_MAX_FOLDERS);
59
+ return { ...state, folders: Object.fromEntries(kept) };
60
+ });
61
+ }
62
+ export async function recordSynced(now = new Date()) {
63
+ await updateVisibility((state) => ({
64
+ ...state,
65
+ syncedAt: now.toISOString(),
66
+ }));
67
+ }
68
+ //# sourceMappingURL=visibility.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/core",
3
- "version": "2.21.0",
3
+ "version": "2.23.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -7,6 +7,7 @@ import { recordIssuedAck } from "@ocean/core/shared/context-ack.js";
7
7
  import { truncateUtf8 } from "@ocean/core/shared/fs-utils.js";
8
8
  import { oceanRoot, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
9
9
  import { autoRegisterProject, gitChangedFiles, projectRules, readProjectManifest, resolveProject, scanProjectManifests, } from "@ocean/core/shared/project-resolution.js";
10
+ import { connectedLine, recordConnected, } from "@ocean/core/shared/visibility.js";
10
11
  const MAX_STDIN_BYTES = 65_536;
11
12
  export async function readBoundedStdin(stream = process.stdin, maxBytes = MAX_STDIN_BYTES) {
12
13
  if (stream.isTTY)
@@ -124,7 +125,11 @@ export async function claudeSessionStartHook(payload) {
124
125
  rulesProblem = error instanceof Error ? error.message : String(error);
125
126
  }
126
127
  const bootstrap = buildOceanBootstrap(project, { rules: rules.length });
127
- await recordIssuedAck(bootstrap.ack);
128
+ const shown = project.status === "bound" ? project.projectId : project.status;
129
+ await Promise.all([
130
+ recordIssuedAck(bootstrap.ack),
131
+ recordConnected(cwd, shown),
132
+ ]);
128
133
  // Beside the 256-byte bootstrap, never inside it: the authority claim is its own line.
129
134
  const parts = [bootstrap.content, MEMORY_AUTHORITY_LINE];
130
135
  if (project.status === "bound" && rules.length)
@@ -140,6 +145,7 @@ export async function claudeSessionStartHook(payload) {
140
145
  if (warning)
141
146
  parts.push(warning);
142
147
  return {
148
+ systemMessage: connectedLine(shown),
143
149
  hookSpecificOutput: {
144
150
  hookEventName: "SessionStart",
145
151
  additionalContext: parts.join("\n"),
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/loop",
3
- "version": "2.21.0",
3
+ "version": "2.23.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/market",
3
- "version": "2.21.0",
3
+ "version": "2.23.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -872,7 +872,13 @@ export async function handleOceanMcpRequest(request, ports) {
872
872
  result: {
873
873
  protocolVersion: "2025-06-18",
874
874
  capabilities: { tools: {}, resources: {}, prompts: {} },
875
- serverInfo: { name: "ocean", version: await serverVersion() },
875
+ // `name` is the machine id; `title` (MCP 2025-06-18) is the one display name every
876
+ // client shows, under the one config key `ocean` → tool prefix `mcp__ocean__` (T-328).
877
+ serverInfo: {
878
+ name: "ocean",
879
+ title: "Ocean",
880
+ version: await serverVersion(),
881
+ },
876
882
  instructions: MEMORY_INSTRUCTIONS,
877
883
  },
878
884
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/services",
3
- "version": "2.21.0",
3
+ "version": "2.23.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -5,9 +5,9 @@
5
5
  {
6
6
  "kind": "skill",
7
7
  "name": "dev.ocean.skills.business-logic",
8
- "version": "2.21.0",
8
+ "version": "2.23.0",
9
9
  "engines": {
10
- "ocean": ">=2.21.0"
10
+ "ocean": ">=2.23.0"
11
11
  },
12
12
  "source": {
13
13
  "type": "path",
@@ -23,9 +23,9 @@
23
23
  {
24
24
  "kind": "skill",
25
25
  "name": "dev.ocean.skills.catch-up",
26
- "version": "2.21.0",
26
+ "version": "2.23.0",
27
27
  "engines": {
28
- "ocean": ">=2.21.0"
28
+ "ocean": ">=2.23.0"
29
29
  },
30
30
  "source": {
31
31
  "type": "path",
@@ -41,9 +41,9 @@
41
41
  {
42
42
  "kind": "skill",
43
43
  "name": "dev.ocean.skills.core-thinking",
44
- "version": "2.21.0",
44
+ "version": "2.23.0",
45
45
  "engines": {
46
- "ocean": ">=2.21.0"
46
+ "ocean": ">=2.23.0"
47
47
  },
48
48
  "source": {
49
49
  "type": "path",
@@ -59,9 +59,9 @@
59
59
  {
60
60
  "kind": "skill",
61
61
  "name": "dev.ocean.skills.daily-harvest",
62
- "version": "2.21.0",
62
+ "version": "2.23.0",
63
63
  "engines": {
64
- "ocean": ">=2.21.0"
64
+ "ocean": ">=2.23.0"
65
65
  },
66
66
  "source": {
67
67
  "type": "path",
@@ -77,9 +77,9 @@
77
77
  {
78
78
  "kind": "skill",
79
79
  "name": "dev.ocean.skills.design-thinking",
80
- "version": "2.21.0",
80
+ "version": "2.23.0",
81
81
  "engines": {
82
- "ocean": ">=2.21.0"
82
+ "ocean": ">=2.23.0"
83
83
  },
84
84
  "source": {
85
85
  "type": "path",
@@ -95,9 +95,9 @@
95
95
  {
96
96
  "kind": "skill",
97
97
  "name": "dev.ocean.skills.graft",
98
- "version": "2.21.0",
98
+ "version": "2.23.0",
99
99
  "engines": {
100
- "ocean": ">=2.21.0"
100
+ "ocean": ">=2.23.0"
101
101
  },
102
102
  "source": {
103
103
  "type": "path",
@@ -113,9 +113,9 @@
113
113
  {
114
114
  "kind": "skill",
115
115
  "name": "dev.ocean.skills.loop",
116
- "version": "2.21.0",
116
+ "version": "2.23.0",
117
117
  "engines": {
118
- "ocean": ">=2.21.0"
118
+ "ocean": ">=2.23.0"
119
119
  },
120
120
  "source": {
121
121
  "type": "path",
@@ -131,9 +131,9 @@
131
131
  {
132
132
  "kind": "skill",
133
133
  "name": "dev.ocean.skills.memory-review",
134
- "version": "2.21.0",
134
+ "version": "2.23.0",
135
135
  "engines": {
136
- "ocean": ">=2.21.0"
136
+ "ocean": ">=2.23.0"
137
137
  },
138
138
  "source": {
139
139
  "type": "path",
@@ -149,16 +149,16 @@
149
149
  {
150
150
  "kind": "skill",
151
151
  "name": "dev.ocean.skills.ocean-memory",
152
- "version": "2.21.0",
152
+ "version": "2.23.0",
153
153
  "engines": {
154
- "ocean": ">=2.21.0"
154
+ "ocean": ">=2.23.0"
155
155
  },
156
156
  "source": {
157
157
  "type": "path",
158
158
  "path": "skills/core/ocean-memory"
159
159
  },
160
160
  "integrity": {
161
- "sha256": "8e918188a476359ea27f945218cf91d9eeadd191b41049047762e752bd227fe1"
161
+ "sha256": "c001b4fdf8afe2e52b5b8a1fea6311584da4b62146e99e7244cc29807ad98365"
162
162
  },
163
163
  "spec": {
164
164
  "directory": "ocean-memory"
@@ -167,9 +167,9 @@
167
167
  {
168
168
  "kind": "skill",
169
169
  "name": "dev.ocean.skills.session-handoff",
170
- "version": "2.21.0",
170
+ "version": "2.23.0",
171
171
  "engines": {
172
- "ocean": ">=2.21.0"
172
+ "ocean": ">=2.23.0"
173
173
  },
174
174
  "source": {
175
175
  "type": "path",
@@ -185,9 +185,9 @@
185
185
  {
186
186
  "kind": "skill",
187
187
  "name": "dev.ocean.skills.use-browser",
188
- "version": "2.21.0",
188
+ "version": "2.23.0",
189
189
  "engines": {
190
- "ocean": ">=2.21.0"
190
+ "ocean": ">=2.23.0"
191
191
  },
192
192
  "source": {
193
193
  "type": "path",
@@ -203,9 +203,9 @@
203
203
  {
204
204
  "kind": "skill",
205
205
  "name": "dev.ocean.skills.verification",
206
- "version": "2.21.0",
206
+ "version": "2.23.0",
207
207
  "engines": {
208
- "ocean": ">=2.21.0"
208
+ "ocean": ">=2.23.0"
209
209
  },
210
210
  "source": {
211
211
  "type": "path",
@@ -221,9 +221,9 @@
221
221
  {
222
222
  "kind": "skill",
223
223
  "name": "dev.ocean.skills.weekly-review",
224
- "version": "2.21.0",
224
+ "version": "2.23.0",
225
225
  "engines": {
226
- "ocean": ">=2.21.0"
226
+ "ocean": ">=2.23.0"
227
227
  },
228
228
  "source": {
229
229
  "type": "path",
@@ -276,9 +276,9 @@
276
276
  "npx"
277
277
  ]
278
278
  },
279
- "version": "2.21.0",
279
+ "version": "2.23.0",
280
280
  "engines": {
281
- "ocean": ">=2.21.0"
281
+ "ocean": ">=2.23.0"
282
282
  },
283
283
  "source": {
284
284
  "type": "path",
@@ -397,9 +397,9 @@
397
397
  "npx"
398
398
  ]
399
399
  },
400
- "version": "2.21.0",
400
+ "version": "2.23.0",
401
401
  "engines": {
402
- "ocean": ">=2.21.0"
402
+ "ocean": ">=2.23.0"
403
403
  },
404
404
  "source": {
405
405
  "type": "path",
@@ -463,9 +463,9 @@
463
463
  "kind": "mcp",
464
464
  "name": "dev.ocean/mcp-gateway",
465
465
  "description": "One MCP endpoint for every registered server: Ocean's own and those installed from the marketplace.",
466
- "version": "2.21.0",
466
+ "version": "2.23.0",
467
467
  "engines": {
468
- "ocean": ">=2.21.0"
468
+ "ocean": ">=2.23.0"
469
469
  },
470
470
  "source": {
471
471
  "type": "path",
@@ -507,9 +507,9 @@
507
507
  "kind": "mcp",
508
508
  "name": "dev.ocean/obsidian",
509
509
  "description": "Ocean's Obsidian vault bridge over MCP.",
510
- "version": "2.21.0",
510
+ "version": "2.23.0",
511
511
  "engines": {
512
- "ocean": ">=2.21.0"
512
+ "ocean": ">=2.23.0"
513
513
  },
514
514
  "source": {
515
515
  "type": "path",
@@ -551,9 +551,9 @@
551
551
  "kind": "mcp",
552
552
  "name": "dev.ocean/ocean",
553
553
  "description": "Ocean's own MCP server: workspace status, tasks, handoffs, sessions and the brain.",
554
- "version": "2.21.0",
554
+ "version": "2.23.0",
555
555
  "engines": {
556
- "ocean": ">=2.21.0"
556
+ "ocean": ">=2.23.0"
557
557
  },
558
558
  "source": {
559
559
  "type": "path",
@@ -605,9 +605,9 @@
605
605
  "npx"
606
606
  ]
607
607
  },
608
- "version": "2.21.0",
608
+ "version": "2.23.0",
609
609
  "engines": {
610
- "ocean": ">=2.21.0"
610
+ "ocean": ">=2.23.0"
611
611
  },
612
612
  "source": {
613
613
  "type": "path",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@amoree-code/ocean",
3
3
  "description": "Local-first memory, tasks and session capture shared by every AI coding client: one private workspace for Claude, Codex, Gemini and more.",
4
- "version": "2.21.0",
4
+ "version": "2.23.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "author": "AMEER ABDULKAREEM JABBAR LAMI",
@@ -53,12 +53,12 @@
53
53
  "@langchain/core": "1.2.14",
54
54
  "@langchain/langgraph": "1.4.19",
55
55
  "@modelcontextprotocol/sdk": "1.32.0",
56
- "@ocean/brain": "2.21.0",
57
- "@ocean/context": "2.21.0",
58
- "@ocean/core": "2.21.0",
59
- "@ocean/loop": "2.21.0",
60
- "@ocean/market": "2.21.0",
61
- "@ocean/services": "2.21.0",
56
+ "@ocean/brain": "2.23.0",
57
+ "@ocean/context": "2.23.0",
58
+ "@ocean/core": "2.23.0",
59
+ "@ocean/loop": "2.23.0",
60
+ "@ocean/market": "2.23.0",
61
+ "@ocean/services": "2.23.0",
62
62
  "playwright-core": "^1.48.0",
63
63
  "sqlite-vec": "0.1.9",
64
64
  "zod": "^4.6.5"
@@ -19,6 +19,11 @@ remember:
19
19
  3. Asked where memory lives, say in one sentence that it lives in Ocean on their
20
20
  own computer, and that your built-in memory is only a copy of it.
21
21
 
22
+ Show the user that Ocean is on: the first reply in a conversation where you call an
23
+ `ocean` tool begins with one line of its own, `🌊 Ocean · <project>`, naming the project
24
+ the Ocean start line or `ocean_context` gives, or just `🌊 Ocean` when none is named.
25
+ Once per conversation, never again after that.
26
+
22
27
  When the user states a decision, preference or correction, call `memory_propose`.
23
28
  Use `memory_write` only when they explicitly ask you to remember or change something.
24
29