@chibitek/chibi 0.1.179 → 0.1.182

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 (104) hide show
  1. package/dist/assets/{abnfDiagram-O67JEVCF-BFpvXOmW.js → abnfDiagram-O67JEVCF-B8rB4VYk.js} +1 -1
  2. package/dist/assets/{arc-0cz8QAA9.js → arc-COTt5eKp.js} +1 -1
  3. package/dist/assets/{architectureDiagram-NJMV4G6O-DxG1U8Tf.js → architectureDiagram-NJMV4G6O-CPejbWZ8.js} +1 -1
  4. package/dist/assets/{blockDiagram-BEXU5L5S-DdpIUUid.js → blockDiagram-BEXU5L5S-DoioDp90.js} +1 -1
  5. package/dist/assets/{c4Diagram-YGBWAQC7-CNB5U3O1.js → c4Diagram-YGBWAQC7-8PWWVdYW.js} +1 -1
  6. package/dist/assets/channel-CDw9Li4I.js +1 -0
  7. package/dist/assets/{chunk-2Q5K7J3B-DixTESOo.js → chunk-2Q5K7J3B-DxtJtts-.js} +1 -1
  8. package/dist/assets/{chunk-3FUC2YCW-9KbkQg_1.js → chunk-3FUC2YCW-D3YkXW5d.js} +2 -2
  9. package/dist/assets/{chunk-5VM5RSS4-DMNRleww.js → chunk-5VM5RSS4-CsKzmOcP.js} +1 -1
  10. package/dist/assets/{chunk-GTNCS2PH-kxGMXg9R.js → chunk-GTNCS2PH-gZEIPwuj.js} +1 -1
  11. package/dist/assets/{chunk-GWA4HPMP-B7sa9Us9.js → chunk-GWA4HPMP-Bjt2-00s.js} +1 -1
  12. package/dist/assets/{chunk-JWPE2WC7-BF65Wqy-.js → chunk-JWPE2WC7-BvUQuiRB.js} +1 -1
  13. package/dist/assets/{chunk-NETBCI7D-Du36YO_k.js → chunk-NETBCI7D-Dq0TzVqk.js} +1 -1
  14. package/dist/assets/{chunk-WEXAMYUT-BMTNPIkJ.js → chunk-WEXAMYUT-DYCSZnMz.js} +1 -1
  15. package/dist/assets/{chunk-XXDRQBXY-BqdQPY5v.js → chunk-XXDRQBXY-B_OfX3TH.js} +1 -1
  16. package/dist/assets/{classDiagram-v2-NBCMYWYE-DYSOprmY.js → classDiagram-v2-NBCMYWYE-CyGFfePO.js} +1 -1
  17. package/dist/assets/{cose-bilkent-JH36ORCC-DXKY6FnT.js → cose-bilkent-JH36ORCC-v7FbM5j-.js} +1 -1
  18. package/dist/assets/{cynefin-OW5HDTMX-DamnOWMn.js → cynefin-OW5HDTMX-CqvJgX3t.js} +1 -1
  19. package/dist/assets/{cynefinDiagram-VND7K2PF-Bb-wuGye.js → cynefinDiagram-VND7K2PF-CA2yN6Xd.js} +1 -1
  20. package/dist/assets/{dagre-6A5THRUB-DVMvGhu7.js → dagre-6A5THRUB-Zr9etAoq.js} +1 -1
  21. package/dist/assets/{diagram-22UHCM2B-BX4_NJ2M.js → diagram-22UHCM2B-DtUG2c4U.js} +1 -1
  22. package/dist/assets/{diagram-3UASUU5V-4J3gjVZn.js → diagram-3UASUU5V-D9Y-Wrhr.js} +1 -1
  23. package/dist/assets/{diagram-ATOU4E4O-Bbune_ll.js → diagram-ATOU4E4O-DkeBHA-m.js} +1 -1
  24. package/dist/assets/{diagram-CDSNMT55-EEDiwifm.js → diagram-CDSNMT55-CdGlcHWC.js} +1 -1
  25. package/dist/assets/{diagram-MLGK6HIB-D5lseSZO.js → diagram-MLGK6HIB-BeHhIQjn.js} +1 -1
  26. package/dist/assets/{diagram-MPIPVDR6-isxlwvOO.js → diagram-MPIPVDR6-AgCxokZc.js} +1 -1
  27. package/dist/assets/{ebnfDiagram-ZINNZB2B-DXhf0QK8.js → ebnfDiagram-ZINNZB2B-CqYoX9yZ.js} +1 -1
  28. package/dist/assets/{elk-276RUBZZ-rR6aJBHM.js → elk-276RUBZZ-Br_wamlb.js} +1 -1
  29. package/dist/assets/{erDiagram-OPXOYQCR-DRIV4t6Y.js → erDiagram-OPXOYQCR-YuGMoUl0.js} +1 -1
  30. package/dist/assets/{flowDiagram-KWPJA3E3-BT3z2JmZ.js → flowDiagram-KWPJA3E3-VflMWlTN.js} +1 -1
  31. package/dist/assets/{ganttDiagram-FUAMR5RP-CR0drs2s.js → ganttDiagram-FUAMR5RP-q1LvQaev.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-X574FWY7-BrjfMmlB.js → gitGraphDiagram-X574FWY7-CHRdJIvn.js} +1 -1
  33. package/dist/assets/{index-DAGHO7rw.js → index-B_gcNCKf.js} +131 -131
  34. package/dist/assets/{index-BISPpSBx.js → index-C2q5K4Lk.js} +1 -1
  35. package/dist/assets/{infoDiagram-VRGFBTTK-fIajbwUK.js → infoDiagram-VRGFBTTK-DRwVvitP.js} +1 -1
  36. package/dist/assets/{ishikawaDiagram-OU5B5YK6-DlOC_sEC.js → ishikawaDiagram-OU5B5YK6-BXZw4L0c.js} +1 -1
  37. package/dist/assets/{journeyDiagram-ZHPQQLJL-BY4NF3Iq.js → journeyDiagram-ZHPQQLJL-B7AeEVRV.js} +1 -1
  38. package/dist/assets/{kanban-definition-PNTS6WVX-CjcD7Qp-.js → kanban-definition-PNTS6WVX-CQLN4aVl.js} +1 -1
  39. package/dist/assets/{linear-D2XvBjOb.js → linear-CbYhE1pa.js} +1 -1
  40. package/dist/assets/{mermaid.core-DbXyvZNy.js → mermaid.core-D1syQdvp.js} +5 -5
  41. package/dist/assets/{mindmap-definition-NLK3R4M7-rjla1J-s.js → mindmap-definition-NLK3R4M7-B2IFEIiB.js} +1 -1
  42. package/dist/assets/{pegDiagram-GJSIUBJH-hvEPNypQ.js → pegDiagram-GJSIUBJH-DHZYilhs.js} +1 -1
  43. package/dist/assets/{pieDiagram-5QR66LMP-D-jjzmff.js → pieDiagram-5QR66LMP-DO_aJLMk.js} +1 -1
  44. package/dist/assets/{quadrantDiagram-O4NWA36T-DJsTKR54.js → quadrantDiagram-O4NWA36T-gUPrtKHH.js} +1 -1
  45. package/dist/assets/{railroadDiagram-XR7U4H2S-CgA8NcMY.js → railroadDiagram-XR7U4H2S-BBF0wp-6.js} +1 -1
  46. package/dist/assets/{requirementDiagram-PLB6GJNP-D5BkeVLA.js → requirementDiagram-PLB6GJNP-xcAp1hln.js} +1 -1
  47. package/dist/assets/{sankeyDiagram-IPEJSGJF-lEfgZleC.js → sankeyDiagram-IPEJSGJF-Dm5c9FwQ.js} +1 -1
  48. package/dist/assets/{sequenceDiagram-PO4LG4MO-iDpAQv2z.js → sequenceDiagram-PO4LG4MO-vRzb3zIA.js} +1 -1
  49. package/dist/assets/{sizeCapture-INFHLROL-hEJsAOhI.js → sizeCapture-INFHLROL-Czu8kIt2.js} +1 -1
  50. package/dist/assets/{stateDiagram-v2-GCMORJYK-CKDZvZXj.js → stateDiagram-v2-GCMORJYK-BOfJjcD1.js} +1 -1
  51. package/dist/assets/{swimlanes-2SLR337P-_dOmzve2.js → swimlanes-2SLR337P-D0ipJonR.js} +1 -1
  52. package/dist/assets/swimlanesDiagram-TC7HE7FX-BJpOJd6C.js +8 -0
  53. package/dist/assets/{timeline-definition-EJHVYXUP-9GwS2a9Y.js → timeline-definition-EJHVYXUP-TpaYbjnd.js} +1 -1
  54. package/dist/assets/{usecaseDiagram-POWQR4AR-CqJl0zf1.js → usecaseDiagram-POWQR4AR-B-jKTFl6.js} +1 -1
  55. package/dist/assets/{vennDiagram-UO4OBE2U-CGQiSSZm.js → vennDiagram-UO4OBE2U-Dy6k1yAu.js} +1 -1
  56. package/dist/assets/{wardleyDiagram-VNRHLVJA-D4KBo3Q_.js → wardleyDiagram-VNRHLVJA-DYRJUBY6.js} +1 -1
  57. package/dist/assets/{xychartDiagram-PMCCYNJV-BgvRJLNL.js → xychartDiagram-PMCCYNJV-CETDzaRA.js} +1 -1
  58. package/dist/index.html +1 -1
  59. package/dist-server/companion/src/routes.js +1 -0
  60. package/dist-server/index.js +1958 -1194
  61. package/dist-server/server/connection-cap-failover.js +243 -0
  62. package/dist-server/server/engine-tiers-view.js +2 -0
  63. package/dist-server/server/index.js +58 -57
  64. package/dist-server/server/model-levels/chibitek-rankings.js +15 -5
  65. package/dist-server/server/paw/fill.js +342 -0
  66. package/dist-server/server/paw/http.js +66 -0
  67. package/dist-server/server/paw/loader.js +19 -2
  68. package/dist-server/server/paw/service.js +61 -4
  69. package/dist-server/server/paw/templates.js +15 -2
  70. package/dist-server/server/routes/engine-tiers.js +12 -1
  71. package/dist-server/server/skill-library.js +8 -0
  72. package/dist-server/server/workspace-backup-copy.js +67 -0
  73. package/dist-server/server/workspace-backup-http.js +1 -0
  74. package/dist-server/server/workspace-backup-maintenance.js +12 -2
  75. package/dist-server/server/workspace-backup.js +32 -50
  76. package/dist-server/shared/engine-tiers.js +9 -0
  77. package/dist-server/shared/paw.js +2 -2
  78. package/package.json +1 -1
  79. package/skills/build-paw/SKILL.md +212 -0
  80. package/skills/build-paw/VENDORED.md +5 -0
  81. package/skills/build-paw/manifest.json +19 -0
  82. package/skills/build-paw/paw-skeleton/AGENTS.md +9 -0
  83. package/skills/build-paw/paw-skeleton/CLAUDE.md +9 -0
  84. package/skills/build-paw/paw-skeleton/CONTEXT.md +10 -0
  85. package/skills/build-paw/paw-skeleton/README.md +5 -0
  86. package/skills/build-paw/paw-skeleton/departments/example-team/CONTEXT.md +5 -0
  87. package/skills/build-paw/paw-skeleton/departments/example-team/skills/README.md +1 -0
  88. package/skills/build-paw/paw-skeleton/departments/example-team/templates/README.md +1 -0
  89. package/skills/build-paw/paw-skeleton/departments/example-team/voice.md +3 -0
  90. package/skills/build-paw/paw-skeleton/me/CHANGELOG.md +7 -0
  91. package/skills/build-paw/paw-skeleton/me/about-me.md +7 -0
  92. package/skills/build-paw/paw-skeleton/me/personal/README.md +1 -0
  93. package/skills/build-paw/paw-skeleton/me/projects/.gitkeep +1 -0
  94. package/skills/build-paw/paw-skeleton/org/brand/voice.md +5 -0
  95. package/skills/build-paw/paw-skeleton/org/company.md +6 -0
  96. package/skills/build-paw/paw-skeleton/org/glossary.md +6 -0
  97. package/skills/build-paw/paw-skeleton/org/marketing/positioning.md +3 -0
  98. package/skills/build-paw/paw-skeleton/org/policies/ai-use.md +5 -0
  99. package/skills/build-paw/paw-skeleton/org/policies/engineering.md +5 -0
  100. package/skills/build-paw/paw-skeleton/org/policies/secrets.md +5 -0
  101. package/skills/build-paw/paw-skeleton/org/tools.md +3 -0
  102. package/skills/build-paw/paw-skeleton/paw.yaml +45 -0
  103. package/dist/assets/channel-DktfdxuU.js +0 -1
  104. package/dist/assets/swimlanesDiagram-TC7HE7FX-BROCOsEt.js +0 -8
