@amoree-code/ocean 2.20.0 → 2.22.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.
@@ -1,59 +1,87 @@
1
1
  import { execFileSync } from "node:child_process";
2
- import { readdirSync, readFileSync } from "node:fs";
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
+ import { enginePath } from "@ocean/core/shared/paths.js";
5
7
  // Claude chat (Desktop, claude.ai, phone) runs on Anthropic's servers: it gets Ocean's tools from
6
8
  // the MCP entry Ocean writes, but it drops the server's `instructions` and runs no hooks. A skill
7
- // does reach it: an account plugin's skills load in chat, Cowork and Claude Code, and Claude
8
- // loads one by itself when a message matches its description (T-328: asked "where your memory
9
+ // does reach it: a skill in the Claude account loads in chat, Cowork and the phone, and Claude
10
+ // loads it by itself when a message matches its description (T-328: asked "where your memory
9
11
  // lives" with the ocean-memory skill installed, chat called brain_search and named Ocean).
10
12
  //
11
- // The plugin lives in Ocean's public repository (`.claude-plugin/marketplace.json` at its root,
12
- // `kernel/plugins/ocean/`), so a release reaches every device without Ocean touching it. Adding a
13
- // marketplace to a Claude account has no API, deep link or config file: the owner adds it once
14
- // in Claude's settings. Ocean makes that one step short — the name on the clipboard, Claude open
15
- // — and checks for it where Claude Code keeps its copy of the account's marketplaces.
16
- export const OCEAN_MARKETPLACE = "amoree-code/ocean";
13
+ // Only an upload reaches chat. Claude Desktop's "Add from a repository" installs a marketplace
14
+ // plugin locally for its Code tab (its log: "skipping remote API path … reason=local-sourced"),
15
+ // so chat never sees it; with only that, chat answered from Anthropic's memory (T-328,
16
+ // 2026-11-24). An uploaded skill (`ocean-memory@My Uploads`) is the account's own and loads in
17
+ // chat, Cowork and the phone. Uploading has no API: Ocean writes the zip, shows it, opens Claude,
18
+ // and checks for it in Desktop's plugin list. Claude Code needs none of this: the session-start
19
+ // skill sync copies the same core skill into it.
20
+ export const CHAT_SKILL_ZIP = "ocean-memory.zip";
17
21
  export const CHAT_PLUGIN_STEPS = [
18
- "In Claude: Customize → Plugins → Add → Add marketplace",
19
- `Paste ${OCEAN_MARKETPLACE} and add it`,
20
- "Install the Ocean plugin it lists",
22
+ "In Claude: Customize → Skills → Add → Upload a skill",
23
+ `Pick ${CHAT_SKILL_ZIP} (Ocean saved it to your Downloads folder)`,
21
24
  "Skills need Settings → Capabilities → Code execution on",
25
+ 'Or in Claude Desktop chat, ask: "Install Ocean\'s memory skill", then save the file it makes',
22
26
  ];
