sideby 0.40.0 → 0.40.1

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
@@ -4,7 +4,7 @@
4
4
 
5
5
  <p align="center">
6
6
  <b>Run work, personal and API-key accounts at the same time, without their configs drifting apart.</b><br>
7
- Each account is its own directory and its own terminal. Skills, hooks and settings stay linked to your main account. Claude Code, Codex, Grok Build and pi.
7
+ Each account is its own directory and its own terminal. Skills, hooks and settings stay linked to your main account. Claude Code, Codex, Grok Build, pi and Antigravity CLI.
8
8
  </p>
9
9
 
10
10
  <p align="center">
@@ -18,7 +18,7 @@
18
18
 
19
19
  ## Quick start
20
20
 
21
- Requires Node 22.18+ and at least one Host CLI (Claude Code, Codex, Grok Build or pi) installed. AI agents: follow the setup steps in [`llms.txt`](llms.txt) ("Set up sideby for a user") instead.
21
+ Requires Node 22.18+ and at least one Host CLI (Claude Code, Codex, Grok Build, pi or Antigravity CLI) installed. AI agents: follow the setup steps in [`llms.txt`](llms.txt) ("Set up sideby for a user") instead.
22
22
 
23
23
  ```sh
24
24
  npm i -g sideby
package/dist/build.json CHANGED
@@ -1 +1 @@
1
- {"id":"20261116T100604-6fbbc9"}
1
+ {"id":"20261117T092443-8d4a3b"}
@@ -14,7 +14,7 @@ import { briefPath, chainDir, ensureChainDir, FILES, HANDOFF_ENV, newId, readJso
14
14
  import { beforeDashes, runHost, sidebyBinProblem, spawnHost } from './launch.js';
15
15
  import { withoutArgs } from './network.js';
16
16
  import { quotaPressure } from './quota-levels.js';
17
- import { withClaudeSessionHooks } from './session-hooks.js';
17
+ import { withClaudeDirs, withClaudeSessionHooks } from './session-hooks.js';
18
18
  /** How long the Host gets to exit after SIGTERM (time for its SessionEnd hooks) before sideby gives up. */
19
19
  export const EXIT_GRACE_MS = 10_000;
20
20
  const PLAN_REFRESH_MS = 60_000;
@@ -201,188 +201,205 @@ export async function runWithHandoff(rt, ref, userArgs, io, opts = {}) {
201
201
  const own = rt.config.aliases?.[ref];
202
202
  let hop = { ref, args: [...aliasArgs(own), ...userArgs] };
203
203
  let n = 1;
204
- for (;;) {
205
- const launch = n === 1 ? firstLaunch : await rt.prepareLaunch(hop.ref, hop.args, 'run', launchOpts);
206
- const account = launch.account;
207
- const h = launch.family.handoff;
208
- if (!h)
209
- return runHost(launch);
210
- const elig = n === 1 ? firstElig : await h.eligibility(withoutNetwork(launch), account, launch.env);
211
- const canStart = h.starts.length > 0 && elig.start && HOOK_FAMILIES.includes(account.family);
212
- if (!canStart && elig.reason)
213
- io.err(`sideby: ${account.ref} will not hand over: ${elig.reason}`);
214
- const runId = newId();
215
- const brief = briefPath(dir, n, account.ref);
216
- const extra = [...(elig.args ?? [])];
217
- const env = { ...launch.env };
218
- // Claude takes one `--settings`: sideby's session hooks (Network Guard §3.35, Unattended Mode §3.37) go into Auto
219
- // Handoff's file.
220
- const sessionArgs = launch.sessionHookArgs ?? launch.networkArgs ?? [];
221
- const mergeNet = canStart && account.family === 'claude' && sessionArgs.length > 0;
222
- if (canStart) {
223
- const hookArgs = (await h.hookArgs?.(hookCommand(account.family), rt.paths.stateDir)) ?? [];
224
- extra.push(...(mergeNet ? await withClaudeSessionHooks(hookArgs, sessionArgs) : hookArgs));
225
- env[HANDOFF_ENV.run] = runId;
226
- env[HANDOFF_ENV.family] = account.family;
227
- env[HANDOFF_ENV.dir] = dir;
228
- if (account.family === 'codex')
229
- await codexTrustNotice(rt, account, io);
230
- }
231
- extra.push(...(h.dirArgs?.(dir) ?? []));
232
- const args = beforeDashes(mergeNet ? withoutNetwork(launch) : launch.args, extra);
233
- // Later hops carry no `--` of their own (continueArgs drops it), so the prompt goes after a fresh one.
234
- if (hop.prompt)
235
- args.push(...h.promptArgs(hop.prompt));
236
- hops.hops.push({ ref: account.ref, startedAt: new Date().toISOString() });
237
- await writeJsonFile(join(dir, FILES.chain), hops);
238
- if (launch.notice)
239
- io.err(launch.notice);
240
- if (!canStart)
241
- return runHost({ ...launch, args, env });
242
- // Plan writes run one after another, and none lands after this hop is over: a late one would carry this
243
- // run's id into the next hop's plan.json and silence its hook.
244
- let stopped = false;
245
- let pending = Promise.resolve();
246
- const writePlan = () => {
247
- pending = pending.then(async () => {
248
- try {
249
- // Read by the hook once the threshold is crossed, so it answers for that moment (spec §3.17 "选号" 1).
250
- const d = await rt.handoffDecision(account, hops.hops, { ahead: true });
251
- if (stopped)
252
- return;
253
- const plan = {
254
- runId,
255
- brief,
256
- at: new Date().toISOString(),
257
- decision: d.kind,
258
- ...(d.kind === 'pick' ? { pick: d.ref } : {}),
259
- ...(d.kind === 'wait' ? { until: d.until } : {}),
260
- prepareAt: settings.prepareAt,
261
- threshold: settings.threshold,
262
- adaptive: settings.adaptive,
263
- ...(elig.agentBrief === false ? { agentBrief: false } : {}),
264
- acceptsTo: true,
265
- };
266
- await writeJsonFile(join(dir, FILES.plan), plan);
204
+ const chainSettings = join(rt.paths.stateDir, 'handoff', 'chains', `${chain}-claude.json`);
205
+ try {
206
+ for (;;) {
207
+ const launch = n === 1 ? firstLaunch : await rt.prepareLaunch(hop.ref, hop.args, 'run', launchOpts);
208
+ const account = launch.account;
209
+ const h = launch.family.handoff;
210
+ if (!h)
211
+ return await runHost(launch);
212
+ const elig = n === 1 ? firstElig : await h.eligibility(withoutNetwork(launch), account, launch.env);
213
+ const canStart = h.starts.length > 0 && elig.start && HOOK_FAMILIES.includes(account.family);
214
+ if (!canStart && elig.reason)
215
+ io.err(`sideby: ${account.ref} will not hand over: ${elig.reason}`);
216
+ const runId = newId();
217
+ const brief = briefPath(dir, n, account.ref);
218
+ const extra = [...(elig.args ?? [])];
219
+ const env = { ...launch.env };
220
+ // Claude takes one `--settings`: sideby's session hooks (Network Guard §3.35, Unattended Mode §3.37) go into Auto
221
+ // Handoff's file.
222
+ const sessionArgs = launch.sessionHookArgs ?? launch.networkArgs ?? [];
223
+ const mergeNet = canStart && account.family === 'claude' && sessionArgs.length > 0;
224
+ let dirInSettings = false;
225
+ if (canStart) {
226
+ const hookArgs = (await h.hookArgs?.(hookCommand(account.family), rt.paths.stateDir)) ?? [];
227
+ let settingsArgs = mergeNet ? await withClaudeSessionHooks(hookArgs, sessionArgs) : hookArgs;
228
+ // Claude Code 2.1.326 asks to trust a folder given by `--add-dir`; one in sideby's `--settings` file needs no
229
+ // question. The file is the chain's own, outside the chain directory the session may write to.
230
+ if (account.family === 'claude' && settingsArgs.includes('--settings')) {
231
+ settingsArgs = await withClaudeDirs(settingsArgs, [dir], chainSettings);
232
+ dirInSettings = true;
267
233
  }
268
- catch {
269
- // the hook treats a missing plan as "do not interrupt"
234
+ extra.push(...settingsArgs);
235
+ env[HANDOFF_ENV.run] = runId;
236
+ env[HANDOFF_ENV.family] = account.family;
237
+ env[HANDOFF_ENV.dir] = dir;
238
+ if (account.family === 'codex')
239
+ await codexTrustNotice(rt, account, io);
240
+ }
241
+ // Where sideby cannot add to `--settings` (the user gave their own), Claude Code asks to trust the folder.
242
+ if (!dirInSettings)
243
+ extra.push(...(h.dirArgs?.(dir) ?? []));
244
+ const args = beforeDashes(mergeNet ? withoutNetwork(launch) : launch.args, extra);
245
+ // Later hops carry no `--` of their own (continueArgs drops it), so the prompt goes after a fresh one.
246
+ if (hop.prompt)
247
+ args.push(...h.promptArgs(hop.prompt));
248
+ hops.hops.push({ ref: account.ref, startedAt: new Date().toISOString() });
249
+ await writeJsonFile(join(dir, FILES.chain), hops);
250
+ if (launch.notice)
251
+ io.err(launch.notice);
252
+ if (!canStart)
253
+ return await runHost({ ...launch, args, env });
254
+ // Plan writes run one after another, and none lands after this hop is over: a late one would carry this
255
+ // run's id into the next hop's plan.json and silence its hook.
256
+ let stopped = false;
257
+ let pending = Promise.resolve();
258
+ const writePlan = () => {
259
+ pending = pending.then(async () => {
260
+ try {
261
+ // Read by the hook once the threshold is crossed, so it answers for that moment (spec §3.17 "选号" 1).
262
+ const d = await rt.handoffDecision(account, hops.hops, { ahead: true });
263
+ if (stopped)
264
+ return;
265
+ const plan = {
266
+ runId,
267
+ brief,
268
+ at: new Date().toISOString(),
269
+ decision: d.kind,
270
+ ...(d.kind === 'pick' ? { pick: d.ref } : {}),
271
+ ...(d.kind === 'wait' ? { until: d.until } : {}),
272
+ prepareAt: settings.prepareAt,
273
+ threshold: settings.threshold,
274
+ adaptive: settings.adaptive,
275
+ ...(elig.agentBrief === false ? { agentBrief: false } : {}),
276
+ acceptsTo: true,
277
+ };
278
+ await writeJsonFile(join(dir, FILES.plan), plan);
279
+ }
280
+ catch {
281
+ // the hook treats a missing plan as "do not interrupt"
282
+ }
283
+ });
284
+ return pending;
285
+ };
286
+ await writePlan();
287
+ const refresh = setInterval(() => void writePlan(), PLAN_REFRESH_MS);
288
+ const host = spawnHost({ ...launch, args, env });
289
+ const exited = host.exited.then((code) => ({ kind: 'exit', code }));
290
+ // Nothing to move on to (or better to wait): leave the session alone, keep listening (the user may still ask to
291
+ // move on while it waits, ADR-0018), and say why once it ends.
292
+ let kept;
293
+ let outcome;
294
+ for (;;) {
295
+ const watcher = watchReady(dir, runId);
296
+ const got = await Promise.race([
297
+ exited,
298
+ watcher.ready.then((ready) => ({ kind: 'ready', ready })),
299
+ ]);
300
+ watcher.stop();
301
+ if (got.kind === 'exit') {
302
+ outcome = got;
303
+ break;
270
304
  }
271
- });
272
- return pending;
273
- };
274
- await writePlan();
275
- const refresh = setInterval(() => void writePlan(), PLAN_REFRESH_MS);
276
- const host = spawnHost({ ...launch, args, env });
277
- const exited = host.exited.then((code) => ({ kind: 'exit', code }));
278
- // Nothing to move on to (or better to wait): leave the session alone, keep listening (the user may still ask to
279
- // move on while it waits, ADR-0018), and say why once it ends.
280
- let kept;
281
- let outcome;
282
- for (;;) {
283
- const watcher = watchReady(dir, runId);
284
- const got = await Promise.race([
285
- exited,
286
- watcher.ready.then((ready) => ({ kind: 'ready', ready })),
287
- ]);
288
- watcher.stop();
289
- if (got.kind === 'exit') {
290
- outcome = got;
291
- break;
305
+ const d = await decide(rt, account, hops.hops, got.ready.to, got.ready.trigger === 'manual');
306
+ if (d.kind === 'pick') {
307
+ outcome = { ...got, decision: d };
308
+ break;
309
+ }
310
+ await rm(join(dir, FILES.ready), { force: true });
311
+ // A session kept at its limit (or kept to wait) ends no turn until it continues, so a request would never be
312
+ // picked up: `waiting.json` lets `handoff ready` hand over at once (ADR-0018). A `threshold` none is still in
313
+ // its turns and gets none.
314
+ const until = d.kind === 'wait' ? d.until : got.ready.trigger === 'limit' ? limitUntil(got.ready) : undefined;
315
+ if (until)
316
+ await writeJsonFile(join(dir, FILES.waiting), {
317
+ runId,
318
+ until,
319
+ at: new Date().toISOString(),
320
+ trigger: got.ready.trigger,
321
+ });
322
+ kept = d;
323
+ }
324
+ clearInterval(refresh);
325
+ stopped = true;
326
+ await pending;
327
+ await rm(join(dir, FILES.waiting), { force: true });
328
+ if (outcome.kind === 'exit') {
329
+ if (kept)
330
+ io.err(`sideby: ${account.ref} did not hand over: ${explain(kept)}`);
331
+ else
332
+ await noteUnhandedHighQuota(rt, account, hops.hops, settings.threshold, io);
333
+ return outcome.code;
292
334
  }
293
- const d = await decide(rt, account, hops.hops, got.ready.to, got.ready.trigger === 'manual');
294
- if (d.kind === 'pick') {
295
- outcome = { ...got, decision: d };
296
- break;
335
+ const decision = outcome.decision;
336
+ // The session is ready: end the Host, give it time to save, never kill it.
337
+ host.child.kill('SIGTERM');
338
+ const ended = await Promise.race([
339
+ host.exited.then((code) => ({ code })),
340
+ new Promise((r) => setTimeout(() => r(null), grace).unref()),
341
+ ]);
342
+ if (!ended) {
343
+ io.err(`sideby: ${account.ref} did not exit within ${grace / 1000}s, so nothing was handed over; exit it yourself, then start the next account with \`sideby run ${decision.ref}\``);
344
+ return await host.exited;
297
345
  }
