brain-memory 0.1.0-beta.3 → 0.1.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -95,6 +95,38 @@ Then append the contents of the corresponding prompt file to your agent's instru
95
95
  | `/brain:sunshine [target]` | Deep forensic erasure — trace and remove all references |
96
96
  | `/brain:sleep [scope]` | Full maintenance cycle — 9 neuroscience-inspired phases |
97
97
  | `/brain:status` | Dashboard with brain health metrics and recommendations |
98
+ | `/brain:sync [subcommand]` | Cloud sync — push/pull memories to Dropbox, Google Drive, or OneDrive |
99
+
100
+ ## Session Lifecycle
101
+
102
+ Brain Memory works automatically in the background — no commands needed for basic context awareness.
103
+
104
+ ### Session Start
105
+
106
+ When a session begins and `.brain/` exists, the agent automatically:
107
+
108
+ 1. Reads the brain index and loads the top 3-5 memories relevant to the current project
109
+ 2. Checks the review queue for memories due for spaced repetition
110
+ 3. Outputs a brief status line:
111
+
112
+ ```
113
+ 🧠 Brain active — 42 memories loaded (8 in current project context)
114
+ 📋 3 memories due for review — run /brain:review
115
+ ```
116
+
117
+ The agent silently internalizes relevant memories and references them naturally during the session — no information dump.
118
+
119
+ ### Session End
120
+
121
+ When a session ends, the agent evaluates whether significant decisions, learnings, insights, or experiences occurred. If so, it suggests:
122
+
123
+ ```
124
+ 💡 This session contained notable decisions and learnings.
125
+ Would you like to store them as brain memories?
126
+ Run /brain:memorize to capture them before this context is lost.
127
+ ```
128
+
129
+ The agent never auto-memorizes without user consent. Session context is always saved to `.brain/contexts.json` for context-dependent recall.
98
130
 
99
131
  ## How It Works
100
132
 
@@ -117,7 +149,7 @@ Create → Store → Decay → Recall → Reinforce → Review → Sleep → Arc
117
149
 
118
150
  ### Neuroscience Foundations
119
151
 
120
- Brain Memory v2 is grounded in peer-reviewed neuroscience research. Here's how each mechanism maps to the brain:
152
+ Brain Memory is grounded in peer-reviewed neuroscience research. Here's how each mechanism maps to the brain:
121
153
 
122
154
  | Brain Mechanism | Implementation |
123
155
  |-----------------|---------------|
@@ -226,8 +258,6 @@ score = 0.38 * relevance
226
258
  - **context_match** (0.14) — How similar the encoding context is to the current session
227
259
  - **salience** (0.08) — Emotional/motivational significance
228
260
 
229
- The formula gracefully degrades for v1 memories missing newer fields — weights are renormalized across available terms.
230
-
231
261
  The agent then decides the response strategy:
232
262
  - **Single strong match** (top score > 0.7) → Return the full memory
233
263
  - **Multiple related** (2-5 candidates > 0.4) → Synthesize a consolidated response
@@ -261,7 +291,7 @@ Memories are connected via weighted edges in `.brain/associations.json`:
261
291
 
262
292
  ### Spaced Reinforcement
263
293
 
264
- Unlike the flat +0.05 boost per recall in v1, spaced reinforcement rewards optimal recall timing:
294
+ Spaced reinforcement rewards optimal recall timing:
265
295
 