@@ -0,0 +1,67 @@
1
+ import { createHash } from "node:crypto";
2
+ import { closeSync, constants, fstatSync, fsyncSync, lstatSync, openSync, readSync, writeSync } from "node:fs";
3
+ import { MAX_WORKSPACE_BACKUP_BYTES } from "./workspace-backup-archive.js";
4
+ /** Export captures live files; restore keeps the strict staged-file check.
5
+ * Reads stay on the opened descriptor, never a replacement symlink. Each live
6
+ * attempt stops at its initial size so a growing log cannot run forever. */
7
+ export function copyRegular(source, destination, onLiveChange) {
8
+ let captured;
9
+ for (let attempt = 0; attempt < 3; attempt++) {
10
+ let input;
11
+ try {
12
+ input = openSync(source, constants.O_RDONLY | constants.O_NOFOLLOW);
13
+ }
14
+ catch (error) {
15
+ if (!onLiveChange || error.code !== "ENOENT")
16
+ throw error;
17
+ onLiveChange(captured ? "changed" : "removed");
18
+ return captured ?? null;
19
+ }
20
+ let output;
21
+ try {
22
+ const before = fstatSync(input);
23
+ if (!before.isFile() || before.size > MAX_WORKSPACE_BACKUP_BYTES)
24
+ throw new Error("A workspace file is not regular or exceeds the 64 GB backup limit.");
25
+ const mode = before.mode & 0o100 ? 0o700 : 0o600;
26
+ output = openSync(destination, attempt === 0 ? "wx" : constants.O_WRONLY | constants.O_NOFOLLOW | constants.O_TRUNC, mode);
27
+ const chunk = Buffer.allocUnsafe(1024 * 1024);
28
+ const hash = createHash("sha256");
29
+ let size = 0;
30
+ while (!onLiveChange || size < before.size) {
31
+ const length = onLiveChange ? Math.min(chunk.length, before.size - size) : chunk.length;
32
+ const count = readSync(input, chunk, 0, length, null);
33
+ if (!count)
34
+ break;
35
+ size += count;
36
+ if (!onLiveChange && size > before.size)
37
+ throw new Error("A staged workspace file changed during restore.");
38
+ hash.update(chunk.subarray(0, count));
39
+ let offset = 0;
40
+ while (offset < count)
41
+ offset += writeSync(output, chunk, offset, count - offset);
42
+ }
43
+ const after = fstatSync(input);
44
+ const current = onLiveChange ? null : lstatSync(source);
45
+ const changed = size !== before.size || after.size !== before.size || after.mtimeMs !== before.mtimeMs || after.ctimeMs !== before.ctimeMs ||
46
+ (current !== null && (current.ino !== before.ino || current.dev !== before.dev || current.isSymbolicLink()));
47
+ if (changed && !onLiveChange)
48
+ throw new Error("A staged workspace file changed during restore.");
49
+ fsyncSync(output);
50
+ captured = { size, mode, sha256: hash.digest("hex") };
51
+ if (!changed)
52
+ return captured;
53
+ // ponytail: three bounded captures, then keep the bytes with a warning.
54
+ // A filesystem snapshot is needed for point-in-time external file consistency.
55
+ if (attempt === 2) {
56
+ onLiveChange?.("changed");
57
+ return captured;
58
+ }
59
+ }
60
+ finally {
61
+ closeSync(input);
62
+ if (output !== undefined)
63
+ closeSync(output);
64
+ }
65
+ }
66
+ return captured ?? null;
67
+ }
@@ -148,6 +148,7 @@ export function createWorkspaceBackupRoutes(options) {
148
148
  const restored = options.restored;
149
149
  json(res, 200, {
150
150
  ...options.status(),
151
+ busy: operating || options.status().busy,
151
152
  progress,
152
153
  lastRestoreId: restored.restored ? restored.id : null,
153
154
  safetyCopyPath: restored.safetyCopyPath ?? null,
@@ -1,4 +1,4 @@
1
- /** A backup owns one quiet workspace. Never interrupt a turn to obtain it. */
1
+ /** Export reads a live snapshot; only restore requires a quiet workspace. */
2
2
  export class WorkspaceBackupMaintenance {
3
3
  active = false;
4
4
  pendingRestore = false;
@@ -16,8 +16,18 @@ export class WorkspaceBackupMaintenance {
16
16
  }
17
17
  async run(work, hooks, keepLocked = false) {
18
18
  this.assertAvailable();
19
+ if (!keepLocked) {
20
+ const release = this.request();
21
+ try {
22
+ await hooks.flush();
23
+ return await work();
24
+ }
25
+ finally {
26
+ release();
27
+ }
28
+ }
19
29
  if (this.requests || !hooks.idle())
20
- throw Object.assign(new Error("Wait for bot turns, approvals, sign-ins, and computer actions to finish before backing up or restoring."), { status: 409 });
30
+ throw Object.assign(new Error("Wait for bot turns, approvals, sign-ins, and computer actions to finish before restoring."), { status: 409 });
21
31
  this.active = true;
22
32
  let committed = false;
23
33
  try {
@@ -1,13 +1,14 @@
1
1
  // A filesystem snapshot, not an additive import, encrypted unless the person
2
- // turns that off (workspace-backup-archive.ts). The caller must quiesce
3
- // writers before create/commit. Restore runs before config/store load.
2
+ // turns that off (workspace-backup-archive.ts). Restore must quiesce
3
+ // app-owned writers before commit. Restore runs before config/store load.
4
4
  import { createHash, randomBytes, randomUUID } from "node:crypto";
5
- import { chmodSync, closeSync, constants, copyFileSync, cpSync, existsSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, readSync, realpathSync, renameSync, rmSync, writeFileSync, writeSync, } from "node:fs";
5
+ import { chmodSync, closeSync, constants, copyFileSync, cpSync, existsSync, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, readSync, realpathSync, renameSync, rmSync, writeFileSync, } from "node:fs";
6
6
  import { isAbsolute, join, parse, posix, relative, resolve, win32 } from "node:path";
7
7
  import { homedir } from "node:os";
8
8
  import { backup, DatabaseSync } from "node:sqlite";
9
9
  import * as tar from "tar";
10
10
  import { fromMarkdown } from "mdast-util-from-markdown";
11
+ import { copyRegular } from "./workspace-backup-copy.js";
11
12
  import { writeFileAtomic } from "./atomic.js";
12
13
  import { escapeAttribute, splitTranscriptAttachments } from "../src/lib/composer-attachments.js";
13
14
  import { WORKSPACE_BACKUP_CLIENT_KEYS } from "../shared/workspace-backup-client.js";
@@ -173,47 +174,6 @@ function assertLocalAuthOutsideSnapshot(dataDir) {
173
174
  check(instance.config.configDir, "config.configDir", String(environment.HOME || environment.USERPROFILE || homedir()));
174
175
  }
175
176
  }
176
- // Open without following links and copy synchronously so this server cannot
177
- // interleave a mutation. External writers are detected where stat permits.
178
- function copyRegular(source, destination) {
179
- const input = openSync(source, constants.O_RDONLY | constants.O_NOFOLLOW);
180
- let output;
181
- try {
182
- const before = fstatSync(input);
183
- if (!before.isFile() || before.size > MAX_WORKSPACE_BACKUP_BYTES)
184
- throw new Error("A workspace file is not regular or exceeds the 64 GB backup limit.");
185
- const mode = before.mode & 0o100 ? 0o700 : 0o600;
186
- output = openSync(destination, "wx", mode);
187
- const chunk = Buffer.allocUnsafe(1024 * 1024);
188
- const hash = createHash("sha256");
189
- let size = 0;
190
- for (;;) {
191
- const count = readSync(input, chunk, 0, chunk.length, null);
192
- if (!count)
193
- break;
194
- size += count;
195
- if (size > before.size)
196
- throw new Error("A workspace file changed during backup. Stop its writer and retry.");
197
- hash.update(chunk.subarray(0, count));
198
- let offset = 0;
199
- while (offset < count)
200
- offset += writeSync(output, chunk, offset, count - offset);
201
- }
202
- const after = fstatSync(input);
203
- const current = lstatSync(source);
204
- if (size !== before.size || after.mtimeMs !== before.mtimeMs || after.ctimeMs !== before.ctimeMs ||
205
- current.ino !== before.ino || current.dev !== before.dev || current.isSymbolicLink()) {
206
- throw new Error("A workspace file changed during backup. Stop its writer and retry.");
207
- }
208
- fsyncSync(output);
209
- return { size, mode, sha256: hash.digest("hex") };
210
- }
211
- finally {
212
- closeSync(input);
213
- if (output !== undefined)
214
- closeSync(output);
215
- }
216
- }
217
177
  function hashFile(path) {
218
178
  const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW);
219
179
  try {
@@ -286,17 +246,19 @@ export async function createWorkspaceBackup(dataDir, options) {
286
246
  const entries = [];
287
247
  const links = [];
288
248
  const checkouts = [];
289
- const warnings = ["Stop external editors and managed desktops before exporting; files written outside this server cannot be frozen by the backup gate.",
249
+ const warnings = ["Files are captured as the backup runs. External changes made after a file is captured belong to the next backup.",
290
250
  encrypted ? "Conversation text and user files are not redacted and may contain secrets you pasted. Keep the encrypted backup private." : "This backup is not encrypted. Anyone with the file can read your conversations and files; keep it private.",
291
251
  ...(secrets ? ["This backup holds your keys, passwords and tokens. Anyone with the file and its password can use them."] : []), RESTORE_WARNING];
292
252
  let bytes = 0;
293
253
  let skippedLinks = 0;
254
+ let changedFiles = 0;
255
+ let removedFiles = 0;
294
256
  const progress = () => options.onProgress?.({ phase: "copying", files: entries.length, bytes });
295
257
  try {
296
258
  const root = realpathSync(dataDir);
297
259
  const sourceDb = join(root, "messages.db");
298
- // The caller closes its message handle after flushing, while maintenance
299
- // remains held. The native snapshot includes any committed WAL records.
260
+ // SQLite online backup captures committed WAL records while the live
261
+ // message connection remains open and turns continue writing.
300
262
  if (existsSync(sourceDb)) {
301
263
  if (lstatSync(sourceDb).isSymbolicLink())
302
264
  throw new Error("The message database must not be a symbolic link.");
@@ -352,7 +314,16 @@ export async function createWorkspaceBackup(dataDir, options) {
352
314
  if (!validRelative(path))
353
315
  throw new Error("A workspace filename cannot be safely restored on supported platforms.");
354
316
  const source = join(directory, name);
355
- const stat = lstatSync(source);
317
+ let stat;
318
+ try {
319
+ stat = lstatSync(source);
320
+ }
321
+ catch (error) {
322
+ if (error.code !== "ENOENT")
323
+ throw error;
324
+ removedFiles++;
325
+ continue;
326
+ }
356
327
  if (prefix && REINSTALLABLE_DIRS.has(name) && (stat.isDirectory() || stat.isSymbolicLink()))
357
328
  continue;
358
329
  if (stat.isSymbolicLink() && BROWSER_LOCK_LINKS.has(name))
@@ -410,8 +381,15 @@ export async function createWorkspaceBackup(dataDir, options) {
410
381
  }
411
382
  copied = { size: lstatSync(destination).size, mode: 0o600, sha256: hashFile(destination) };
412
383
  }
413
- else
414
- copied = copyRegular(path === "messages.db" ? join(snapshot, "messages-snapshot.db") : source, destination);
384
+ else {
385
+ const captured = copyRegular(path === "messages.db" ? join(snapshot, "messages-snapshot.db") : source, destination, path === "messages.db" ? undefined : (kind) => { if (kind === "changed")
386
+ changedFiles++;
387
+ else
388
+ removedFiles++; });
389
+ if (!captured)
390
+ continue;
391
+ copied = captured;
392
+ }
415
393
  bytes += copied.size;
416
394
  if (bytes > MAX_WORKSPACE_BACKUP_BYTES)
417
395
  throw new Error("The workspace exceeds the 64 GB backup limit.");
@@ -424,6 +402,10 @@ export async function createWorkspaceBackup(dataDir, options) {
424
402
  }
425
403
  };
426
404
  walk(root);
405
+ if (changedFiles)
406
+ warnings.push(`${changedFiles} file(s) kept changing during backup. Their captured bytes are included, but may contain an in-progress write.`);
407
+ if (removedFiles)
408
+ warnings.push(`${removedFiles} file(s) disappeared before they could be captured and are not included.`);
427
409
  if (skippedLinks)
428
410
  warnings.push(`${skippedLinks} managed skill discovery link(s) were omitted and are recreated by the app.`);
429
411
  if (checkouts.length)
@@ -14,6 +14,15 @@ export const MODEL_CLASSES = ["Mezcal", "Plata", "Reposado", "Añejo"];
14
14
  export function isModelClass(value) {
15
15
  return typeof value === "string" && MODEL_CLASSES.includes(value);
16
16
  }
17
+ /** What happens when a connection hits its plan limit (Capy run-out setting).
18
+ * ask: stop before any next connection. ask-before-paid (default): move to
19
+ * another subscription, and stop before a pay-per-use key.
20
+ * keep-going: move on, including onto pay-per-use keys. */
21
+ export const CONNECTION_RUN_OUT_POLICIES = ["ask", "ask-before-paid", "keep-going"];
22
+ export const DEFAULT_CONNECTION_RUN_OUT = "ask-before-paid";
23
+ export function isConnectionRunOutPolicy(value) {
24
+ return typeof value === "string" && CONNECTION_RUN_OUT_POLICIES.includes(value);
25
+ }
17
26
  /** The levels step 3 graded before classes, as older config and override
18
27
  * files still hold them: L1 Mezcal, L2 Plata, L3 Reposado, L4 Añejo. */
19
28
  export const LEGACY_LEVEL_CLASSES = {
@@ -8,7 +8,7 @@ export const CHIBITEK_DEPARTMENTS = [
8
8
  { id: "creative", name: "Creative" },
9
9
  { id: "sales-and-marketing", name: "Sales and Marketing" },
10
10
  ];
11
- /** The interview can be sent once at least one answer is filled in. */
11
+ /** The short wizard interview can be sent once at least one answer is filled in. */
12
12
  export function interviewHasAnswers(answers) {
13
- return ["role", "department", "company", "goals", "workingStyle"].some((key) => Boolean(answers[key]?.trim()));
13
+ return ["role", "department", "company", "goals", "workingStyle"].some((key) => Boolean(answers[key]?.toString().trim()));
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chibitek/chibi",
3
- "version": "0.1.179",
3
+ "version": "0.1.182",
4
4
  "description": "Atomic by Chibitek: run your AI team's server anywhere and pair your devices to it",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: build-paw
3
+ description: >-
4
+ Use when setting up a Personal AI Workspace (PAW) on the user's machine, when
5
+ PAW files are empty or missing, or whenever the user shares a new lasting fact,
6
+ preference, rule, tool, team, or project that should be saved into PAW. The
7
+ agent MUST interview the user (plain questions, small groups), write answers
8
+ into the matching PAW files, confirm before saving locked policies, and keep
9
+ PAW updated going forward. Never store secrets or customer PII.
10
+ ---
11
+ # Build PAW (Personal AI Workspace): interview, write, keep updated
12
+
13
+ Atomic already creates `~/workspace/PAW` (under the home folder as `workspace/PAW` on
14
+ Windows too; Node path joining handles the separator) from its empty template when needed. Prefer filling that tree from
15
+ interview answers. The bundled `paw-skeleton/` next to this skill is the shape
16
+ to match when a file is still missing. Use Atomic's confirm-before-write helpers
17
+ for locked policy files under `org/policies/`.
18
+
19
+
20
+ PAW is a plain-markdown context workspace any AI tool can read (Claude Code, Claude Desktop, Cursor, Codex, Gemini, and similar). It is inspired by the Interpretable Context Methodology (ICM) by Van Clief and McDermott.
21
+
22
+ **This skill is not a manual fill-in form.** You (the LLM) MUST run the interview yourself, write the answers into PAW, and keep doing so as the user shares new lasting facts.
23
+
24
+ A ready skeleton lives next to this pack in `paw-skeleton/`. Prefer copying it, then filling it from interview answers.
25
+
26
+ ## Standing rules (all phases)
27
+
28
+ - Ask questions yourself. Do not tell the user to "go edit the files" as the primary path.
29
+ - Ask **3 to 5 plain-language questions per turn**. One small group at a time. Every question is skippable ("skip" or "later" is fine).
30
+ - **Never ask for passwords, API keys, tokens, certificates, or customer PII** (no individual client names, emails, phone numbers, account numbers, or health data). Market and customer *type* is fine ("restaurants in NJ", "creative agencies").
31
+ - If the user offers a secret, refuse to store it. Point them to a password manager by name only.
32
+ - Show what you will write and where. Save after a clear yes. For files under `org/policies/` (locked), require an **explicit** yes for that file.
33
+ - `me/personal/` stays private. Company-scoped agents must not open it.
34
+ - Append every accepted update to `me/CHANGELOG.md` with the date (America/New_York label when known) and a one-line summary.
35
+
36
+ ## Goal layout
37
+
38
+ ```
39
+ ~/workspace/PAW/
40
+ ├── paw.yaml
41
+ ├── CLAUDE.md
42
+ ├── AGENTS.md
43
+ ├── CONTEXT.md
44
+ ├── org/
45
+ │ ├── company.md
46
+ │ ├── glossary.md
47
+ │ ├── tools.md
48
+ │ ├── brand/voice.md
49
+ │ ├── marketing/positioning.md
50
+ │ └── policies/ai-use.md, engineering.md, secrets.md
51
+ ├── departments/<team>/CONTEXT.md, voice.md, skills/, templates/
52
+ └── me/about-me.md, CHANGELOG.md, projects/, personal/
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Phase 1: Interview (mandatory when PAW is new, empty, or sparse)
58
+
59
+ Run this before relying on PAW. Cover the topics below across several turns. Adapt wording to the user. Skip anything they decline.
60
+
61
+ ### How to interview
62
+
63
+ 1. Open with one short sentence: you will ask a few questions so their assistants remember how they work, and they can skip any question.
64
+ 2. Ask group A, wait for answers, then group B, and so on.
65
+ 3. After each group, restate what you heard in one or two lines and map it to the target files (do not write yet until Phase 2, unless they already confirmed a single correction mid-flow).
66
+ 4. When coverage is enough for a useful first PAW (at least: name/role, company, one team or "just me", tools, personal goals, and at least one hard rule), move to Phase 2. You can fill gaps later in Phase 3.
67
+
68
+ ### Question groups (3 to 5 per turn)
69
+
70
+ **Group A · You**
71
+ 1. What name should assistants use for you?
72
+ 2. What is your role or title?
73
+ 3. What are your main goals for the next few months?
74
+ 4. How do you like assistants to work with you (short answers, draft first, ask before acting, and so on)?
75
+ 5. What should assistants never do?
76
+
77
+ → `me/about-me.md`; never-do also seeds `org/policies/ai-use.md` and `CLAUDE.md` / `AGENTS.md` notes.
78
+
79
+ **Group B · Company**
80
+ 1. What is the company or project name?
81
+ 2. What do you sell or offer, in plain words?
82
+ 3. Who do you serve (market or customer type only, no client names)?
83
+ 4. What is the mission in one or two sentences?
84
+ 5. What hard rules must everyone (and every assistant) follow?
85
+
86
+ → `paw.yaml` `organization.name` and `owners.org` (ask for an email only if they want it as owner contact; never require it); `org/company.md`; mission/rules also touch `org/marketing/positioning.md` when relevant.
87
+
88
+ **Group C · Teams**
89
+ 1. What teams or departments exist (or is it just you)?
90
+ 2. For each team, what do they own day to day?
91
+ 3. Who owns each team pack for approvals (name or "me")?
92
+ 4. Any team-specific writing voice?
93
+
94
+ → `paw.yaml` `departments` and `owners.departments`; `departments/<team>/CONTEXT.md`; `departments/<team>/voice.md`.
95
+
96
+ **Group D · Tools and systems**
97
+ 1. Which tools and systems do you use daily (names only)?
98
+ 2. Which ones are approved for assistants to talk about or call?
99
+ 3. Any tool assistants must not touch?
100
+
101
+ → `org/tools.md`; optional notes in `org/policies/ai-use.md`.
102
+
103
+ **Group E · Voice and brand**
104
+ 1. How should writing sound (plain, warm, formal, bold)?
105
+ 2. Words or phrases to prefer?
106
+ 3. Words or phrases to avoid?
107
+ 4. One-line positioning: who you serve and why you are different?
108
+
109
+ → `org/brand/voice.md`; `org/marketing/positioning.md`; glossary terms → `org/glossary.md`.
110
+
111
+ **Group F · Policies**
112
+ 1. AI use: what may assistants do alone, and what needs your OK?
113
+ 2. Engineering or code rules (tests, review, deploy, branches)?
114
+ 3. Confirm: secrets stay in a password manager, never in PAW?
115
+
116
+ → `org/policies/ai-use.md`; `org/policies/engineering.md`; `org/policies/secrets.md` (locked; explicit yes before save).
117
+
118
+ **Group G · Projects**
119
+ 1. What projects are active right now (names and one-line purpose)?
120
+ 2. What is on deck next?
121
+ 3. Any project an assistant should treat as private to you only?
122
+
123
+ → `me/projects/` (one short markdown file per project, or a simple list in `me/about-me.md` if they prefer); private ones stay under `me/personal/` only if they ask.
124
+
125
+ ### Question-to-file table
126
+
127
+ | Topic | Example questions | Writes to |
128
+ |---|---|---|
129
+ | Name, role, goals, preferences | Group A 1-4 | `me/about-me.md` |
130
+ | Never-do list | Group A 5 | `me/about-me.md`, `org/policies/ai-use.md`, `CLAUDE.md`, `AGENTS.md` |
131
+ | Company name | Group B 1 | `paw.yaml` `organization.name`, `org/company.md` |
132
+ | What you sell | Group B 2 | `org/company.md` |
133
+ | Market / customer type | Group B 3 | `org/company.md`, `org/marketing/positioning.md` |
134
+ | Mission | Group B 4 | `org/company.md` |
135
+ | Hard rules | Group B 5 | `org/company.md`, relevant `org/policies/*.md` |
136
+ | Teams and ownership | Group C 1-3 | `paw.yaml` `departments`, `owners.departments`, `departments/<team>/CONTEXT.md` |
137
+ | Team voice | Group C 4 | `departments/<team>/voice.md` |
138
+ | Tools (names only) | Group D | `org/tools.md` |
139
+ | Writing voice / brand words | Group E 1-3 | `org/brand/voice.md`, `org/glossary.md` |
140
+ | Positioning | Group E 4 | `org/marketing/positioning.md` |
141
+ | AI use rules | Group F 1 | `org/policies/ai-use.md` |
142
+ | Engineering / code rules | Group F 2 | `org/policies/engineering.md` |
143
+ | Secrets policy | Group F 3 | `org/policies/secrets.md` |
144
+ | Current projects | Group G | `me/projects/*.md` or `me/about-me.md` |
145
+ | Owner email (optional) | "Who should own the org pack?" | `paw.yaml` `owners.org` |
146
+
147
+ ---
148
+
149
+ ## Phase 2: Write (create skeleton, save from answers, confirm)
150
+
151
+ 1. **Ensure the tree exists.** If `~/workspace/PAW` (or the user's chosen PAW root) is missing, copy `paw-skeleton` there, or create the same files. Never overwrite filled files without saying so.
152
+ 2. **Draft from answers.** Fill each mapped file. Keep placeholders only where the user skipped.
153
+ 3. **Show a short summary** before saving, for example:
154
+ - `org/company.md`: company name, what you sell, mission
155
+ - `departments/ops/CONTEXT.md`: new team pack
156
+ - `me/about-me.md`: role and preferences
157
+ - `paw.yaml`: org name and departments list
158
+ 4. **Ask the user to confirm or correct.** On yes, write the files. On corrections, adjust and confirm once more for locked policy files.
159
+ 5. **Changelog.** Append to `me/CHANGELOG.md`:
160
+ ```
161
+ ## YYYY-MM-DD (America/New_York)
162
+ - Initial PAW filled from interview: company, teams, about-me, tools, policies.
163
+ ```
164
+ 6. **Smoke check.** Answer one question from PAW alone (for example "what are our hard rules?") and cite the file.
165
+
166
+ ---
167
+
168
+ ## Phase 3: Going forward (standing behavior)
169
+
170
+ This phase never ends. It is how every session should treat PAW.
171
+
172
+ ### Session start
173
+ - Read `paw.yaml` and follow its `load:` rules for the current job.
174
+ - Policies load first and cannot be overridden.
175
+ - Stop when the token budget is spent; list remaining paths instead of stuffing them.
176
+
177
+ ### When the user shares a lasting fact
178
+ Examples: a new preference, hard rule, tool, team, project, brand word, or never-do.
179
+ 1. Propose the **exact file** (and section or bullet) to update.
180
+ 2. For normal files under `me/` (except `me/personal/`) and most org/department docs: save after a quick yes.
181
+ 3. For `org/policies/**` and other locked paths listed in `paw.yaml` `policies:`: require an **explicit** yes naming that file.
182
+ 4. Never write into `me/personal/` unless the user asks to put something private there.
183
+ 5. Append a dated line to `me/CHANGELOG.md`.
184
+
185
+ ### Periodic follow-ups
186
+ - If important files are still placeholders, or a file's `reviewed` date in `paw.yaml` is missing or older than **90 days**, ask a few follow-up interview questions (still 3 to 5, skippable) to fill gaps.
187
+ - After updates, refresh `files.<path>.reviewed` in `paw.yaml` when you touch that file.
188
+
189
+ ### Secrets (always)
190
+ - Never store passwords, keys, tokens, or certificates in PAW, chat, or git.
191
+ - If offered, refuse, do not echo the value, and point to a password manager.
192
+
193
+ ---
194
+
195
+ ## Acceptance checklist
196
+
197
+ - [ ] Interview run by the agent (not dumped on the user as homework)
198
+ - [ ] `paw.yaml` names THEIR org and lists real or "just-me" departments
199
+ - [ ] `me/about-me.md` filled from answers
200
+ - [ ] At least one department CONTEXT (or a clear "solo" department)
201
+ - [ ] Policies present; secrets policy says password manager only
202
+ - [ ] User confirmed the write summary before save
203
+ - [ ] `me/CHANGELOG.md` has an initial dated entry
204
+ - [ ] No secrets or customer PII in any file
205
+ - [ ] Agent can answer a policy or company question from PAW alone
206
+
207
+ ## Non-goals
208
+
209
+ - Do not copy another organization's PAW contents into this one.
210
+ - Do not put credentials or private customer data in PAW.
211
+ - Do not silently overwrite locked policy files.
212
+ - Do not replace the interview with "here is a blank template, good luck."
@@ -0,0 +1,5 @@
1
+ # Vendored skill
2
+
3
+ `SKILL.md` and `paw-skeleton/` come from the Anthony Rudolph skill pack
4
+ (`build-paw`, 2026-11-05), adapted for Atomic so the interview runs inside
5
+ Atomic on Mac, Windows and Linux against `~/workspace/PAW`.
@@ -0,0 +1,19 @@
1
+ {
2
+ "id": "build-paw",
3
+ "name": "Build PAW",
4
+ "version": "1.0.0",
5
+ "description": "Interview the person and fill their Personal AI Workspace (PAW) when it is missing, empty or sparse, then keep it updated as they share lasting facts.",
6
+ "defaultEnabled": true,
7
+ "triggerTerms": [
8
+ "build-paw",
9
+ "/build-paw",
10
+ "set up paw",
11
+ "setup paw",
12
+ "set up my paw",
13
+ "fill my paw",
14
+ "personal ai workspace",
15
+ "paw interview",
16
+ "build my paw"
17
+ ],
18
+ "requiredCapabilities": []
19
+ }
@@ -0,0 +1,9 @@
1
+ # Agent rules for this PAW
2
+
3
+ - If PAW is unfilled, run the build-paw interview first. When I share new lasting facts, offer to save them to the right PAW file.
4
+ - Layer order: organization, then department, then person.
5
+ - Closer layers win only where `paw.yaml` lists them under `overridable`.
6
+ - `me/personal/` is private. Company-scoped agents must not open it.
7
+ - Stop loading files when the token budget is spent. List remaining paths instead.
8
+ - No credentials, tokens, or customer PII in any PAW file.
9
+ - Log accepted updates in `me/CHANGELOG.md` with the date.
@@ -0,0 +1,9 @@
1
+ # Claude rules for this PAW
2
+
3
+ - If PAW is unfilled, run the build-paw interview first. When I share new lasting facts, offer to save them to the right PAW file.
4
+ - Read `paw.yaml` first. Load only the files the matching job lists.
5
+ - Policies under `org/policies/` always win. Never override them without an explicit yes for that file.
6
+ - Never read or write secrets. Point to a password manager instead.
7
+ - Prefer editing `me/` for personal notes. Propose changes to `org/` and `departments/` and save after a quick yes.
8
+ - Keep `me/personal/` private. Append accepted updates to `me/CHANGELOG.md`.
9
+ - Keep answers short. Cite the PAW file you used.
@@ -0,0 +1,10 @@
1
+ # PAW start here
2
+
3
+ This folder is your Personal AI Workspace. Plain markdown that any AI tool can read.
4
+
5
+ 1. Open `paw.yaml` for load rules and owners.
6
+ 2. Org facts live in `org/`.
7
+ 3. Team SOPs live in `departments/<id>/`.
8
+ 4. Your preferences live in `me/about-me.md`.
9
+
10
+ If this PAW is still mostly placeholders, ask your assistant to run the build-paw interview and fill it from your answers. See `skills/build-paw/SKILL.md` in the skill pack.
@@ -0,0 +1,5 @@
1
+ # PAW skeleton (generic)
2
+
3
+ Copy this folder to `~/workspace/PAW`, then fill in the placeholders.
4
+ See `../skills/build-paw/SKILL.md` for the step-by-step.
5
+ Contains no company-specific data.
@@ -0,0 +1,5 @@
1
+ # Example Team context
2
+
3
+ - How we work: (fill in)
4
+ - Definition of Done: (fill in)
5
+ - SOPs: (link or summarize; no secrets)
@@ -0,0 +1 @@
1
+ Put reusable team skills here as `skills/<name>/SKILL.md`.
@@ -0,0 +1 @@
1
+ Put reusable templates here (PR body, email outline, and so on).
@@ -0,0 +1,3 @@
1
+ # Team voice
2
+
3
+ Short notes on how this team writes (support tone, engineering tone, and so on).
@@ -0,0 +1,7 @@
1
+ # PAW changelog
2
+
3
+ Dated notes of what changed in this workspace. Newest first.
4
+
5
+ ## (no updates yet)
6
+
7
+ Filled by the build-paw interview and later lasting-fact saves.
@@ -0,0 +1,7 @@
1
+ # About me
2
+
3
+ - Name:
4
+ - Role:
5
+ - Goals:
6
+ - How I like to work:
7
+ - Tools I use daily:
@@ -0,0 +1 @@
1
+ Private notes. Company bots must not read this folder.
@@ -0,0 +1,5 @@
1
+ # Brand voice
2
+
3
+ - Tone: (plain, warm, direct, ...)
4
+ - Words to use:
5
+ - Words to avoid:
@@ -0,0 +1,6 @@
1
+ # Company
2
+
3
+ - Name: Your Organization
4
+ - What we do: (fill in)
5
+ - Mission: (fill in)
6
+ - Hard rules agents must follow: (fill in; no secrets)
@@ -0,0 +1,6 @@
1
+ # Glossary
2
+
3
+ | Term | Meaning |
4
+ |---|---|
5
+ | PAW | Personal AI Workspace |
6
+ | (add your terms) | |
@@ -0,0 +1,3 @@
1
+ # Positioning
2
+
3
+ One paragraph on who you serve and why you are different. No confidential pipeline data.
@@ -0,0 +1,5 @@
1
+ # AI use policy
2
+
3
+ - Humans own decisions that affect customers or money.
4
+ - Agents propose; owners approve irreversible actions.
5
+ - No pasting secrets into prompts or PAW files.
@@ -0,0 +1,5 @@
1
+ # Engineering policy
2
+
3
+ - Tests before merge for behavior changes.
4
+ - No force-push to shared main without explicit owner OK.
5
+ - Dependencies stay pinned; review new ones before adding.
@@ -0,0 +1,5 @@
1
+ # Secrets policy
2
+
3
+ - Passwords and API keys live in a password manager, never in PAW, git, or chat.
4
+ - If an agent finds a secret in a file, it stops, redacts, and alerts the owner.
5
+ - Rotate anything that may have leaked.