23
- function syncedDir(home) {
24
- return path.join(home, ".claude", "plugins", "synced");
27
+ // Where Claude Desktop keeps each signed-in account's plugin list:
28
+ // plugin-list/<org>/<account>/plugins.json, rows `{id, name, enabled, installPath}`.
29
+ function desktopPluginListDir(home, platform) {
30
+ if (platform === "darwin")
31
+ return path.join(home, "Library", "Application Support", "Claude", "plugin-list");
32
+ if (platform === "win32")
33
+ return path.join(process.env.APPDATA ?? path.join(home, "AppData", "Roaming"), "Claude", "plugin-list");
34
+ return undefined;
25
35
  }
26
- // True once the account lists Ocean's marketplace. Claude Code (v2.1.273 and later) mirrors the
27
- // account's marketplaces into ~/.claude/plugins/synced/<account>_<org>/.marketplaces.json; the
28
- // row's source names the repository. Undefined when that mirror does not exist, so absence of
29
- // Claude Code never reads as "not added".
30
- export function chatPluginAdded(home = os.homedir()) {
31
- let accounts;
36
+ const OCEAN_PLUGIN_NAMES = new Set(["ocean", "ocean-memory"]);
37
+ function readJson(file) {
32
38
  try {
33
- accounts = readdirSync(syncedDir(home));
39
+ return JSON.parse(readFileSync(file, "utf8"));
34
40
  }
35
41
  catch {
36
42
  return undefined;
37
43
  }
38
- let mirrored = false;
39
- for (const account of accounts) {
40
- let rows;
41
- try {
42
- rows = JSON.parse(readFileSync(path.join(syncedDir(home), account, ".marketplaces.json"), "utf8")).rows;
43
- }
44
- catch {
45
- continue;
46
- }
47
- if (!Array.isArray(rows))
48
- continue;
49
- mirrored = true;
50
- const wanted = OCEAN_MARKETPLACE.toLowerCase();
51
- if (rows.some((row) => JSON.stringify(row?.source ?? "")
52
- .toLowerCase()
53
- .includes(wanted)))
54
- return true;
44
+ }
45
+ function subdirs(dir) {
46
+ try {
47
+ return readdirSync(dir, { withFileTypes: true })
48
+ .filter((entry) => entry.isDirectory())
49
+ .map((entry) => entry.name);
50
+ }
51
+ catch {
52
+ return [];
55
53
  }
56
- return mirrored ? false : undefined;
54
+ }
55
+ // True when an account Desktop has signed in lists an enabled Ocean plugin, whether it came
56
+ // from the marketplace (`ocean@ocean`) or was uploaded (`ocean-memory@My Uploads`). Undefined
57
+ // when Desktop keeps no list here.
58
+ function desktopListsOcean(home, platform) {
59
+ const root = desktopPluginListDir(home, platform);
60
+ if (!root)
61
+ return undefined;
62
+ let listed = false;
63
+ for (const org of subdirs(root))
64
+ for (const account of subdirs(path.join(root, org))) {
65
+ const plugins = readJson(path.join(root, org, account, "plugins.json"))?.plugins;
66
+ if (!Array.isArray(plugins))
67
+ continue;
68
+ listed = true;
69
+ if (plugins.some((row) => {
70
+ const { id, name, enabled } = (row ?? {});
71
+ const named = (typeof name === "string" && OCEAN_PLUGIN_NAMES.has(name)) ||
72
+ (typeof id === "string" &&
73
+ OCEAN_PLUGIN_NAMES.has(id.split("@")[0]));
74
+ return named && enabled !== false;
75
+ }))
76
+ return true;
77
+ }
78
+ return listed ? false : undefined;
79
+ }
80
+ // True once the ocean-memory skill is in the Claude account, which is what chat and Cowork load,
81
+ // read from Claude Desktop's own plugin list. Undefined when Desktop keeps no list here, so a
82
+ // machine without Desktop never reads as "not added".
83
+ export function chatPluginAdded(home = os.homedir(), platform = process.platform) {
84
+ return desktopListsOcean(home, platform);
57
85
  }
58
86
  const run = (file, args, input) => {
59
87
  execFileSync(file, args, {
@@ -62,30 +90,87 @@ const run = (file, args, input) => {
62
90
  timeout: 10_000,
63
91
  });
64
92
  };
65
- // Puts the marketplace name on the clipboard and brings Claude up, so the step is a paste and a
66
- // few clicks. Either half failing leaves the printed steps, which say the same.
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.
95
+ export function chatSkillZip(skill = readFileSync(path.join(enginePath("skills"), "core", "ocean-memory", "SKILL.md"))) {
96
+ const entries = [
97
+ ["ocean-memory/", Buffer.alloc(0)],
98
+ ["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]);
137
+ }
138
+ // Saves the skill zip to Downloads, shows it in the file manager and brings Claude up, so the
139
+ // step is an upload and a few clicks. Any part failing leaves the printed steps.
67
140
  export function openChatPluginSetup(options = {}) {
68
141
  const platform = options.platform ?? process.platform;
69
142
  const exec = options.exec ?? run;
70
- const attempt = (file, args, input) => {
143
+ const attempt = (file, args) => {
71
144
  try {
72
- exec(file, args, input);
145
+ exec(file, args);
73
146
  return true;
74
147
  }
75
148
  catch {
76
149
  return false;
77
150
  }
78
151
  };
152
+ let zip;
153
+ try {
154
+ const dir = path.join(options.home ?? os.homedir(), "Downloads");
155
+ mkdirSync(dir, { recursive: true });
156
+ zip = path.join(dir, CHAT_SKILL_ZIP);
157
+ writeFileSync(zip, (options.zip ?? chatSkillZip)());
158
+ }
159
+ catch {
160
+ zip = undefined;
161
+ }
79
162
  if (platform === "darwin")
80
163
  return {
81
- copied: attempt("pbcopy", [], OCEAN_MARKETPLACE),
164
+ zip,
165
+ revealed: zip !== undefined && attempt("open", ["-R", zip]),
82
166
  opened: attempt("open", ["-a", "Claude"]),
83
167
  };
84
168
  if (platform === "win32")
85
169
  return {
86
- copied: attempt("clip", [], OCEAN_MARKETPLACE),
170
+ zip,
171
+ revealed: zip !== undefined && attempt("explorer", [`/select,${zip}`]),
87
172
  opened: false,
88
173
  };
89
- return { copied: false, opened: false };
174
+ return { zip, revealed: false, opened: false };
90
175
  }
91
176
  //# sourceMappingURL=chat-plugin.js.map
@@ -118,7 +118,7 @@ export function buildClientStatus(input) {
118
118
  if (watcher && watcher.status !== "current")
119
119
  notes.push(`chat watcher ${watcher.status}`);
120
120
  if (plan.client === "claude-desktop" && input.chatPlugin?.added === false)
121
- notes.push("Ocean plugin not in your Claude account: run `ocean clients chat-plugin`");
121
+ notes.push("ocean-memory skill not in your Claude account: run `ocean clients chat-plugin`");
122
122
  if (plan.tier !== "supported" && plan.reason)
123
123
  notes.push(plan.reason);
124
124
  clients.push({
@@ -4,7 +4,7 @@ import { syncCoreSkills } from "@ocean/market/skills/core-skill-sync.js";
4
4
  import { copyClientSkills } from "@ocean/market/skills/skill-hub.js";
5
5
  import { connectObsidianVault } from "@ocean/services/obsidian/vault-discovery.js";
6
6
  import { ONBOARDING_QUESTIONS, onboard, } from "@ocean/services/onboarding/onboarding.js";
7
- import { CHAT_PLUGIN_STEPS, chatPluginAdded, OCEAN_MARKETPLACE, openChatPluginSetup, } from "../clients/chat-plugin.js";
7
+ import { CHAT_PLUGIN_STEPS, CHAT_SKILL_ZIP, chatPluginAdded, openChatPluginSetup, } from "../clients/chat-plugin.js";
8
8
  // Bump when a step is added; completed steps stay completed, only new ids run.
9
9
  export const ONBOARDING_VERSION = 5;
10
10
  async function yes(io, question) {
@@ -98,27 +98,27 @@ function connectStep(clients) {
98
98
  };
99
99
  }
100
100
  // Claude chat (Desktop, claude.ai, phone) runs no hooks and drops MCP instructions, so Ocean's
101
- // rule reaches it as a skill in an account plugin (T-328). Adding a marketplace to an account
102
- // has no API: the one step left to the owner is a paste and a few clicks, set up here.
101
+ // rule reaches it as a skill uploaded to the account (T-328). Uploading has no API: the one step
102
+ // left to the owner is an upload and a few clicks, set up here.
103
103
  export function chatPluginStep(chat = {
104
104
  added: () => chatPluginAdded(),
105
105
  open: () => openChatPluginSetup(),
106
106
  }) {
107
107
  return {
108
108
  id: "chat-plugin",
109
- title: "Claude chat (the Ocean plugin in your Claude account)",
109
+ title: "Claude chat (the ocean-memory skill in your Claude account)",
110
110
  optional: false,
111
111
  async reopen() {
112
112
  return chat.added() === false
113
- ? "the Ocean plugin is not in your Claude account"
113
+ ? "the ocean-memory skill is not in your Claude account"
114
114
  : null;
115
115
  },
116
116
  async run(io) {
117
117
  if (chat.added() === true) {
118
- io.say(` ${OCEAN_MARKETPLACE} is in your Claude account: every Claude chat asks Ocean first.`);
118
+ io.say(" The ocean-memory skill is in your Claude account: every Claude chat asks Ocean first.");
119
119
  return "done";
120
120
  }
121
- io.say(" Claude chat runs on Anthropic's servers, so one step is yours: add Ocean's plugin to your Claude account.");
121
+ io.say(" Claude chat runs on Anthropic's servers, so one step is yours: upload Ocean's skill to your Claude account.");
122
122
  if (!io.interactive) {
123
123
  for (const step of CHAT_PLUGIN_STEPS)
124
124
  io.say(` ${step}`);
@@ -126,16 +126,16 @@ export function chatPluginStep(chat = {
126
126
  return "skipped";
127
127
  }
128
128
  const opened = chat.open();
129
- if (opened.copied)
130
- io.say(` ${OCEAN_MARKETPLACE} is on your clipboard.`);
129
+ if (opened.zip)
130
+ io.say(` Saved ${opened.zip}.`);
131
131
  if (opened.opened)
132
132
  io.say(" Claude is open.");
133
133
  for (const step of CHAT_PLUGIN_STEPS)
134
134
  io.say(` ${step}`);
135
- if (!(await yes(io, " Added it?")))
135
+ if (!(await yes(io, ` Uploaded ${CHAT_SKILL_ZIP}?`)))
136
136
  return "skipped";
137
137
  if (chat.added() === false)
138
- io.say(" Claude Code has not synced it yet; `ocean clients status` shows it once it has.");
138
+ io.say(" Claude has not listed it yet; `ocean clients status` shows it once it has.");
139
139
  return "done";
140
140
  },
141
141
  };
@@ -3,7 +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 { CHAT_PLUGIN_STEPS, chatPluginAdded, OCEAN_MARKETPLACE, openChatPluginSetup, } from "../../application/clients/chat-plugin.js";
6
+ import { CHAT_PLUGIN_STEPS, chatPluginAdded, openChatPluginSetup, } from "../../application/clients/chat-plugin.js";
7
7
  import { applyClients, attributeLedger, confirmClient, defaultClientEnv, gatewayDefault, planClients, readGatewayClients, recordVerification, repairClients, restoreClients, setGatewayClient, setGatewayDefault, temporaryEntryProblem, verifyClient, } from "../../application/clients/clients.js";
8
8
  import { applyDesktopWatcher, planDesktopWatcher, restoreDesktopWatcher, } from "../../application/clients/desktop-watcher.js";
9
9
  import { applyHooks, planHooks, restoreHooks, } from "../../application/clients/hooks.js";
@@ -141,7 +141,7 @@ export async function runClientsCommand(args) {
141
141
  .results,
142
142
  sessionFacts: await sessionFactsAnswer(values("--session-facts")[0]),
143
143
  };
144
- // Claude chat's Ocean plugin (T-328) is added to the account in Claude's own settings, which
144
+ // Claude chat's ocean-memory skill (T-328) is uploaded to the account in Claude's own settings, which
145
145
  // Ocean cannot write; apply only says whether it is there and what to run when it is not.
146
146
  const desktop = (await planClients()).find((plan) => plan.client === "claude-desktop");
147
147
  const added = chatPluginAdded();
@@ -159,24 +159,24 @@ export async function runClientsCommand(args) {
159
159
  };
160
160
  }
161
161
  else if (action === "chat-plugin") {
162
- // Claude chat's one step (T-328): the marketplace name on the clipboard, Claude open, the
163
- // clicks printed. Nothing to do once Claude Code's mirror of the account lists it.
162
+ // Claude chat's one step (T-328): the skill zip saved and shown, Claude open, the clicks
163
+ // printed. Nothing to do once Desktop's plugin list shows it.
164
164
  const added = chatPluginAdded();
165
165
  const opened = added === true ? undefined : openChatPluginSetup();
166
166
  if (!json) {
167
167
  if (added === true) {
168
- console.log(`added: ${OCEAN_MARKETPLACE} is in your Claude account; its skill reaches every Claude chat`);
168
+ console.log("added: the ocean-memory skill is in your Claude account; it reaches every Claude chat");
169
169
  return;
170
170
  }
171
- if (opened?.copied)
172
- console.log(`${OCEAN_MARKETPLACE} is on your clipboard.`);
171
+ if (opened?.zip)
172
+ console.log(`Saved ${opened.zip}.`);
173
173
  for (const step of CHAT_PLUGIN_STEPS)
174
174
  console.log(` ${step}`);
175
175
  if (added === undefined)
176
- console.log("Ocean checks for it through Claude Code; without Claude Code, nothing confirms it here.");
176
+ console.log("Ocean checks for it in Claude Desktop's plugin list; without Desktop, nothing confirms it here.");
177
177
  return;
178
178
  }
179
- result = { added, ...(opened ?? {}), marketplace: OCEAN_MARKETPLACE };
179
+ result = { added, ...(opened ?? {}) };
180
180
  }
181
181
  else if (action === "verify") {
182
182
  const ids = rest.filter((arg) => !arg.startsWith("--"));
@@ -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.20.0",
3
+ "version": "2.22.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.20.0",
3
+ "version": "2.22.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.20.0",
3
+ "version": "2.22.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.20.0",
3
+ "version": "2.22.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.20.0",
3
+ "version": "2.22.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -12,7 +12,7 @@ import { actionFingerprint, mcpApprovalSchema, } from "@ocean/core/domain/mcp/mc
12
12
  import { MEMORY_AUTHORITY_LINE, MEMORY_CONTRACT_VERSION, MEMORY_INSTRUCTIONS, MemoryContractError, } from "@ocean/core/domain/mcp/memory-contract.js";
13
13
  import { redactSecrets } from "@ocean/core/domain/redaction/redaction.js";
14
14
  import { ackIssued } from "@ocean/core/shared/context-ack.js";
15
- import { oceanPath, oceanRoot, SYSTEM_DIR } from "@ocean/core/shared/paths.js";
15
+ import { enginePath, oceanPath, oceanRoot, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
16
16
  import { findProject, folderProject, scanProjectManifests, } from "@ocean/core/shared/project-resolution.js";
17
17
  import { createHandoff, getHandoff, getTask, listHandoffs, } from "@ocean/loop/handoff/handoff-service.js";
18
18
  import { oceanContext } from "@ocean/loop/hooks/session-start-hook.js";
@@ -394,7 +394,36 @@ const tools = new McpToolRegistry(withContextAck([
394
394
  additionalProperties: false,
395
395
  },
396
396
  },
397
+ {
398
+ name: "ocean_chat_skill",
399
+ description: "Install Ocean's memory skill (ocean-memory) in the user's Claude account, so every Claude chat, Cowork and phone session asks Ocean before its own memory. Call when the user asks to install, set up, add or update Ocean or Ocean's skill in Claude, or says Claude chat is not using Ocean. Returns the skill file and how to hand it to the user to save.",
400
+ annotations: { readOnlyHint: true },
401
+ inputSchema: {
402
+ type: "object",
403
+ properties: {},
404
+ additionalProperties: false,
405
+ },
406
+ },
397
407
  ]));
408
+ // Ocean's memory skill for Claude chat (T-328). Nothing can add a skill to a Claude account
409
+ // for the user: no API, deep link or MCP call. Chat can propose the skill itself, though: Claude
410
+ // Desktop chat shows a skill card the user saves with one click (T-328, 2026-11-24), so the
411
+ // click stays inside the chat; a .skill file is the fallback.
412
+ export const CHAT_SKILL_DIR = "ocean-memory";
413
+ export async function chatSkillInstall() {
414
+ const file = `${CHAT_SKILL_DIR}/SKILL.md`;
415
+ return {
416
+ skill: CHAT_SKILL_DIR,
417
+ file,
418
+ content: await readFile(enginePath("skills", "core", CHAT_SKILL_DIR, "SKILL.md"), "utf8"),
419
+ steps: [
420
+ "If you can propose a skill for the user to save (a skill card), propose this one: name ocean-memory, content exactly as given, changing nothing. The user saves it from the card.",
421
+ `Otherwise, with your code tool, write content to ${file} exactly as given, zip the ${CHAT_SKILL_DIR} folder (the folder itself, so the zip holds ${file}) as ${CHAT_SKILL_DIR}.skill, share that file, and tell the user to save it, or to upload it in Customize → Skills.`,
422
+ "Without either, tell the user to run `ocean clients chat-plugin` on their computer: it saves ocean-memory.zip to upload in Customize → Skills.",
423
+ "Skills need Settings → Capabilities → Code execution on.",
424
+ ],
425
+ };
426
+ }
398
427
  // What one MCP handoff may hold, summed over its texts (T-307).
399
428
  export const HANDOFF_MAX_BYTES = 4096;
400
429
  const resources = [
@@ -628,6 +657,8 @@ async function callTool(name, args, ports) {
628
657
  });
629
658
  if (name === "ocean_ping")
630
659
  return { ok: true };
660
+ if (name === "ocean_chat_skill")
661
+ return chatSkillInstall();
631
662
  if (name === "ocean_capabilities")
632
663
  return {
633
664
  contract: MEMORY_CONTRACT_VERSION,
@@ -841,7 +872,13 @@ export async function handleOceanMcpRequest(request, ports) {
841
872
  result: {
842
873
  protocolVersion: "2025-06-18",
843
874
  capabilities: { tools: {}, resources: {}, prompts: {} },
844
- 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
+ },
845
882
  instructions: MEMORY_INSTRUCTIONS,
846
883
  },
847
884
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/services",
3
- "version": "2.20.0",
3
+ "version": "2.22.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.20.0",
8
+ "version": "2.22.0",
9
9
  "engines": {
10
- "ocean": ">=2.20.0"
10
+ "ocean": ">=2.22.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.20.0",
26
+ "version": "2.22.0",
27
27
  "engines": {
28
- "ocean": ">=2.20.0"
28
+ "ocean": ">=2.22.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.20.0",
44
+ "version": "2.22.0",
45
45
  "engines": {
46
- "ocean": ">=2.20.0"
46
+ "ocean": ">=2.22.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.20.0",
62
+ "version": "2.22.0",
63
63
  "engines": {
64
- "ocean": ">=2.20.0"
64
+ "ocean": ">=2.22.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.20.0",
80
+ "version": "2.22.0",
81
81
  "engines": {
82
- "ocean": ">=2.20.0"
82
+ "ocean": ">=2.22.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.20.0",
98
+ "version": "2.22.0",
99
99
  "engines": {
100
- "ocean": ">=2.20.0"
100
+ "ocean": ">=2.22.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.20.0",
116
+ "version": "2.22.0",
117
117
  "engines": {
118
- "ocean": ">=2.20.0"
118
+ "ocean": ">=2.22.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.20.0",
134
+ "version": "2.22.0",
135
135
  "engines": {
136
- "ocean": ">=2.20.0"
136
+ "ocean": ">=2.22.0"
137
137
  },
138
138
  "source": {
139
139
  "type": "path",
@@ -146,12 +146,30 @@
146
146
  "directory": "memory-review"
147
147
  }
148
148
  },
149
+ {
150
+ "kind": "skill",
151
+ "name": "dev.ocean.skills.ocean-memory",
152
+ "version": "2.22.0",
153
+ "engines": {
154
+ "ocean": ">=2.22.0"
155
+ },
156
+ "source": {
157
+ "type": "path",
158
+ "path": "skills/core/ocean-memory"
159
+ },
160
+ "integrity": {
161
+ "sha256": "c001b4fdf8afe2e52b5b8a1fea6311584da4b62146e99e7244cc29807ad98365"
162
+ },
163
+ "spec": {
164
+ "directory": "ocean-memory"
165
+ }
166
+ },
149
167
  {
150
168
  "kind": "skill",
151
169
  "name": "dev.ocean.skills.session-handoff",
152
- "version": "2.20.0",
170
+ "version": "2.22.0",
153
171
  "engines": {
154
- "ocean": ">=2.20.0"
172
+ "ocean": ">=2.22.0"
155
173
  },
156
174
  "source": {
157
175
  "type": "path",
@@ -167,9 +185,9 @@
167
185
  {
168
186
  "kind": "skill",
169
187
  "name": "dev.ocean.skills.use-browser",
170
- "version": "2.20.0",
188
+ "version": "2.22.0",
171
189
  "engines": {
172
- "ocean": ">=2.20.0"
190
+ "ocean": ">=2.22.0"
173
191
  },
174
192
  "source": {
175
193
  "type": "path",
@@ -185,9 +203,9 @@
185
203
  {
186
204
  "kind": "skill",
187
205
  "name": "dev.ocean.skills.verification",
188
- "version": "2.20.0",
206
+ "version": "2.22.0",
189
207
  "engines": {
190
- "ocean": ">=2.20.0"
208
+ "ocean": ">=2.22.0"
191
209
  },
192
210
  "source": {
193
211
  "type": "path",
@@ -203,9 +221,9 @@
203
221
  {
204
222
  "kind": "skill",
205
223
  "name": "dev.ocean.skills.weekly-review",
206
- "version": "2.20.0",
224
+ "version": "2.22.0",
207
225
  "engines": {
208
- "ocean": ">=2.20.0"
226
+ "ocean": ">=2.22.0"
209
227
  },
210
228
  "source": {
211
229
  "type": "path",
@@ -258,9 +276,9 @@
258
276
  "npx"
259
277
  ]
260
278
  },
261
- "version": "2.20.0",
279
+ "version": "2.22.0",
262
280
  "engines": {
263
- "ocean": ">=2.20.0"
281
+ "ocean": ">=2.22.0"
264
282
  },
265
283
  "source": {
266
284
  "type": "path",
@@ -379,9 +397,9 @@
379
397
  "npx"
380
398
  ]
381
399
  },
382
- "version": "2.20.0",
400
+ "version": "2.22.0",
383
401
  "engines": {
384
- "ocean": ">=2.20.0"
402
+ "ocean": ">=2.22.0"
385
403
  },
386
404
  "source": {
387
405
  "type": "path",
@@ -445,9 +463,9 @@
445
463
  "kind": "mcp",
446
464
  "name": "dev.ocean/mcp-gateway",
447
465
  "description": "One MCP endpoint for every registered server: Ocean's own and those installed from the marketplace.",
448
- "version": "2.20.0",
466
+ "version": "2.22.0",
449
467
  "engines": {
450
- "ocean": ">=2.20.0"
468
+ "ocean": ">=2.22.0"
451
469
  },
452
470
  "source": {
453
471
  "type": "path",
@@ -489,9 +507,9 @@
489
507
  "kind": "mcp",
490
508
  "name": "dev.ocean/obsidian",
491
509
  "description": "Ocean's Obsidian vault bridge over MCP.",
492
- "version": "2.20.0",
510
+ "version": "2.22.0",
493
511
  "engines": {
494
- "ocean": ">=2.20.0"
512
+ "ocean": ">=2.22.0"
495
513
  },
496
514
  "source": {
497
515
  "type": "path",
@@ -533,9 +551,9 @@
533
551
  "kind": "mcp",
534
552
  "name": "dev.ocean/ocean",
535
553
  "description": "Ocean's own MCP server: workspace status, tasks, handoffs, sessions and the brain.",
536
- "version": "2.20.0",
554
+ "version": "2.22.0",
537
555
  "engines": {
538
- "ocean": ">=2.20.0"
556
+ "ocean": ">=2.22.0"
539
557
  },
540
558
  "source": {
541
559
  "type": "path",
@@ -587,9 +605,9 @@
587
605
  "npx"
588
606
  ]
589
607
  },
590
- "version": "2.20.0",
608
+ "version": "2.22.0",
591
609
  "engines": {
592
- "ocean": ">=2.20.0"
610
+ "ocean": ">=2.22.0"
593
611
  },
594
612
  "source": {
595
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.20.0",
4
+ "version": "2.22.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.20.0",
57
- "@ocean/context": "2.20.0",
58
- "@ocean/core": "2.20.0",
59
- "@ocean/loop": "2.20.0",
60
- "@ocean/market": "2.20.0",
61
- "@ocean/services": "2.20.0",
56
+ "@ocean/brain": "2.22.0",
57
+ "@ocean/context": "2.22.0",
58
+ "@ocean/core": "2.22.0",
59
+ "@ocean/loop": "2.22.0",
60
+ "@ocean/market": "2.22.0",
61
+ "@ocean/services": "2.22.0",
62
62
  "playwright-core": "^1.48.0",
63
63
  "sqlite-vec": "0.1.9",
64
64
  "zod": "^4.6.5"
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: ocean-memory
3
+ description: The user's memory lives in Ocean, a local memory system on their own computer, reached through the ocean MCP tools (brain_search, brain_read, memory_propose). Use this skill whenever the user asks where their memory is stored, what you remember about them, what you know about their projects, tasks, code, people, preferences or past decisions, or says "my", "our", "remember", "last time", "as before". Ocean is the authority; your built-in memory is not a second store but a copy that Ocean captures.
4
+ ---
5
+
6
+ # Ocean is the user's memory
7
+
8
+ Ocean is this user's single memory and the authority. Your own built-in memory
9
+ (Claude's memory on claude.ai, a CLI's memory file) is not a separate store to weigh
10
+ against it: it is a copy that Ocean captures.
11
+
12
+ When a message touches the user's own world (their projects, code, tasks, people,
13
+ preferences or past decisions), or they ask where their memory lives or what you
14
+ remember:
15
+
16
+ 1. Call the `brain_search` tool from the `ocean` MCP server (a connector in Claude
17
+ chat) with their question.
18
+ 2. Read the hits you use with `brain_read`, answer from them, and cite each path.
19
+ 3. Asked where memory lives, say in one sentence that it lives in Ocean on their
20
+ own computer, and that your built-in memory is only a copy of it.
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
+
27
+ When the user states a decision, preference or correction, call `memory_propose`.
28
+ Use `memory_write` only when they explicitly ask you to remember or change something.
29
+
30
+ If the `ocean` tools are not available here, say that Ocean is their memory but is
31
+ not connected here, and answer from your built-in memory as a fallback.
package/skills/index.json CHANGED
@@ -47,6 +47,12 @@
47
47
  "version": "1.0.0",
48
48
  "category": "core"
49
49
  },
50
+ {
51
+ "name": "ocean-memory",
52
+ "description": "The user's memory lives in Ocean, a local memory system on their own computer, reached through the ocean MCP tools (brain_search, brain_read, memory_propose). Use this skill whenever the user asks where their memory is stored, what you remember about them, what you know about their projects, tasks, code, people, preferences or past decisions, or says \"my\", \"our\", \"remember\", \"last time\", \"as before\". Ocean is the authority; your built-in memory is not a second store but a copy that Ocean captures.",
53
+ "version": "1.0.0",
54
+ "category": "core"
55
+ },
50
56
  {
51
57
  "name": "session-handoff",
52
58
  "description": "Produce a compact continuation packet with the next action and verification commands.",