346
+ const ready = outcome.ready;
347
+ const assembled = await h
348
+ .briefFromSession?.(account, {
349
+ ...(ready.sessionId ? { id: ready.sessionId } : {}),
350
+ ...(ready.transcriptPath ? { transcriptPath: ready.transcriptPath } : {}),
351
+ })
352
+ .catch(() => undefined);
353
+ const done = await finishBrief({
354
+ target: brief,
355
+ ready,
356
+ ...(assembled ? { assembled } : {}),
357
+ cwd: process.cwd(),
358
+ });
359
+ const last = hops.hops[hops.hops.length - 1];
360
+ Object.assign(last, {
361
+ trigger: ready.trigger,
362
+ briefSource: done.source,
363
+ brief: done.path,
364
+ ...(ready.window ? { window: ready.window } : {}),
365
+ });
366
+ await writeJsonFile(join(dir, FILES.chain), hops);
298
367
  await rm(join(dir, FILES.ready), { force: true });
299
- // A session kept at its limit (or kept to wait) ends no turn until it continues, so a request would never be
300
- // picked up: `waiting.json` lets `handoff ready` hand over at once (ADR-0018). A `threshold` none is still in
301
- // its turns and gets none.
302
- const until = d.kind === 'wait' ? d.until : got.ready.trigger === 'limit' ? limitUntil(got.ready) : undefined;
303
- if (until)
304
- await writeJsonFile(join(dir, FILES.waiting), {
305
- runId,
306
- until,
307
- at: new Date().toISOString(),
308
- trigger: got.ready.trigger,
309
- });
310
- kept = d;
311
- }
312
- clearInterval(refresh);
313
- stopped = true;
314
- await pending;
315
- await rm(join(dir, FILES.waiting), { force: true });
316
- if (outcome.kind === 'exit') {
317
- if (kept)
318
- io.err(`sideby: ${account.ref} did not hand over: ${explain(kept)}`);
319
- else
320
- await noteUnhandedHighQuota(rt, account, hops.hops, settings.threshold, io);
321
- return outcome.code;
322
- }
323
- const decision = outcome.decision;
324
- // The session is ready: end the Host, give it time to save, never kill it.
325
- host.child.kill('SIGTERM');
326
- const ended = await Promise.race([
327
- host.exited.then((code) => ({ code })),
328
- new Promise((r) => setTimeout(() => r(null), grace).unref()),
329
- ]);
330
- if (!ended) {
331
- io.err(`sideby: ${account.ref} did not exit within ${grace / 1000}s, so nothing was handed over; exit it yourself, then start the next account with \`sideby run ${decision.ref}\``);
332
- return host.exited;
333
- }
334
- const ready = outcome.ready;
335
- const assembled = await h
336
- .briefFromSession?.(account, {
337
- ...(ready.sessionId ? { id: ready.sessionId } : {}),
338
- ...(ready.transcriptPath ? { transcriptPath: ready.transcriptPath } : {}),
339
- })
340
- .catch(() => undefined);
341
- const done = await finishBrief({
342
- target: brief,
343
- ready,
344
- ...(assembled ? { assembled } : {}),
345
- cwd: process.cwd(),
346
- });
347
- const last = hops.hops[hops.hops.length - 1];
348
- Object.assign(last, {
349
- trigger: ready.trigger,
350
- briefSource: done.source,
351
- brief: done.path,
352
- ...(ready.window ? { window: ready.window } : {}),
353
- });
354
- await writeJsonFile(join(dir, FILES.chain), hops);
355
- await rm(join(dir, FILES.ready), { force: true });
356
- await rm(join(dir, FILES.request), { force: true });
357
- io.err(`sideby: ${account.ref} saved its session and is handing over because ${WHY[ready.trigger]}${ready.window ? ` (${windowText(ready.window)})` : ''}; next is ${decision.ref}${skippedText(decision)}. Brief: ${done.path}`);
358
- if (settings.countdownSeconds > 0 &&
359
- (await countdown(io, settings.countdownSeconds, decision.ref, account.ref))) {
360
- io.err(`sideby: staying in ${account.ref}`);
361
- if (!ready.sessionId) {
362
- io.err(`sideby: the session id is unknown, so start ${account.ref} yourself; the Brief is at ${done.path}`);
368
+ await rm(join(dir, FILES.request), { force: true });
369
+ io.err(`sideby: ${account.ref} saved its session and is handing over because ${WHY[ready.trigger]}${ready.window ? ` (${windowText(ready.window)})` : ''}; next is ${decision.ref}${skippedText(decision)}. Brief: ${done.path}`);
370
+ if (settings.countdownSeconds > 0 &&
371
+ (await countdown(io, settings.countdownSeconds, decision.ref, account.ref))) {
372
+ io.err(`sideby: staying in ${account.ref}`);
373
+ if (!ready.sessionId) {
374
+ io.err(`sideby: the session id is unknown, so start ${account.ref} yourself; the Brief is at ${done.path}`);
375
+ return ended.code;
376
+ }
377
+ const backArgs = [...h.continueArgs(hop.args), ...h.resumeArgs(ready.sessionId)];
378
+ const back = await rt.prepareLaunch(account.ref, backArgs, 'run', launchOpts);
379
+ // The same per-Account arguments as before (Grok's leader socket), without sideby's hooks.
380
+ const backElig = await h.eligibility(withoutNetwork(back), account, back.env);
381
+ return await runHost({ ...back, args: beforeDashes(back.args, backElig.args ?? []) });
382
+ }
383
+ let next;
384
+ try {
385
+ next = await rt.resolve(decision.ref);
386
+ }
387
+ catch (err) {
388
+ io.err(`sideby: cannot start ${decision.ref}: ${err.message}; the Brief is at ${done.path}`);
363
389
  return ended.code;
364
390
  }
365
- const backArgs = [...h.continueArgs(hop.args), ...h.resumeArgs(ready.sessionId)];
366
- const back = await rt.prepareLaunch(account.ref, backArgs, 'run', launchOpts);
367
- // The same per-Account arguments as before (Grok's leader socket), without sideby's hooks.
368
- const backElig = await h.eligibility(withoutNetwork(back), account, back.env);
369
- return runHost({ ...back, args: beforeDashes(back.args, backElig.args ?? []) });
370
- }
371
- let next;
372
- try {
373
- next = await rt.resolve(decision.ref);
374
- }
375
- catch (err) {
376
- io.err(`sideby: cannot start ${decision.ref}: ${err.message}; the Brief is at ${done.path}`);
377
- return ended.code;
391
+ io.err(`sideby: handing over from ${account.ref} to ${next.ref}`);
392
+ hop = {
393
+ ref: next.ref,
394
+ args: next.family === account.family ? h.continueArgs(hop.args) : [],
395
+ prompt: firstPrompt(account.ref, done.path, ready.trigger),
396
+ };
397
+ n++;
378
398
  }
379
- io.err(`sideby: handing over from ${account.ref} to ${next.ref}`);
380
- hop = {
381
- ref: next.ref,
382
- args: next.family === account.family ? h.continueArgs(hop.args) : [],
383
- prompt: firstPrompt(account.ref, done.path, ready.trigger),
384
- };
385
- n++;
399
+ }
400
+ finally {
401
+ // Read by Claude Code while a session runs, so it goes only once the chain's last Host is over.
402
+ await rm(chainSettings, { force: true });
386
403
  }
