sideby 0.41.2 → 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.
Files changed (53) hide show
  1. package/dist/build.json +1 -1
  2. package/dist/src/cli/commands.d.ts +2 -0
  3. package/dist/src/cli/commands.js +263 -32
  4. package/dist/src/cli/json-schemas.js +85 -4
  5. package/dist/src/cli/main.js +49 -7
  6. package/dist/src/core/claude-memory.d.ts +236 -0
  7. package/dist/src/core/claude-memory.js +937 -0
  8. package/dist/src/core/cli-commands.js +16 -3
  9. package/dist/src/core/config.d.ts +17 -0
  10. package/dist/src/core/config.js +266 -43
  11. package/dist/src/core/history-project.d.ts +14 -0
  12. package/dist/src/core/history-project.js +42 -12
  13. package/dist/src/core/history.d.ts +4 -6
  14. package/dist/src/core/history.js +5 -15
  15. package/dist/src/core/local-build.d.ts +12 -0
  16. package/dist/src/core/local-build.js +32 -0
  17. package/dist/src/core/search-catalog.js +49 -0
  18. package/dist/src/core/session-hooks.d.ts +12 -2
  19. package/dist/src/core/session-hooks.js +12 -8
  20. package/dist/src/core/unattended-followup.d.ts +62 -0
  21. package/dist/src/core/unattended-followup.js +205 -0
  22. package/dist/src/core/unattended-pending.d.ts +11 -3
  23. package/dist/src/core/unattended-pending.js +34 -8
  24. package/dist/src/families/claude/history.js +9 -1
  25. package/dist/src/families/claude/layout.d.ts +7 -0
  26. package/dist/src/families/claude/layout.js +17 -0
  27. package/dist/src/families/claude/live-sessions.js +2 -1
  28. package/dist/src/families/history.d.ts +22 -2
  29. package/dist/src/families/history.js +55 -0
  30. package/dist/src/handoff/messages.js +1 -1
  31. package/dist/src/panel/handler.d.ts +22 -4
  32. package/dist/src/panel/handler.js +71 -25
  33. package/dist/src/panel/i18n.d.ts +35 -1
  34. package/dist/src/panel/i18n.js +72 -4
  35. package/dist/src/panel/page-logic.d.ts +53 -0
  36. package/dist/src/panel/page-logic.js +96 -0
  37. package/dist/src/panel/page-script.js +174 -36
  38. package/dist/src/panel/page-styles.js +18 -0
  39. package/dist/src/runtime.d.ts +30 -0
  40. package/dist/src/runtime.js +85 -1
  41. package/dist/src/unattended/hook.d.ts +10 -5
  42. package/dist/src/unattended/hook.js +17 -12
  43. package/package.json +1 -1
  44. package/schemas/config.json +5 -1
  45. package/schemas/memory-set.json +117 -0
  46. package/schemas/memory.json +210 -0
  47. package/schemas/unattended-pending.json +156 -56
  48. package/skills/sideby/SKILL.md +3 -1
  49. package/skills/sideby/references/diagnose.md +1 -0
  50. package/skills/sideby/references/handoff.md +1 -1
  51. package/skills/sideby/references/panel.md +1 -1
  52. package/skills/sideby/references/sharing.md +23 -1
  53. package/skills/sideby/references/unattended.md +16 -5
@@ -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>;
@@ -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();
@@ -27,7 +27,10 @@ export declare function questionText(input: Record<string, unknown>): string;
27
27
  * answering (Answer Wait); the session shows the text too, so it opens with what happened for the person coming back.
28
28
  */
29
29
  export declare function questionReason(state: UnattendedState, now: Date, zh: boolean, kept: boolean, waited?: number): string;
30
- /** How much of the end of the model's last message is read to tell whether it ends on a question. */
30
+ /**
31
+ * How much of the end of the model's last message is read to tell whether it ends on a question. The `需要你拍板`
32
+ * marker is looked for in the whole message instead (`endingQuestion`).
33
+ */
31
34
  export declare const QUESTION_TAIL = 600;
