@amoree-code/ocean 2.14.0 → 2.15.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.
@@ -9,7 +9,7 @@ import { scorecardFile, searchEvalFile, } from "@ocean/services/scorecard/scorec
9
9
  import { previousScorecard, renderDigest, runUpkeepJobs, scorecardMoves, writeDigest, } from "@ocean/services/upkeep/upkeep.js";
10
10
  import { listSchedules } from "../scheduler/local-scheduler.js";
11
11
  // Nightly upkeep (T-322): each job is a child `ocean` process with a timeout; the results become
12
- // the morning digest in 01-daily/digest/. Once a day through `ocean rhythm` (ifDue), and the
12
+ // the morning digest in 01-daily/reports/digest/. Once a day through `ocean rhythm` (ifDue), and the
13
13
  // monthly memory hygiene joins the first run of a month that has no report yet.
14
14
  const MINUTE = 60_000;
15
15
  const OUTPUT_LIMIT = 4 * 1024 * 1024;
@@ -1,7 +1,7 @@
1
1
  import { localDate } from "@ocean/core/shared/local-date.js";
2
2
  import { buildBrief } from "@ocean/services/brief/brief.js";
3
3
  // `ocean brief [--weekly] [--dry-run] [--date YYYY-MM-DD]` (T-314): what moved in what the owner