266
296
  ```
267
297
  spacingMultiplier = min(3.0, 1.0 + log2(1 + daysSinceLastAccess))
@@ -328,15 +358,24 @@ Each expertise area gets an `_expertise.md` profile documenting what you know we
328
358
 
329
359
  Failed recalls reset the interval to 1 day. Successful recalls extend the interval by the ease factor. This ensures you spend time on memories that need reinforcement, not ones you already know well.
330
360
 
331
- ### Migration from v1
361
+ ### Cloud Sync
332
362
 
333
- Existing v1 brains upgrade automatically. The first `/brain:sleep` after upgrade runs a migration phase that:
334
- - Creates `associations.json` from existing `related` fields
335
- - Backfills `recall_history` from `access_count`
336
- - Sets sensible defaults for new fields (`cognitive_type: semantic`, `salience: 0.5`, `confidence: 0.8`)
337
- - Bumps `index.json` version to 2
363
+ `/brain:sync` lets you push and pull your `.brain/` memories to a cloud provider for cross-device access. Supports **Dropbox**, **Google Drive**, and **OneDrive** with zero npm dependencies (uses Node.js 18+ built-in `fetch`).
338
364
 
339
- No data is lost. All new scoring gracefully falls back when newer fields are absent.
365
+ **Key features:**
366
+ - **Manual push/pull** — No background watchers, no auto-sync. You control when data moves.
367
+ - **Three-way diff** — Compares local state, remote state, and last-known sync state to detect changes and conflicts.
368
+ - **Conflict resolution** — When the same file is modified locally and remotely, sync detects the conflict and lets you choose: keep local, keep remote, or keep both.
369
+ - **Optional encryption** — AES-256-GCM encryption with a user-provided passphrase. When enabled, all files are encrypted before upload and decrypted after download. The cloud provider only ever sees opaque bytes.
370
+ - **OAuth2 authentication** — PKCE authorization code flow with a Device Code Flow fallback for headless/SSH environments. Users register their own OAuth app with the provider and supply their client ID.
371
+
372
+ **Setup:**
373
+ 1. Register an OAuth app with your chosen provider (Dropbox / Google Drive / OneDrive)
374
+ 2. Run `/brain:sync login <provider>` and provide your client ID
375
+ 3. Authorize in the browser (or enter the device code for headless environments)
376
+ 4. Use `/brain:sync push` and `/brain:sync pull` to keep memories in sync
377
+
378
+ Sync state is stored locally in `.brain/.sync/` and is never uploaded to the cloud.
340
379
 
341
380
  ## File Structure
342
381
 
@@ -368,9 +407,13 @@ No data is lost. All new scoring gracefully falls back when newer fields are abs
368
407
  │ └── events/
369
408
  ├── _consolidated/ # Merged memories from consolidation
370
409
  │ └── _meta.json
371
- └── _archived/ # Decayed memories (recoverable + searchable)
372
- ├── _meta.json
373
- └── index.json # Searchable archive index
410
+ ├── _archived/ # Decayed memories (recoverable + searchable)
411
+ │ ├── _meta.json
412
+ │ └── index.json # Searchable archive index
413
+ └── .sync/ # Cloud sync state (never synced, local only)
414
+ ├── config.json # Provider, client ID, encryption flag
415
+ ├── credentials.enc # AES-256-GCM encrypted OAuth tokens
416
+ └── sync-state.json # Per-file revisions, cursor, conflicts
374
417
  ```
375
418
 
376
419
  Subdirectories are created **on demand** — the agent decides placement depth based on how specific the memory is. A generic career thought lands in `professional/`, but a specific deployment incident goes to `professional/companies/acme/projects/alpha/`.
@@ -413,40 +456,9 @@ Brain configuration lives in `.brain/index.json` under the `config` key:
413
456
  | `association_config.spreading_activation_depth` | 2 | Maximum hops for spreading activation traversal |
414
457
  | `association_config.spreading_activation_decay` | 0.5 | Decay factor per hop during spreading activation |
415
458
 
416
- ## Project Structure
459
+ ## Contributing
417
460
 
418
- ```
419
- brain/
420
- ├── bin/
421
- │ └── install.js # Interactive installer (npx brain-memory)
422
- ├── commands/
423
- │ └── brain/ # Slash command definitions
424
- │ ├── init.md
425
- │ ├── memorize.md
426
- │ ├── remember.md
427
- │ ├── review.md
428
- │ ├── explore.md
429
- │ ├── consolidate.md
430
- │ ├── forget.md
431
- │ ├── sunshine.md
432
- │ ├── sleep.md
433
- │ └── status.md
434
- ├── prompts/
435
- │ ├── claude.md # CLAUDE.md content (injected by installer)
436
- │ ├── gemini.md # GEMINI.md content (injected by installer)
437
- │ └── openai.md # AGENTS.md content (injected by installer)
438
- ├── hooks/
439
- │ ├── session-start.md # Ambient memory loading + review notifications
440
- │ └── session-end.md # Auto-memorize suggestion + context capture
441
- ├── templates/
442
- │ └── default-categories.json # Default brain category definitions
443
- ├── src/
444
- │ ├── scorer.js # Decay, spreading activation, context matching, spaced reinforcement
445
- │ └── index-manager.js # Index, associations, contexts, review queue, archive CRUD
446
- ├── CLAUDE.md # Development guide for this repo
447
- ├── package.json
448
- └── README.md
449
- ```
461
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, project structure, and how to submit changes.
450
462
 
451
463
  ## Inspired By
452
464
 