32
35
  /**
33
36
  * Ways a model asks the user in plain text, in English and Chinese, checked against the end of its last message (the
@@ -37,10 +40,12 @@ export declare const QUESTION_TAIL = 600;
37
40
  export declare const QUESTION_PATTERNS: readonly RegExp[];
38
41
  /**
39
42
  * The part of the model's last message that asks the user something, or undefined when it does not end on a
40
- * question. Code blocks (``` and ~~~), inline code and quoted lines (`> …`) are left out first, then the last
41
- * {@link QUESTION_TAIL} characters are read: a line that starts with the `需要你拍板` marker (from it to the end); a last line that ends with `?`
42
- * or `?`, or a list of options at the end right after such a line; or one of {@link QUESTION_PATTERNS} in the last
43
- * paragraph (and the one before it when the last is a list), unless a negation comes just before it ("无需你来决定").
43
+ * question. Code blocks (``` and ~~~), inline code and quoted lines (`> …`) are left out first. A line anywhere in
44
+ * the rest that starts with the `需要你拍板` / `Needs your decision` marker asks (from the first such line to the end):
45
+ * a report often goes on for a long while after it. Otherwise only the last {@link QUESTION_TAIL} characters are
46
+ * read: a last line that ends with `?` or `?`, or a list of options at the end right after such a line; or one of
47
+ * {@link QUESTION_PATTERNS} in the last paragraph (and the one before it when the last is a list), unless a negation
48
+ * comes just before it ("无需你来决定").
44
49
  */
45
50
  export declare function endingQuestion(message: string): string | undefined;
46
51
  /**
@@ -125,7 +125,7 @@ export function questionReason(state, now, zh, kept, waited) {
125
125
  const head = waited
126
126
  ? `${waited} 分钟没人回答:sideby 无人值守已开启${when},会话不再等回答,${keep}。`
127
127
  : `未显示:sideby 无人值守已开启${when},现在没人能回答,${keep}。`;
128
- return `${head}不要再问。能撤回的选择按推荐的选项继续,在最终汇报里写出这个问题和你的选择。删除、对外发送或发布、部署、付费等难撤回的操作不要做:跳过它,运行 \`sideby unattended defer "<一句话>"\` 记下,再继续做其余的事。`;
128
+ return `${head}不要再问。能撤回的选择按推荐的选项继续,在最终汇报里写出这个问题和你的选择。删除、对外发送或发布、部署、付费等难撤回的操作不要做:跳过它,运行 \`sideby unattended defer "<一句话>"\` 记下,再继续做其余的事。用户自己的规则或项目文档已对这类操作常设授权的,照那份授权做。`;
129
129
  }
130
130
  const when = session ? 'for this session' : until ? `until ${until}` : 'with no end set';
131
131
  const keep = kept
@@ -134,10 +134,13 @@ export function questionReason(state, now, zh, kept, waited) {
134
134
  const head = waited
135
135
  ? `No answer after ${minutesText(waited)}: sideby's Unattended Mode is on ${when}, so the session goes on without one, and ${keep}.`
136
136
  : `Not shown: sideby's Unattended Mode is on ${when}, so nobody is here to answer, and ${keep}.`;
137
- return `${head} Do not ask again. Where the choice can be undone, go on with the recommended option, and list the question and your choice in your final report. Do not do anything hard to undo (deleting, sending or posting anything outside, publishing, deploying, paying): skip it, record it with \`sideby unattended defer "<one sentence>"\`, and go on with the rest.`;
137
+ return `${head} Do not ask again. Where the choice can be undone, go on with the recommended option, and list the question and your choice in your final report. Do not do anything hard to undo (deleting, sending or posting anything outside, publishing, deploying, paying): skip it, record it with \`sideby unattended defer "<one sentence>"\`, and go on with the rest. Where the user's own rules or project docs already give standing permission for that kind of action, follow that permission instead.`;
138
138
  }
139
139
  const minutesText = (n) => (n === 1 ? '1 minute' : `${n} minutes`);
140
- /** How much of the end of the model's last message is read to tell whether it ends on a question. */
140
+ /**
141
+ * How much of the end of the model's last message is read to tell whether it ends on a question. The `需要你拍板`
142
+ * marker is looked for in the whole message instead (`endingQuestion`).
143
+ */
141
144
  export const QUESTION_TAIL = 600;