4
- // follows, written to 01-daily/briefs/.
4
+ // follows, written to 01-daily/reports/briefs/.
5
5
  export async function runBriefCommand(args) {
6
6
  const at = args.indexOf("--date");
7
7
  const date = at >= 0 ? args[at + 1] : localDate();
@@ -4,8 +4,9 @@ import { archiveHarvested, harvestDay, pendingDays, undoDay, } from "@ocean/serv
4
4
  const USAGE = "Usage: ocean harvest [--date YYYY-MM-DD | --pending] [--yes] | archive [--days N] [--yes] | undo <YYYY-MM-DD>";
5
5
  const DATE = /^\d{4}-\d{2}-\d{2}$/;
6
6
  // `ocean harvest` (T-314): a day's sessions from every AI client into that day's summary, their
7
- // decisions, fixes and lessons into 05-knowledge on their own (undo per day), then archiving after
8
- // 30 days. A dry run until --yes. The service runs `--pending --yes` once a day.
7
+ // decisions, fixes and lessons into 05-knowledge on their own (undo per day), then archiving the
8
+ // day's note after 7 days and its session records after 30. A dry run until --yes. The service
9
+ // runs `--pending --yes` once a day.
9
10
  export async function runHarvestCommand(args) {
10
11
  const apply = args.includes("--yes");
11
12
  const [action] = args;
@@ -18,7 +19,7 @@ export async function runHarvestCommand(args) {
18
19
  }
19
20
  if (action === "archive") {
20
21
  const at = args.indexOf("--days");
21
- const days = at >= 0 ? Number(args[at + 1]) : 30;
22
+ const days = at >= 0 ? Number(args[at + 1]) : 7;
22
23
  if (!(days > 0))
23
24
  throw new Error(USAGE);
24
25
  const result = await archiveHarvested({ today: localDate(), days, apply });
@@ -157,7 +157,7 @@ export const commandHelp = {
157
157
  "ocean capture add <idea>|scan [session-id]|list [status]|promote <id> <target>|discard <id>",
158
158
  ],
159
159
  brief: [
160
- "Write today's brief from your interests' feeds to 01-daily/briefs/ (high priority daily, all weekly).",
160
+ "Write today's brief from your interests' feeds to 01-daily/reports/briefs/ (high priority daily, all weekly).",
161
161
  "ocean brief [--weekly] [--dry-run] [--date YYYY-MM-DD]",
162
162
  ],
163
163
  interests: [
@@ -165,7 +165,7 @@ export const commandHelp = {
165
165
  "ocean interests discover [--yes] | signals [--weeks N] [--yes] | decay [--weeks N] [--yes] | keep <name> | skip <name>",
166
166
  ],
167
167
  distill: [
168
- "Distill a week (digest in 01-daily/weekly/, decisions and lessons as candidates), or review last month against goals.md (01-daily/monthly/).",
168
+ "Distill a week (digest in 01-daily/reports/weekly/, decisions and lessons as candidates), or review last month against goals.md (01-daily/reports/monthly/).",
169
169
  "ocean distill --week [--date YYYY-MM-DD] [--yes] | --month [--month-of YYYY-MM] [--yes]",
170
170
  ],
171
171
  harvest: [
@@ -177,7 +177,7 @@ export const commandHelp = {
177
177
  "ocean rhythm [--yes]",
178
178
  ],
179
179
  upkeep: [
180
- "Run the nightly jobs (doctor, telemetry, reindex, search eval, curator, scorecard), no model, and write the morning digest to 01-daily/digest/.",
180
+ "Run the nightly jobs (doctor, telemetry, reindex, search eval, curator, scorecard), no model, and write the morning digest to 01-daily/reports/digest/.",
181
181
  "ocean upkeep [--yes] [--if-due]",
182
182
  ],
183
183
  curator: [
@@ -193,7 +193,7 @@ export const commandHelp = {
193
193
  "ocean failures [list] [--json] | open <id> <signature> --title <t> --mechanism <why> [--lesson <id>] [--rung <r>] | status <id> <status> [--by <mechanism>] | climb <id>",
194
194
  ],
195
195
  scorecard: [
196
- "Print Ocean's health numbers from real data; --write saves 01-daily/scorecard/YYYY-MM-DD.md.",
196
+ "Print Ocean's health numbers from real data; --write saves 01-daily/reports/scorecard/YYYY-MM-DD.md.",
197
197
  "ocean scorecard [--json] [--write]",
198
198
  ],
199
199
  express: [
@@ -97,7 +97,7 @@ async function collect() {
97
97
  };
98
98
  }
99
99
  // `ocean scorecard [--json] [--write]` (T-318): Ocean's health numbers from real data; --write
100
- // also saves 01-daily/scorecard/YYYY-MM-DD.md.
100
+ // also saves 01-daily/reports/scorecard/YYYY-MM-DD.md.
101
101
  export async function runScorecardCommand(args) {
102
102
  const unknown = args.filter((arg) => !["--json", "--write"].includes(arg));
103
103
  if (unknown.length)
@@ -2,7 +2,7 @@ import { access, chmod, mkdir, readdir, readFile, rename, writeFile, } from "nod
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, LEGACY_NOTES_DIR, liveEngineEntry, NOTES_DIR, 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, LEGACY_NOTES_DIR, liveEngineEntry, NOTES_DIR, oceanPath, oceanRoot, PERSONAL_DIR, projectDir, REGISTRY_DIR, REPORT_KINDS, REPORTS_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";
@@ -114,8 +114,8 @@ export function parseSetupArgs(args) {
114
114
  }
115
115
  // The notes moved from 07-notes into 02-personal/notes. An older workspace's folder moves once,
116
116
  // whole; when both exist nothing is touched (the doctor names the leftover for the owner).
117
+ const present = (file) => access(file).then(() => true, () => false);
117
118
  export async function moveLegacyNotes() {
118
- const present = (file) => access(file).then(() => true, () => false);
119
119
  const from = oceanPath(LEGACY_NOTES_DIR);
120
120
  const to = oceanPath(NOTES_DIR);
121
121
  if (!(await present(from)))
@@ -126,9 +126,27 @@ export async function moveLegacyNotes() {
126
126
  await rename(from, to);
127
127
  return "moved";
128
128
  }
129
+ // The generated reports moved from 01-daily/<kind>/ into 01-daily/reports/<kind>/. Each folder
130
+ // moves once, whole; one that already exists at the new place is left for the owner.
131
+ export async function moveReportFolders() {
132
+ const moved = [];
133
+ for (const kind of REPORT_KINDS) {
134
+ const from = oceanPath(DAILY_DIR, kind);
135
+ const to = oceanPath(REPORTS_DIR, kind);
136
+ if (!(await present(from)) || (await present(to)))
137
+ continue;
138
+ await mkdir(path.dirname(to), { recursive: true });
139
+ await rename(from, to);
140
+ moved.push(kind);
141
+ }
142
+ return moved;
143
+ }
129
144
  export async function setup(options = {}) {
130
145
  if ((await moveLegacyNotes()) === "moved")
131
146
  console.log(`Moved your notes: ${LEGACY_NOTES_DIR}/ → ${NOTES_DIR}/`);
147
+ const reports = await moveReportFolders();
148
+ if (reports.length)
149
+ console.log(`Moved reports into ${REPORTS_DIR}/: ${reports.join(", ")}`);
132
150
  await Promise.all([...personalDirectories, `${projectDir(WORKSPACE_PROJECT_ID)}/tasks`].map((directory) => mkdir(oceanPath(directory), { recursive: true })));
133
151
  // T-296: charter, policies, templates and indexes for a new workspace; existing files are kept.
134
152
  await seedWorkspaceTemplate();
@@ -1,10 +1,11 @@
1
- import { mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
1
+ import { mkdir, open, readdir, readFile, rm, writeFile, } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { redactRuntimeText } from "@ocean/core/domain/redaction/redaction.js";
4
4
  import { cleanTitle } from "@ocean/core/shared/clean-title.js";
5
5
  import { localDate, localMoment, localTime, } from "@ocean/core/shared/local-date.js";
6
6
  import { DAILY_DIR, INBOX_DIR, oceanPath, oceanRoot, } from "@ocean/core/shared/paths.js";
7
7
  import { findGitRoot } from "@ocean/core/shared/project-resolution.js";
8
+ import { isTrivialSession } from "./model-narrative.js";
8
9
  // Same fallback title stamped on a session with no explicit title (see
9
10
  // daily-narrative.ts) — never meaningful content on its own.
10
11
  const GENERIC_TITLE = /^(claude|codex|hermes|kimi|gemini|copilot|kilo|antigravity|openhands) session$/i;
@@ -45,6 +46,107 @@ async function uniqueFilename(directory, base, ext) {
45
46
  }
46
47
  return `${base}-${Date.now()}${ext}`;
47
48
  }
49
+ // Blocks a client wraps around or slips in front of the user's words — system notes, IDE state,
50
+ // slash-command echoes, background-task notices. Never the goal of a session (T-326).
51
+ const WRAPPER_TAGS = "system-reminder|task-notification|ide_[a-z_]+|command-[a-z-]+|local-command-[a-z-]+|browser_instruction|user-prompt-submit-hook";
52
+ const WRAPPER_BLOCK = new RegExp(`<(${WRAPPER_TAGS})\\b[^>]*>[\\s\\S]*?</\\1>`, "gi");
53
+ const WRAPPER_START = new RegExp(`^<(${WRAPPER_TAGS})\\b`, "i");
54
+ /** The user's own words in a message, or "" when it was only client wrapping. */
55
+ export function withoutWrappers(text) {
56
+ const stripped = text.replace(WRAPPER_BLOCK, " ").trim();
57
+ return WRAPPER_START.test(stripped) ? "" : stripped;
58
+ }
59
+ const RECORD_HEAD_BYTES = 1024;
60
+ async function recordHead(file) {
61
+ const handle = await open(file, "r").catch(() => null);
62
+ if (!handle)
63
+ return "";
64
+ try {
65
+ const buffer = Buffer.alloc(RECORD_HEAD_BYTES);
66
+ const { bytesRead } = await handle.read(buffer, 0, RECORD_HEAD_BYTES, 0);
67
+ return buffer.subarray(0, bytesRead).toString("utf8");
68
+ }
69
+ finally {
70
+ await handle.close();
71
+ }
72
+ }
73
+ /**
74
+ * The live record of one session in 01-daily/sessions/YYYY-MM/ (archive/ is history and is never
75
+ * rewritten). When an older duplicate exists, the digest record wins over a closeout one.
76
+ */
77
+ export async function findSessionRecord(sessionId) {
78
+ const root = oceanPath(DAILY_DIR, "sessions");
79
+ const needle = `session_id: ${JSON.stringify(sessionId)}`;
80
+ const months = (await readdir(root).catch(() => []))
81
+ .filter((name) => /^\d{4}-\d{2}$/.test(name))
82
+ .sort()
83
+ .reverse();
84
+ const found = [];
85
+ for (const month of months) {
86
+ const directory = path.join(root, month);
87
+ for (const name of (await readdir(directory).catch(() => [])).sort()) {
88
+ if (!name.endsWith(".md"))
89
+ continue;
90
+ const file = path.join(directory, name);
91
+ if (!(await recordHead(file)).split("\n").includes(needle))
92
+ continue;
93
+ found.push({ file, text: await readFile(file, "utf8") });
94
+ }
95
+ }
96
+ return (found.find((record) => isDigestRecord(record.text)) ?? found[0] ?? null);
97
+ }
98
+ // Records written before `source:` existed carry the chat summary's verification line instead.
99
+ export function isDigestRecord(text) {
100
+ return (/^source: "digest"$/m.test(text) ||
101
+ text.includes("NOT PROVEN — summarized from a chat"));
102
+ }
103
+ const PLACEHOLDER = /^(not stated\.?|no objective was captured\.?)$/i;
104
+ /** A digest record read back into the digest it was written from. */
105
+ export function recordDigest(text) {
106
+ const section = (heading) => {
107
+ const start = text.indexOf(`\n## ${heading}\n`);
108
+ if (start < 0)
109
+ return "";
110
+ const body = text.slice(start + heading.length + 5);
111
+ const end = body.search(/\n## |\n---\n|\nRaw events:/);
112
+ return (end < 0 ? body : body.slice(0, end)).trim();
113
+ };
114
+ const prose = (heading) => {
115
+ const value = section(heading);
116
+ return PLACEHOLDER.test(value) ? "" : value;
117
+ };
118
+ const items = (heading) => section(heading)
119
+ .split("\n")
120
+ .filter((line) => line.startsWith("- "))
121
+ .map((line) => line.slice(2).trim())
122
+ .filter(Boolean);
123
+ return {
124
+ title: /^# (.+)$/m.exec(text)?.[1]?.trim() ?? "",
125
+ goal: prose("Goal"),
126
+ outcome: prose("Outcome"),
127
+ decisions: items("Decisions"),
128
+ fixes: items("Problems → fixes"),
129
+ learned: items("Learned"),
130
+ next: items("Next"),
131
+ };
132
+ }
133
+ const MERGED_ITEMS = 5;
134
+ /**
135
+ * Two stretches of one conversation as one account: what it set out to do comes from the first,
136
+ * where it ended from the latest, and what remains to do only from the latest that said anything.
137
+ */
138
+ export function mergeDigests(earlier, later) {
139
+ const union = (a, b) => [...new Set([...a, ...b])].slice(-MERGED_ITEMS);
140
+ return {
141
+ title: earlier.title || later.title,
142
+ goal: earlier.goal || later.goal,
143
+ outcome: later.outcome || earlier.outcome,
144
+ decisions: union(earlier.decisions, later.decisions),
145
+ fixes: union(earlier.fixes, later.fixes),
146
+ learned: union(earlier.learned, later.learned),
147
+ next: (later.next.length ? later.next : earlier.next).slice(0, MERGED_ITEMS),
148
+ };
149
+ }
48
150
  /**
49
151
  * One session record per session in 01-daily/sessions/YYYY-MM/ (T-314; was 00-inbox/brain-dump/),
50
152
  * separate from the machine-oriented kernel/bridge/sessions/summaries/ dump. Prefers
@@ -61,14 +163,39 @@ async function uniqueFilename(directory, base, ext) {
61
163
  */
62
164
  export async function writeBrainDump(input) {
63
165
  const { session, events, narrative, changedFiles, observations } = input;
166
+ // One record per session (T-326): the chat digest's record is the richer account, so it wins;
167
+ // a session that changed nothing and said nothing gets no record at all.
168
+ const existing = await findSessionRecord(session.sessionId);
169
+ if (existing && isDigestRecord(existing.text))
170
+ return {
171
+ brainDumpPath: path
172
+ .relative(oceanRoot(), existing.file)
173
+ .split(path.sep)
174
+ .join("/"),
175
+ };
176
+ if (!narrative && isTrivialSession(events, changedFiles))
177
+ return null;
178
+ // The first thing the user actually said, past any client wrapping.
64
179
  const workLog = narrative?.workLog ??
65
180
  (() => {
66
- const objectiveEvent = events.find((event) => event.type === "user_input" || event.type === "resume_requested");
67
- return safeText(objectiveEvent?.data ?? session.title, 200);
181
+ for (const event of events) {
182
+ if (event.type !== "user_input" && event.type !== "resume_requested")
183
+ continue;
184
+ const words = withoutWrappers(event.data);
185
+ if (words)
186
+ return safeText(words, 200);
187
+ }
188
+ return safeText(session.title, 200);
68
189
  })();
69
190
  const hasRealProject = findGitRoot(session.workingDirectory) !== null;
70
191
  if (isGenericContent(workLog) && !hasRealProject)
71
192
  return null;
193
+ // Where the session ended: the assistant's last reply, else what it touched.
194
+ const lastReply = [...events]
195
+ .reverse()
196
+ .filter((event) => event.type === "provider_output" || event.type === "text")
197
+ .map((event) => safeText(withoutWrappers(event.data), 300))
198
+ .find(Boolean);
72
199
  const decision = narrative?.decision ??
73
200
  events
74
201
  .filter((event) => event.type === "provider_output" ||
@@ -90,9 +217,17 @@ export async function writeBrainDump(input) {
90
217
  const status = session.status === "completed" && (input.exitCode ?? 0) === 0
91
218
  ? "completed"
92
219
  : "failed";
93
- const title = isGenericContent(workLog)
94
- ? project
95
- : cleanTitle(workLog, project);
220
+ const title = !isGenericContent(workLog)
221
+ ? cleanTitle(workLog, project)
222
+ : lastReply
223
+ ? cleanTitle(lastReply, project)
224
+ : project;
225
+ const outcome = status === "completed"
226
+ ? (lastReply ??
227
+ (changedFiles.length
228
+ ? `Changed ${changedFiles.length} file(s).`
229
+ : "Completed."))
230
+ : `Did not complete.${lastReply ? ` ${lastReply}` : ""}`;
96
231
  // A session record (T-314): flat frontmatter Obsidian can read, then fixed sections. The
97
232
  // narrative comes from one model call when there was one; otherwise from the events.
98
233
  const quote = (value) => JSON.stringify(value);
@@ -101,6 +236,7 @@ export async function writeBrainDump(input) {
101
236
  "type: session",
102
237
  `project: ${quote(project)}`,
103
238
  `provider: ${quote(session.provider)}`,
239
+ 'source: "closeout"',
104
240
  `status: ${status}`,
105
241
  `session_id: ${quote(session.sessionId)}`,
106
242
  `date: ${date}`,
@@ -116,7 +252,7 @@ export async function writeBrainDump(input) {
116
252
  "",
117
253
  "## Outcome",
118
254
  "",
119
- status === "completed" ? "Completed." : "Did not complete.",
255
+ outcome,
120
256
  ...(decision ? ["", "## Decisions", "", decision] : []),
121
257
  ...(problem ? ["", "## Problems → fixes", "", problem] : []),
122
258
  ...(observations?.length
@@ -127,12 +263,15 @@ export async function writeBrainDump(input) {
127
263
  ...observations.map((o) => `- [${o.signalType}] ${safeText(o.summary, 300)} (confidence ${o.confidence})`),
128
264
  ]
129
265
  : []),
130
- "",
131
- "## Verification",
132
- "",
133
- status === "completed" && (input.exitCode ?? 0) === 0
134
- ? "NOT PROVEN — the session ended cleanly; no check is recorded here."
135
- : `NOT PROVEN — exit code ${input.exitCode ?? "unknown"}.`,
266
+ // A clean exit proves nothing either way, so it says nothing; a failed one says how it ended.
267
+ ...(status === "failed"
268
+ ? [
269
+ "",
270
+ "## Verification",
271
+ "",
272
+ `NOT PROVEN — exit code ${input.exitCode ?? "unknown"}.`,
273
+ ]
274
+ : []),
136
275
  ...(changedFiles.length
137
276
  ? [
138
277
  "",
@@ -147,6 +286,16 @@ export async function writeBrainDump(input) {
147
286
  "",
148
287
  `Raw events: \`ocean session events ${session.sessionId}\``,
149
288
  ];
289
+ // A session closed out again (resumed, then ended) rewrites its own record.
290
+ if (existing) {
291
+ await writeFile(existing.file, `${lines.join("\n")}\n`, "utf8");
292
+ return {
293
+ brainDumpPath: path
294
+ .relative(oceanRoot(), existing.file)
295
+ .split(path.sep)
296
+ .join("/"),
297
+ };
298
+ }
150
299
  // 01-daily/sessions/YYYY-MM/, where the session-record template and Templater point.
151
300
  const directory = oceanPath(DAILY_DIR, "sessions", date.slice(0, 7));
152
301
  await mkdir(directory, { recursive: true });
@@ -194,12 +343,20 @@ export async function migrateBrainDumps(options) {
194
343
  }
195
344
  return { moved, skipped };
196
345
  }
197
- // A chat with no session in the store (Claude Desktop, an export: T-314) gets the same record, from
198
- // the digest its fact extraction returned — no model call of its own. One record per captured
199
- // stretch of the conversation, dated by its newest message.
346
+ // A chat's record (Claude Desktop, an export, a Claude Code transcript: T-314) from the digest its
347
+ // fact extraction returned — no model call of its own. One record per session (T-326): a later
348
+ // stretch of the same conversation is merged into the record the first one wrote, and a thin
349
+ // closeout record for the session is replaced by this richer one.
200
350
  export async function writeDigestRecord(input) {
201
- const { digest } = input;
202
- const date = localDate(localMoment(input.endedAt));
351
+ const existing = await findSessionRecord(input.sessionId);
352
+ const earlier = existing && isDigestRecord(existing.text)
353
+ ? recordDigest(existing.text)
354
+ : null;
355
+ const digest = earlier ? mergeDigests(earlier, input.digest) : input.digest;
356
+ const existingDate = existing
357
+ ? /^date: (\d{4}-\d{2}-\d{2})$/m.exec(existing.text)?.[1]
358
+ : undefined;
359
+ const date = existingDate ?? localDate(localMoment(input.endedAt));
203
360
  const time = localTime(localMoment(input.startedAt));
204
361
  const title = cleanTitle(safeText(digest.title || digest.goal, 400), input.project || "Conversation");
205
362
  const quote = (value) => JSON.stringify(value);
@@ -216,6 +373,7 @@ export async function writeDigestRecord(input) {
216
373
  "type: session",
217
374
  `project: ${quote(input.project ?? "")}`,
218
375
  `provider: ${quote(input.provider)}`,
376
+ 'source: "digest"',
219
377
  "status: completed",
220
378
  `session_id: ${quote(input.sessionId)}`,
221
379
  `date: ${date}`,
@@ -235,17 +393,29 @@ export async function writeDigestRecord(input) {
235
393
  ...list("Decisions", digest.decisions),
236
394
  ...list("Problems → fixes", digest.fixes),
237
395
  ...list("Learned", digest.learned),
238
- "",
239
- "## Verification",
240
- "",
241
- "NOT PROVEN — summarized from a chat; nothing was run.",
242
396
  ...list("Next", digest.next),
243
397
  "",
244
398
  ];
245
- const directory = oceanPath(DAILY_DIR, "sessions", date.slice(0, 7));
246
- await mkdir(directory, { recursive: true });
247
- const filename = await uniqueFilename(directory, `${date}-${time.replace(":", "")}-${slugify(title).length >= MIN_USEFUL_SLUG_LENGTH ? slugify(title) : input.provider}`, ".md");
248
- const file = path.join(directory, filename);
399
+ const slug = slugify(title).length >= MIN_USEFUL_SLUG_LENGTH
400
+ ? slugify(title)
401
+ : input.provider;
402
+ let file;
403
+ if (earlier && existing) {
404
+ // A later stretch of the same chat: the record keeps its name, its day and its place.
405
+ file = existing.file;
406
+ }
407
+ else if (existing) {
408
+ // The thin closeout record for this session: replaced in place, renamed after the real title.
409
+ const directory = path.dirname(existing.file);
410
+ const stamp = /^\d{4}-\d{2}-\d{2}-\d{4}/.exec(path.basename(existing.file))?.[0];
411
+ await rm(existing.file, { force: true });
412
+ file = path.join(directory, await uniqueFilename(directory, `${stamp ?? `${date}-${time.replace(":", "")}`}-${slug}`, ".md"));
413
+ }
414
+ else {
415
+ const directory = oceanPath(DAILY_DIR, "sessions", date.slice(0, 7));
416
+ await mkdir(directory, { recursive: true });
417
+ file = path.join(directory, await uniqueFilename(directory, `${date}-${time.replace(":", "")}-${slug}`, ".md"));
418
+ }
249
419
  await writeFile(file, `${lines.join("\n")}\n`, "utf8");
250
420
  return { path: path.relative(oceanRoot(), file).split(path.sep).join("/") };
251
421
  }
@@ -14,9 +14,9 @@
14
14
  "capture": "00-inbox/captures/",
15
15
  "daily": "01-daily/",
16
16
  "session": "01-daily/sessions/",
17
- "brief": "01-daily/briefs/",
18
- "weekly": "01-daily/weekly/",
19
- "monthly": "01-daily/monthly/",
17
+ "brief": "01-daily/reports/briefs/",
18
+ "weekly": "01-daily/reports/weekly/",
19
+ "monthly": "01-daily/reports/monthly/",
20
20
  "note": "02-personal/notes/",
21
21
  "decision": "05-knowledge/decisions/",
22
22
  "lesson": "05-knowledge/lessons/",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/brain",
3
- "version": "2.14.0",
3
+ "version": "2.15.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.14.0",
3
+ "version": "2.15.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -75,6 +75,17 @@ const brainArea = (area) => path.posix.join(BRAIN_PREFIX, area);
75
75
  export const PERSONAL_DIR = brainArea("02-personal");
76
76
  export const KNOWLEDGE_DIR = brainArea("05-knowledge");
77
77
  export const DAILY_DIR = brainArea("01-daily");
78
+ // Generated reports (briefs, digest, scorecard, hygiene, weekly, monthly), one folder each, so
79
+ // 01-daily/ itself holds only day notes, session records and their archive.
80
+ export const REPORTS_DIR = path.posix.join(DAILY_DIR, "reports");
81
+ export const REPORT_KINDS = [
82
+ "briefs",
83
+ "digest",
84
+ "scorecard",
85
+ "hygiene",
86
+ "weekly",
87
+ "monthly",
88
+ ];
78
89
  export const INBOX_DIR = brainArea("00-inbox");
79
90
  export const TEMPLATES_DIR = brainArea("06-templates");
80
91
  // The owner's own notes (T-314): agents read and index them, and never write there. They sit
@@ -236,7 +247,7 @@ export const STORE_DIR = {
236
247
  notes: NOTES_DIR,
237
248
  // Session records and briefs (T-314), searchable beside memory and knowledge.
238
249
  sessions: `${DAILY_DIR}/sessions`,
239
- briefs: `${DAILY_DIR}/briefs`,
250
+ briefs: `${REPORTS_DIR}/briefs`,
240
251
  };
241
252
  // Brain-index records are "<store>/<path inside store>" ("memory/x.md", "knowledge/decisions/y.md").
242
253
  // Project memory (T-296) is "project/<id>/<path>" for 04-projects/<id>/memory/<path>, and
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/core",
3
- "version": "2.14.0",
3
+ "version": "2.15.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/loop",
3
- "version": "2.14.0",
3
+ "version": "2.15.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.14.0",
3
+ "version": "2.15.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -2,14 +2,14 @@ import { createHash } from "node:crypto";
2
2
  import { mkdir, readdir, readFile, stat } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { atomicWrite, parseFrontmatter } from "@ocean/core/shared/fs-utils.js";
5
- import { DAILY_DIR, KNOWLEDGE_DIR, NOTES_DIR, oceanPath, PERSONAL_DIR, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
5
+ import { KNOWLEDGE_DIR, NOTES_DIR, oceanPath, PERSONAL_DIR, REPORTS_DIR, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
6
6
  // The daily brief (T-314): what moved in the things the owner follows. Interests are files in
7
7
  // 02-personal/interests/ (`type: interest`, priority, keywords, sources); a source is a feed URL
8
8
  // (RSS or Atom) or `github:<owner>/<repo>` for that repo's releases. A seen-ledger keeps an item
9
9
  // from coming back. Daily: high-priority interests only, five items at most. Weekly: every
10
10
  // interest, fifteen at most. No model and no web search here: the brief is the feed, filtered.
11
11
  export const INTERESTS_DIR = `${PERSONAL_DIR}/interests`;
12
- const BRIEFS_DIR = `${DAILY_DIR}/briefs`;
12
+ const BRIEFS_DIR = `${REPORTS_DIR}/briefs`;
13
13
  const DAILY_LIMIT = 5;
14
14
  const WEEKLY_LIMIT = 15;
15
15
  const FETCH_TIMEOUT_MS = 10_000;
@@ -2,7 +2,7 @@ import { mkdir, readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { memoryDigest } from "@ocean/brain/memory/memory-digest.js";
4
4
  import { atomicWrite, withFileLock } from "@ocean/core/shared/fs-utils.js";
5
- import { DAILY_DIR, oceanPath, PERSONAL_DIR, } from "@ocean/core/shared/paths.js";
5
+ import { DAILY_DIR, oceanPath, PERSONAL_DIR, REPORTS_DIR, } from "@ocean/core/shared/paths.js";
6
6
  import { listTasks } from "@ocean/loop/tasks/list-tasks.js";
7
7
  import { buildBrief } from "../brief/brief.js";
8
8
  import { keepTicks, loopKey, noteFile, noteRelative, putBlock, readBlock, } from "./note.js";
@@ -12,7 +12,8 @@ import { keepTicks, loopKey, noteFile, noteRelative, putBlock, readBlock, } from
12
12
  // Written between markers under the title; rerunning replaces only that block.
13
13
  const DAY_MS = 24 * 60 * 60 * 1000;
14
14
  const AHEAD_DAYS = 30;
15
- const LOOP_DAYS = 14;
15
+ // Loops carry for three mornings; older ones stay in their session records.
16
+ const LOOP_DAYS = 3;
16
17
  const EVENT = /\b(exam|deadline|due|interview|meeting|appointment|call|submit|test)\b|موعد|امتحان|مقابلة/i;
17
18
  const OPEN_STATES = new Set([
18
19
  "active",
@@ -78,7 +79,7 @@ export async function upcoming(date) {
78
79
  .filter((line) => !seen.has(line) && seen.add(line))
79
80
  .slice(0, 8);
80
81
  }
81
- // Unticked open loops from the last two weeks of notes, oldest first; ticking one in any note
82
+ // Unticked open loops from the last three days of notes, oldest first; ticking one in any note
82
83
  // (`- [x]`) closes it everywhere.
83
84
  export async function openLoops(date) {
84
85
  const notes = [];
@@ -140,7 +141,7 @@ export async function prepareDay(options) {
140
141
  fetchText: options.fetchText,
141
142
  }).catch(() => null);
142
143
  // Items already in today's brief (an earlier run marked them seen) still lead the morning.
143
- const briefFile = oceanPath(DAILY_DIR, "briefs", `${date}.md`);
144
+ const briefFile = oceanPath(REPORTS_DIR, "briefs", `${date}.md`);
144
145
  const earlier = (await readFile(briefFile, "utf8").catch(() => ""))
145
146
  .split("\n")
146
147
  .filter((line) => line.startsWith("- **"));
@@ -154,7 +155,7 @@ export async function prepareDay(options) {
154
155
  const hasFile = Boolean(brief?.file) || earlier.length > 0;
155
156
  const briefLines = [
156
157
  ...top,
157
- ...(hasFile ? [`- Full brief: [${date}](briefs/${date}.md)`] : []),
158
+ ...(hasFile ? [`- Full brief: [${date}](reports/briefs/${date}.md)`] : []),
158
159
  ...(brief?.resurface ? [`- Look again: ${brief.resurface}`] : []),
159
160
  ...(options.news
160
161
  ? [`- ${options.news.replace(/\s+/g, " ").slice(0, 600)}`]
@@ -4,10 +4,10 @@ import { proposeMemory } from "@ocean/brain/memory/memory-write.js";
4
4
  import { MemoryContractError } from "@ocean/core/domain/mcp/memory-contract.js";
5
5
  import { cleanTitle } from "@ocean/core/shared/clean-title.js";
6
6
  import { atomicWrite, parseFrontmatter } from "@ocean/core/shared/fs-utils.js";
7
- import { DAILY_DIR, INBOX_DIR, KNOWLEDGE_DIR, oceanPath, PERSONAL_DIR, } from "@ocean/core/shared/paths.js";
7
+ import { DAILY_DIR, INBOX_DIR, KNOWLEDGE_DIR, oceanPath, PERSONAL_DIR, REPORTS_DIR, } from "@ocean/core/shared/paths.js";
8
8
  import { listMilestones } from "../express/express.js";
9
9
  // The weekly distill (T-314): a week's session records and briefs become one digest in
10
- // 01-daily/weekly/, the Decisions and Learned sections become knowledge candidates for review,
10
+ // 01-daily/reports/weekly/, the Decisions and Learned sections become knowledge candidates for review,
11
11
  // each record read is marked `distilled: true`, and inbox captures marked processed move to
12
12
  // 00-inbox/archive/<week>/. Dry run unless `apply`. Nothing is written as knowledge directly.
13
13
  const DAY = 24 * 60 * 60 * 1000;
@@ -72,7 +72,7 @@ export async function distillWeek(options) {
72
72
  const title = cleanTitle(/^# (.+)$/m.exec(text)?.[1] ?? "", fields.project || path.basename(file, ".md"));
73
73
  sessions.push({ file, text, title, status: fields.status ?? "" });
74
74
  }
75
- const briefs = (await markdownIn(oceanPath(DAILY_DIR, "briefs"))).filter((file) => inWeek(/(\d{4}-\d{2}-\d{2})/.exec(path.basename(file))?.[1]));
75
+ const briefs = (await markdownIn(oceanPath(REPORTS_DIR, "briefs"))).filter((file) => inWeek(/(\d{4}-\d{2}-\d{2})/.exec(path.basename(file))?.[1]));
76
76
  const captures = [];
77
77
  for (const file of await markdownIn(oceanPath(INBOX_DIR, "captures")))
78
78
  if (/^status:\s*processed\s*$/m.test(await readFile(file, "utf8")))
@@ -104,9 +104,9 @@ export async function distillWeek(options) {
104
104
  const learned = pick("Learned");
105
105
  const problems = pick("Problems → fixes");
106
106
  const next = pick("Next");
107
- const link = (file, label) => `[${label.replace(/[[\]]/g, "")}](../${path.relative(oceanPath(DAILY_DIR), file).split(path.sep).join("/")})`;
107
+ const link = (file, label) => `[${label.replace(/[[\]]/g, "")}](${path.relative(oceanPath(REPORTS_DIR, "weekly"), file).split(path.sep).join("/")})`;
108
108
  const list = (items) => items.map(({ item, text }) => `- ${link(item.file, item.title)}: ${text.replace(/\s+/g, " ").slice(0, 400)}`);
109
- const digestRelative = `${DAILY_DIR}/weekly/${week.label}.md`;
109
+ const digestRelative = `${REPORTS_DIR}/weekly/${week.label}.md`;
110
110
  result.digest = digestRelative;
111
111
  if (!options.apply)
112
112
  return result;
@@ -182,7 +182,7 @@ export async function reviewMonth(options) {
182
182
  const first = `${month}-01`;
183
183
  const last = `${month}-31`;
184
184
  const weeks = [];
185
- for (const file of await markdownIn(oceanPath(DAILY_DIR, "weekly"))) {
185
+ for (const file of await markdownIn(oceanPath(REPORTS_DIR, "weekly"))) {
186
186
  const fields = parseFrontmatter(await readFile(file, "utf8"));
187
187
  if (fields.type !== "weekly")
188
188
  continue;
@@ -194,7 +194,7 @@ export async function reviewMonth(options) {
194
194
  const sessions = (await markdownIn(oceanPath(DAILY_DIR, "sessions", month)))
195
195
  .length;
196
196
  const goals = await goalNames();
197
- const relative = `${DAILY_DIR}/monthly/${month}.md`;
197
+ const relative = `${REPORTS_DIR}/monthly/${month}.md`;
198
198
  const result = {
199
199
  month,
200
200
  review: relative,
@@ -213,7 +213,7 @@ export async function reviewMonth(options) {
213
213
  // The owner's answers live in this file; a rerun never overwrites them.
214
214
  if (await readFile(file, "utf8").then(() => true, () => false))
215
215
  return result;
216
- const link = (target, label) => `[${label.replace(/[[\]]/g, "")}](../${path.relative(oceanPath(DAILY_DIR), target).split(path.sep).join("/")})`;
216
+ const link = (target, label) => `[${label.replace(/[[\]]/g, "")}](${path.relative(oceanPath(REPORTS_DIR, "monthly"), target).split(path.sep).join("/")})`;
217
217
  const body = [
218
218
  "---",
219
219
  "type: monthly",
@@ -17,6 +17,11 @@ import { section } from "../distill/distill.js";
17
17
  const DAY_MS = 24 * 60 * 60 * 1000;
18
18
  const MAX_SESSION_MS = 8 * 60 * 60 * 1000;
19
19
  const MIN_ITEM = 25;
20
+ // A journal line stays one line; a session lists at most this many Next steps.
21
+ const JOURNAL_CHARS = 200;
22
+ const JOURNAL_NEXT = 3;
23
+ // "Completed." is a status, not an outcome (older closeout records wrote it on every session).
24
+ const PLACEHOLDER = /^(not stated|no objective was captured|none|n\/a|completed)\.?$/i;
20
25
  const SAME_TITLE = 0.6;
21
26
  // Where each kind of harvested item is filed, and the record type it carries.
22
27
  const KINDS = {
@@ -253,36 +258,53 @@ function dayBlock(input) {
253
258
  const byProvider = new Map();
254
259
  for (const session of input.sessions)
255
260
  byProvider.set(session.provider || "unknown", (byProvider.get(session.provider || "unknown") ?? 0) + 1);
256
- const kind = (k, label) => {
257
- const items = input.items.filter((item) => item.kind === k);
258
- return items.length
259
- ? [
260
- "",
261
- `### ${label}`,
262
- "",
263
- ...items.map((item) => {
264
- const filed = input.filed.get(item);
265
- return `- ${item.text}${filed ? ` → \`${filed}\`` : ""} (${link(item.session)})`;
266
- }),
267
- ]
268
- : [];
261
+ // One journal entry per session, newest first: what it was for, how it ended, what was
262
+ // decided, and its Next steps as open loops (carried forward a few mornings until ticked).
263
+ const line = (text) => text.length > JOURNAL_CHARS ? `${text.slice(0, JOURNAL_CHARS - 1)}…` : text;
264
+ // Goal and Outcome are prose: kept however short, unless a placeholder.
265
+ const first = (session, heading) => {
266
+ const text = clean(section(session.text, heading));
267
+ return text && !PLACEHOLDER.test(text) && !containsKnownSecret(text)
268
+ ? text
269
+ : "";
269
270
  };
270
- // Every Next a session left is an open loop: carried forward each morning until ticked.
271
- const loops = input.sessions.flatMap((session) => sectionItems(session.text, "Next").map((item) => `- [ ] ${item} (${link(session)})`));
271
+ const journal = [...input.sessions]
272
+ .sort((a, b) => b.relative.localeCompare(a.relative))
273
+ .flatMap((session) => {
274
+ const time = /(\d{4}-\d{2}-\d{2})-(\d{2})(\d{2})/.exec(path.basename(session.file));
275
+ const head = [
276
+ time ? `${time[2]}:${time[3]}` : "",
277
+ session.provider,
278
+ session.title,
279
+ ]
280
+ .filter(Boolean)
281
+ .join(" · ");
282
+ const decisions = sectionItems(session.text, KINDS.decision.heading);
283
+ const goal = first(session, "Goal");
284
+ const outcome = first(session, "Outcome");
285
+ return [
286
+ "",
287
+ `### ${head}`,
288
+ "",
289
+ ...(goal ? [`- Goal: ${line(goal)}`] : []),
290
+ ...(outcome ? [`- Outcome: ${line(outcome)}`] : []),
291
+ ...(decisions.length
292
+ ? [
293
+ `- Decided: ${line(decisions[0])}${decisions.length > 1 ? ` (+${decisions.length - 1} more)` : ""}`,
294
+ ]
295
+ : []),
296
+ ...sectionItems(session.text, "Next")
297
+ .slice(0, JOURNAL_NEXT)
298
+ .map((item) => `- [ ] ${line(item)} (${link(session)})`),
299
+ `- Record: ${link(session)}`,
300
+ ];
301
+ });
272
302
  const minutes = Object.entries(input.minutes).sort((a, b) => b[1] - a[1]);
273
303
  return [
274
304
  "## Day summary",
275
305
  "",
276
306
  `${input.sessions.length} session(s): ${[...byProvider].map(([provider, n]) => `${provider} ${n}`).join(", ") || "none"}.`,
277
- "",
278
- "### Sessions",
279
- "",
280
- ...(input.sessions.length
281
- ? input.sessions.map((session) => `- ${link(session)} — ${[session.project, session.provider, session.status].filter(Boolean).join(" · ")}`)
282
- : ["- none"]),
283
- ...kind("decision", "Decisions"),
284
- ...kind("solution", "Problems → fixes"),
285
- ...kind("discovery", "Learned"),
307
+ ...(journal.length ? ["", "## Journal", ...journal] : []),
286
308
  ...(input.captures.length
287
309
  ? ["", "### Captured", "", ...input.captures]
288
310
  : []),
@@ -292,7 +314,6 @@ function dayBlock(input) {
292
314
  `_Filed into knowledge on its own; undo with \`ocean harvest undo ${input.date}\`._`,
293
315
  ]
294
316
  : []),
295
- ...(loops.length ? ["", "## Open loops", "", ...loops] : []),
296
317
  ...(input.corrections.length
297
318
  ? [
298
319
  "",
@@ -371,7 +392,6 @@ export async function harvestDay(options) {
371
392
  await mkdir(path.dirname(file), { recursive: true });
372
393
  const body = dayBlock({
373
394
  sessions,
374
- items,
375
395
  filed,
376
396
  corrections,
377
397
  minutes,
@@ -431,17 +451,22 @@ export async function undoDay(date) {
431
451
  await rename(ledgerFile(date), stateDir("ledger", `${date}.undone.json`));
432
452
  return { removed, restored };
433
453
  }
434
- // After `days`, a harvested day leaves the working folders: the day's note to
435
- // 01-daily/archive/<YYYY-MM>/, its session records to 01-daily/sessions/archive/<YYYY-MM>/ (still
436
- // searched). Nothing is deleted, and nothing unharvested moves.
454
+ // A harvested day leaves the working folders: after `days` (a week) its note goes to
455
+ // 01-daily/archive/<YYYY-MM>/, so the root holds about the last seven days; after `sessionDays`
456
+ // (a month) its session records go to 01-daily/sessions/archive/<YYYY-MM>/ (still searched).
457
+ // Nothing is deleted, and nothing unharvested moves.
437
458
  export async function archiveHarvested(options) {
438
- const cutoff = new Date(Date.parse(options.today) - (options.days ?? 30) * DAY_MS)
459
+ const before = (days) => new Date(Date.parse(options.today) - days * DAY_MS)
439
460
  .toISOString()
440
461
  .slice(0, 10);
462
+ const cutoff = before(options.days ?? 7);
463
+ const sessionCutoff = before(options.sessionDays ?? 30);
441
464
  const moves = [];
442
465
  for (const file of await markdownIn(sessionsRoot())) {
443
466
  const fields = parseFrontmatter((await readFile(file, "utf8")).slice(0, 4096));
444
- if (fields.type !== "session" || !fields.date || fields.date >= cutoff)
467
+ if (fields.type !== "session" ||
468
+ !fields.date ||
469
+ fields.date >= sessionCutoff)
445
470
  continue;
446
471
  if (!fields.harvested)
447
472
  continue;
@@ -2,7 +2,7 @@ import { mkdir, readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { appendAudit, readAudit, sha256, } from "@ocean/brain/memory/memory-audit.js";
4
4
  import { atomicWrite, parseFrontmatter } from "@ocean/core/shared/fs-utils.js";
5
- import { DAILY_DIR, KNOWLEDGE_DIR, oceanPath, PERSONAL_DIR, PROJECTS_DIR, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
5
+ import { KNOWLEDGE_DIR, oceanPath, PERSONAL_DIR, PROJECTS_DIR, REPORTS_DIR, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
6
6
  import { setFrontmatterFields } from "@ocean/loop/tasks/task-verification.js";
7
7
  const SKIP_HOSTS = /^(localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\]|example\.(com|org|net)|[^/]*\.(local|test|example|invalid))$/i;
8
8
  const PLACEHOLDER = /[<>*{}$|]|\.\.\./;
@@ -84,7 +84,7 @@ export function stampFor(source, verdict, today) {
84
84
  const next = setFrontmatterFields(source, change);
85
85
  return next === source ? null : next;
86
86
  }
87
- export const hygieneFile = (month) => oceanPath(DAILY_DIR, "hygiene", `${month}.md`);
87
+ export const hygieneFile = (month) => oceanPath(REPORTS_DIR, "hygiene", `${month}.md`);
88
88
  export async function runHygiene(options) {
89
89
  const root = oceanPath();
90
90
  const cache = new Map();
@@ -1,7 +1,7 @@
1
1
  import { mkdir, readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { atomicWrite, parseFrontmatter } from "@ocean/core/shared/fs-utils.js";
4
- import { DAILY_DIR, KNOWLEDGE_DIR, listProjectDirs, oceanPath, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
4
+ import { KNOWLEDGE_DIR, listProjectDirs, oceanPath, REPORTS_DIR, SYSTEM_DIR, } from "@ocean/core/shared/paths.js";
5
5
  import { sessionTokens } from "@ocean/loop/runs/session-tokens.js";
6
6
  import { RECURRENCE_WINDOW_DAYS, } from "../journey/failures.js";
7
7
  // Moved to the loop package (T-322) so run guards can count tokens; re-exported for callers.
@@ -259,7 +259,7 @@ export async function readSearchEval() {
259
259
  }
260
260
  }
261
261
  export function scorecardFile(date) {
262
- return oceanPath(DAILY_DIR, "scorecard", `${date}.md`);
262
+ return oceanPath(REPORTS_DIR, "scorecard", `${date}.md`);
263
263
  }
264
264
  export async function writeScorecard(rows, date) {
265
265
  const file = scorecardFile(date);
@@ -1,7 +1,7 @@
1
1
  import { mkdir, readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { atomicWrite } from "@ocean/core/shared/fs-utils.js";
4
- import { DAILY_DIR, oceanPath } from "@ocean/core/shared/paths.js";
4
+ import { oceanPath, REPORTS_DIR } from "@ocean/core/shared/paths.js";
5
5
  import { scorecardFile } from "../scorecard/scorecard.js";
6
6
  const tokens = (n) => n.toLocaleString("en-US");
7
7
  const lastLine = (text) => text.trim().split(/\r?\n/).filter(Boolean).at(-1)?.slice(0, 200) ?? "";
@@ -86,7 +86,7 @@ export async function previousScorecard(date) {
86
86
  .at(-1);
87
87
  return earlier ? readFile(path.join(dir, earlier), "utf8") : null;
88
88
  }
89
- export const digestFile = (date) => oceanPath(DAILY_DIR, "digest", `${date}.md`);
89
+ export const digestFile = (date) => oceanPath(REPORTS_DIR, "digest", `${date}.md`);
90
90
  export function renderDigest(input) {
91
91
  const failed = input.results.filter((result) => !result.ok);
92
92
  const cell = (text) => text.replace(/\|/g, "\\|");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ocean/services",
3
- "version": "2.14.0",
3
+ "version": "2.15.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.14.0",
8
+ "version": "2.15.0",
9
9
  "engines": {
10
- "ocean": ">=2.14.0"
10
+ "ocean": ">=2.15.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.14.0",
26
+ "version": "2.15.0",
27
27
  "engines": {
28
- "ocean": ">=2.14.0"
28
+ "ocean": ">=2.15.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.14.0",
44
+ "version": "2.15.0",
45
45
  "engines": {
46
- "ocean": ">=2.14.0"
46
+ "ocean": ">=2.15.0"
47
47
  },
48
48
  "source": {
49
49
  "type": "path",
@@ -59,16 +59,16 @@
59
59
  {
60
60
  "kind": "skill",
61
61
  "name": "dev.ocean.skills.daily-harvest",
62
- "version": "2.14.0",
62
+ "version": "2.15.0",
63
63
  "engines": {
64
- "ocean": ">=2.14.0"
64
+ "ocean": ">=2.15.0"
65
65
  },
66
66
  "source": {
67
67
  "type": "path",
68
68
  "path": "skills/core/daily-harvest"
69
69
  },
70
70
  "integrity": {
71
- "sha256": "23c7018021bda0bdf8eebe03e78c74ff42e14fe85c15b413b82b648505af2c08"
71
+ "sha256": "fdc3de506622fb13ad9e7e0fcf16b69c7f564215e6a46e767846cee070c28e48"
72
72
  },
73
73
  "spec": {
74
74
  "directory": "daily-harvest"
@@ -77,9 +77,9 @@
77
77
  {
78
78
  "kind": "skill",
79
79
  "name": "dev.ocean.skills.design-thinking",
80
- "version": "2.14.0",
80
+ "version": "2.15.0",
81
81
  "engines": {
82
- "ocean": ">=2.14.0"
82
+ "ocean": ">=2.15.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.14.0",
98
+ "version": "2.15.0",
99
99
  "engines": {
100
- "ocean": ">=2.14.0"
100
+ "ocean": ">=2.15.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.14.0",
116
+ "version": "2.15.0",
117
117
  "engines": {
118
- "ocean": ">=2.14.0"
118
+ "ocean": ">=2.15.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.14.0",
134
+ "version": "2.15.0",
135
135
  "engines": {
136
- "ocean": ">=2.14.0"
136
+ "ocean": ">=2.15.0"
137
137
  },
138
138
  "source": {
139
139
  "type": "path",
@@ -149,9 +149,9 @@
149
149
  {
150
150
  "kind": "skill",
151
151
  "name": "dev.ocean.skills.session-handoff",
152
- "version": "2.14.0",
152
+ "version": "2.15.0",
153
153
  "engines": {
154
- "ocean": ">=2.14.0"
154
+ "ocean": ">=2.15.0"
155
155
  },
156
156
  "source": {
157
157
  "type": "path",
@@ -167,9 +167,9 @@
167
167
  {
168
168
  "kind": "skill",
169
169
  "name": "dev.ocean.skills.use-browser",
170
- "version": "2.14.0",
170
+ "version": "2.15.0",
171
171
  "engines": {
172
- "ocean": ">=2.14.0"
172
+ "ocean": ">=2.15.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.verification",
188
- "version": "2.14.0",
188
+ "version": "2.15.0",
189
189
  "engines": {
190
- "ocean": ">=2.14.0"
190
+ "ocean": ">=2.15.0"
191
191
  },
192
192
  "source": {
193
193
  "type": "path",
@@ -203,16 +203,16 @@
203
203
  {
204
204
  "kind": "skill",
205
205
  "name": "dev.ocean.skills.weekly-review",
206
- "version": "2.14.0",
206
+ "version": "2.15.0",
207
207
  "engines": {
208
- "ocean": ">=2.14.0"
208
+ "ocean": ">=2.15.0"
209
209
  },
210
210
  "source": {
211
211
  "type": "path",
212
212
  "path": "skills/core/weekly-review"
213
213
  },
214
214
  "integrity": {
215
- "sha256": "112aac4a9ec788a8c818dedec28989f62172ce1a0957112e979518f3dcb2452d"
215
+ "sha256": "c02ce051b5bda70c9f081ecff1bef28ca2b683650b438378d75425fa938d356c"
216
216
  },
217
217
  "spec": {
218
218
  "directory": "weekly-review"
@@ -258,9 +258,9 @@
258
258
  "npx"
259
259
  ]
260
260
  },
261
- "version": "2.14.0",
261
+ "version": "2.15.0",
262
262
  "engines": {
263
- "ocean": ">=2.14.0"
263
+ "ocean": ">=2.15.0"
264
264
  },
265
265
  "source": {
266
266
  "type": "path",
@@ -379,9 +379,9 @@
379
379
  "npx"
380
380
  ]
381
381
  },
382
- "version": "2.14.0",
382
+ "version": "2.15.0",
383
383
  "engines": {
384
- "ocean": ">=2.14.0"
384
+ "ocean": ">=2.15.0"
385
385
  },
386
386
  "source": {
387
387
  "type": "path",
@@ -445,9 +445,9 @@
445
445
  "kind": "mcp",
446
446
  "name": "dev.ocean/mcp-gateway",
447
447
  "description": "One MCP endpoint for every registered server: Ocean's own and those installed from the marketplace.",
448
- "version": "2.14.0",
448
+ "version": "2.15.0",
449
449
  "engines": {
450
- "ocean": ">=2.14.0"
450
+ "ocean": ">=2.15.0"
451
451
  },
452
452
  "source": {
453
453
  "type": "path",
@@ -489,9 +489,9 @@
489
489
  "kind": "mcp",
490
490
  "name": "dev.ocean/obsidian",
491
491
  "description": "Ocean's Obsidian vault bridge over MCP.",
492
- "version": "2.14.0",
492
+ "version": "2.15.0",
493
493
  "engines": {
494
- "ocean": ">=2.14.0"
494
+ "ocean": ">=2.15.0"
495
495
  },
496
496
  "source": {
497
497
  "type": "path",
@@ -533,9 +533,9 @@
533
533
  "kind": "mcp",
534
534
  "name": "dev.ocean/ocean",
535
535
  "description": "Ocean's own MCP server: workspace status, tasks, handoffs, sessions and the brain.",
536
- "version": "2.14.0",
536
+ "version": "2.15.0",
537
537
  "engines": {
538
- "ocean": ">=2.14.0"
538
+ "ocean": ">=2.15.0"
539
539
  },
540
540
  "source": {
541
541
  "type": "path",
@@ -587,9 +587,9 @@
587
587
  "npx"
588
588
  ]
589
589
  },
590
- "version": "2.14.0",
590
+ "version": "2.15.0",
591
591
  "engines": {
592
- "ocean": ">=2.14.0"
592
+ "ocean": ">=2.15.0"
593
593
  },
594
594
  "source": {
595
595
  "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.14.0",
4
+ "version": "2.15.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.14.0",
57
- "@ocean/context": "2.14.0",
58
- "@ocean/core": "2.14.0",
59
- "@ocean/loop": "2.14.0",
60
- "@ocean/market": "2.14.0",
61
- "@ocean/services": "2.14.0",
56
+ "@ocean/brain": "2.15.0",
57
+ "@ocean/context": "2.15.0",
58
+ "@ocean/core": "2.15.0",
59
+ "@ocean/loop": "2.15.0",
60
+ "@ocean/market": "2.15.0",
61
+ "@ocean/services": "2.15.0",
62
62
  "playwright-core": "^1.48.0",
63
63
  "sqlite-vec": "0.1.9",
64
64
  "zod": "^4.6.5"
@@ -67,9 +67,9 @@ about other people, only what the work needs; never invent a detail.
67
67
 
68
68
  ## 3. Archive
69
69
 
70
- Run `ocean harvest archive --yes`: harvested days older than 30 days leave `01-daily/` for
71
- `01-daily/archive/<YYYY-MM>/` (notes) and `01-daily/sessions/archive/<YYYY-MM>/` (records, still
72
- searched). Nothing is deleted.
70
+ Run `ocean harvest archive --yes`: a harvested day's note leaves `01-daily/` for
71
+ `01-daily/archive/<YYYY-MM>/` after 7 days, and its session records go to
72
+ `01-daily/sessions/archive/<YYYY-MM>/` (still searched) after 30. Nothing is deleted.
73
73
 
74
74
  ## 4. Report
75
75
 
@@ -10,7 +10,7 @@ category: core
10
10
  Take the owner from a full inbox to zero, one decision at a time. He decides; you prepare.
11
11
 
12
12
  1. Run `ocean distill --week` (dry run) and show what it would do; on his yes, run it with
13
- `--yes`. Open the digest it wrote in `01-daily/weekly/`.
13
+ `--yes`. Open the digest it wrote in `01-daily/reports/weekly/`.
14
14
  2. Walk `ocean memory review list`, oldest first. For each candidate, show its title, source and
15
15
  proposed target in two lines, then ask: approve (`ocean memory review approve <id>`, with
16
16
  `--type <type>` or `--to <path>` when it has no target), edit, or reject. Never approve