package/bin/install.js CHANGED
@@ -1,46 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const fs = require('fs');
4
- const path = require('path');
5
3
  const readline = require('readline');
6
-
7
- const PACKAGE_ROOT = path.resolve(__dirname, '..');
8
-
9
- const RUNTIMES = {
10
- claude: {
11
- name: 'Claude Code',
12
- globalDir: path.join(require('os').homedir(), '.claude'),
13
- localDir: '.claude',
14
- commandsSubdir: 'commands',
15
- promptFile: 'CLAUDE.md',
16
- promptSource: 'claude.md',
17
- settingsFile: 'settings.json',
18
- commandStyle: 'flat',
19
- },
20
- gemini: {
21
- name: 'Gemini CLI',
22
- globalDir: path.join(require('os').homedir(), '.gemini'),
23
- localDir: '.gemini',
24
- commandsSubdir: 'commands',
25
- promptFile: 'GEMINI.md',
26
- promptSource: 'gemini.md',
27
- settingsFile: null,
28
- commandStyle: 'flat',
29
- },
30
- openai: {
31
- name: 'OpenAI Codex CLI',
32
- globalDir: path.join(require('os').homedir(), '.codex'),
33
- localDir: '.codex',
34
- commandsSubdir: 'skills',
35
- promptFile: 'AGENTS.md',
36
- promptSource: 'openai.md',
37
- settingsFile: null,
38
- commandStyle: 'skills',
39
- },
40
- };
41
-
42
- const BRAIN_MARKER_START = '<!-- BRAIN-MEMORY-START -->';
43
- const BRAIN_MARKER_END = '<!-- BRAIN-MEMORY-END -->';
4
+ const {
5
+ RUNTIMES,
6
+ installForRuntime,
7
+ initializeBrain,
8
+ } = require('../src/installer');
44
9
 