142
145
  /**
143
146
  * Ways a model asks the user in plain text, in English and Chinese, checked against the end of its last message (the
@@ -180,10 +183,12 @@ function asks(pattern, text) {
180
183
  }
181
184
  /**
182
185
  * The part of the model's last message that asks the user something, or undefined when it does not end on a
183
- * question. Code blocks (``` and ~~~), inline code and quoted lines (`> …`) are left out first, then the last
184
- * {@link QUESTION_TAIL} characters are read: a line that starts with the `需要你拍板` marker (from it to the end); a last line that ends with `?`
185
- * or `?`, or a list of options at the end right after such a line; or one of {@link QUESTION_PATTERNS} in the last
186
- * paragraph (and the one before it when the last is a list), unless a negation comes just before it ("无需你来决定").
186
+ * question. Code blocks (``` and ~~~), inline code and quoted lines (`> …`) are left out first. A line anywhere in
187
+ * the rest that starts with the `需要你拍板` / `Needs your decision` marker asks (from the first such line to the end):
188
+ * a report often goes on for a long while after it. Otherwise only the last {@link QUESTION_TAIL} characters are
189
+ * read: a last line that ends with `?` or `?`, or a list of options at the end right after such a line; or one of
190
+ * {@link QUESTION_PATTERNS} in the last paragraph (and the one before it when the last is a list), unless a negation
191
+ * comes just before it ("无需你来决定").
187
192
  */