387
404
  }
388
405
  /** After a session ended on its own: when its Quota passed the threshold but nothing could take over, say why. */
@@ -31,6 +31,13 @@ export declare function sessionHookArgs(family: string, stateDir: string, parts:
31
31
  * Code takes one `--settings`). Auto Handoff's own hooks and options come first and are kept as they are.
32
32
  */
33
33
  export declare function withClaudeHooks(hookArgs: readonly string[], extra: ClaudeHooks, out: string): Promise<string[]>;
34
+ /**
35
+ * Claude `--settings` arguments with `dirs` added to the file's `permissions.additionalDirectories`, written as `out`.
36
+ * Claude Code 2.1.326 asks the user to trust every `--add-dir` folder it has not seen before the session starts, and
37
+ * exits on "No"; a folder from `--settings` becomes a working directory without that question (tried with Claude Code
38
+ * 2.1.326 on 2026-11-17). Each folder is listed as given and, when a link leads to it, by its real path too.
39
+ */
40
+ export declare function withClaudeDirs(args: readonly string[], dirs: readonly string[], out: string): Promise<string[]>;
34
41
  /**
35
42
  * Auto Handoff's Claude hook arguments with the session's own sideby hooks (`sessionArgs`, from `sessionHookArgs`)
36
43
  * merged into one `--settings` file, written next to the session's file with `-handoff` added to its name.
@@ -92,6 +92,33 @@ export async function withClaudeHooks(hookArgs, extra, out) {
92
92
  const at = hookArgs.indexOf('--settings');
93
93
  return at === -1 ? [...hookArgs, '--settings', out] : hookArgs.map((a, i) => (i === at + 1 ? out : a));
94
94
  }
95
+ /**
96
+ * Claude `--settings` arguments with `dirs` added to the file's `permissions.additionalDirectories`, written as `out`.
97
+ * Claude Code 2.1.326 asks the user to trust every `--add-dir` folder it has not seen before the session starts, and
98
+ * exits on "No"; a folder from `--settings` becomes a working directory without that question (tried with Claude Code
99
+ * 2.1.326 on 2026-11-17). Each folder is listed as given and, when a link leads to it, by its real path too.
100
+ */
101
+ export async function withClaudeDirs(args, dirs, out) {
102
+ const settings = await settingsOf(args);
103
+ const permissions = settings.permissions && typeof settings.permissions === 'object' && !Array.isArray(settings.permissions)
104
+ ? settings.permissions
105
+ : {};
106
+ const had = Array.isArray(permissions.additionalDirectories) ? permissions.additionalDirectories : [];
107
+ const add = dirs.flatMap((d) => {
108
+ try {
109
+ const real = realpathSync(d);
110
+ return real === d ? [d] : [d, real];
111
+ }
112
+ catch {
113
+ return [d];
114
+ }
115
+ });
116
+ const additionalDirectories = [...new Set([...had, ...add])];
117
+ await mkdir(dirname(out), { recursive: true, mode: 0o700 });
118
+ await writeFileAtomic(out, `${JSON.stringify({ ...settings, permissions: { ...permissions, additionalDirectories } }, null, 2)}\n`, 0o600);
119
+ const at = args.indexOf('--settings');
120
+ return at === -1 ? [...args, '--settings', out] : args.map((a, i) => (i === at + 1 ? out : a));
121
+ }
95
122
  /**
96
123
  * Auto Handoff's Claude hook arguments with the session's own sideby hooks (`sessionArgs`, from `sessionHookArgs`)
97
124
  * merged into one `--settings` file, written next to the session's file with `-handoff` added to its name.
@@ -1,5 +1,7 @@
1
1
  // How Claude Code takes part in a Handoff (spec §3.17): hooks through `--settings`, which merges with the
2
- // Account's own settings hooks (verified 2026-10-09), and the Brief's directory through `--add-dir`.
2
+ // Account's own settings hooks (verified 2026-10-09). The Brief's directory goes into that file's
3
+ // `permissions.additionalDirectories` (`withClaudeDirs`): Claude Code 2.1.326 asks to trust an `--add-dir` folder it
4
+ // has not seen, so `dirArgs` is used only where sideby cannot add to `--settings`.
3
5
  import { mkdir } from 'node:fs/promises';
4
6
  import { join } from 'node:path';
5
7
  import { locate, readObject } from '../../core/claude-settings-file.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sideby",
3
- "version": "0.40.0",
3
+ "version": "0.40.1",
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)",
@@ -86,5 +86,5 @@
86
86
  },
87
87
  "packageManager": "pnpm@10.15.0",
88
88
  "readmeFilename": "README.md",
89
- "readme": "<p align=\"center\">\n <img alt=\"sideby: work, personal and API-key accounts, one terminal each, one shared config\" src=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/banner.jpg\" width=\"880\">\n</p>\n\n<p align=\"center\">\n <b>Run work, personal and API-key accounts at the same time, without their configs drifting apart.</b><br>\n Each account is its own directory and its own terminal. Skills, hooks and settings stay linked to your main account. Claude Code, Codex, Grok Build and pi.\n</p>\n\n<p align=\"center\">\n <a href=\"https://www.npmjs.com/package/sideby\"><img alt=\"npm\" src=\"https://img.shields.io/npm/v/sideby\"></a>\n <a href=\"https://github.com/Adonis0123/sideby/actions/workflows/ci.yml\"><img alt=\"CI\" src=\"https://github.com/Adonis0123/sideby/actions/workflows/ci.yml/badge.svg\"></a>\n <img alt=\"Node 22.18+\" src=\"https://img.shields.io/badge/node-%E2%89%A522.18-339933\">\n <a href=\"LICENSE\"><img alt=\"MIT\" src=\"https://img.shields.io/badge/license-MIT-blue\"></a>\n</p>\n\n<p align=\"center\">English | <a href=\"README.zh-CN.md\">中文</a></p>\n\n## Quick start\n\nRequires Node 22.18+ and at least one Host CLI (Claude Code, Codex, Grok Build or pi) installed. AI agents: follow the setup steps in [`llms.txt`](llms.txt) (\"Set up sideby for a user\") instead.\n\n```sh\nnpm i -g sideby\nsideby new claude work # create ~/.claude-work, sharing ~/.claude's skills and hooks\nsideby login claude:work # sign in once\nsideby run work # Claude Code on the work account\nsideby quota setup claude --yes # optional: live Claude quota while a session runs; undo: sideby quota teardown claude\nsideby ui --background # every account's quota at http://127.0.0.1:17420, still there after you close the terminal\n```\n\n`sideby app install` adds a Dock icon that opens the panel, and `sideby autostart on` has it ready each time you log in. `sideby update` installs a newer sideby when there is one; sideby says so after a command and in the panel. `sideby run claude:main` keeps using `~/.claude` in another terminal at the same time. Arguments after `--` go to the Host: `sideby run work -- --resume`. To try it without installing, run `npx sideby`.\n\n## Set up with your AI agent\n\nPaste this into Claude Code, Codex or any coding agent:\n\n```text\nInstall the sideby CLI (npm package `sideby`) and its agent skill, then set up a second Claude Code account for me.\nFollow \"Set up sideby for a user\" in https://raw.githubusercontent.com/Adonis0123/sideby/main/llms.txt\n```\n\nThe agent checks Node and your Host CLIs, installs sideby and the skill, creates the account, tells you what it shares with your main one and makes its short command work. You sign in once in your browser; the agent gives you that one command. Once the skill is installed, short requests work too: \"add another Claude account, cc008\", \"what do my Codex accounts share?\", \"which account still has quota?\".\n\n## What it looks like\n\nThe 25-second story: one account buried in tasks, then accounts side by side sharing one setup, and a task moving on when one runs out.\n\nhttps://github.com/user-attachments/assets/d1d7e8dd-1df1-4881-ac88-e468c2dd4a1d\n\n<img alt=\"Two terminals: the personal account and the work account running at the same time, both linked to the main account's skills and settings, then the local quota panel, and at 95% Auto Handoff moving work's session to the next account\" src=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/demo.gif\" width=\"1280\">\n\n<picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel-dark.png\">\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel.png\">\n <img alt=\"sideby panel: every account's 5h and 7d quota, 7-day token usage and health in one page\" src=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel.png\" width=\"1280\">\n</picture>\n\nOn macOS, the same quota sits in the menu bar (`sideby menubar on`): click or press `⌥X` to open it, and click an account to start it in the terminal.\n\n<picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/menubar-dark.png\">\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/menubar.png\">\n <img alt=\"sideby macOS menu bar dropdown: a status card, each tool with 5-hour and weekly quota bars, reset times, and the suggested account marked\" src=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/menubar.png\" width=\"468\">\n</picture>\n\n## Why not just an alias?\n\n`CLAUDE_CONFIG_DIR` plus a shell alias already starts a second account. It does not keep skills and settings in one place, and it does not show quota for every account. [Does this break a provider's terms?](docs/guide/faq.md#terms)\n\n| | At the same time | Skills, hooks, settings | Quota and usage | Setup |\n|---|---|---|---|---|\n| `CLAUDE_CONFIG_DIR` and an alias | Yes. Each terminal exports the variable. | Each directory is its own copy. They drift unless you symlink by hand. | That session's status line | One alias per account |\n| [cc-switch](https://github.com/farion1231/cc-switch) | Enabling a provider writes the host's live config, so open sessions share that switch. | Plugin settings are copied across providers as a separate step. | The active provider, from its quota endpoint | Install the desktop app |\n| sideby | Yes. `sideby run` selects the directory for that process and leaves your shell alone. | Linked to the main account. `sideby doctor --fix` repairs copies. Sign-in and sessions stay separate. | Every account, from local files and each tool's own CLI. | `npm i -g sideby`, then `sideby new` and sign in |\n\ncc-switch's docs describe that switch: it writes the live settings file ([README](https://github.com/farion1231/cc-switch#readme)). [#1105](https://github.com/farion1231/cc-switch/issues/1105) and [#2908](https://github.com/farion1231/cc-switch/issues/2908) ask for several sessions at once. [#1106](https://github.com/farion1231/cc-switch/issues/1106) is closed; the maintainer says Claude Code's \"open terminal\" can start one provider without changing the global config.\n\n## What else it does\n\n| You want to | Run | Guide |\n|---|---|---|\n| Find any past session of any account by what you remember, grouped by project, read it and continue it where it was | **Sessions › History** in the panel, or `sideby history \"fix login\" --project .` | [History](docs/guide/panel.md#history) |\n| See what every account is running right now and copy one session for another AI | **Sessions › Running** in the panel, or `sideby sessions` | [Sessions](docs/guide/panel.md#sessions) |\n| Send a running session a message, screenshots included | **Send to it** on a running session, or `sideby send claude:work \"run the tests\"` | [Send to a session](docs/guide/panel.md#send-to-a-session) |\n| Hand a task to your own AI from the panel: set up an account, fix a problem, support a new tool | **Let AI do it** in the panel, or `sideby ask` | [Let AI do it](docs/guide/panel.md#let-ai-do-it) |\n| See quota at a glance in the macOS menu bar | **Settings › Startup** in the panel, or `sideby menubar on` | [Quota in the menu bar](docs/guide/usage.md#quota-in-the-menu-bar) |\n| Have the panel ready in the background whenever you log in | **Settings › Startup** in the panel, or `sideby autostart on` | [Start at login](docs/guide/usage.md#start-at-login) |\n| Add an API key account (DeepSeek, a gateway, …) | `sideby new claude deepseek --api` | [API accounts](docs/guide/usage.md#api-accounts) |\n| Find and fix config drift between accounts | `sideby doctor --fix` | [Doctor](docs/guide/usage.md#doctor) |\n| See every account's quota (no setup) | `sideby quota` | [Claude quota](docs/guide/usage.md#claude-quota) |\n| Find the cheapest auto-compact size from your own sessions, and use it in one click | `sideby tune` (or the panel's Context tuning tab) | [Context tuning](docs/guide/usage.md#context-tuning) |\n| See each account's model and effort, and set them per account | `sideby model <account>` (or click the model in the panel) | [Model and effort](docs/guide/usage.md#model-and-effort) |\n| Stop Claude and Codex when your requests would leave from a country you did not allow, for example when the proxy stopped | **Settings › Network check** in the panel, or `sideby network on` | [Network check](docs/guide/usage.md#network-check) |\n| Choose whether Claude sessions connect to claude.ai by themselves (Remote Control), for every account at once | `sideby remote-control off` or `on` (or the panel's Settings) | [Remote Control](docs/guide/usage.md#remote-control) |\n| Pin the accounts you use most, put tools and accounts in your own order, and hide the ones you never use | `sideby pin claude:work`, `sideby order`, `sideby hide grok` (or the panel's Settings) | [Your own order](docs/guide/usage.md#your-own-order) |\n| Give the panel other colors: five built-in Themes, your own color, or one your AI writes | **Settings › Theme** in the panel, or `sideby theme use leaf` | [Themes](docs/guide/panel.md#themes) |\n| Move on when an account hits its limit | `sideby next claude` | [Handoff](docs/guide/usage.md#when-an-account-hits-its-limit) |\n| Let a running task move to the next account by itself when quota runs low (off by default; see the risk) | `sideby handoff enable` (or the panel) | [Auto Handoff](docs/guide/usage.md#auto-handoff) |\n| Short commands such as `ccw` | `sideby alias add ccw claude:work` | [Shell functions](docs/guide/configuration.md#shell-functions) |\n| Reopen a session from Orca and the like in the account that holds it | `\"resumeRouting\": true` in config | [Resuming from other tools](docs/guide/configuration.md#resuming-from-other-tools) |\n| Open Claude Desktop or the Codex app as one account, several side by side (macOS) | `sideby desktop claude:work` (or the panel) | [Desktop apps](docs/guide/usage.md#desktop-apps) |\n| Keep several Grok Bot windows open, each signed in to its own account (macOS) | `sideby desktop grok-bot:002` (or the panel) | [Grok Bot windows](docs/guide/usage.md#grok-bot-windows) |\n| Open the panel from the Dock or app menu | `sideby app install` | [Panel app](docs/guide/panel.md#panel-app) |\n| Show the panel inside your own local page | `createPanelHandler()` | [Embed the panel](docs/guide/panel.md#embed-the-panel) |\n| Add a Host, a pre-launch check, or your own project categories for History | a local plugin | [Plugins](docs/guide/plugins.md) |\n\n## Supported hosts\n\n| Host | Account directories | Sign-in | Quota | Usage (7 days) |\n|---|---|---|---|---|\n| Claude Code | `~/.claude`, `~/.claude-<name>` | `claude auth login` | ✓ | ✓ |\n| Codex CLI | `~/.codex`, `~/.codex-<name>` | `codex login` | ✓ | ✓ |\n| Grok Build | `~/.grok`, `~/.grok-<name>` | `grok login` | weekly, asked from the `grok` CLI | no public source |\n| pi | `~/.pi/agent`, `~/.pi-<name>/agent` | `/login` inside pi | no public source | no public source |\n| Antigravity CLI | `~/.gemini/antigravity-cli` (main account only) | sign in with Google inside `agy` | 5-hour and weekly per model group, asked from the `agy` CLI | no public source |\n\nsideby starts the official binary on your `PATH` and never patches it. Tested versions and per-Host notes are in the [guide](docs/guide/usage.md#host-notes).\n\n## Platforms\n\nmacOS and Linux. CI runs the suite on `ubuntu-latest` and `macos-latest`, Node 22 and 24. **Windows is untested.** `sideby app` only installs a launcher on macOS and Linux. Linked items are symlinks, `sideby shell-init` prints bash and zsh functions, and the Claude quota wrapper runs `/bin/sh`.\n\n## Roadmap\n\n**Gemini CLI.** Gemini can point at another config directory with `GEMINI_CONFIG_DIR`. Older docs use `GEMINI_CLI_HOME`; current builds treat that name as deprecated, and exit on startup if it is set together with an exact directory override. A sideby family still needs a tested Gemini version, a login check that does not read tokens, and a list of which files to link or copy. That is more than a small patch, so it is not in this version.\n\n## Safe by design\n\n- It never edits a Host's global config to switch accounts. It moves a task to another account only when you turn on Auto Handoff, and never proxies requests or pools logins.\n- It never reads, prints or sends a credential value. Nothing about your accounts leaves your machine: the only request sideby makes on its own is a daily check of the npm registry for its newest version (off with `NO_UPDATE_NOTIFIER=1`; see [Updates](docs/guide/configuration.md#updates)).\n- `doctor --fix` never replaces a real file and never changes where a link points.\n- The panel answers only on `127.0.0.1` and refuses web pages from other sites, but it trusts every user of this computer. On a shared Mac, do not leave it running in the background ([details](docs/guide/panel.md#who-can-reach-the-panel)).\n\nDetails and the terms-of-service question are in the [FAQ](docs/guide/faq.md).\n\nUsage questions and ideas go in [Discussions](https://github.com/Adonis0123/sideby/discussions).\n\n## Docs\n\n- [Using sideby](docs/guide/usage.md): accounts, API accounts, Doctor, quota, Handoff, Host notes\n- [Commands](docs/guide/commands.md): every command, exit codes and `--json`\n- [Configuration](docs/guide/configuration.md): `config.json`, aliases, shell functions\n- [Panel](docs/guide/panel.md): the panel, sessions and their history, panel app and embedding\n- [Plugins](docs/guide/plugins.md): write your own Family, launch hook or project categories\n- [FAQ](docs/guide/faq.md): terms of service, data locations, alternatives, uninstall\n- [Changelog](https://github.com/Adonis0123/sideby/releases)\n\n## For AI agents\n\n- [`llms.txt`](llms.txt): setup steps, commands, JSON contract and plugin API in one index. `sideby families --json` states what each Host's accounts share.\n- [`skills/sideby/SKILL.md`](skills/sideby/SKILL.md): one Agent Skill for seeing, repairing and creating accounts and for moving on when one hits its limit. Install with `npx skills add Adonis0123/sideby -g`; `sideby doctor` warns when the installed copy is for another sideby version.\n- [`AGENTS.md`](AGENTS.md): rules for agents working on this repository.\n\n## License\n\n[MIT](LICENSE)\n"
89
+ "readme": "<p align=\"center\">\n <img alt=\"sideby: work, personal and API-key accounts, one terminal each, one shared config\" src=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/banner.jpg\" width=\"880\">\n</p>\n\n<p align=\"center\">\n <b>Run work, personal and API-key accounts at the same time, without their configs drifting apart.</b><br>\n Each account is its own directory and its own terminal. Skills, hooks and settings stay linked to your main account. Claude Code, Codex, Grok Build, pi and Antigravity CLI.\n</p>\n\n<p align=\"center\">\n <a href=\"https://www.npmjs.com/package/sideby\"><img alt=\"npm\" src=\"https://img.shields.io/npm/v/sideby\"></a>\n <a href=\"https://github.com/Adonis0123/sideby/actions/workflows/ci.yml\"><img alt=\"CI\" src=\"https://github.com/Adonis0123/sideby/actions/workflows/ci.yml/badge.svg\"></a>\n <img alt=\"Node 22.18+\" src=\"https://img.shields.io/badge/node-%E2%89%A522.18-339933\">\n <a href=\"LICENSE\"><img alt=\"MIT\" src=\"https://img.shields.io/badge/license-MIT-blue\"></a>\n</p>\n\n<p align=\"center\">English | <a href=\"README.zh-CN.md\">中文</a></p>\n\n## Quick start\n\nRequires Node 22.18+ and at least one Host CLI (Claude Code, Codex, Grok Build, pi or Antigravity CLI) installed. AI agents: follow the setup steps in [`llms.txt`](llms.txt) (\"Set up sideby for a user\") instead.\n\n```sh\nnpm i -g sideby\nsideby new claude work # create ~/.claude-work, sharing ~/.claude's skills and hooks\nsideby login claude:work # sign in once\nsideby run work # Claude Code on the work account\nsideby quota setup claude --yes # optional: live Claude quota while a session runs; undo: sideby quota teardown claude\nsideby ui --background # every account's quota at http://127.0.0.1:17420, still there after you close the terminal\n```\n\n`sideby app install` adds a Dock icon that opens the panel, and `sideby autostart on` has it ready each time you log in. `sideby update` installs a newer sideby when there is one; sideby says so after a command and in the panel. `sideby run claude:main` keeps using `~/.claude` in another terminal at the same time. Arguments after `--` go to the Host: `sideby run work -- --resume`. To try it without installing, run `npx sideby`.\n\n## Set up with your AI agent\n\nPaste this into Claude Code, Codex or any coding agent:\n\n```text\nInstall the sideby CLI (npm package `sideby`) and its agent skill, then set up a second Claude Code account for me.\nFollow \"Set up sideby for a user\" in https://raw.githubusercontent.com/Adonis0123/sideby/main/llms.txt\n```\n\nThe agent checks Node and your Host CLIs, installs sideby and the skill, creates the account, tells you what it shares with your main one and makes its short command work. You sign in once in your browser; the agent gives you that one command. Once the skill is installed, short requests work too: \"add another Claude account, cc008\", \"what do my Codex accounts share?\", \"which account still has quota?\".\n\n## What it looks like\n\nThe 25-second story: one account buried in tasks, then accounts side by side sharing one setup, and a task moving on when one runs out.\n\nhttps://github.com/user-attachments/assets/d1d7e8dd-1df1-4881-ac88-e468c2dd4a1d\n\n<img alt=\"Two terminals: the personal account and the work account running at the same time, both linked to the main account's skills and settings, then the local quota panel, and at 95% Auto Handoff moving work's session to the next account\" src=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/demo.gif\" width=\"1280\">\n\n<picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel-dark.png\">\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel.png\">\n <img alt=\"sideby panel: every account's 5h and 7d quota, 7-day token usage and health in one page\" src=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/panel.png\" width=\"1280\">\n</picture>\n\nOn macOS, the same quota sits in the menu bar (`sideby menubar on`): click or press `⌥X` to open it, and click an account to start it in the terminal.\n\n<picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/menubar-dark.png\">\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/menubar.png\">\n <img alt=\"sideby macOS menu bar dropdown: a status card, each tool with 5-hour and weekly quota bars, reset times, and the suggested account marked\" src=\"https://raw.githubusercontent.com/Adonis0123/sideby/main/docs/assets/menubar.png\" width=\"468\">\n</picture>\n\n## Why not just an alias?\n\n`CLAUDE_CONFIG_DIR` plus a shell alias already starts a second account. It does not keep skills and settings in one place, and it does not show quota for every account. [Does this break a provider's terms?](docs/guide/faq.md#terms)\n\n| | At the same time | Skills, hooks, settings | Quota and usage | Setup |\n|---|---|---|---|---|\n| `CLAUDE_CONFIG_DIR` and an alias | Yes. Each terminal exports the variable. | Each directory is its own copy. They drift unless you symlink by hand. | That session's status line | One alias per account |\n| [cc-switch](https://github.com/farion1231/cc-switch) | Enabling a provider writes the host's live config, so open sessions share that switch. | Plugin settings are copied across providers as a separate step. | The active provider, from its quota endpoint | Install the desktop app |\n| sideby | Yes. `sideby run` selects the directory for that process and leaves your shell alone. | Linked to the main account. `sideby doctor --fix` repairs copies. Sign-in and sessions stay separate. | Every account, from local files and each tool's own CLI. | `npm i -g sideby`, then `sideby new` and sign in |\n\ncc-switch's docs describe that switch: it writes the live settings file ([README](https://github.com/farion1231/cc-switch#readme)). [#1105](https://github.com/farion1231/cc-switch/issues/1105) and [#2908](https://github.com/farion1231/cc-switch/issues/2908) ask for several sessions at once. [#1106](https://github.com/farion1231/cc-switch/issues/1106) is closed; the maintainer says Claude Code's \"open terminal\" can start one provider without changing the global config.\n\n## What else it does\n\n| You want to | Run | Guide |\n|---|---|---|\n| Find any past session of any account by what you remember, grouped by project, read it and continue it where it was | **Sessions › History** in the panel, or `sideby history \"fix login\" --project .` | [History](docs/guide/panel.md#history) |\n| See what every account is running right now and copy one session for another AI | **Sessions › Running** in the panel, or `sideby sessions` | [Sessions](docs/guide/panel.md#sessions) |\n| Send a running session a message, screenshots included | **Send to it** on a running session, or `sideby send claude:work \"run the tests\"` | [Send to a session](docs/guide/panel.md#send-to-a-session) |\n| Hand a task to your own AI from the panel: set up an account, fix a problem, support a new tool | **Let AI do it** in the panel, or `sideby ask` | [Let AI do it](docs/guide/panel.md#let-ai-do-it) |\n| See quota at a glance in the macOS menu bar | **Settings › Startup** in the panel, or `sideby menubar on` | [Quota in the menu bar](docs/guide/usage.md#quota-in-the-menu-bar) |\n| Have the panel ready in the background whenever you log in | **Settings › Startup** in the panel, or `sideby autostart on` | [Start at login](docs/guide/usage.md#start-at-login) |\n| Add an API key account (DeepSeek, a gateway, …) | `sideby new claude deepseek --api` | [API accounts](docs/guide/usage.md#api-accounts) |\n| Find and fix config drift between accounts | `sideby doctor --fix` | [Doctor](docs/guide/usage.md#doctor) |\n| See every account's quota (no setup) | `sideby quota` | [Claude quota](docs/guide/usage.md#claude-quota) |\n| Find the cheapest auto-compact size from your own sessions, and use it in one click | `sideby tune` (or the panel's Context tuning tab) | [Context tuning](docs/guide/usage.md#context-tuning) |\n| See each account's model and effort, and set them per account | `sideby model <account>` (or click the model in the panel) | [Model and effort](docs/guide/usage.md#model-and-effort) |\n| Stop Claude and Codex when your requests would leave from a country you did not allow, for example when the proxy stopped | **Settings › Network check** in the panel, or `sideby network on` | [Network check](docs/guide/usage.md#network-check) |\n| Choose whether Claude sessions connect to claude.ai by themselves (Remote Control), for every account at once | `sideby remote-control off` or `on` (or the panel's Settings) | [Remote Control](docs/guide/usage.md#remote-control) |\n| Pin the accounts you use most, put tools and accounts in your own order, and hide the ones you never use | `sideby pin claude:work`, `sideby order`, `sideby hide grok` (or the panel's Settings) | [Your own order](docs/guide/usage.md#your-own-order) |\n| Give the panel other colors: five built-in Themes, your own color, or one your AI writes | **Settings › Theme** in the panel, or `sideby theme use leaf` | [Themes](docs/guide/panel.md#themes) |\n| Move on when an account hits its limit | `sideby next claude` | [Handoff](docs/guide/usage.md#when-an-account-hits-its-limit) |\n| Let a running task move to the next account by itself when quota runs low (off by default; see the risk) | `sideby handoff enable` (or the panel) | [Auto Handoff](docs/guide/usage.md#auto-handoff) |\n| Short commands such as `ccw` | `sideby alias add ccw claude:work` | [Shell functions](docs/guide/configuration.md#shell-functions) |\n| Reopen a session from Orca and the like in the account that holds it | `\"resumeRouting\": true` in config | [Resuming from other tools](docs/guide/configuration.md#resuming-from-other-tools) |\n| Open Claude Desktop or the Codex app as one account, several side by side (macOS) | `sideby desktop claude:work` (or the panel) | [Desktop apps](docs/guide/usage.md#desktop-apps) |\n| Keep several Grok Bot windows open, each signed in to its own account (macOS) | `sideby desktop grok-bot:002` (or the panel) | [Grok Bot windows](docs/guide/usage.md#grok-bot-windows) |\n| Open the panel from the Dock or app menu | `sideby app install` | [Panel app](docs/guide/panel.md#panel-app) |\n| Show the panel inside your own local page | `createPanelHandler()` | [Embed the panel](docs/guide/panel.md#embed-the-panel) |\n| Add a Host, a pre-launch check, or your own project categories for History | a local plugin | [Plugins](docs/guide/plugins.md) |\n\n## Supported hosts\n\n| Host | Account directories | Sign-in | Quota | Usage (7 days) |\n|---|---|---|---|---|\n| Claude Code | `~/.claude`, `~/.claude-<name>` | `claude auth login` | ✓ | ✓ |\n| Codex CLI | `~/.codex`, `~/.codex-<name>` | `codex login` | ✓ | ✓ |\n| Grok Build | `~/.grok`, `~/.grok-<name>` | `grok login` | weekly, asked from the `grok` CLI | no public source |\n| pi | `~/.pi/agent`, `~/.pi-<name>/agent` | `/login` inside pi | no public source | no public source |\n| Antigravity CLI | `~/.gemini/antigravity-cli` (main account only) | sign in with Google inside `agy` | 5-hour and weekly per model group, asked from the `agy` CLI | no public source |\n\nsideby starts the official binary on your `PATH` and never patches it. Tested versions and per-Host notes are in the [guide](docs/guide/usage.md#host-notes).\n\n## Platforms\n\nmacOS and Linux. CI runs the suite on `ubuntu-latest` and `macos-latest`, Node 22 and 24. **Windows is untested.** `sideby app` only installs a launcher on macOS and Linux. Linked items are symlinks, `sideby shell-init` prints bash and zsh functions, and the Claude quota wrapper runs `/bin/sh`.\n\n## Roadmap\n\n**Gemini CLI.** Gemini can point at another config directory with `GEMINI_CONFIG_DIR`. Older docs use `GEMINI_CLI_HOME`; current builds treat that name as deprecated, and exit on startup if it is set together with an exact directory override. A sideby family still needs a tested Gemini version, a login check that does not read tokens, and a list of which files to link or copy. That is more than a small patch, so it is not in this version.\n\n## Safe by design\n\n- It never edits a Host's global config to switch accounts. It moves a task to another account only when you turn on Auto Handoff, and never proxies requests or pools logins.\n- It never reads, prints or sends a credential value. Nothing about your accounts leaves your machine: the only request sideby makes on its own is a daily check of the npm registry for its newest version (off with `NO_UPDATE_NOTIFIER=1`; see [Updates](docs/guide/configuration.md#updates)).\n- `doctor --fix` never replaces a real file and never changes where a link points.\n- The panel answers only on `127.0.0.1` and refuses web pages from other sites, but it trusts every user of this computer. On a shared Mac, do not leave it running in the background ([details](docs/guide/panel.md#who-can-reach-the-panel)).\n\nDetails and the terms-of-service question are in the [FAQ](docs/guide/faq.md).\n\nUsage questions and ideas go in [Discussions](https://github.com/Adonis0123/sideby/discussions).\n\n## Docs\n\n- [Using sideby](docs/guide/usage.md): accounts, API accounts, Doctor, quota, Handoff, Host notes\n- [Commands](docs/guide/commands.md): every command, exit codes and `--json`\n- [Configuration](docs/guide/configuration.md): `config.json`, aliases, shell functions\n- [Panel](docs/guide/panel.md): the panel, sessions and their history, panel app and embedding\n- [Plugins](docs/guide/plugins.md): write your own Family, launch hook or project categories\n- [FAQ](docs/guide/faq.md): terms of service, data locations, alternatives, uninstall\n- [Changelog](https://github.com/Adonis0123/sideby/releases)\n\n## For AI agents\n\n- [`llms.txt`](llms.txt): setup steps, commands, JSON contract and plugin API in one index. `sideby families --json` states what each Host's accounts share.\n- [`skills/sideby/SKILL.md`](skills/sideby/SKILL.md): one Agent Skill for seeing, repairing and creating accounts and for moving on when one hits its limit. Install with `npx skills add Adonis0123/sideby -g`; `sideby doctor` warns when the installed copy is for another sideby version.\n- [`AGENTS.md`](AGENTS.md): rules for agents working on this repository.\n\n## License\n\n[MIT](LICENSE)\n"
90
90
  }
@@ -2,7 +2,7 @@
2
2
  name: sideby
3
3
  description: Use when the user runs, or wants to run, several AI coding accounts (Claude Code, Codex, Grok Build, pi) side by side. Covers installing sideby and setting up a new account ("install sideby", "set up another Claude account", "add cc008", "配置一个 cc00x", "再加一个 Codex 账号"), explaining what accounts share and what stays separate ("what do my accounts share?", "这些账号共享了什么"), showing which account a session is ("show [cc001] in the status line", "加上账号标识"), finding a past session of any account ("找一下我上周改登录页的那个会话"), telling another running session something, in any account ("告诉 cc002 ……", "给跑构建的那个会话发消息"; Claude Code's own SendMessage reaches only sessions of the same account), seeing accounts, quota and usage, moving on when one hits its 5-hour or weekly limit, moving the current task to another account ("用 cc008 继续", "交回 cc008"), adding a short command (alias) or a pick command that starts whichever account has the most quota ("加个 cc"), adding an API account from a vendor's docs ("加一个 DeepSeek API 账号"), supporting a new tool, and repairing drifted account directories (skills, hooks, rules or settings not shared, wrong symlinks, credential file permissions). Drives the `sideby` CLI with `--json`; the agent does every step except browser sign-in, filling in secrets and starting interactive sessions, which it hands to the user as one command (inside an Auto Handoff session, `sideby handoff ready --to` moves the task itself).
4
4
  metadata:
5
- version: "0.40.0"
5
+ version: "0.40.1"
6
6
  requires:
7
7
  bins: [sideby, node]
8
8
  cliHelp: sideby --help