45
10
  function createRL() {
46
11
  return readline.createInterface({
@@ -53,85 +18,6 @@ function ask(rl, question) {
53
18
  return new Promise((resolve) => rl.question(question, resolve));
54
19
  }
55
20
 
56
- function copyDir(src, dest) {
57
- fs.mkdirSync(dest, { recursive: true });
58
- const entries = fs.readdirSync(src, { withFileTypes: true });
59
- for (const entry of entries) {
60
- const srcPath = path.join(src, entry.name);
61
- const destPath = path.join(dest, entry.name);
62
- if (entry.isDirectory()) {
63
- copyDir(srcPath, destPath);
64
- } else {
65
- fs.copyFileSync(srcPath, destPath);
66
- }
67
- }
68
- }
69
-
70
- function installSkills(commandsSrc, skillsDest) {
71
- const entries = fs.readdirSync(commandsSrc).filter((f) => f.endsWith('.md'));
72
- for (const file of entries) {
73
- const name = file.replace('.md', '');
74
- const skillDir = path.join(skillsDest, `brain-${name}`);
75
- fs.mkdirSync(skillDir, { recursive: true });
76
- fs.copyFileSync(
77
- path.join(commandsSrc, file),
78
- path.join(skillDir, 'SKILL.md')
79
- );
80
- }
81
- }
82
-
83
- function injectPrompt(targetDir, promptFile, promptSource) {
84
- const promptContent = fs.readFileSync(
85
- path.join(PACKAGE_ROOT, 'prompts', promptSource),
86
- 'utf-8'
87
- );
88
- const targetPath = path.join(targetDir, promptFile);
89
-
90
- const wrappedContent = `\n${BRAIN_MARKER_START}\n${promptContent}\n${BRAIN_MARKER_END}\n`;
91
-
92
- if (fs.existsSync(targetPath)) {
93
- let existing = fs.readFileSync(targetPath, 'utf-8');
94
- // Remove old brain section if present
95
- const startIdx = existing.indexOf(BRAIN_MARKER_START);
96
- const endIdx = existing.indexOf(BRAIN_MARKER_END);
97
- if (startIdx !== -1 && endIdx !== -1) {
98
- existing =
99
- existing.substring(0, startIdx) +
100
- existing.substring(endIdx + BRAIN_MARKER_END.length);
101
- }
102
- fs.writeFileSync(targetPath, existing.trimEnd() + '\n' + wrappedContent);
103
- } else {
104
- fs.writeFileSync(targetPath, wrappedContent.trim() + '\n');
105
- }
106
- }
107
-
108
- function installForRuntime(runtime, scope) {
109
- const config = RUNTIMES[runtime];
110
- const targetDir = scope === 'global' ? config.globalDir : config.localDir;
111
- const commandsSrc = path.join(PACKAGE_ROOT, 'commands', 'brain');
112
-
113
- console.log(`\n Installing for ${config.name} (${scope})...`);
114
-
115
- if (config.commandStyle === 'skills') {
116
- // Codex: each command becomes a skill directory with SKILL.md
117
- const skillsDest = path.join(targetDir, config.commandsSubdir);
118
- console.log(` Installing skills to ${skillsDest}`);
119
- installSkills(commandsSrc, skillsDest);
120
- } else {
121
- // Claude / Gemini: flat copy into commands/brain/
122
- const commandsDest = path.join(targetDir, config.commandsSubdir, 'brain');
123
- console.log(` Copying commands to ${commandsDest}`);
124
- copyDir(commandsSrc, commandsDest);
125
- }
126
-
127
- // Inject prompt into CLAUDE.md / GEMINI.md / AGENTS.md
128
- const promptTarget = scope === 'global' ? config.globalDir : '.';
129
- console.log(` Injecting brain context into ${path.join(promptTarget, config.promptFile)}`);
130
- injectPrompt(promptTarget, config.promptFile, config.promptSource);
131
-
132
- console.log(` Done!`);
133
- }
134
-
135
21
  async function main() {
136
22
  console.log(`
137
23
  ╔══════════════════════════════════════════════════════╗
@@ -210,12 +96,23 @@ async function main() {
210
96
  // Perform installation
211
97
  console.log('\n Installing...');
212
98
  for (const runtime of runtimes) {
99
+ const config = RUNTIMES[runtime];
100
+ console.log(`\n Installing for ${config.name} (${scope})...`);
213
101
  installForRuntime(runtime, scope);
102
+ console.log(` Done!`);
214
103
  }
215
104
 
216
105
  // Initialize .brain if requested
217
106
  if (initBrain.trim().toLowerCase() !== 'n') {
218
- initializeBrain();
107
+ const result = initializeBrain();
108
+ if (result.alreadyExists) {
109
+ console.log('\n .brain/ already exists, skipping initialization.');
110
+ } else {
111
+ console.log('\n .brain/ initialized successfully.');
112
+ console.log('');
113
+ console.log(' ☁️ Cloud sync is available! Use /brain:sync login to connect');
114
+ console.log(' Dropbox, Google Drive, or OneDrive for cross-device access.');
115
+ }
219
116
  }
220
117
 
221
118
  console.log(`
@@ -232,6 +129,7 @@ async function main() {
232
129
  /brain:sunshine Deep forensic memory erasure
233
130
  /brain:sleep Full maintenance cycle
234
131
  /brain:status Brain overview dashboard
132
+ /brain:sync Cloud sync (Dropbox/Google Drive/OneDrive)
235
133
 
236
134
  Get started by running /brain:init in your agent session.
237
135
  `);
@@ -240,121 +138,6 @@ async function main() {
240
138
  }
241
139
  }
242
140
 
243
- function initializeBrain() {
244
- const brainDir = path.join(process.cwd(), '.brain');
245
-
246
- if (fs.existsSync(brainDir)) {
247
- console.log('\n .brain/ already exists, skipping initialization.');
248
- return;
249
- }
250
-
251
- console.log('\n Creating .brain/ directory structure...');
252
-
253
- const now = new Date().toISOString();
254
-
255
- // Create directories
256
- const categories = ['professional', 'personal', 'social', 'family', '_consolidated', '_archived'];
257
- for (const cat of categories) {
258
- fs.mkdirSync(path.join(brainDir, cat), { recursive: true });
259
- }
260
-
261
- // Create index.json
262
- const index = {
263
- version: 2,
264
- created: now,
265
- last_updated: now,
266
- memory_count: 0,
267
- memories: {},
268
- config: {
269
- max_depth: 6,
270
- consolidation_threshold: 0.3,
271
- decay_check_interval_days: 7,
272
- strength_boost_on_recall: 0.05,
273
- auto_consolidate: true,
274
- propagation_window_days: 7,
275
- association_config: {
276
- co_retrieval_boost: 0.10,
277
- link_decay_rate: 0.998,
278
- link_prune_threshold: 0.05,
279
- spreading_activation_depth: 2,
280
- spreading_activation_decay: 0.5,
281
- },
282
- },
283
- };
284
- fs.writeFileSync(
285
- path.join(brainDir, 'index.json'),
286
- JSON.stringify(index, null, 2) + '\n'
287
- );
288
-
289
- // Create associations.json
290
- fs.writeFileSync(
291
- path.join(brainDir, 'associations.json'),
292
- JSON.stringify({ version: 1, edges: {} }, null, 2) + '\n'
293
- );
294
-
295
- // Create contexts.json
296
- fs.writeFileSync(
297
- path.join(brainDir, 'contexts.json'),
298
- JSON.stringify({ version: 1, sessions: [] }, null, 2) + '\n'
299
- );
300
-
301
- // Create review-queue.json
302
- fs.writeFileSync(
303
- path.join(brainDir, 'review-queue.json'),
304
- JSON.stringify({ version: 1, items: [] }, null, 2) + '\n'
305
- );
306
-
307
- // Create _archived/index.json
308
- fs.writeFileSync(
309
- path.join(brainDir, '_archived', 'index.json'),
310
- JSON.stringify({ version: 1, archived_count: 0, memories: {} }, null, 2) + '\n'
311
- );
312
-
313
- // Load category descriptions from template
314
- const templatePath = path.join(PACKAGE_ROOT, 'templates', 'default-categories.json');
315
- let template = { top_categories: [] };
316
- if (fs.existsSync(templatePath)) {
317
- template = JSON.parse(fs.readFileSync(templatePath, 'utf-8'));
318
- }
319
-
320
- // Create _meta.json for each category
321
- const mainCategories = ['professional', 'personal', 'social', 'family'];
322
- for (const cat of mainCategories) {
323
- const templateCat = template.top_categories.find((c) => c.name === cat) || {};
324
- const meta = {
325
- category: cat,
326
- description: templateCat.description || cat,
327
- created: now,
328
- memory_count: 0,
329
- subcategories: [],
330
- };
331
- fs.writeFileSync(
332
- path.join(brainDir, cat, '_meta.json'),
333
- JSON.stringify(meta, null, 2) + '\n'
334
- );
335
- }
336
-
337
- // Create _meta.json for special directories
338
- for (const special of ['_consolidated', '_archived']) {
339
- const meta = {
340
- category: special,
341
- description:
342
- special === '_consolidated'
343
- ? 'Merged memories from consolidation operations'
344
- : 'Archived memories preserved for recovery',
345
- created: now,
346
- memory_count: 0,
347
- subcategories: [],
348
- };
349
- fs.writeFileSync(
350
- path.join(brainDir, special, '_meta.json'),
351
- JSON.stringify(meta, null, 2) + '\n'
352
- );
353
- }
354
-
355
- console.log(' .brain/ initialized successfully.');
356
- }
357
-
358
141
  main().catch((err) => {
359
142
  console.error('Installation failed:', err.message);
360
143
  process.exit(1);
@@ -147,11 +147,3 @@ Print a summary of what was created, including the full tree structure. Inform t
147
147
  - `/brain:status` — View brain overview
148
148
  - `/brain:review` — Spaced repetition review of memories due for reinforcement
149
149
 
150
- ### Migration Note
151
-
152
- If upgrading an existing v1 brain, the first `/brain:sleep` after upgrade will run a **Migration phase** (Phase 0) that:
153
- - Creates `associations.json` from existing `related` fields
154
- - Creates `contexts.json`, `review-queue.json`, and `_archived/index.json`
155
- - Backfills `recall_history` from `access_count` (using `last_accessed` as sole entry)
156
- - Sets default values for new frontmatter fields (`cognitive_type: semantic`, `salience: 0.5`, `confidence: 0.8`)
157
- - Bumps `index.json` version to 2
@@ -67,7 +67,7 @@ effective_score = 0.38 * relevance
67
67
  + 0.08 * salience_bonus
68
68
  ```
69
69
 
70
- **Note:** If a memory lacks newer fields (spreading_bonus, context_match, salience), the formula renormalizes weights across the available terms. This ensures backward compatibility with v1 memories.
70
+ **Note:** If a memory lacks some fields (spreading_bonus, context_match, salience), the formula renormalizes weights across the available terms.
71
71
 
72
72
  ### 5. Decide Response Strategy
73
73
 
@@ -110,7 +110,7 @@ diminishingFactor = 1.0 / (1.0 + 0.1 * recallCount)
110
110
  boost = 0.05 * spacingMultiplier * diminishingFactor
111
111
  ```
112
112
 
113
- Examples: 1 day gap = +0.05 (same as v1), 7 days = +0.08, 30 days = +0.10, cramming same day 20th recall = +0.02.
113
+ Examples: 1 day gap = +0.05, 7 days = +0.08, 30 days = +0.10, cramming same day 20th recall = +0.02.
114
114
 
115
115
  **Update in both the memory file AND index.json:**
116
116
  - `last_accessed` → current timestamp
@@ -18,24 +18,6 @@ Sleep performs nine phases, mimicking real neuroscience:
18
18
  8. **REM Dreaming** — Discover creative cross-domain associations via analogical reasoning
19
19
  9. **Expertise Detection** — Identify dense knowledge areas and generate expertise profiles
20
20
 
21
- ### Migration Phase (Phase 0)
22
-
23
- If the brain's `index.json` has `version: 1` (pre-v2), run migration first:
24
-
25
- 1. Create `associations.json` from existing `related` fields — for each memory with `related` entries, create edges with weight 0.20 and origin `manual`
26
- 2. Auto-discover associations: for any two memories sharing 2+ tags, create edges with weight 0.10 and origin `tag_overlap`
27
- 3. Create `contexts.json` with `{"version": 1, "sessions": []}`
28
- 4. Create `review-queue.json` with `{"version": 1, "items": []}`
29
- 5. Create `_archived/index.json` if not present with `{"version": 1, "archived_count": 0, "memories": {}}`
30
- 6. For each memory: backfill `recall_history` from `access_count` (if `access_count > 0`, set `recall_history: [last_accessed]`; otherwise `recall_history: []`)
31
- 7. Set defaults for missing fields: `cognitive_type: "semantic"`, `salience: 0.5`, `confidence: 0.8`
32
- 8. Update both memory files (frontmatter) and `index.json` entries
33
- 9. Set `index.json` version to 2
34
-
35
- Present migration summary, then proceed to Phase 1.
36
-
37
- ---
38
-
39
21
  ## Phase 1: Replay (Hippocampal Scan)
40
22
 
41
23
  During sleep, the hippocampus replays the day's events. Here, we scan and assess the full brain state.
@@ -532,4 +514,3 @@ After all phases complete, present a comprehensive sleep report:
532
514
  7. **Idempotent expertise** — if `_expertise.md` already exists, update it rather than creating a duplicate.
533
515
  8. **Skip empty phases** — if there's nothing to do in a phase (e.g., no flat clusters to reorganize), briefly note it and move on.
534
516
  9. **Salience protection** — never auto-prune memories with salience >= 0.7.
535
- 10. **Run migration** — if `index.json` version is 1, run Phase 0 migration before proceeding.
@@ -12,6 +12,8 @@ Also read (if they exist):
12
12
  - `.brain/associations.json` — for association network stats
13
13
  - `.brain/review-queue.json` — for review schedule info
14
14
  - `.brain/_archived/index.json` — for archive stats
15
+ - `.brain/.sync/config.json` — for cloud sync configuration
16
+ - `.brain/.sync/sync-state.json` — for sync state and pending changes
15
17
 
16
18
  ### 2. Compute Statistics
17
19
 
@@ -104,6 +106,13 @@ Calculate aggregate stats:
104
106
  + <title> (<path>) — <date>
105
107
  + <title> (<path>) — <date>
106
108
  ...
109
+
110
+ ## Cloud Sync
111
+ Provider: <provider or "not configured">
112
+ Encryption: <enabled/disabled>
113
+ Last Sync: <timestamp or "never">
114
+ Pending Changes: <count> files modified since last sync
115
+ Conflicts: <count>
107
116
  ```
108
117
 
109
118
  ### 4. Health Check
@@ -119,4 +128,6 @@ Analyze the brain's health and provide recommendations:
119
128
  - **"Needs sleep"** — Multiple flat clusters detected, OR many memories in moderate/weak tiers, OR no `_expertise.md` profiles exist despite having 10+ memories. Suggest `/brain:sleep`
120
129
  - **"Low confidence"** — More than 30% of memories have confidence < 0.5. Suggest reviewing and validating uncertain memories.
121
130
  - **"Review overdue"** — More than 10 memories are past their review date. Suggest `/brain:review`
122
- - **"Needs migration"** — Brain is v1 and needs upgrade. Suggest `/brain:sleep` to trigger migration.
131
+ - **"Sync available"** — Cloud sync is not configured. Suggest `/brain:sync login` for cross-device access.
132
+ - **"Sync stale"** — Last sync was more than 7 days ago. Suggest `/brain:sync push` or `/brain:sync pull`.
133
+ - **"Sync conflicts"** — Unresolved sync conflicts exist. Suggest `/brain:sync resolve`.