188
193
  export function endingQuestion(message) {
189
194
  // Judged on a copy where code and quotes are blanked out at the same length, so a span of it is the same span of
@@ -195,14 +200,14 @@ export function endingQuestion(message) {
195
200
  .replace(/`[^`\n]*`/g, (m) => 'x'.repeat(m.length))
196
201
  .replace(/^[ \t]*>.*$/gm, blank);
197
202
  const stop = plain.trimEnd().length;
203
+ const heading = DECIDE_HEADING.exec(plain.slice(0, stop));
204
+ if (heading)
205
+ return written.slice(heading.index, stop).trim();
198
206
  const from = Math.max(0, stop - QUESTION_TAIL);
199
207
  const tail = plain.slice(from, stop);
200
208
  if (!tail.trim())
201
209
  return undefined;
202
210
  const kept = (at) => written.slice(from + at, stop).trim();
203
- const heading = DECIDE_HEADING.exec(tail);
204
- if (heading)
205
- return kept(heading.index);
206
211
  // Each paragraph with where it starts in the tail.
207
212
  const paragraphs = [];
208
213
  let at = 0;
@@ -245,7 +250,7 @@ export function stopReason(state, now, zh, kept, waited) {
245
250
  const head = waited
246
251
  ? `${waited} 分钟没人回复你的问题:sideby 无人值守已开启${when},${keep}。这条不是用户的回复。`
247
252
  : `没人能回答:sideby 无人值守已开启${when},${keep}。`;
248
- return `${head}不要等回复,也不要再问。能撤回的选择按推荐的选项继续,一直做到完。删除、对外发送或发布、部署、付费等难撤回的操作不要做:跳过它,运行 \`sideby unattended defer "<一句话>"\` 记下,再做完其余的事。最后写一份最终汇报,列出你做的每个选择和记下的每件事,不提任何问题。`;
253
+ return `${head}不要等回复,也不要再问。能撤回的选择按推荐的选项继续,一直做到完。删除、对外发送或发布、部署、付费等难撤回的操作不要做:跳过它,运行 \`sideby unattended defer "<一句话>"\` 记下,再做完其余的事。用户自己的规则或项目文档已对这类操作常设授权的,照那份授权做。最后写一份最终汇报,列出你做的每个选择和记下的每件事,不提任何问题。`;
249
254
  }
250
255
  const when = session ? 'for this session' : until ? `until ${until}` : 'with no end set';
251
256
  const keep = kept
@@ -254,7 +259,7 @@ export function stopReason(state, now, zh, kept, waited) {
254
259
  const head = waited
255
260
  ? `Nobody replied to your question for ${minutesText(waited)}: sideby's Unattended Mode is on ${when}, and ${keep}. This note is not the user's reply.`
256
261
  : `Nobody is here to answer: sideby's Unattended Mode is on ${when}, and ${keep}.`;
257
- return `${head} Do not wait for an answer and do not ask again. Where the choice can be undone, go on with the recommended option and carry on to the end. Do not do anything hard to undo (deleting, sending or posting anything outside, publishing, deploying, paying): skip it, record it with \`sideby unattended defer "<one sentence>"\`, and finish the rest. Then end with a final report that lists each choice you made and each item you recorded, without asking anything.`;
262
+ return `${head} Do not wait for an answer and do not ask again. Where the choice can be undone, go on with the recommended option and carry on to the end. Do not do anything hard to undo (deleting, sending or posting anything outside, publishing, deploying, paying): skip it, record it with \`sideby unattended defer "<one sentence>"\`, and finish the rest. Where the user's own rules or project docs already give standing permission for that kind of action, follow that permission instead. Then end with a final report that lists each choice you made and each item you recorded, without asking anything.`;
258
263
  }
259
264
  /** What a declined MCP form is kept as: the server's name and what it asked, never a field's value. */
260
265
  export function elicitationText(v) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.41.2",
3
+ "version": "0.42.0",
4
4
  "description": "Run work, personal and API-key accounts at the same time, without their configs drifting apart.",
5
5
  "license": "MIT",
6
6
  "author": "Adonis0123 (https://github.com/Adonis0123)",
@@ -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",
@@ -0,0 +1,117 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sideby/memory-set.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schemaVersion",
7
+ "action",
8
+ "on",
9
+ "changed",
10
+ "applied",
11
+ "before",
12
+ "after",
13
+ "file"
14
+ ],
15
+ "properties": {
16
+ "schemaVersion": {
17
+ "type": "number",
18
+ "const": 1
19
+ },
20
+ "action": {
21
+ "anyOf": [
22
+ {
23
+ "type": "string",
24
+ "const": "on"
25
+ },
26
+ {
27
+ "type": "string",
28
+ "const": "off"
29
+ }
30
+ ]
31
+ },
32
+ "on": {
33
+ "type": "boolean",
34
+ "description": "Whether config `claude.shareMemory` is on now."
35
+ },
36
+ "changed": {
37
+ "type": "boolean"
38
+ },
39
+ "applied": {
40
+ "type": "boolean",
41
+ "description": "False when only the change was shown; run again with --yes (exit 10)."
42
+ },
43
+ "before": {
44
+ "type": "boolean"
45
+ },
46
+ "after": {
47
+ "type": "boolean"
48
+ },
49
+ "file": {
50
+ "type": "string",
51
+ "description": "The config file changed."
52
+ },
53
+ "_notice": {
54
+ "type": "object",
55
+ "properties": {
56
+ "update": {
57
+ "type": "object",
58
+ "required": [
59
+ "current",
60
+ "latest",
61
+ "command",
62
+ "message"
63
+ ],
64
+ "properties": {
65
+ "current": {
66
+ "type": "string"
67
+ },
68
+ "latest": {
69
+ "type": "string"
70
+ },
71
+ "command": {
72
+ "type": "string",
73
+ "description": "Run it after the user agrees: it shows the plan and exits 10; then --yes."
74
+ },
75
+ "message": {
76
+ "type": "string"
77
+ }
78
+ }
79
+ },
80
+ "skill": {
81
+ "type": "object",
82
+ "required": [
83
+ "installed",
84
+ "current",
85
+ "command",
86
+ "message"
87
+ ],
88
+ "properties": {
89
+ "installed": {
90
+ "anyOf": [
91
+ {
92
+ "type": "string"
93
+ },
94
+ {
95
+ "type": "null"
96
+ }
97
+ ],
98
+ "description": "The skill's version; null when it has none."
99
+ },
100
+ "current": {
101
+ "type": "string"
102
+ },
103
+ "command": {
104
+ "type": "string",
105
+ "description": "`sideby update`, which updates the skill with sideby: run it after the user agrees; it shows the plan and exits 10, then --yes."
106
+ },
107
+ "message": {
108
+ "type": "string"
109
+ }
110
+ }
111
+ }
112
+ },
113
+ "description": "Not the answer to the task: mention it briefly afterwards and offer to update."
114
+ }
115
+ },
116
+ "title": "sideby memory on|off --json"
117
+ }
@@ -0,0 +1,210 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sideby/memory.json",
4
+ "type": "object",
5
+ "required": [
6
+ "schemaVersion",
7
+ "action",
8
+ "on",
9
+ "main",
10
+ "folded"
11
+ ],
12
+ "properties": {
13
+ "schemaVersion": {
14
+ "type": "number",
15
+ "const": 1
16
+ },
17
+ "action": {
18
+ "type": "string",
19
+ "const": "status"
20
+ },
21
+ "on": {
22
+ "type": "boolean",
23
+ "description": "Config `claude.shareMemory` (spec §3.44): Claude sessions sideby starts in other accounts read and write the main account's memory for their project, and `sideby doctor --fix` moves memory an account wrote on its own into the main account."
24
+ },
25
+ "main": {
26
+ "type": "string",
27
+ "description": "The main account's folder that holds every project's memory."
28
+ },
29
+ "folded": {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "object",
33
+ "required": [
34
+ "account",
35
+ "project",
36
+ "files",
37
+ "at"
38
+ ],
39
+ "properties": {
40
+ "account": {
41
+ "type": "string",
42
+ "description": "The account the memory came from."
43
+ },
44
+ "project": {
45
+ "type": "string",
46
+ "description": "The project folder name under projects/."
47
+ },
48
+ "files": {
49
+ "type": "number",
50
+ "description": "How many files reached the main account."
51
+ },
52
+ "at": {
53
+ "type": "string",
54
+ "description": "When (ISO time)."
55
+ }
56
+ }
57
+ },
58
+ "description": "What `sideby doctor --fix` moved into the main account, oldest first."
59
+ },
60
+ "dir": {
61
+ "type": "object",
62
+ "required": [
63
+ "path"
64
+ ],
65
+ "properties": {
66
+ "path": {
67
+ "type": "string",
68
+ "description": "The folder asked about (its real path)."
69
+ },
70
+ "name": {
71
+ "type": "string",
72
+ "description": "Its project folder name under projects/."
73
+ },
74
+ "memory": {
75
+ "type": "string",
76
+ "description": "Where its memory goes for every Claude account sideby starts."
77
+ },
78
+ "why": {
79
+ "type": "string",
80
+ "description": "Why sideby cannot tell; such a session keeps its own memory."
81
+ }
82
+ },
83
+ "description": "Where the memory of the folder asked about goes; only while on."
84
+ },
85
+ "projects": {
86
+ "type": "array",
87
+ "items": {
88
+ "type": "object",
89
+ "required": [
90
+ "name",
91
+ "main",
92
+ "pending",
93
+ "folded"
94
+ ],
95
+ "properties": {
96
+ "name": {
97
+ "type": "string",
98
+ "description": "The project folder name under projects/."
99
+ },
100
+ "main": {
101
+ "type": "number",
102
+ "description": "Files in the main account's memory folder for it."
103
+ },
104
+ "pending": {
105
+ "type": "array",
106
+ "items": {
107
+ "type": "object",
108
+ "required": [
109
+ "account",
110
+ "files"
111
+ ],
112
+ "properties": {
113
+ "account": {
114
+ "type": "string"
115
+ },
116
+ "files": {
117
+ "type": "number"
118
+ }
119
+ }
120
+ },
121
+ "description": "Accounts that keep memory of their own for it: what `sideby doctor --fix` would move."
122
+ },
123
+ "folded": {
124
+ "type": "array",
125
+ "items": {
126
+ "type": "object",
127
+ "required": [
128
+ "account",
129
+ "files"
130
+ ],
131
+ "properties": {
132
+ "account": {
133
+ "type": "string"
134
+ },
135
+ "files": {
136
+ "type": "number"
137
+ }
138
+ }
139
+ },
140
+ "description": "Files `sideby doctor --fix` already moved in, per account."
141
+ }
142
+ }
143
+ },
144
+ "description": "Each project with memory in the main account or in an account of its own; only while on. Nothing is read while off."
145
+ },
146
+ "_notice": {
147
+ "type": "object",
148
+ "properties": {
149
+ "update": {
150
+ "type": "object",
151
+ "required": [
152
+ "current",
153
+ "latest",
154
+ "command",
155
+ "message"
156
+ ],
157
+ "properties": {
158
+ "current": {
159
+ "type": "string"
160
+ },
161
+ "latest": {
162
+ "type": "string"
163
+ },
164
+ "command": {
165
+ "type": "string",
166
+ "description": "Run it after the user agrees: it shows the plan and exits 10; then --yes."
167
+ },
168
+ "message": {
169
+ "type": "string"
170
+ }
171
+ }
172
+ },
173
+ "skill": {
174
+ "type": "object",
175
+ "required": [
176
+ "installed",
177
+ "current",
178
+ "command",
179
+ "message"
180
+ ],
181
+ "properties": {
182
+ "installed": {
183
+ "anyOf": [
184
+ {
185
+ "type": "string"
186
+ },
187
+ {
188
+ "type": "null"
189
+ }
190
+ ],
191
+ "description": "The skill's version; null when it has none."
192
+ },
193
+ "current": {
194
+ "type": "string"
195
+ },
196
+ "command": {
197
+ "type": "string",
198
+ "description": "`sideby update`, which updates the skill with sideby: run it after the user agrees; it shows the plan and exits 10, then --yes."
199
+ },
200
+ "message": {
201
+ "type": "string"
202
+ }
203
+ }
204
+ }
205
+ },
206
+ "description": "Not the answer to the task: mention it briefly afterwards and offer to update."
207
+ }
208
+ },
209
+ "title": "sideby memory [--dir <path>] --json"
210
+ }