sideby 0.41.3 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.d.ts +2 -0
- package/dist/src/cli/commands.js +100 -0
- package/dist/src/cli/json-schemas.js +44 -0
- package/dist/src/cli/main.js +32 -1
- package/dist/src/core/claude-memory.d.ts +236 -0
- package/dist/src/core/claude-memory.js +937 -0
- package/dist/src/core/cli-commands.js +15 -2
- package/dist/src/core/config.d.ts +1 -0
- package/dist/src/core/config.js +4 -1
- package/dist/src/core/search-catalog.js +22 -0
- package/dist/src/core/session-hooks.d.ts +12 -2
- package/dist/src/core/session-hooks.js +12 -8
- package/dist/src/families/claude/layout.d.ts +7 -0
- package/dist/src/families/claude/layout.js +17 -0
- package/dist/src/families/claude/live-sessions.js +2 -1
- package/dist/src/panel/handler.d.ts +11 -0
- package/dist/src/panel/handler.js +21 -0
- package/dist/src/panel/i18n.d.ts +12 -0
- package/dist/src/panel/i18n.js +24 -0
- package/dist/src/panel/page-script.js +35 -1
- package/dist/src/panel/page-styles.js +1 -0
- package/dist/src/runtime.d.ts +30 -0
- package/dist/src/runtime.js +85 -1
- package/package.json +1 -1
- package/schemas/config.json +5 -1
- package/schemas/memory-set.json +117 -0
- package/schemas/memory.json +210 -0
- package/skills/sideby/SKILL.md +2 -1
- package/skills/sideby/references/sharing.md +23 -1
|
@@ -111,6 +111,18 @@ export const CLI_COMMANDS = [
|
|
|
111
111
|
example: 'sideby trust on',
|
|
112
112
|
feature: 'setting.trust',
|
|
113
113
|
},
|
|
114
|
+
{
|
|
115
|
+
id: 'memory',
|
|
116
|
+
group: 'accounts',
|
|
117
|
+
usage: 'sideby memory [on|off] [--dir <path>] [--yes]',
|
|
118
|
+
help: "let every Claude account use the main account's memory of a project: sessions sideby starts read and write it, and doctor --fix moves memory an account wrote on its own into the main account (on|off, shows the change first)",
|
|
119
|
+
summary: {
|
|
120
|
+
en: 'Let every Claude account remember what the others learned about a project',
|
|
121
|
+
zh: '让每个 Claude 账号记得其他账号对项目学到的东西',
|
|
122
|
+
},
|
|
123
|
+
example: 'sideby memory on',
|
|
124
|
+
feature: 'setting.memory',
|
|
125
|
+
},
|
|
114
126
|
{
|
|
115
127
|
id: 'edit',
|
|
116
128
|
group: 'accounts',
|
|
@@ -890,9 +902,10 @@ export function cliHelp(list = CLI_COMMANDS) {
|
|
|
890
902
|
const HELP_TAIL = `Options:
|
|
891
903
|
--json machine-readable output (list, new, next, alias, doctor, quota, tune, model, advisor, remote-control, handoff,
|
|
892
904
|
families, commands, plugins, app, desktop, sessions, history, send, messages, edit, browser, update, local, ask,
|
|
893
|
-
terminal, key, try, autostart, menubar, config, network, unattended, progress, trust)
|
|
905
|
+
terminal, key, try, autostart, menubar, config, network, unattended, progress, trust, memory)
|
|
894
906
|
-h, --help show this help; \`sideby <command> --help\` for new, alias, login, doctor, families, commands, desktop, edit, browser,
|
|
895
|
-
autostart, menubar, config, sessions, history, send, messages, network, unattended, progress, trust
|
|
907
|
+
autostart, menubar, config, sessions, history, send, messages, network, unattended, progress, trust,
|
|
908
|
+
memory
|
|
896
909
|
-v, --version show the version
|
|
897
910
|
|
|
898
911
|
An <account> is <family>:<name> (claude:work) or just <name> when it is unique.
|
|
@@ -124,6 +124,7 @@ export declare const ConfigSchema: Type.TObject<{
|
|
|
124
124
|
claude: Type.TOptional<Type.TObject<{
|
|
125
125
|
apiBetasOff: Type.TOptional<Type.TBoolean>;
|
|
126
126
|
carryTrust: Type.TOptional<Type.TBoolean>;
|
|
127
|
+
shareMemory: Type.TOptional<Type.TBoolean>;
|
|
127
128
|
}>>;
|
|
128
129
|
unattended: Type.TOptional<Type.TObject<{
|
|
129
130
|
schedule: Type.TOptional<Type.TArray<Type.TObject<{
|
package/dist/src/core/config.js
CHANGED
|
@@ -253,9 +253,12 @@ export const ConfigSchema = Type.Object({
|
|
|
253
253
|
carryTrust: Type.Optional(Type.Boolean({
|
|
254
254
|
description: 'Carry folder trust between Claude accounts (spec §3.43, ADR-0078): before sideby starts an interactive Claude session in a folder this account has not trusted yet, when another Claude account of yours already trusts it (the folder, a parent folder outside any git repository, or the repository\'s main checkout), sideby copies that one trust mark (`projects["<path>"].hasTrustDialogAccepted`) into this account\'s `.claude.json`, so Claude Code does not ask again. It never adds trust no account gave. Off by default; turning it off does not remove marks already copied (`sideby trust undo` does).',
|
|
255
255
|
})),
|
|
256
|
+
shareMemory: Type.Optional(Type.Boolean({
|
|
257
|
+
description: "Shared Project Memory (spec §3.44, ADR-0081): every interactive Claude session sideby starts in an account other than the main one reads and writes the main account's auto memory for its project (`~/.claude/projects/<project>/memory`, passed as `autoMemoryDirectory` through sideby's `--settings`), and `sideby doctor --fix` moves memory an account wrote on its own into the main account. Off by default; turning it off stops passing the folder and leaves the memory where it is.",
|
|
258
|
+
})),
|
|
256
259
|
}, {
|
|
257
260
|
additionalProperties: false,
|
|
258
|
-
description: 'Claude Code launches (spec §3.41, ADR-0074; `carryTrust`: spec §3.43, ADR-0078).',
|
|
261
|
+
description: 'Claude Code launches (spec §3.41, ADR-0074; `carryTrust`: spec §3.43, ADR-0078; `shareMemory`: spec §3.44, ADR-0081).',
|
|
259
262
|
})),
|
|
260
263
|
unattended: Type.Optional(Type.Object({
|
|
261
264
|
schedule: Type.Optional(Type.Array(UnattendedSlotSchema, {
|
|
@@ -228,6 +228,28 @@ const ENTRIES = [
|
|
|
228
228
|
target: { settings: 'trust', find: 'trust' },
|
|
229
229
|
cliCommand: 'sideby trust',
|
|
230
230
|
},
|
|
231
|
+
{
|
|
232
|
+
id: 'setting.memory',
|
|
233
|
+
kind: 'setting',
|
|
234
|
+
title: { en: 'Shared memory', zh: '共享记忆' },
|
|
235
|
+
synonyms: [
|
|
236
|
+
'memory',
|
|
237
|
+
'auto memory',
|
|
238
|
+
'project memory',
|
|
239
|
+
'shared memory',
|
|
240
|
+
'remember',
|
|
241
|
+
'MEMORY.md',
|
|
242
|
+
'autoMemoryDirectory',
|
|
243
|
+
'记忆',
|
|
244
|
+
'项目记忆',
|
|
245
|
+
'共享项目记忆',
|
|
246
|
+
'自动记忆',
|
|
247
|
+
'记不住',
|
|
248
|
+
],
|
|
249
|
+
panel: at(SET, { en: 'Shared memory', zh: '共享记忆' }),
|
|
250
|
+
target: { settings: 'memory', find: 'memory' },
|
|
251
|
+
cliCommand: 'sideby memory',
|
|
252
|
+
},
|
|
231
253
|
{
|
|
232
254
|
id: 'setting.quota-checks',
|
|
233
255
|
kind: 'setting',
|
|
@@ -7,6 +7,13 @@ export interface SessionHookPart {
|
|
|
7
7
|
claude: ClaudeHooks;
|
|
8
8
|
/** Per Codex event, the inline TOML tables of its list, such as `{matcher="…",hooks=[{type="command",command="…"}]}`. */
|
|
9
9
|
codex: Record<string, string[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Other top-level Claude settings it adds to the same file, such as `autoMemoryDirectory` (Shared Project Memory,
|
|
12
|
+
* ADR-0081). Claude only.
|
|
13
|
+
*/
|
|
14
|
+
settings?: Record<string, unknown>;
|
|
15
|
+
/** Added to the file's name when `settings` differ per Launch, so two Launches never share one file. */
|
|
16
|
+
fileKey?: string;
|
|
10
17
|
}
|
|
11
18
|
/**
|
|
12
19
|
* The command a Host runs for a hook entry: this Node and this sideby by absolute path, never `sideby` by name. A
|
|
@@ -30,7 +37,9 @@ export declare function sessionHookArgs(family: string, stateDir: string, parts:
|
|
|
30
37
|
* Auto Handoff's Claude hook arguments with `extra` hooks added to its `--settings` file, written as `out` (Claude
|
|
31
38
|
* Code takes one `--settings`). Auto Handoff's own hooks and options come first and are kept as they are.
|
|
32
39
|
*/
|
|
33
|
-
export declare function withClaudeHooks(hookArgs: readonly string[], extra: ClaudeHooks, out: string
|
|
40
|
+
export declare function withClaudeHooks(hookArgs: readonly string[], extra: ClaudeHooks, out: string,
|
|
41
|
+
/** Other top-level settings to add, such as the session's `autoMemoryDirectory` (ADR-0081). */
|
|
42
|
+
more?: Record<string, unknown>): Promise<string[]>;
|
|
34
43
|
/**
|
|
35
44
|
* Claude `--settings` arguments with `dirs` added to the file's `permissions.additionalDirectories`, written as `out`.
|
|
36
45
|
* Claude Code 2.1.326 asks the user to trust every `--add-dir` folder it has not seen before the session starts, and
|
|
@@ -40,6 +49,7 @@ export declare function withClaudeHooks(hookArgs: readonly string[], extra: Clau
|
|
|
40
49
|
export declare function withClaudeDirs(args: readonly string[], dirs: readonly string[], out: string): Promise<string[]>;
|
|
41
50
|
/**
|
|
42
51
|
* Auto Handoff's Claude hook arguments with the session's own sideby hooks (`sessionArgs`, from `sessionHookArgs`)
|
|
43
|
-
* merged into one `--settings` file, written next to the session's file with `-handoff` added to its name.
|
|
52
|
+
* merged into one `--settings` file, written next to the session's file with `-handoff` added to its name. The
|
|
53
|
+
* session file's other settings (`autoMemoryDirectory`, ADR-0081) come along.
|
|
44
54
|
*/
|
|
45
55
|
export declare function withClaudeSessionHooks(hookArgs: readonly string[], sessionArgs: readonly string[]): Promise<string[]>;
|
|
@@ -51,11 +51,12 @@ export async function sessionHookArgs(family, stateDir, parts) {
|
|
|
51
51
|
// A real folder of the user that nobody else can write to, so the file is never written through a link.
|
|
52
52
|
const dir = (await ownedFolder(stateDir, [parts[0].id], { create: true, private: true }));
|
|
53
53
|
const name = `claude-settings${parts
|
|
54
|
-
.
|
|
55
|
-
.map((p) => `-${p.id}`)
|
|
54
|
+
.map((p, i) => `${i ? `-${p.id}` : ''}${p.fileKey ? `-${p.fileKey}` : ''}`)
|
|
56
55
|
.join('')}.json`;
|
|
57
56
|
const hooks = mergeClaudeHooks(...parts.map((p) => p.claude));
|
|
58
|
-
|
|
57
|
+
const settings = Object.assign({}, ...parts.map((p) => p.settings ?? {}));
|
|
58
|
+
const body = { ...(Object.keys(hooks).length ? { hooks } : {}), ...settings };
|
|
59
|
+
await writeFileAtomic(join(dir, name), `${JSON.stringify(body, null, 2)}\n`, 0o600);
|
|
59
60
|
return ['--settings', join(dir, name)];
|
|
60
61
|
}
|
|
61
62
|
if (family === 'codex') {
|
|
@@ -84,11 +85,13 @@ async function settingsOf(args) {
|
|
|
84
85
|
* Auto Handoff's Claude hook arguments with `extra` hooks added to its `--settings` file, written as `out` (Claude
|
|
85
86
|
* Code takes one `--settings`). Auto Handoff's own hooks and options come first and are kept as they are.
|
|
86
87
|
*/
|
|
87
|
-
export async function withClaudeHooks(hookArgs, extra, out
|
|
88
|
+
export async function withClaudeHooks(hookArgs, extra, out,
|
|
89
|
+
/** Other top-level settings to add, such as the session's `autoMemoryDirectory` (ADR-0081). */
|
|
90
|
+
more = {}) {
|
|
88
91
|
const settings = await settingsOf(hookArgs);
|
|
89
92
|
const hooks = mergeClaudeHooks(settings.hooks ?? {}, extra);
|
|
90
93
|
await mkdir(dirname(out), { recursive: true, mode: 0o700 });
|
|
91
|
-
await writeFileAtomic(out, `${JSON.stringify({ ...settings, hooks }, null, 2)}\n`, 0o600);
|
|
94
|
+
await writeFileAtomic(out, `${JSON.stringify({ ...settings, ...more, hooks }, null, 2)}\n`, 0o600);
|
|
92
95
|
const at = hookArgs.indexOf('--settings');
|
|
93
96
|
return at === -1 ? [...hookArgs, '--settings', out] : hookArgs.map((a, i) => (i === at + 1 ? out : a));
|
|
94
97
|
}
|
|
@@ -121,13 +124,14 @@ export async function withClaudeDirs(args, dirs, out) {
|
|
|
121
124
|
}
|
|
122
125
|
/**
|
|
123
126
|
* Auto Handoff's Claude hook arguments with the session's own sideby hooks (`sessionArgs`, from `sessionHookArgs`)
|
|
124
|
-
* merged into one `--settings` file, written next to the session's file with `-handoff` added to its name.
|
|
127
|
+
* merged into one `--settings` file, written next to the session's file with `-handoff` added to its name. The
|
|
128
|
+
* session file's other settings (`autoMemoryDirectory`, ADR-0081) come along.
|
|
125
129
|
*/
|
|
126
130
|
export async function withClaudeSessionHooks(hookArgs, sessionArgs) {
|
|
127
131
|
const at = sessionArgs.indexOf('--settings');
|
|
128
132
|
const file = at === -1 ? undefined : sessionArgs[at + 1];
|
|
129
133
|
if (!file)
|
|
130
134
|
return [...hookArgs];
|
|
131
|
-
const extra =
|
|
132
|
-
return withClaudeHooks(hookArgs, extra, join(dirname(file), `${basename(file, '.json')}-handoff.json`));
|
|
135
|
+
const { hooks: extra = {}, ...more } = await settingsOf(sessionArgs);
|
|
136
|
+
return withClaudeHooks(hookArgs, extra, join(dirname(file), `${basename(file, '.json')}-handoff.json`), more);
|
|
133
137
|
}
|
|
@@ -4,3 +4,10 @@ export declare const CLAUDE_LAYOUT: {
|
|
|
4
4
|
main: string;
|
|
5
5
|
account: string;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* The folder Claude Code keeps a path's sessions and memory in under `projects/`: every character that is not an
|
|
9
|
+
* ASCII letter or digit becomes `-`; a name longer than 200 characters is cut there and gets `-` and a base-36 hash
|
|
10
|
+
* of the whole path (the 32-bit `(h << 5) - h + c` string hash, UTF-16 units). Read from Claude Code 2.1.328 on
|
|
11
|
+
* 2026-11-20 (ADR-0081).
|
|
12
|
+
*/
|
|
13
|
+
export declare function claudeProjectDirName(path: string): string;
|
|
@@ -3,3 +3,20 @@
|
|
|
3
3
|
export const CLAUDE_MAIN_DIR = '.claude';
|
|
4
4
|
export const CLAUDE_ACCOUNT_PREFIX = '.claude-';
|
|
5
5
|
export const CLAUDE_LAYOUT = { main: CLAUDE_MAIN_DIR, account: `${CLAUDE_ACCOUNT_PREFIX}<name>` };
|
|
6
|
+
/** The longest folder name Claude Code keeps under `projects/` before it shortens one and adds a hash. */
|
|
7
|
+
const PROJECT_NAME_MAX = 200;
|
|
8
|
+
/**
|
|
9
|
+
* The folder Claude Code keeps a path's sessions and memory in under `projects/`: every character that is not an
|
|
10
|
+
* ASCII letter or digit becomes `-`; a name longer than 200 characters is cut there and gets `-` and a base-36 hash
|
|
11
|
+
* of the whole path (the 32-bit `(h << 5) - h + c` string hash, UTF-16 units). Read from Claude Code 2.1.328 on
|
|
12
|
+
* 2026-11-20 (ADR-0081).
|
|
13
|
+
*/
|
|
14
|
+
export function claudeProjectDirName(path) {
|
|
15
|
+
const name = path.replace(/[^a-zA-Z0-9]/g, '-');
|
|
16
|
+
if (name.length <= PROJECT_NAME_MAX)
|
|
17
|
+
return name;
|
|
18
|
+
let h = 0;
|
|
19
|
+
for (let i = 0; i < path.length; i++)
|
|
20
|
+
h = ((h << 5) - h + path.charCodeAt(i)) | 0;
|
|
21
|
+
return `${name.slice(0, PROJECT_NAME_MAX)}-${Math.abs(h).toString(36)}`;
|
|
22
|
+
}
|
|
@@ -5,6 +5,7 @@ import { readdir } from 'node:fs/promises';
|
|
|
5
5
|
import { basename, join } from 'node:path';
|
|
6
6
|
import { statOrNull } from '../../core/fs-safe.js';
|
|
7
7
|
import { isoOf } from '../../core/live-sessions-procs.js';
|
|
8
|
+
import { claudeProjectDirName } from './layout.js';
|
|
8
9
|
import { readSessionRecord, recordRunsOn, recordStart, tailLinesWith } from './session-files.js';
|
|
9
10
|
const PID_FILE = /^(\d+)\.json$/;
|
|
10
11
|
/** Claude Code's `status`: `busy` and `shell` run, `idle` waits for a prompt, a blocked one waits for the user. */
|
|
@@ -38,7 +39,7 @@ export function claudeStartedFrom(v) {
|
|
|
38
39
|
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : undefined);
|
|
39
40
|
const str = (v) => (typeof v === 'string' && v ? v : undefined);
|
|
40
41
|
/** The transcript Claude Code writes for a session: `projects/<cwd with every other character as ->/<id>.jsonl`. */
|
|
41
|
-
export const claudeTranscript = (dir, cwd, id) => join(dir, 'projects', cwd
|
|
42
|
+
export const claudeTranscript = (dir, cwd, id) => join(dir, 'projects', claudeProjectDirName(cwd), `${id}.jsonl`);
|
|
42
43
|
const titleMemo = new Map();
|
|
43
44
|
/**
|
|
44
45
|
* The title Claude Code gave the session itself (the one it shows as the terminal tab title): the last `ai-title`
|
|
@@ -309,6 +309,12 @@ export interface PanelState {
|
|
|
309
309
|
* `.claude.json` is read for it); absent with fewer than two Claude Accounts, unless it is on or has marks.
|
|
310
310
|
*/
|
|
311
311
|
trust?: PanelTrust;
|
|
312
|
+
/**
|
|
313
|
+
* Shared Project Memory (spec §3.44): config `claude.shareMemory` and how many files Doctor moved into the Main Account,
|
|
314
|
+
* from the config and sideby's own records (no Account folder is read for it); absent with fewer than two Claude
|
|
315
|
+
* Accounts, unless it is on or Doctor moved something.
|
|
316
|
+
*/
|
|
317
|
+
memory?: PanelMemory;
|
|
312
318
|
}
|
|
313
319
|
export interface PanelTrust {
|
|
314
320
|
on: boolean;
|
|
@@ -319,6 +325,11 @@ export interface PanelTrust {
|
|
|
319
325
|
at: string;
|
|
320
326
|
}[];
|
|
321
327
|
}
|
|
328
|
+
export interface PanelMemory {
|
|
329
|
+
on: boolean;
|
|
330
|
+
/** Files Doctor moved into the Main Account so far. */
|
|
331
|
+
folded: number;
|
|
332
|
+
}
|
|
322
333
|
/**
|
|
323
334
|
* One Pending Decision as the Panel's Unattended page lists it, with its Project, state and reply (ADR-0078; `project`
|
|
324
335
|
* and `cwd` shortened with `~`) and the way back to its Session.
|
|
@@ -652,6 +652,7 @@ async function buildState(rt, opts) {
|
|
|
652
652
|
const showBrowser = browser && (browser.families.matched.length || browser.families.openOnly.length);
|
|
653
653
|
const progress = accounts.some((a) => PROGRESS_FAMILIES.includes(a.family)) ? rt.progressView() : undefined;
|
|
654
654
|
const trust = await panelTrust(rt, accounts).catch(() => undefined);
|
|
655
|
+
const memory = await panelMemory(rt, accounts).catch(() => undefined);
|
|
655
656
|
const permissions = aiTaskPermissions(rt.config);
|
|
656
657
|
return {
|
|
657
658
|
schemaVersion: 1,
|
|
@@ -701,8 +702,16 @@ async function buildState(rt, opts) {
|
|
|
701
702
|
...(unattended ? { unattended } : {}),
|
|
702
703
|
...(progress ? { progress } : {}),
|
|
703
704
|
...(trust ? { trust } : {}),
|
|
705
|
+
...(memory ? { memory } : {}),
|
|
704
706
|
};
|
|
705
707
|
}
|
|
708
|
+
/** The Panel's view of Shared Project Memory (spec §3.44), or undefined when there is nothing to show. */
|
|
709
|
+
async function panelMemory(rt, accounts) {
|
|
710
|
+
const st = await rt.memoryOverview();
|
|
711
|
+
if (accounts.filter((a) => a.family === 'claude').length < 2 && !st.on && !st.folded.length)
|
|
712
|
+
return undefined;
|
|
713
|
+
return { on: st.on, folded: st.folded.reduce((n, f) => n + f.files, 0) };
|
|
714
|
+
}
|
|
706
715
|
/** The Panel's view of carried trust (spec §3.43), or undefined when there is nothing to show. */
|
|
707
716
|
async function panelTrust(rt, accounts) {
|
|
708
717
|
const st = await rt.trustStatus();
|
|
@@ -1528,6 +1537,18 @@ export function createPanelHandler(opts) {
|
|
|
1528
1537
|
return { ...r, file: tildify(r.file, rt.paths.home) };
|
|
1529
1538
|
},
|
|
1530
1539
|
},
|
|
1540
|
+
// Shared Project Memory (spec §3.44, ADR-0081): config `claude.shareMemory`, shown first like every config change;
|
|
1541
|
+
// the switch sends `confirm` with the words it shows beside it.
|
|
1542
|
+
'/api/memory/settings': {
|
|
1543
|
+
writes: (body) => body.confirm === true,
|
|
1544
|
+
async run(body) {
|
|
1545
|
+
if (typeof body.on !== 'boolean')
|
|
1546
|
+
throw new HttpError(400, '"on" must be true or false');
|
|
1547
|
+
const rt = await getRuntime();
|
|
1548
|
+
const r = await rt.memorySet(body.on, { apply: optBool(body, 'confirm') });
|
|
1549
|
+
return { ...r, file: tildify(r.file, rt.paths.home) };
|
|
1550
|
+
},
|
|
1551
|
+
},
|
|
1531
1552
|
// Takes back the trust marks sideby copied (`sideby trust undo`): without `confirm` what it would do, with it done.
|
|
1532
1553
|
'/api/trust/undo': {
|
|
1533
1554
|
writes: (body) => body.confirm === true,
|
package/dist/src/panel/i18n.d.ts
CHANGED
|
@@ -1818,6 +1818,18 @@ declare const en: {
|
|
|
1818
1818
|
'tr.onToast': string;
|
|
1819
1819
|
'tr.offToast': string;
|
|
1820
1820
|
'tr.failed': string;
|
|
1821
|
+
'ai.ask.memory': string;
|
|
1822
|
+
'mm.title': string;
|
|
1823
|
+
'mm.hint': string;
|
|
1824
|
+
'mm.switch': string;
|
|
1825
|
+
'mm.what': string;
|
|
1826
|
+
'mm.doctor': string;
|
|
1827
|
+
'mm.offKeeps': string;
|
|
1828
|
+
'mm.folded.one': string;
|
|
1829
|
+
'mm.folded.other': string;
|
|
1830
|
+
'mm.onToast': string;
|
|
1831
|
+
'mm.offToast': string;
|
|
1832
|
+
'mm.failed': string;
|
|
1821
1833
|
};
|
|
1822
1834
|
export type MessageKey = keyof typeof en;
|
|
1823
1835
|
export declare const MESSAGES: Record<PanelLang, Record<string, string>>;
|
package/dist/src/panel/i18n.js
CHANGED
|
@@ -1820,6 +1820,18 @@ const en = {
|
|
|
1820
1820
|
'tr.onToast': 'Folder trust is reused now. Claude accounts sideby starts no longer ask where another account trusts the folder.',
|
|
1821
1821
|
'tr.offToast': 'Folder trust is no longer reused. What was copied stays.',
|
|
1822
1822
|
'tr.failed': 'Could not change folder trust: {msg}. Try again, or run sideby trust in a terminal.',
|
|
1823
|
+
'ai.ask.memory': 'Let all my Claude accounts share what they remember about each project.',
|
|
1824
|
+
'mm.title': 'Shared memory',
|
|
1825
|
+
'mm.hint': 'Claude remembers what it learns about a project, but each account keeps its own memory. sideby can let all your Claude accounts share one memory per project.',
|
|
1826
|
+
'mm.switch': 'Share project memory across my Claude accounts',
|
|
1827
|
+
'mm.what': "Claude sessions sideby starts in your other accounts read and write the main account's memory of the project, so the next account knows what the last one learned.",
|
|
1828
|
+
'mm.doctor': 'Memory an account wrote on its own (a session started without sideby) stays there until you click Fix all on the Accounts page; then it moves into the main account. A file that differs is kept beside the main one under a new name, and the emptied folder goes to the trash.',
|
|
1829
|
+
'mm.offKeeps': 'Turning it off stops sharing from the next session on. Memory already moved into the main account stays there; it is not moved back to each account.',
|
|
1830
|
+
'mm.folded.one': 'So far, Fix all moved 1 memory file into the main account.',
|
|
1831
|
+
'mm.folded.other': 'So far, Fix all moved {n} memory files into the main account.',
|
|
1832
|
+
'mm.onToast': "Shared memory is on. Claude accounts sideby starts from now on use the main account's memory; Fix all moves what they already wrote.",
|
|
1833
|
+
'mm.offToast': 'Shared memory is off. Memory already in the main account stays.',
|
|
1834
|
+
'mm.failed': 'Could not change shared memory: {msg}. Try again, or run sideby memory in a terminal.',
|
|
1823
1835
|
};
|
|
1824
1836
|
const zh = {
|
|
1825
1837
|
'top.tagline': '所有 AI 编程账号,并排运行。',
|
|
@@ -3640,5 +3652,17 @@ const zh = {
|
|
|
3640
3652
|
'tr.onToast': '已开始沿用文件夹信任。sideby 启动的 Claude 账号,在别的账号信任过的文件夹里不再询问。',
|
|
3641
3653
|
'tr.offToast': '已不再沿用文件夹信任。已经复制的保留。',
|
|
3642
3654
|
'tr.failed': '没能改文件夹信任:{msg}。可以再试一次,或在终端运行 sideby trust。',
|
|
3655
|
+
'ai.ask.memory': '让我所有 Claude 账号共用对每个项目的记忆。',
|
|
3656
|
+
'mm.title': '共享记忆',
|
|
3657
|
+
'mm.hint': 'Claude 会记住它在项目里学到的东西,但每个账号各记各的。sideby 可以让你所有 Claude 账号每个项目共用一份记忆。',
|
|
3658
|
+
'mm.switch': '让我的 Claude 账号共用项目记忆',
|
|
3659
|
+
'mm.what': 'sideby 在其他账号里启动的 Claude 会话,读写主账号对这个项目的记忆,下一个账号就知道上一个学到了什么。',
|
|
3660
|
+
'mm.doctor': '账号自己写下的记忆(不经 sideby 启动的会话)先留在那个账号里,在账号页点「全部修复」后移进主账号。同名但内容不同的文件换个名字放在主账号那份旁边,清空的文件夹移到废纸篓。',
|
|
3661
|
+
'mm.offKeeps': '关掉后,从下一个会话起不再共用。已经移进主账号的记忆留在主账号,不会搬回各账号。',
|
|
3662
|
+
'mm.folded.one': '「全部修复」已把 1 个记忆文件移进主账号。',
|
|
3663
|
+
'mm.folded.other': '「全部修复」已把 {n} 个记忆文件移进主账号。',
|
|
3664
|
+
'mm.onToast': '已打开共享记忆。之后 sideby 启动的 Claude 账号用主账号的记忆;「全部修复」会把它们已经写下的移过来。',
|
|
3665
|
+
'mm.offToast': '已关闭共享记忆。已经在主账号里的记忆保留。',
|
|
3666
|
+
'mm.failed': '没能改共享记忆:{msg}。可以再试一次,或在终端运行 sideby memory。',
|
|
3643
3667
|
};
|
|
3644
3668
|
export const MESSAGES = { en, zh };
|
|
@@ -7237,6 +7237,38 @@ const MAIN = String.raw `
|
|
|
7237
7237
|
out.push(h('p', { class: 'small' }, h('button', { class: 'link-btn small', type: 'button', 'data-key': 'tr-ask', onclick: () => openAsk({ text: t('ai.ask.trust') }) }, t('adv.ask'))))
|
|
7238
7238
|
return out
|
|
7239
7239
|
}
|
|
7240
|
+
// Shared Project Memory (spec §3.44, ADR-0081): the switch writes config claude.shareMemory at once (the words beside
|
|
7241
|
+
// it say what it does and what Fix all moves) and the toast offers the way back. Its state reads no account folder.
|
|
7242
|
+
async function setMemory(on) {
|
|
7243
|
+
const mm = S.state && S.state.memory
|
|
7244
|
+
if (!mm) return
|
|
7245
|
+
const was = mm.on
|
|
7246
|
+
S.state.memory = Object.assign({}, mm, { on })
|
|
7247
|
+
refreshSettings()
|
|
7248
|
+
try {
|
|
7249
|
+
await api('/api/memory/settings', { on, confirm: true })
|
|
7250
|
+
toast(t(on ? 'mm.onToast' : 'mm.offToast'), { kind: 'ok', action: { label: t('toast.undo'), run: () => setMemory(was) }, duration: 8000 })
|
|
7251
|
+
} catch (e) {
|
|
7252
|
+
S.state.memory = Object.assign({}, S.state.memory, { on: was })
|
|
7253
|
+
refreshSettings()
|
|
7254
|
+
toast(t('mm.failed', { msg: e.message }), { kind: 'fail' })
|
|
7255
|
+
}
|
|
7256
|
+
load({ silent: true })
|
|
7257
|
+
}
|
|
7258
|
+
function memoryItems() {
|
|
7259
|
+
const mm = S.state.memory
|
|
7260
|
+
const label = t('mm.switch')
|
|
7261
|
+
const out = [fm('memory', h('div', { class: 'set-row', 'data-patch': '' },
|
|
7262
|
+
h('span', { class: 'set-label' }, label),
|
|
7263
|
+
BOOT.readOnly ? h('span', { class: 'chip chip-sm' + (mm.on ? ' chip-ok' : '') }, mm.on ? t('ah.on') : t('ah.off'))
|
|
7264
|
+
: h('div', { class: 'seg', role: 'group', 'aria-label': label, 'data-patch': '' }, [[true, t('ah.on')], [false, t('ah.off')]].map(([v, text]) =>
|
|
7265
|
+
h('button', { class: 'seg-btn', type: 'button', 'aria-pressed': String(v === mm.on), onclick: () => { if (v !== mm.on) setMemory(v) } }, text)))))]
|
|
7266
|
+
out.push(h('ul', { class: 'pr-notes' }, h('li', null, t('mm.what')), h('li', null, t('mm.doctor')), h('li', null, t('mm.offKeeps'))))
|
|
7267
|
+
if (mm.folded) out.push(h('p', { class: 'small muted mm-folded' }, tn('mm.folded', mm.folded)))
|
|
7268
|
+
if (!BOOT.readOnly && !askBridged(BOOT, window))
|
|
7269
|
+
out.push(h('p', { class: 'small' }, h('button', { class: 'link-btn small', type: 'button', 'data-key': 'mm-ask', onclick: () => openAsk({ text: t('ai.ask.memory') }) }, t('adv.ask'))))
|
|
7270
|
+
return out
|
|
7271
|
+
}
|
|
7240
7272
|
function famTitleOf(fam) { const f = S.state && S.state.families.find((x) => x.id === fam); return f ? f.title : fam }
|
|
7241
7273
|
// ---------- settings ----------
|
|
7242
7274
|
// One header button holds what is set once and rarely changed: language, theme, Remote Control and Auto Handoff.
|
|
@@ -7255,6 +7287,7 @@ const MAIN = String.raw `
|
|
|
7255
7287
|
if (S.state && S.state.network) out.push('net')
|
|
7256
7288
|
if (S.state && S.state.progress) out.push('progress')
|
|
7257
7289
|
if (S.state && S.state.trust) out.push('trust')
|
|
7290
|
+
if (S.state && S.state.memory) out.push('memory')
|
|
7258
7291
|
return out
|
|
7259
7292
|
}
|
|
7260
7293
|
function renderSettingsButton() {
|
|
@@ -7370,6 +7403,7 @@ const MAIN = String.raw `
|
|
|
7370
7403
|
{ id: 'handoff', title: t('ah.button'), items: [ahLink(leave)].filter(Boolean), foot: t('set.ahHint') },
|
|
7371
7404
|
{ id: 'progress', title: t('pr.title'), items: secs.includes('progress') ? progressItems() : [], foot: t('pr.hint') },
|
|
7372
7405
|
{ id: 'trust', title: t('tr.title'), items: secs.includes('trust') ? trustItems() : [], foot: t('tr.hint') },
|
|
7406
|
+
{ id: 'memory', title: t('mm.title'), items: secs.includes('memory') ? memoryItems() : [], foot: t('mm.hint') },
|
|
7373
7407
|
{ id: 'network', title: t('net.title'), items: netItems, foot: t('net.hint') },
|
|
7374
7408
|
{ id: 'ai', title: t('set.g.ai'), items: ai, foot: t('set.aiHint') },
|
|
7375
7409
|
].filter((g) => g.items.length)
|
|
@@ -8073,7 +8107,7 @@ const MAIN = String.raw `
|
|
|
8073
8107
|
return Boolean(u && u.skillUpdate && u.skillUpdate.installed && u.skillUpdate.installed.length)
|
|
8074
8108
|
}
|
|
8075
8109
|
// Example phrases: a click puts one in the Let AI do it box (spec §3.28).
|
|
8076
|
-
const AI_ASKS = ['ai.ask.quota', 'ai.ask.reset', 'ai.ask.pick', 'ai.ask.new', 'ai.ask.api', 'ai.ask.pin', 'ai.ask.hide', 'ai.ask.relogin', 'ai.ask.expired', 'ai.ask.fix', 'ai.ask.handoff', 'ai.ask.handoffRules', 'ai.ask.session', 'ai.ask.history', 'ai.ask.send', 'ai.ask.inbound', 'ai.ask.menubar', 'ai.ask.rc', 'ai.ask.advisor', 'ai.ask.trust', 'ai.ask.network', 'ai.ask.unattended', 'ai.ask.pending', 'ai.ask.progress', 'ai.ask.theme', 'ai.ask.find', 'ai.ask.commands', 'ai.ask.tool']
|
|
8110
|
+
const AI_ASKS = ['ai.ask.quota', 'ai.ask.reset', 'ai.ask.pick', 'ai.ask.new', 'ai.ask.api', 'ai.ask.pin', 'ai.ask.hide', 'ai.ask.relogin', 'ai.ask.expired', 'ai.ask.fix', 'ai.ask.handoff', 'ai.ask.handoffRules', 'ai.ask.session', 'ai.ask.history', 'ai.ask.send', 'ai.ask.inbound', 'ai.ask.menubar', 'ai.ask.rc', 'ai.ask.advisor', 'ai.ask.trust', 'ai.ask.memory', 'ai.ask.network', 'ai.ask.unattended', 'ai.ask.pending', 'ai.ask.progress', 'ai.ask.theme', 'ai.ask.find', 'ai.ask.commands', 'ai.ask.tool']
|
|
8077
8111
|
// Network Guard (spec §3.35): one dialog with the switch, the allowed countries and the newest result per address.
|
|
8078
8112
|
// Countries are never ticked for the user, the current one included: a wrong network would allow itself.
|
|
8079
8113
|
const NET_COMMON = ['US', 'JP', 'SG', 'GB', 'DE', 'FR', 'NL', 'CA', 'AU', 'KR', 'TW', 'HK']
|
|
@@ -982,6 +982,7 @@ ${UI_CSS}
|
|
|
982
982
|
.set-group > .reveal[data-key=pr-every] { margin-top: -8px; }
|
|
983
983
|
.reveal[data-key=pr-every] > .reveal-in > .pr-every { padding-top: 8px; }
|
|
984
984
|
.pr-notes { margin: 4px 0 0; padding-left: 16px; display: grid; gap: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
|
|
985
|
+
.mm-folded { margin: 12px 0 0; }
|
|
985
986
|
.pr-every .seg-btn { white-space: nowrap; }
|
|
986
987
|
:where(:root[data-width=phone]) .pr-every { flex-direction: column; align-items: flex-start; gap: 8px; }
|
|
987
988
|
:where(:root[data-width=phone]) .pr-every .seg { max-width: 100%; }
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AccountRefError } from './core/accounts.ts';
|
|
2
2
|
import { type AdvisorChange, type AdvisorChoice, type AdvisorSeen, type AdvisorStatus } from './core/advisor.ts';
|
|
3
|
+
import { type FoldRecord, type LiveCwds, type MemoryStatus, type Trash } from './core/claude-memory.ts';
|
|
3
4
|
import { type TrustStatus, type UndoItem } from './core/claude-trust.ts';
|
|
4
5
|
import { type Config, type DisplayConfig, type HandoffSettings } from './core/config.ts';
|
|
5
6
|
import { type CreateResult } from './core/create.ts';
|
|
@@ -474,6 +475,27 @@ export interface Runtime {
|
|
|
474
475
|
at: string;
|
|
475
476
|
}[];
|
|
476
477
|
}): Promise<UndoItem[]>;
|
|
478
|
+
/**
|
|
479
|
+
* Shared Project Memory (spec §3.44, ADR-0081): config `claude.shareMemory`, the folds Doctor recorded and, only while
|
|
480
|
+
* on, each Project's memory in the Main Account and in each Account, and where `dir`'s memory goes. While off no
|
|
481
|
+
* Account folder is read.
|
|
482
|
+
*/
|
|
483
|
+
memoryStatus(dir?: string): Promise<MemoryStatus>;
|
|
484
|
+
/** Turns config `claude.shareMemory` on or off; without `apply`, only says what would change. */
|
|
485
|
+
memorySet(on: boolean, opts: {
|
|
486
|
+
apply: boolean;
|
|
487
|
+
}): Promise<{
|
|
488
|
+
changed: boolean;
|
|
489
|
+
applied: boolean;
|
|
490
|
+
before: boolean;
|
|
491
|
+
after: boolean;
|
|
492
|
+
file: string;
|
|
493
|
+
}>;
|
|
494
|
+
/** The setting and the folds Doctor recorded, from the config and sideby's own records only (no Account folder). */
|
|
495
|
+
memoryOverview(): Promise<{
|
|
496
|
+
on: boolean;
|
|
497
|
+
folded: FoldRecord[];
|
|
498
|
+
}>;
|
|
477
499
|
/**
|
|
478
500
|
* Which Account of a Family to move on to (spec §3.13), for a start the user asks for: past the Takeover Limit it
|
|
479
501
|
* falls back to the least used Account under 100% (`tight`). Throws a UserError with code `no-quota-source`
|
|
@@ -545,4 +567,12 @@ export declare function createRuntime(opts?: {
|
|
|
545
567
|
cwd?: () => string;
|
|
546
568
|
print?: (line: string) => void;
|
|
547
569
|
};
|
|
570
|
+
/**
|
|
571
|
+
* Internal, for tests: the working folders of an Account's Live Sessions (null: cannot tell) and where Doctor puts a
|
|
572
|
+
* memory folder it emptied (spec §3.44). Omitted, the Claude session files with `ps`, and the system trash.
|
|
573
|
+
*/
|
|
574
|
+
memory?: {
|
|
575
|
+
liveCwds?: (account: Account) => Promise<LiveCwds>;
|
|
576
|
+
trash?: Trash;
|
|
577
|
+
};
|
|
548
578
|
}): Promise<Runtime>;
|
package/dist/src/runtime.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// The one service layer the CLI and the Panel share. Frozen contract for v0.1 (plan: 审核修订).
|
|
2
|
-
import { aliasesByAccount, discoverAccounts, resolveRef, startArgsOf, } from './core/accounts.js';
|
|
2
|
+
import { aliasesByAccount, discoverAccounts, mainDirOf, resolveRef, startArgsOf, } from './core/accounts.js';
|
|
3
3
|
import { advisorStatus, checkAdvisorAccount, setAdvisor, setAdvisorUnlock, undoAdvisor, } from './core/advisor.js';
|
|
4
|
+
import { claudeLiveCwds, mainMemoryFindings, memoryFindings, memoryHookPart, memorySettingsLine, memorySkipLine, memoryStatus, memoryTarget, readFolds, systemTrash, } from './core/claude-memory.js';
|
|
4
5
|
import { carryLine, carryTrust, trustStatus, undoCarries, } from './core/claude-trust.js';
|
|
5
6
|
import { addConfigAlias, addConfigPickCommand, aiTaskPermissions, aliasAccount, aliasArgs, aliasProblem, aliasRefs, editConfigClaude, editConfigDisplay, editConfigQuotaCheck, handoffSettings, loadConfig, removeConfigAlias, removeConfigPickCommand, } from './core/config.js';
|
|
6
7
|
import { createAccount } from './core/create.js';
|
|
@@ -202,6 +203,45 @@ export async function createRuntime(opts = {}) {
|
|
|
202
203
|
p.env[PROGRESS_ENV] = String(every);
|
|
203
204
|
return progressHookPart();
|
|
204
205
|
};
|
|
206
|
+
/** The Main Claude Account's folder (`~/.claude`), where Shared Project Memory lives. */
|
|
207
|
+
const claudeMainDir = () => {
|
|
208
|
+
const f = families.get('claude');
|
|
209
|
+
return f ? mainDirOf(f, paths.home) : `${paths.home}/.claude`;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Shared Project Memory on a Claude session sideby starts (spec §3.44, ADR-0081): the Main Account's memory folder of
|
|
213
|
+
* the Project, as `autoMemoryDirectory` in sideby's own `--settings` file. Not for the Main Account (that folder is
|
|
214
|
+
* already its own), a headless run, or a session given its own `--settings` (the notice says so).
|
|
215
|
+
*/
|
|
216
|
+
const memoryPrepared = async (p) => {
|
|
217
|
+
if (p.family.id !== 'claude' || config.claude?.shareMemory !== true || p.account.isMain)
|
|
218
|
+
return null;
|
|
219
|
+
if (claudeHeadless(p.args))
|
|
220
|
+
return null;
|
|
221
|
+
if (hasOption(p.args, ['--settings'])) {
|
|
222
|
+
addNotice(p, [memorySettingsLine(p.env)]);
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
const t = await memoryTarget(claudeMainDir(), opts.trust?.cwd?.() ?? process.cwd());
|
|
226
|
+
if (t.status === 'skip') {
|
|
227
|
+
addNotice(p, [memorySkipLine(p.env, t.why.split(`${paths.home}/`).join('~/'))]);
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
return memoryHookPart(t.dir);
|
|
231
|
+
};
|
|
232
|
+
/** What Doctor's Shared Project Memory check and Fix use (spec §3.44, ADR-0081). */
|
|
233
|
+
const memoryCtx = () => ({
|
|
234
|
+
mainDir: claudeMainDir(),
|
|
235
|
+
stateDir: paths.stateDir,
|
|
236
|
+
liveCwds: opts.memory?.liveCwds ??
|
|
237
|
+
(async (a) => {
|
|
238
|
+
const { processView, systemDeps } = await import('./core/live-sessions-procs.js');
|
|
239
|
+
return claudeLiveCwds(a, processView(systemDeps(env)));
|
|
240
|
+
}),
|
|
241
|
+
trash: opts.memory?.trash ?? systemTrash(env, paths.stateDir, now),
|
|
242
|
+
now,
|
|
243
|
+
show: (p) => p.split(`${paths.home}/`).join('~/'),
|
|
244
|
+
});
|
|
205
245
|
/** Puts every session hook into the Launch's arguments: one `--settings` for Claude, `-c hooks.*` for Codex. */
|
|
206
246
|
const addSessionHooks = async (p, list) => {
|
|
207
247
|
const parts = list.filter((x) => x !== null);
|
|
@@ -225,6 +265,9 @@ export async function createRuntime(opts = {}) {
|
|
|
225
265
|
parts.push(await unattendedPrepared(p, Boolean(o.unattended)));
|
|
226
266
|
if (session)
|
|
227
267
|
parts.push(progressPrepared(p));
|
|
268
|
+
// Last: its file name says which Project's folder it holds.
|
|
269
|
+
if (session)
|
|
270
|
+
parts.push(await memoryPrepared(p));
|
|
228
271
|
await addSessionHooks(p, parts);
|
|
229
272
|
};
|
|
230
273
|
const familyOf = (id) => {
|
|
@@ -788,6 +831,12 @@ export async function createRuntime(opts = {}) {
|
|
|
788
831
|
scope = { kind: 'account', ref: one.ref };
|
|
789
832
|
}
|
|
790
833
|
}
|
|
834
|
+
// Shared Project Memory (spec §3.44): checked only while on, and only when the run includes Claude.
|
|
835
|
+
const freshMemory = await loadConfig(paths.configFile).catch(() => null);
|
|
836
|
+
if (freshMemory)
|
|
837
|
+
config.claude = freshMemory.claude;
|
|
838
|
+
const memoryOn = config.claude?.shareMemory === true && fams.has('claude');
|
|
839
|
+
const mctx = memoryOn ? memoryCtx() : null;
|
|
791
840
|
const input = {
|
|
792
841
|
home: paths.home,
|
|
793
842
|
families: fams,
|
|
@@ -802,6 +851,8 @@ export async function createRuntime(opts = {}) {
|
|
|
802
851
|
...(await checkAppData(loaded.plugins, paths.home, a, Boolean(o.force))),
|
|
803
852
|
// Messages held in bypass permission mode (spec §3.32 step 2): the arguments the Account starts with.
|
|
804
853
|
...(await inboundFindings(a, startArgs(a))),
|
|
854
|
+
// Memory an Account wrote on its own, folded into the Main Account by the Fix (spec §3.44).
|
|
855
|
+
...(mctx ? await memoryFindings(mctx, a) : []),
|
|
805
856
|
],
|
|
806
857
|
loginProblem: (a) => loginProblemFor(a),
|
|
807
858
|
};
|
|
@@ -819,6 +870,9 @@ export async function createRuntime(opts = {}) {
|
|
|
819
870
|
: {}),
|
|
820
871
|
home: paths.home,
|
|
821
872
|
});
|
|
873
|
+
// The Main Account's memory index and folder names (spec §3.44); warnings only.
|
|
874
|
+
if (mctx)
|
|
875
|
+
extra.push(...(await mainMemoryFindings(mctx, all.filter((a) => a.family === 'claude')).catch(() => [])));
|
|
822
876
|
return extra.length ? { ...r, general: [...r.general, ...extra] } : r;
|
|
823
877
|
};
|
|
824
878
|
let report = await withHandoff(await runDoctor(input));
|
|
@@ -1619,6 +1673,36 @@ export async function createRuntime(opts = {}) {
|
|
|
1619
1673
|
};
|
|
1620
1674
|
},
|
|
1621
1675
|
trustUndo: (o) => undoCarries(paths.stateDir, { apply: o.apply, ...(o.only ? { only: o.only } : {}) }),
|
|
1676
|
+
async memoryStatus(dir) {
|
|
1677
|
+
const fresh = await loadConfig(paths.configFile).catch(() => null);
|
|
1678
|
+
if (fresh)
|
|
1679
|
+
config.claude = fresh.claude;
|
|
1680
|
+
// `accounts` walks the Host folders: asked only while the setting is on.
|
|
1681
|
+
return memoryStatus({ mainDir: claudeMainDir(), stateDir: paths.stateDir, accounts }, config.claude?.shareMemory === true, dir);
|
|
1682
|
+
},
|
|
1683
|
+
async memorySet(on, o) {
|
|
1684
|
+
const r = await editConfigClaude(paths.configFile, (c) => {
|
|
1685
|
+
if (on)
|
|
1686
|
+
return { ...c, shareMemory: true };
|
|
1687
|
+
const { shareMemory: _drop, ...rest } = c;
|
|
1688
|
+
return Object.keys(rest).length ? rest : undefined;
|
|
1689
|
+
}, { dryRun: !o.apply });
|
|
1690
|
+
if (o.apply && r.changed)
|
|
1691
|
+
config.claude = r.after;
|
|
1692
|
+
return {
|
|
1693
|
+
changed: r.changed,
|
|
1694
|
+
applied: o.apply && r.changed,
|
|
1695
|
+
before: r.before?.shareMemory === true,
|
|
1696
|
+
after: r.after?.shareMemory === true,
|
|
1697
|
+
file: paths.configFile,
|
|
1698
|
+
};
|
|
1699
|
+
},
|
|
1700
|
+
async memoryOverview() {
|
|
1701
|
+
const fresh = await loadConfig(paths.configFile).catch(() => null);
|
|
1702
|
+
if (fresh)
|
|
1703
|
+
config.claude = fresh.claude;
|
|
1704
|
+
return { on: config.claude?.shareMemory === true, folded: await readFolds(paths.stateDir) };
|
|
1705
|
+
},
|
|
1622
1706
|
async advisorUnlock(on) {
|
|
1623
1707
|
const r = await setAdvisorUnlock(paths.configFile, on);
|
|
1624
1708
|
await reloadAdvisorConfig();
|
package/package.json
CHANGED
package/schemas/config.json
CHANGED
|
@@ -428,10 +428,14 @@
|
|
|
428
428
|
"carryTrust": {
|
|
429
429
|
"type": "boolean",
|
|
430
430
|
"description": "Carry folder trust between Claude accounts (spec §3.43, ADR-0078): before sideby starts an interactive Claude session in a folder this account has not trusted yet, when another Claude account of yours already trusts it (the folder, a parent folder outside any git repository, or the repository's main checkout), sideby copies that one trust mark (`projects[\"<path>\"].hasTrustDialogAccepted`) into this account's `.claude.json`, so Claude Code does not ask again. It never adds trust no account gave. Off by default; turning it off does not remove marks already copied (`sideby trust undo` does)."
|
|
431
|
+
},
|
|
432
|
+
"shareMemory": {
|
|
433
|
+
"type": "boolean",
|
|
434
|
+
"description": "Shared Project Memory (spec §3.44, ADR-0081): every interactive Claude session sideby starts in an account other than the main one reads and writes the main account's auto memory for its project (`~/.claude/projects/<project>/memory`, passed as `autoMemoryDirectory` through sideby's `--settings`), and `sideby doctor --fix` moves memory an account wrote on its own into the main account. Off by default; turning it off stops passing the folder and leaves the memory where it is."
|
|
431
435
|
}
|
|
432
436
|
},
|
|
433
437
|
"additionalProperties": false,
|
|
434
|
-
"description": "Claude Code launches (spec §3.41, ADR-0074; `carryTrust`: spec §3.43, ADR-0078)."
|
|
438
|
+
"description": "Claude Code launches (spec §3.41, ADR-0074; `carryTrust`: spec §3.43, ADR-0078; `shareMemory`: spec §3.44, ADR-0081)."
|
|
435
439
|
},
|
|
436
440
|
"unattended": {
|
|
437
441
|
"type": "object",
|