@tekmidian/pai 0.64.0 → 0.65.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.
Files changed (212) hide show
  1. package/README.md +60 -1051
  2. package/dist/{aibroker-client-BpfuGPe5.mjs → aibroker-client-B8c42Lh8.mjs} +1 -1
  3. package/dist/{aibroker-client-DRld7g6z.mjs → aibroker-client-C5Fw7DNz.mjs} +10 -4
  4. package/dist/{aibroker-client-DRld7g6z.mjs.map → aibroker-client-C5Fw7DNz.mjs.map} +1 -1
  5. package/dist/{async-CY_cd_8j.mjs → async-CNn36gm4.mjs} +2 -2
  6. package/dist/{async-CY_cd_8j.mjs.map → async-CNn36gm4.mjs.map} +1 -1
  7. package/dist/{auto-route-CPlam4iv.mjs → auto-route-sLMU-NnM.mjs} +2 -2
  8. package/dist/{auto-route-CPlam4iv.mjs.map → auto-route-sLMU-NnM.mjs.map} +1 -1
  9. package/dist/{chain-o-g8AgE3.mjs → chain-CLb6hbFS.mjs} +4 -4
  10. package/dist/{chain-o-g8AgE3.mjs.map → chain-CLb6hbFS.mjs.map} +1 -1
  11. package/dist/cli/index.mjs +19 -19
  12. package/dist/cli/program.d.mts.map +1 -1
  13. package/dist/cli/program.mjs +19 -19
  14. package/dist/{clusters-DsMf20PP.mjs → clusters-PgIUYT_v.mjs} +1 -1
  15. package/dist/{clusters-DsMf20PP.mjs.map → clusters-PgIUYT_v.mjs.map} +1 -1
  16. package/dist/{config-2wkz744W.mjs → config-BbLFD7Uf.mjs} +3 -3
  17. package/dist/config-BbLFD7Uf.mjs.map +1 -0
  18. package/dist/{config-CUTg6VDq.mjs → config-YinjgXEJ.mjs} +1 -1
  19. package/dist/{context-handover-cache-BOpjLsKe.mjs → context-handover-cache-mGxq2-8f.mjs} +11 -29
  20. package/dist/context-handover-cache-mGxq2-8f.mjs.map +1 -0
  21. package/dist/daemon/index.mjs +16 -16
  22. package/dist/daemon-BjaPR39W.mjs +19 -0
  23. package/dist/{daemon-BYieXduQ.mjs → daemon-DqCB3fO-.mjs} +30 -30
  24. package/dist/{daemon-BYieXduQ.mjs.map → daemon-DqCB3fO-.mjs.map} +1 -1
  25. package/dist/daemon-mcp/index.mjs +18 -18
  26. package/dist/daemon-mcp/index.mjs.map +1 -1
  27. package/dist/detector-C3Q7mxQU.mjs +3 -0
  28. package/dist/{detector-BAlmrLQ0.mjs → detector-CIHEXKsV.mjs} +1 -1
  29. package/dist/{detector-BAlmrLQ0.mjs.map → detector-CIHEXKsV.mjs.map} +1 -1
  30. package/dist/{embeddings-DK9XfQic.mjs → embeddings-BbNVXa_0.mjs} +1 -1
  31. package/dist/{embeddings-DK9XfQic.mjs.map → embeddings-BbNVXa_0.mjs.map} +1 -1
  32. package/dist/{embeddings-Xg8XLf2K.mjs → embeddings-CDfM63uC.mjs} +1 -1
  33. package/dist/{factory-BMK0tC1b.mjs → factory-CaswxuJ0.mjs} +1 -1
  34. package/dist/{factory-C4We3xR_.mjs → factory-y36qGegI.mjs} +13 -13
  35. package/dist/{factory-C4We3xR_.mjs.map → factory-y36qGegI.mjs.map} +1 -1
  36. package/dist/{fallback-ECiqCuh6.mjs → fallback-CupzGkuJ.mjs} +1205 -1204
  37. package/dist/fallback-CupzGkuJ.mjs.map +1 -0
  38. package/dist/{federation-db-CUgy0WYs.mjs → federation-db-BTyoufBh.mjs} +2 -2
  39. package/dist/{federation-db-CUgy0WYs.mjs.map → federation-db-BTyoufBh.mjs.map} +1 -1
  40. package/dist/federation-db-HfIFc7FG.mjs +3 -0
  41. package/dist/hooks/block-sleep-poll.mjs +36 -11
  42. package/dist/hooks/block-sleep-poll.mjs.map +2 -2
  43. package/dist/hooks/capture-all-events.mjs +3 -17
  44. package/dist/hooks/capture-all-events.mjs.map +3 -3
  45. package/dist/hooks/capture-session-summary.mjs +3 -17
  46. package/dist/hooks/capture-session-summary.mjs.map +3 -3
  47. package/dist/hooks/capture-tool-output.mjs +3 -17
  48. package/dist/hooks/capture-tool-output.mjs.map +3 -3
  49. package/dist/hooks/cleanup-session-files.mjs +3 -17
  50. package/dist/hooks/cleanup-session-files.mjs.map +2 -2
  51. package/dist/hooks/context-compression-hook.mjs +3 -17
  52. package/dist/hooks/context-compression-hook.mjs.map +3 -3
  53. package/dist/hooks/initialize-session.mjs +3 -17
  54. package/dist/hooks/initialize-session.mjs.map +2 -2
  55. package/dist/hooks/inject-observations.mjs +3 -17
  56. package/dist/hooks/inject-observations.mjs.map +2 -2
  57. package/dist/hooks/load-core-context.mjs +4 -22
  58. package/dist/hooks/load-core-context.mjs.map +2 -2
  59. package/dist/hooks/load-project-context.mjs +3 -17
  60. package/dist/hooks/load-project-context.mjs.map +3 -3
  61. package/dist/hooks/mcp-deferred-gate.mjs +3 -17
  62. package/dist/hooks/mcp-deferred-gate.mjs.map +2 -2
  63. package/dist/hooks/observe.mjs +3 -17
  64. package/dist/hooks/observe.mjs.map +2 -2
  65. package/dist/hooks/post-compact-inject.mjs.map +1 -1
  66. package/dist/hooks/route-agents-to-worker.mjs.map +1 -1
  67. package/dist/hooks/security-validator.mjs +5 -19
  68. package/dist/hooks/security-validator.mjs.map +3 -3
  69. package/dist/hooks/stop-hook.mjs +3 -17
  70. package/dist/hooks/stop-hook.mjs.map +3 -3
  71. package/dist/hooks/sync-todo-to-md.mjs +3 -17
  72. package/dist/hooks/sync-todo-to-md.mjs.map +2 -2
  73. package/dist/hooks/whisper-rules.mjs.map +1 -1
  74. package/dist/hooks/worker-guard.mjs.map +2 -2
  75. package/dist/hooks/worker-proxy.mjs.map +1 -1
  76. package/dist/hooks/worker-status-line.mjs +4 -4
  77. package/dist/hooks/worker-status-line.mjs.map +2 -2
  78. package/dist/hooks/worker-supervision.mjs.map +1 -1
  79. package/dist/{indexer-backend-CJ0RGgMz.mjs → indexer-backend-Cnc7Tf5C.mjs} +2 -2
  80. package/dist/{ipc-client-EhWY8XL0.mjs → ipc-client-D16Xw6Uo.mjs} +2 -2
  81. package/dist/{ipc-client-EhWY8XL0.mjs.map → ipc-client-D16Xw6Uo.mjs.map} +1 -1
  82. package/dist/{kg-entity-1uqCnk4u.mjs → kg-entity-COTUj1ZC.mjs} +1 -1
  83. package/dist/{kg-entity-1uqCnk4u.mjs.map → kg-entity-COTUj1ZC.mjs.map} +1 -1
  84. package/dist/{latent-ideas-CSuKfiq3.mjs → latent-ideas-ByvMjVcb.mjs} +3 -3
  85. package/dist/{latent-ideas-CSuKfiq3.mjs.map → latent-ideas-ByvMjVcb.mjs.map} +1 -1
  86. package/dist/{link-boost-BtjzfE3c.mjs → link-boost-UiE-uooT.mjs} +1 -1
  87. package/dist/{link-boost-BtjzfE3c.mjs.map → link-boost-UiE-uooT.mjs.map} +1 -1
  88. package/dist/{main-resolver-DyOrwNYw.mjs → main-resolver-BeYWNzrt.mjs} +11 -11
  89. package/dist/{main-resolver-DyOrwNYw.mjs.map → main-resolver-BeYWNzrt.mjs.map} +1 -1
  90. package/dist/main-resolver-kHW6FewU.mjs +7 -0
  91. package/dist/merge-2gqRPFu2.mjs +3 -0
  92. package/dist/{merge-D58n_-LZ.mjs → merge-DgU9OgZy.mjs} +1 -1
  93. package/dist/{merge-D58n_-LZ.mjs.map → merge-DgU9OgZy.mjs.map} +1 -1
  94. package/dist/module-paths-DdRzbkUI.mjs +44 -0
  95. package/dist/module-paths-DdRzbkUI.mjs.map +1 -0
  96. package/dist/{neighborhood-DNuRelRB.mjs → neighborhood-CvRHlqdR.mjs} +2 -2
  97. package/dist/{neighborhood-DNuRelRB.mjs.map → neighborhood-CvRHlqdR.mjs.map} +1 -1
  98. package/dist/{note-context-D9JZ4-7o.mjs → note-context-BrbfUIoP.mjs} +1 -1
  99. package/dist/{note-context-D9JZ4-7o.mjs.map → note-context-BrbfUIoP.mjs.map} +1 -1
  100. package/dist/{pai-home-UncxWxlX.mjs → pai-home-Cm9rcJgX.mjs} +1 -1
  101. package/dist/{pai-home-UncxWxlX.mjs.map → pai-home-Cm9rcJgX.mjs.map} +1 -1
  102. package/dist/{planner-DgC3oSvb.mjs → planner-DAq4Yx-H.mjs} +7 -7
  103. package/dist/{planner-DgC3oSvb.mjs.map → planner-DAq4Yx-H.mjs.map} +1 -1
  104. package/dist/{postgres-CcsRKir-.mjs → postgres-DYtZg7J7.mjs} +5 -13
  105. package/dist/{postgres-CcsRKir-.mjs.map → postgres-DYtZg7J7.mjs.map} +1 -1
  106. package/dist/{program-JhF2GgJY.mjs → program-CWf9mT7Z.mjs} +262 -260
  107. package/dist/program-CWf9mT7Z.mjs.map +1 -0
  108. package/dist/{query-feedback-BPa0dISE.mjs → query-feedback-BIaZTTFO.mjs} +2 -2
  109. package/dist/{query-feedback-BPa0dISE.mjs.map → query-feedback-BIaZTTFO.mjs.map} +1 -1
  110. package/dist/query-feedback-B_iigYj-.mjs +3 -0
  111. package/dist/{registry-db-DCzdI4sC.mjs → registry-db-C7voqML9.mjs} +2 -2
  112. package/dist/{registry-db-DCzdI4sC.mjs.map → registry-db-C7voqML9.mjs.map} +1 -1
  113. package/dist/registry-db-JHPhA8vF.mjs +3 -0
  114. package/dist/{registry-postgres-BUnkHKYs.mjs → registry-postgres-DSrkxqfF.mjs} +2 -2
  115. package/dist/{registry-postgres-BUnkHKYs.mjs.map → registry-postgres-DSrkxqfF.mjs.map} +1 -1
  116. package/dist/{registry-sqlite-CKYNwkUv.mjs → registry-sqlite-B2436JgX.mjs} +2 -2
  117. package/dist/{registry-sqlite-CKYNwkUv.mjs.map → registry-sqlite-B2436JgX.mjs.map} +1 -1
  118. package/dist/router-S6C5BxzZ.mjs +3 -0
  119. package/dist/{router-CGZATlvm.mjs → router-aqLMvNMg.mjs} +1 -1
  120. package/dist/{router-CGZATlvm.mjs.map → router-aqLMvNMg.mjs.map} +1 -1
  121. package/dist/{run-env-Br4Bc7Vz.mjs → run-env-BHWnXqle.mjs} +3 -3
  122. package/dist/{run-env-Br4Bc7Vz.mjs.map → run-env-BHWnXqle.mjs.map} +1 -1
  123. package/dist/{run-W2rV_9j0.mjs → run-uAkNItb6.mjs} +140 -44
  124. package/dist/run-uAkNItb6.mjs.map +1 -0
  125. package/dist/{runtime-paths-QGQJAekd.mjs → runtime-paths-CHTg3ywb.mjs} +1 -1
  126. package/dist/{runtime-paths-QGQJAekd.mjs.map → runtime-paths-CHTg3ywb.mjs.map} +1 -1
  127. package/dist/{server-B71rem4q.mjs → server-DlL1QI2k.mjs} +4 -5
  128. package/dist/server-DlL1QI2k.mjs.map +1 -0
  129. package/dist/{session-keepalive-Dgil9hjw.mjs → session-keepalive-BWEjcRrh.mjs} +7 -7
  130. package/dist/{session-keepalive-Dgil9hjw.mjs.map → session-keepalive-BWEjcRrh.mjs.map} +1 -1
  131. package/dist/skills/Art/SKILL.md +1 -1
  132. package/dist/skills/Observability/SKILL.md +4 -4
  133. package/dist/skills/Research/SKILL.md +1 -1
  134. package/dist/skills/Tasks/SKILL.md +1 -1
  135. package/dist/{sources-LcGptLA-.mjs → sources-DX4ElmrE.mjs} +1 -1
  136. package/dist/{sources-LcGptLA-.mjs.map → sources-DX4ElmrE.mjs.map} +1 -1
  137. package/dist/{sqlite-CAJcw2zL.mjs → sqlite-BrEu3avy.mjs} +3 -3
  138. package/dist/{sqlite-CAJcw2zL.mjs.map → sqlite-BrEu3avy.mjs.map} +1 -1
  139. package/dist/{state-S9wlKarB.mjs → state-DW8zdweW.mjs} +1 -1
  140. package/dist/{state-CHltNjXI.mjs → state-HyjqTihC.mjs} +1 -1
  141. package/dist/{state-CHltNjXI.mjs.map → state-HyjqTihC.mjs.map} +1 -1
  142. package/dist/{themes-D1FQFthd.mjs → themes-BgqahYVM.mjs} +2 -2
  143. package/dist/{themes-D1FQFthd.mjs.map → themes-BgqahYVM.mjs.map} +1 -1
  144. package/dist/{tools-BW7OXf-N.mjs → tools-BbqQIHPe.mjs} +4 -4
  145. package/dist/{tools-BFC-113F.mjs → tools-gMGDIpJ9.mjs} +18 -18
  146. package/dist/{tools-BFC-113F.mjs.map → tools-gMGDIpJ9.mjs.map} +1 -1
  147. package/dist/{trace-IDKK1VFs.mjs → trace-CmAB7iJZ.mjs} +1 -1
  148. package/dist/{trace-IDKK1VFs.mjs.map → trace-CmAB7iJZ.mjs.map} +1 -1
  149. package/dist/{vault-indexer-y6YC2-mh.mjs → vault-indexer-Ddq51X20.mjs} +1 -1
  150. package/dist/{vault-indexer-y6YC2-mh.mjs.map → vault-indexer-Ddq51X20.mjs.map} +1 -1
  151. package/dist/{wakeup-CNZQZzsY.mjs → wakeup-CZw88uXf.mjs} +3 -3
  152. package/dist/{wakeup-CNZQZzsY.mjs.map → wakeup-CZw88uXf.mjs.map} +1 -1
  153. package/dist/{work-queue-worker-Dy5FT2ak.mjs → work-queue-worker-DCzfH0d1.mjs} +4 -4
  154. package/dist/{work-queue-worker-Dy5FT2ak.mjs.map → work-queue-worker-DCzfH0d1.mjs.map} +1 -1
  155. package/dist/work-queue-worker-Taba_vcA.mjs +11 -0
  156. package/dist/{zettelkasten-Dx-63BEk.mjs → zettelkasten-Dwj67e4p.mjs} +4 -4
  157. package/dist/{zettelkasten-Dx-63BEk.mjs.map → zettelkasten-Dwj67e4p.mjs.map} +1 -1
  158. package/docker/docker-compose.yml +39 -0
  159. package/docs/auto-compact.md +31 -0
  160. package/docs/budget-advisor.md +48 -0
  161. package/docs/command-reference.md +25 -0
  162. package/docs/commands/README.md +3 -3
  163. package/docs/commands/config.md +3 -3
  164. package/docs/commands/setup.md +9 -2
  165. package/docs/commands/worker.md +2 -2
  166. package/docs/companion-projects.md +9 -0
  167. package/docs/context-preservation.md +43 -0
  168. package/docs/how-it-works.md +25 -0
  169. package/docs/install-linux.md +32 -0
  170. package/docs/install.md +56 -0
  171. package/docs/memory.md +96 -0
  172. package/docs/observations.md +58 -0
  173. package/docs/release-history.md +42 -0
  174. package/docs/rules-and-privacy.md +37 -0
  175. package/docs/search.md +169 -0
  176. package/docs/session-management.md +153 -0
  177. package/docs/session-notes.md +64 -0
  178. package/docs/skills.md +45 -0
  179. package/docs/task-bus.md +1 -2
  180. package/docs/use-cases.md +194 -0
  181. package/docs/what-you-can-ask.md +78 -0
  182. package/docs/worker-providers.md +58 -0
  183. package/docs/zettelkasten.md +37 -0
  184. package/package.json +3 -2
  185. package/plugins/productivity/skills/Tasks/SKILL.md +1 -1
  186. package/scripts/build-hooks.mjs +6 -6
  187. package/src/hooks/ts/lib/pai-paths-case.test.ts +12 -0
  188. package/src/hooks/ts/lib/pai-paths-import.test.ts +25 -0
  189. package/src/hooks/ts/lib/pai-paths.ts +5 -28
  190. package/src/hooks/ts/lib/sleep-poll-gate.test.ts +17 -1
  191. package/src/hooks/ts/lib/sleep-poll-gate.ts +21 -9
  192. package/src/hooks/ts/pre-tool-use/security-validator.test.ts +23 -0
  193. package/src/hooks/ts/pre-tool-use/security-validator.ts +1 -1
  194. package/src/hooks/ts/session-start/load-core-context.ts +2 -6
  195. package/src/hooks/ts/session-start/load-project-context.ts +1 -1
  196. package/src/hooks/ts/session-start/session-start-worker-guard.test.ts +24 -1
  197. package/dist/config-2wkz744W.mjs.map +0 -1
  198. package/dist/context-handover-cache-BOpjLsKe.mjs.map +0 -1
  199. package/dist/daemon-q3xjHwa4.mjs +0 -19
  200. package/dist/detector-C-YmZsOi.mjs +0 -3
  201. package/dist/fallback-ECiqCuh6.mjs.map +0 -1
  202. package/dist/federation-db-BZ8PyxFe.mjs +0 -3
  203. package/dist/main-resolver-vN09bkXv.mjs +0 -7
  204. package/dist/merge-CXGz5wXz.mjs +0 -3
  205. package/dist/program-JhF2GgJY.mjs.map +0 -1
  206. package/dist/query-feedback-BPHFFSu1.mjs +0 -3
  207. package/dist/registry-db-Hphlj3H4.mjs +0 -3
  208. package/dist/router-CoA8Uy1m.mjs +0 -3
  209. package/dist/run-W2rV_9j0.mjs.map +0 -1
  210. package/dist/server-B71rem4q.mjs.map +0 -1
  211. package/dist/work-queue-worker-CkShUa0z.mjs +0 -11
  212. /package/dist/{indexer-backend-DotpxHJd.mjs → indexer-backend-isSLg6yE.mjs} +0 -0
@@ -0,0 +1,153 @@
1
+ # Session Management
2
+
3
+ PAI gives you a complete picture of every Claude Code session running on your machine — live tabs in iTerm2, paused snapshots on disk, and everything in between.
4
+
5
+ ## The Core Idea: One Entry Point
6
+
7
+ Two ways in, both forgiving:
8
+
9
+ - **`pai`** (no args) — opens the **interactive picker**: type to search across projects *and* sessions, then act on the highlighted row with a single key.
10
+ - **`pai <name>`** — the universal session command when you already know the name. It does the right thing based on session state:
11
+ - **Live session** — switches the iTerm2 tab to front (no new Claude launched)
12
+ - **Otherwise** — starts a fresh Claude in the project directory, on the configured route. If a resumable transcript exists it asks `Resume it? [y/N]` first (Enter keeps fresh); `--resume` or `pai resume <name>` resume without asking; `-y` skips the question.
13
+ - **No match** — searches `~/.claude/history.jsonl`, shows a candidate picker
14
+
15
+ ```bash
16
+ pai # Interactive picker — search, then go / new / cd / finder / remove
17
+ pai aibroker # Switch to the live AIBroker tab (iTerm comes to front)
18
+ pai youdrill # Fresh youdrill session; offers to resume the last transcript
19
+ pai mdf # Free-text search across your prompt history
20
+ pai 0856d40b # Resume by UUID prefix
21
+ pai --list # Static deduped table (the old no-args behaviour)
22
+ ```
23
+
24
+ ## Daily Commands
25
+
26
+ ```bash
27
+ pai # Interactive picker (projects + sessions; search then act)
28
+ pai --list # Static deduped listing (one row per name)
29
+ pai <name> # Switch / resume / fresh — universal
30
+ pai pause # Save state checkpoint (write ## Continue to TODO.md)
31
+ pai pause all # Pause every live Claude session at once
32
+ pai end # Finalize: save state + mark session note Completed
33
+ ```
34
+
35
+ And inside Claude Code, the two slash commands that matter:
36
+
37
+ ```
38
+ /pause → write checkpoint to TODO.md, print handoff block, then type /exit
39
+ /end → same as /pause, plus marks the session note Completed
40
+ ```
41
+
42
+ ## The Interactive Picker
43
+
44
+ Run `pai` with no arguments to open a self-contained terminal selector (no `fzf` or other dependency) over a **unified, deduped list of both projects and sessions** — tagged so the two stay distinct. It's the one place to answer "where did I work on X, and take me there."
45
+
46
+ ```
47
+ pai — find a project or session
48
+ search > samba
49
+
50
+ live Chenarlier now …/Raspi/Chenarlier samba setup monster reverse proxy
51
+ project Glidr 2d …/apps/glidr claude pai research
52
+
53
+ ────────────────────────────────────────
54
+ Chenarlier ~/…/Raspi/Chenarlier
55
+ recent notes:
56
+ 10 - Samba Setup/01 - Samba Server Setup.md 1mo
57
+ 00 - Monster/00 - Monster.md 3mo
58
+ ────────────────────────────────────────
59
+ g go to tab · n new · c cd · f finder · d remove · s search · ↑↓ move · q quit
60
+ ```
61
+
62
+ **Two modes.** You start in *command mode* (single keys are actions). Press `s` (or `/`) to enter *search mode* (type a topic — it filters by name, path, **and folded-in note file/folder names**, so `samba` finds a project literally named "Chenarlier"); `Enter` or `esc` returns to command mode.
63
+
64
+ **Command keys** act immediately on the highlighted row:
65
+
66
+ | Key | Action |
67
+ |-----|--------|
68
+ | `g` | **Go to** the running iTerm2 tab (for live rows) |
69
+ | `n` | **New** Claude session in that directory (current terminal) |
70
+ | `c` | **cd** into the folder only — no Claude (your shell stays there) |
71
+ | `f` | Open the folder in **Finder** / Explorer / `xdg-open` (keeps the picker open) |
72
+ | `d` | **Remove** from PAI's list — archives the project (reversible, files untouched); asks `y/N` first |
73
+ | `s` `/` | Enter **search** mode |
74
+ | `↑↓` `j` `k` | Move the highlight |
75
+ | `q` `esc` | Quit |
76
+
77
+ `Enter` on a row takes the smart default: a live row → go to its tab, otherwise → new session.
78
+
79
+ The `c` (cd) action needs PAI's shell integration to change your shell's directory — see [Finding the Claude Binary](#finding-the-claude-binary) / `pai shell-init`. On a non-interactive terminal (piped output), `pai` falls back to the static listing automatically.
80
+
81
+ ## Static Listing
82
+
83
+ `pai --list` shows a single deduped table — one row per session name, regardless of how many snapshots exist on disk:
84
+
85
+ ```
86
+ Sessions:
87
+
88
+ # name status age project last prompt
89
+ -- ---------- ---------- -------- ---------------------------- --------------------------
90
+ 1 AIBroker live now — —
91
+ 2 PAI resumable 2m ago /…dev/ai/PAI "refactor session listing…"
92
+ 3 MDF transcript 3d ago /…MDF/Infrastruktur/Webseiten "ok so we recently had…"
93
+ ```
94
+
95
+ Status values: `live` (active iTerm tab), `resumable` (clean snapshot on disk), `transcript` (history available, not resumable), `stub` (empty or minimal).
96
+
97
+ ## Finding Sessions by Topic
98
+
99
+ `pai <topic>` first checks session names, then falls back to searching your prompt history:
100
+
101
+ ```
102
+ Sessions matching "mdf":
103
+
104
+ # id when project last matching prompt
105
+ - -------- ---------------- ----------------------------------- -------------------------
106
+ 1 6269cf64 2026-05-21 08:20 /…MDF/Infrastruktur/20 - Webseiten "ok so we recently had an order…"
107
+ 2 abe2d977 2026-02-23 08:40 /…MDF/Infrastruktur/20 - Webseiten "yes the session notes for Whazaa…"
108
+
109
+ Enter # to launch (1-2), or press Enter to cancel:
110
+ ```
111
+
112
+ Use `pai <topic> --auto` (or `-y`) to auto-pick #1. Use `pai <topic> 2` to pick directly.
113
+
114
+ ## Power User Access
115
+
116
+ The full session management namespace is still available:
117
+
118
+ ```bash
119
+ pai sessions # Live + disk listing (with more columns)
120
+ pai sessions --all # Include unnamed orphan sessions
121
+ pai sessions --all-tabs # Include shell tabs in the live section
122
+ pai sessions goto <name> # Named-session resolver (same as pai <name>)
123
+ pai sessions list # Explicit listing (same as pai sessions)
124
+ ```
125
+
126
+ ## Pausing All Sessions at Once
127
+
128
+ When you're done for the day and have multiple Claude windows open:
129
+
130
+ ```bash
131
+ pai pause all # send "pause session" to every live Claude pane
132
+ pai pause all --dry-run # preview what would be sent
133
+ pai pause all --exit # also send /exit after each session saves state
134
+ ```
135
+
136
+ AIBroker must be running for this to work. Shell tabs (bare zsh, SSH panes) are automatically skipped — only Claude Code panes receive the pause command. The count of skipped tabs is printed to stderr.
137
+
138
+ ## /pause and /end Inside Claude Code
139
+
140
+ Type `/pause` or `/end` from inside an active Claude Code session (not from a shell — these are Claude Code slash commands, not CLI commands):
141
+
142
+ - `/pause` — Claude writes a `## Continue` block to the project's `TODO.md`, prints a handoff summary with the session ID, then tells you to type `/exit`. The next session starts by reading that TODO.md block and picking up exactly where you left off.
143
+ - `/end` — Same as `/pause`, plus Claude marks the session note as Completed and writes a final summary. Use this when you're genuinely done with a topic, not just pausing mid-task.
144
+
145
+ After either command, type `/exit` to exit Claude Code cleanly.
146
+
147
+ ## Why /exit and Not Ctrl+C
148
+
149
+ Ctrl+C or closing the terminal kills the Claude Code process abruptly. The session note generation hook never fires, the checkpoint is not written, and the session cannot be resumed with `claude --resume`.
150
+
151
+ `/exit` sends a clean shutdown signal. Claude Code runs its Stop and Session End hooks, which trigger PAI to write the session note, push the final summary to the daemon, and save a resumable snapshot. The difference in recovery quality between a clean `/exit` and a Ctrl+C is significant for long sessions.
152
+
153
+ If you do accidentally close a terminal, use `pai sessions --all` to find the orphaned transcript. The `/reconstruct` skill can retroactively generate a session note from it.
@@ -0,0 +1,64 @@
1
+ # Automatic Session Notes
2
+
3
+ ## Automatic Session Notes — by Topic
4
+
5
+ PAI's headline feature: **every session is automatically documented.** No manual note-taking, no "pause session" commands, no forgetting to save what you did.
6
+
7
+ When you work, a background daemon watches your session **continuously**. Every time Claude's context compacts — which happens automatically as the conversation grows — the daemon reads the JSONL transcript, combines it with your git history, and spawns a headless Claude process to write a structured session note. Not just at session end. Midway through your work, while you're still coding. The notes build up in real time as you go — what was built, what decisions were made, what problems were hit, what's left to do.
8
+
9
+ **When you change topics mid-session, PAI creates a new note.** If you start the day debugging audio, then pivot to a Flutter rewrite, you get two notes — not one giant file mixing unrelated work:
10
+
11
+ ```
12
+ Notes/2026/03/
13
+ 0001 - 2026-03-23 - Phase 1 Research and Architecture.md
14
+ 0002 - 2026-03-24 - Background Audio and iOS Conflicts.md
15
+ 0003 - 2026-03-24 - Flutter Rewrite with Whisper.md ← auto-split, same day
16
+ ```
17
+
18
+ Topic detection uses Jaccard word similarity between the new summary's topic and the existing note's title. Below 30% overlap = new note.
19
+
20
+ **Model tiering:** Opus for final session summaries (best quality, runs once). Sonnet for mid-session checkpoints (good quality, runs on compaction). All using your Max plan — no API charges.
21
+
22
+ This is not a template or a skeleton. These are real notes with build error chronologies, architectural decisions with rationale, code snippets, and "what was tried and failed" sections. The kind of notes you'd write yourself if you had time.
23
+
24
+ ## Automatic Session Notes
25
+
26
+ PAI automatically writes structured session notes after every session ends — no manual journaling required. The daemon spawns a headless Claude CLI process (using your Max plan, not the API) to summarize the JSONL conversation transcript combined with recent git history.
27
+
28
+ ### What Gets Generated
29
+
30
+ Each session note contains:
31
+
32
+ - **Work Done** — concrete description of what was accomplished
33
+ - **Key Decisions** — choices made and their rationale
34
+ - **Known Issues** — bugs found, blockers, or open questions
35
+ - **Next Steps** — where to pick up in the next session
36
+
37
+ The summarizer uses tiered model selection based on the trigger:
38
+
39
+ | Trigger | Model | Timeout | JSONL Limit |
40
+ |---------|-------|---------|-------------|
41
+ | Session end (Stop hook) | Opus | 5 minutes | 500K bytes |
42
+ | Auto-compaction (PreCompact hook) | Sonnet | 2 minutes | 200K bytes |
43
+
44
+ ### Topic-Based Note Splitting
45
+
46
+ When a session covers multiple distinct topics, PAI creates separate notes rather than one long note for the whole session. The summarizer outputs a `TOPIC:` line describing the subject of the current work. PAI compares this against the existing note title using Jaccard word similarity — when similarity falls below 30%, a new note is created automatically.
47
+
48
+ Notes within the same day are numbered sequentially: `0042 - 2026-03-24 - Session Name.md`, `0043 - 2026-03-24 - Different Topic.md`, and so on.
49
+
50
+ ### One Note Per Session
51
+
52
+ Each compaction within a session updates the existing note rather than creating a new one. The 30-minute cooldown between summaries prevents redundant updates. Stop hook triggers bypass the cooldown with a force flag to ensure the final state is always captured.
53
+
54
+ ### Garbage Title Filter
55
+
56
+ Session note titles are validated before creation. Over 20 patterns are rejected, including: task notification strings, `[object Object]`, hex hashes, bare numbers, and other non-descriptive artifacts that can appear in session transcripts. Titles must describe actual work done and are capped at 60 characters.
57
+
58
+ ### Finding the Claude Binary
59
+
60
+ The daemon runs under launchd with a minimal PATH that does not include `~/.local/bin/`. PAI resolves the Claude CLI binary by checking `~/.local/bin/claude` first, then falling back to PATH lookup, before spawning headless summarization processes.
61
+
62
+ ### Stripping the API Key
63
+
64
+ When spawning headless Claude CLI processes for summarization, the daemon strips `ANTHROPIC_API_KEY` from the subprocess environment. This forces the spawned process to authenticate via your Max plan (free) rather than using the API key (billable). Without this, every automatic session note would incur API charges.
package/docs/skills.md ADDED
@@ -0,0 +1,45 @@
1
+ # Skills
2
+
3
+ PAI ships 22 skills — slash commands that activate specialized workflows. Each responds to natural language triggers as well as the `/command` syntax.
4
+
5
+ ## Productivity
6
+
7
+ | Skill | Trigger | What it does |
8
+ |-------|---------|-------------|
9
+ | `/advisor` | "budget mode", "save budget", "go easy on the budget" | Manage budget-aware model tiering for subagents |
10
+ | `/plan` | "plan my week", "what should I focus on", "priorities" | Plan tomorrow/week/month based on open tasks and calendar |
11
+ | `/review` | "review my week", "what did I do", "recap" | Daily/weekly/monthly review of work accomplished |
12
+ | `/journal` | "journal", "note to self", "capture this thought" | Create, read, or search personal journal entries |
13
+ | `/share` | "share on LinkedIn", "tweet about", "post to Bluesky" | Generate social media posts about completed work |
14
+
15
+ ## Session Management
16
+
17
+ | Skill | Trigger | What it does |
18
+ |-------|---------|-------------|
19
+ | `/sessions` | "list sessions", "where was I working" | Navigate sessions, projects, switch working context |
20
+ | `/route` | "what project is this", "tag this session" | Detect which PAI project the current session belongs to |
21
+ | `/name` | "name this session", "rename session" | Name or rename the current session |
22
+ | `/search-history` | "search history", "find past", "what did we do" | Search past sessions and previous work by keyword |
23
+ | `/consolidate` | "consolidate notes", "clean up notes", "merge duplicates" | Merge duplicate session notes, fix titles, renumber |
24
+ | `/reconstruct` | "reconstruct sessions", "backfill session notes" | Retroactively create notes from JSONL transcripts and git history |
25
+
26
+ ## Obsidian Vault
27
+
28
+ | Skill | Trigger | What it does |
29
+ |-------|---------|-------------|
30
+ | `/vault-context` | "morning briefing", "load vault context" | Load Obsidian vault context for a briefing |
31
+ | `/vault-connect` | "connect X and Y", "how does X relate to Y" | Find connections between two topics in the vault |
32
+ | `/vault-emerge` | "what's emerging", "find patterns", "themes in vault" | Surface emerging themes and clusters |
33
+ | `/vault-orphans` | "find orphans", "unlinked notes" | Find and reconnect orphaned notes with zero inbound links |
34
+ | `/vault-trace` | "trace idea", "how did X evolve", "idea history" | Trace the evolution of an idea across vault notes over time |
35
+
36
+ ## Tools & System
37
+
38
+ | Skill | Trigger | What it does |
39
+ |-------|---------|-------------|
40
+ | `/whisper` | "add whisper rule", "show whisper rules" | Manage persistent behavioral constraints injected on every prompt |
41
+ | `/research` | "do research", "extract wisdom", "analyze content" | Web research, content extraction, and analysis via parallel agents |
42
+ | `/art` | "create diagram", "flowchart", "visualize" | Create visual content, diagrams, flowcharts, and AI-generated images |
43
+ | `/story` | "explain this as a story", "create story explanation" | Create numbered narrative story explanations of any content |
44
+ | `/observability` | "start observability", "monitor agents" | Start, stop, or check the multi-agent observability dashboard |
45
+ | `/createskill` | "create skill", "validate skill" | Create, validate, update, or canonicalize a PAI skill |
package/docs/task-bus.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  File a task from your phone. A session picks it up, does the work, and ticks it off.
4
4
 
5
- This document is the setup guide. For why the design splits the way it does, see
6
- `Notes/docs/task-bus.md`.
5
+ This document is the setup guide.
7
6
 
8
7
  ---
9
8
 
@@ -0,0 +1,194 @@
1
+ # PAI Knowledge OS - Use Cases
2
+
3
+
4
+ ## 1. Solo Developer - Building a SaaS Product
5
+
6
+ ### The Person
7
+
8
+ Alex builds a project management SaaS solo. Alternates between frontend (React), backend (Node.js), infrastructure (AWS), and customer support. Uses Claude Code 8-10 hours a day.
9
+
10
+ ### Before PAI
11
+
12
+ Every morning, Alex spends 20 minutes re-explaining the project to Claude: "We're building a PM tool, here's the stack, here's where we left off on the notification system, the database schema looks like this..." When context compaction hits mid-afternoon, another 15 minutes gone. Multiply by 250 working days: **145 hours per year re-explaining context**.
13
+
14
+ ### After PAI
15
+
16
+ Alex says "Go" and Claude reads the TODO.md continuation prompt. It knows the project, the stack, the current sprint, and what broke yesterday. When compaction hits, PAI's relay preserves state automatically. Alex's weekly review ("review my week") generates a narrative of everything accomplished - useful for investor updates.
17
+
18
+ **Key features used:** Session continuity, context preservation, project registry, plan skill, review skill
19
+
20
+ ---
21
+
22
+ ## 2. Team Lead - Managing Multiple Codebases
23
+
24
+ ### The Person
25
+
26
+ Jordan manages 5 microservices, 3 frontend apps, and a shared library. Switches between projects 10-15 times per day. Has 3 junior developers asking questions about architecture decisions made months ago.
27
+
28
+ ### Before PAI
29
+
30
+ Jordan cannot remember which session had the discussion about the event bus architecture. The junior dev asks "why did we choose RabbitMQ over Kafka?" and Jordan has to dig through Slack, Notion, and git commit messages to reconstruct the reasoning.
31
+
32
+ ### After PAI
33
+
34
+ Jordan searches: "Search your memory for message queue decision." PAI finds the session from 6 weeks ago where the tradeoffs were discussed, including the specific latency requirements that ruled out Kafka. The junior dev gets a complete answer in 30 seconds.
35
+
36
+ **Key features used:** Memory search, cross-project sessions, session history, project registry, observation capture
37
+
38
+ ---
39
+
40
+ ## 3. Researcher - Academic Paper Writing
41
+
42
+ ### The Person
43
+
44
+ Dr. Chen writes papers using Claude Code for LaTeX editing, data analysis scripts, and literature review organization. Works on 3 papers simultaneously with different co-authors.
45
+
46
+ ### Before PAI
47
+
48
+ Each paper requires different context: methodologies, related work, reviewer comments. Switching between papers means a 10-minute context dump each time. Literature connections between papers are tracked manually in a spreadsheet.
49
+
50
+ ### After PAI
51
+
52
+ Each paper is a PAI project. "Which project am I in?" auto-detects from the directory. Dr. Chen's Obsidian vault is indexed by PAI's Zettelkasten system. "Find surprising connections to this note on attention mechanisms" discovers a relevant paper in the NLP project that applies to the computer vision paper - a connection Dr. Chen missed.
53
+
54
+ **Key features used:** Project registry, Zettelkasten (surprise, themes), session management, vault intelligence
55
+
56
+ ---
57
+
58
+ ## 4. Consultant - Client Project Rotation
59
+
60
+ ### The Person
61
+
62
+ Maria is a freelance developer working with 6 clients simultaneously. Each client has different tech stacks, coding standards, deployment processes, and communication preferences.
63
+
64
+ ### Before PAI
65
+
66
+ Monday: Maria works on Client A's Django project. Tuesday: Client B's React app. By Wednesday, she can't remember Client A's specific deployment process. She keeps a folder of client context documents that she manually pastes into Claude sessions.
67
+
68
+ ### After PAI
69
+
70
+ Maria's 6 clients are 6 PAI projects. "What's the deployment process for Client A?" - PAI finds it in session notes from last week. Observations capture every deployment command she ran, so the process is reconstructible even if she never wrote it down. Weekly reviews per client make invoicing easy.
71
+
72
+ **Key features used:** Multi-project management, observation capture, memory search, review skill, session history
73
+
74
+ ---
75
+
76
+ ## 5. Open Source Maintainer - Community Management
77
+
78
+ ### The Person
79
+
80
+ Sam maintains a popular open source library with 5,000 GitHub stars, 200+ issues, and regular pull request reviews.
81
+
82
+ ### Before PAI
83
+
84
+ Contributors ask the same architectural questions repeatedly. "Why is this implemented this way?" Sam re-explains the same reasoning in GitHub issues, Discord, and PR reviews. Design decisions from 8 months ago are lost in conversation history.
85
+
86
+ ### After PAI
87
+
88
+ Sam's design decisions are captured as observations. "Search your memory for the decision about the plugin API" finds the session where the API was designed, including rejected alternatives and the reasoning. Sam uses the Share skill to generate a technical blog post about the architecture for the project's documentation.
89
+
90
+ **Key features used:** Observation capture (decisions), memory search, share skill, review skill
91
+
92
+ ---
93
+
94
+ ## 6. Job Seeker - Application Management
95
+
96
+ ### The Person
97
+
98
+ Lisa is a senior engineer looking for her next role. She's applying to 15 companies, each requiring tailored cover letters and application tracking.
99
+
100
+ ### Before PAI
101
+
102
+ Lisa tracks applications in a spreadsheet. Each cover letter requires manually adapting her experience to the job description. Follow-up timing is tracked with calendar reminders.
103
+
104
+ ### After PAI
105
+
106
+ With SeriousLetter MCP (companion), Lisa's applications are managed through Claude. PAI remembers each company's context: "What did I tell Acme Corp about my distributed systems experience?" The journal skill tracks her reflections after interviews. The review skill generates weekly job search summaries.
107
+
108
+ **Key features used:** SeriousLetter integration, journal skill, review skill, project management, memory search
109
+
110
+ ---
111
+
112
+ ## 7. Content Creator - Technical Writing
113
+
114
+ ### The Person
115
+
116
+ Dev writes a weekly technical newsletter and produces YouTube tutorials. Uses Claude Code to help draft content, write code examples, and edit scripts.
117
+
118
+ ### Before PAI
119
+
120
+ Dev cannot easily find previous content to avoid repetition. "Did I already write about rate limiting?" requires manually searching through 50+ newsletter editions. Code examples are lost in old Claude sessions.
121
+
122
+ ### After PAI
123
+
124
+ "Search your memory for rate limiting" instantly shows what Dev has written. The Share skill generates newsletter drafts and social media posts from recent work. Code examples from any session are retrievable. "Review my month" generates a content roundup.
125
+
126
+ **Key features used:** Memory search, share skill (LinkedIn, X, Bluesky), review skill, session history
127
+
128
+ ---
129
+
130
+ ## 8. Knowledge Worker - Building a Second Brain
131
+
132
+ ### The Person
133
+
134
+ Pat is a product manager who uses Obsidian to track market research, user interviews, competitive analysis, and product strategy. Has 2,000+ notes accumulated over 3 years.
135
+
136
+ ### Before PAI
137
+
138
+ Obsidian search is keyword-only. Pat knows there's a connection between the user interview from March and the competitive analysis from June, but can't find it. Notes accumulate but connections between them are manual.
139
+
140
+ ### After PAI
141
+
142
+ PAI's Zettelkasten module indexes Pat's vault. "What themes are emerging in my vault?" detects clusters of related notes forming around "AI-first workflows." "Suggest connections for this note" proposes 5 links Pat never considered. "How healthy is my vault?" reveals 47 orphaned notes that need integration.
143
+
144
+ **Key features used:** Zettelkasten (all 6 operations), vault indexing, semantic search, themes, health
145
+
146
+ ---
147
+
148
+ ## 9. Security Auditor - Compliance and Penetration Testing
149
+
150
+ ### The Person
151
+
152
+ Robin conducts security audits for enterprise clients. Each engagement produces hundreds of findings, code reviews, and remediation recommendations.
153
+
154
+ ### Before PAI
155
+
156
+ Previous audit findings are buried in PDF reports. When Robin encounters a similar vulnerability pattern at a new client, there's no quick way to reference how it was documented and remediated before.
157
+
158
+ ### After PAI
159
+
160
+ Each audit is a PAI project. "Search your memory for SQL injection remediation" finds findings from previous audits, including specific remediation code. Observations automatically capture every security-relevant command and finding. Session summaries create audit trails. The research skill structures vulnerability analysis.
161
+
162
+ **Key features used:** Project registry, observation capture, memory search, session summaries, research skill
163
+
164
+ ---
165
+
166
+ ## 10. AI-First Company - Engineering Team
167
+
168
+ ### The Person
169
+
170
+ A 12-person startup where every engineer uses Claude Code daily. The CTO wants institutional knowledge to survive employee turnover and ensure architectural decisions are documented.
171
+
172
+ ### Before PAI
173
+
174
+ When Engineer A leaves, their Claude Code sessions (and all the architectural reasoning) vanish. The replacement spends 2 months reconstructing context. Design decisions are scattered across Slack, Notion, and individual engineers' heads.
175
+
176
+ ### After PAI
177
+
178
+ Every engineer runs PAI. Architectural decisions are automatically captured as observations. Memory search works across all projects. When Engineer A leaves, their session history, observations, and decision trail remain searchable. New engineers search "why did we choose GraphQL" and get the complete reasoning. The review skill generates team-wide weekly summaries for the CTO.
179
+
180
+ **Key features used:** Multi-project registry, observation capture (decisions), memory search (cross-project), review skill, session continuity
181
+
182
+ ---
183
+
184
+ ## Common Patterns Across Use Cases
185
+
186
+ | Pattern | PAI Feature | Time Saved |
187
+ |---------|------------|------------|
188
+ | Re-explaining context every session | Session continuity, context preservation | 15-30 min/session |
189
+ | Finding past decisions | Observation capture, memory search | Hours/week |
190
+ | Tracking work across projects | Project registry, cross-project search | Hours/week |
191
+ | Creating content from work | Share, Review skills | 2-4 hours/week |
192
+ | Maintaining knowledge connections | Zettelkasten operations | Manual impossible |
193
+ | Surviving context compaction | Two-stage relay | 15 min/compaction |
194
+ | Onboarding new team members | Searchable institutional memory | Weeks/hire |
@@ -0,0 +1,78 @@
1
+ # What You Can Ask Claude
2
+
3
+ ## Searching Your Memory
4
+
5
+ - "Search your memory for authentication" — finds past sessions about auth, even with different words
6
+ - "What do you know about the Whazaa project?" — retrieves full project context instantly
7
+ - "Find where we discussed the database migration" — semantic search finds it even if you phrase it differently
8
+ - "Search your memory for that Chrome browser issue" — keyword and meaning-based search combined
9
+
10
+ ## Managing Projects
11
+
12
+ - "Show me all my projects" — lists everything PAI tracks with stats
13
+ - "Which project am I in?" — auto-detects from your current directory
14
+ - "What's the status of the PAI project?" — full project details, sessions, last activity
15
+ - "How many sessions does Whazaa have?" — project-level session history
16
+
17
+ ## Navigating Sessions
18
+
19
+ - "List my recent sessions" — shows what you've been working on across all projects
20
+ - "What did we do in session 42?" — retrieves any specific session by number
21
+ - "What were we working on last week?" — Claude knows, without you re-explaining
22
+ - "Clean up my session notes" — auto-names unnamed sessions and organizes by date
23
+
24
+ ## Reviewing Your Work
25
+
26
+ - "Review my week" — synthesizes session notes, git commits, and completed tasks into a themed narrative
27
+ - "What did I do today?" — daily review across all projects
28
+ - "Journal this thought" — capture freeform reflections with timestamps
29
+ - "Plan my week" — forward-looking priorities based on open TODOs and recent activity
30
+ - "What themes are emerging in my work?" — spot patterns across sessions and projects
31
+
32
+ ## Sharing Your Work
33
+
34
+ - "Share on LinkedIn today" — generates a professional post about what you shipped, with real numbers and technical substance
35
+ - "Tweet about the vault migration" — punchy X/Twitter post or thread, with option to post directly
36
+ - "Share on Bluesky this week" — conversational technical post for the Bluesky audience
37
+ - Platform-aware formatting: LinkedIn gets hashtags and narrative, X gets threads and hooks, Bluesky gets conversational tone
38
+
39
+ ## Tracking Your Activity
40
+
41
+ - "What changes did I make to the daemon today?" — automatic observation capture tracks every tool call
42
+ - "Show me all decisions from the last session" — observations are classified: decision, bugfix, feature, refactor, discovery, change
43
+ - "What files did I modify in the PAI project this week?" — searchable timeline of every edit, commit, and search
44
+ - "Show observation stats" — totals, breakdowns by type and project, with visual bar charts
45
+
46
+ ## Continuing Where You Left Off
47
+
48
+ - "Go" — reads your TODO.md continuation prompt and picks up exactly where the last session stopped
49
+ - "What was I working on?" — progressive context injection loads recent observations at session start
50
+ - "Continue the daemon refactor" — session summaries give Claude full context without re-explaining
51
+ - "/reconstruct" — retroactively creates session notes from JSONL transcripts and git history when automatic capture missed a session
52
+
53
+ ## Keeping Things Safe
54
+
55
+ - "Back up everything" — creates a timestamped backup of all your data
56
+ - "How's the system doing?" — checks daemon health, index stats, embedding coverage
57
+
58
+ ## Obsidian Integration
59
+
60
+ - "Sync my Obsidian vault" — updates your linked vault with the latest notes
61
+ - "Open my notes in Obsidian" — launches Obsidian with your full knowledge graph
62
+
63
+ ## Zettelkasten Intelligence
64
+
65
+ - "Explore notes linked to PAI" — follow trains of thought through wikilink chains
66
+ - "Find surprising connections to this note" — discover semantically similar but graph-distant notes
67
+ - "What themes are emerging in my vault?" — detect clusters of related notes forming new ideas
68
+ - "How healthy is my vault?" — structural audit: dead links, orphans, disconnected clusters
69
+ - "Suggest connections for this note" — proactive link suggestions using semantic + graph signals
70
+ - "What does my vault say about knowledge management?" — use the vault as a thinking partner
71
+
72
+ ## Budget Management
73
+
74
+ - "How much budget do I have left?" — shows current weekly usage and advisor mode
75
+ - "Go easy on the budget" — switches to conservative mode (prefer haiku subagents)
76
+ - "Lock it down" — switches to critical mode (minimize all token usage)
77
+ - "Go full power" — switches to normal mode (no constraints)
78
+ - "Back to auto" — resets to auto mode (derives from weekly budget percentage)
@@ -0,0 +1,58 @@
1
+ # Worker Providers — Run the Fleet Anywhere
2
+
3
+ **Read the story: [Provider Independence — how I freed my stack from a single vendor in one day](provider-independence.md).**
4
+
5
+ Only the outer orchestrator session runs on Anthropic. Every worker PAI spawns — research, drafting, implementation, review, spotchecks — runs on a managed provider you choose. The same provider layer carries the daemon's background calls and the session picker, so the whole stack moves together.
6
+
7
+ ## Why
8
+
9
+ - **Vendor independence.** Any provider that speaks the Anthropic Messages protocol is a registry entry: models, key file, price tier. OpenAI-protocol providers work through a built-in translating proxy. Switching is configuration, not surgery.
10
+ - **Cost control.** Parallel work is a commodity; it should not burn your premium seat. Workers bill against their own provider, and cheap classes resolve to the provider's fast model automatically.
11
+ - **No lock-in to one orchestrator vendor.** Sessions run on the active provider too — the picker launches through it, and `pai worker fallback` extends that machine-wide.
12
+ - **Survives orchestrator outages.** Workers carry their own provider credentials, so a quota freeze or outage on the vendor seat does not stop delegated work.
13
+
14
+ ## How
15
+
16
+ - **Managed providers.** `pai worker providers add` registers one, `pai worker providers use <name>` switches the fleet, `pai worker off` disables routing entirely (the Agent tool runs on Anthropic again), `pai worker on` re-enables it. The reserved name `anthropic` needs no `add` step — it's Claude Code's own login; `pai worker providers use anthropic` switches straight to it.
17
+ - **Start the harness itself on any provider.** `pai launch` (numbered picker, or `--provider <name> [--model <model>]`) starts a fresh Claude Code session on any provider/model in `workers.yaml` — a running session can't switch providers (base URL and auth are fixed at start), so this always begins a new one. Claude Code's own `/model` only lists the current endpoint's models; `pai launch --list` (or the `/providers` skill, from inside a session) lists every provider configured here.
18
+ - **Classes route work to the right model.** `--class` picks the provider and model for the job: `draft`, `plan`, `implement`, `review`, `research`, `spotcheck`, `simple`, `complex`, `image`. `pai worker classes` shows and edits the mapping; `--provider` / `--model` override for a single run.
19
+ - **Every worker spawn stands alone.** The orchestrator's API key is stripped and the spawn gets the provider's base URL, token and model ids instead — proven live: a worker answers with the parent's credentials gone. No inherited billing, no fallback to the vendor login.
20
+ - **The route is pinned, not inherited.** Claude Code's user settings outrank the process env, so a machine-wide proxy route (a `caveman` install, a `pai worker fallback`) would otherwise swallow a worker's base URL and send its provider token to the wrong endpoint. Every spawn repeats its route with `--settings`, which outranks user settings; native-Anthropic workers are pinned to `api.anthropic.com`, or launched as `caveman claude` when `workers.caveman: true` is set in `config.yaml`. Details: [docs/worker.md](worker.md), "What a worker is".
21
+ - **One file to configure it.** Providers, per-role model ids and class routing live in one hand-editable `workers.yaml` — adding a provider (Anthropic-compatible, OpenAI-compatible, or local) is a YAML edit, never code. Full reference: [docs/workers-config.md](workers-config.md).
22
+
23
+ ```yaml
24
+ active: anthropic
25
+ providers:
26
+ anthropic:
27
+ builtin: true # Claude Code's own login
28
+ models: { default: claude-sonnet-5, fast: claude-haiku-4-5-20251001 }
29
+ glm:
30
+ url: https://api.z.ai/api/anthropic
31
+ key: "<your-api-key>" # or key_file: <path to a 0600 file>
32
+ tier: 3
33
+ models: { default: glm-5.3[1m], fast: glm-5.3-flash }
34
+ classes:
35
+ implement: anthropic
36
+ spotcheck: anthropic/fast # cheap classes default to the fast model
37
+ ```
38
+
39
+ ## What
40
+
41
+ ```bash
42
+ pai worker run -p '<task>' --class implement # one worker on a provider
43
+ pai worker ps # this session's workers (--all: every one)
44
+ pai worker follow <id> # live transcript of one worker
45
+ pai worker pane # shared follow pane for the session
46
+ pai worker replay <id> # transcript of a finished or running worker
47
+ pai worker say <id> <text> # message a running worker mid-run
48
+ pai worker handoff '<json>' # from inside a worker: report to the parent
49
+ pai worker merge <id> # merge the worker's branch back, drop the worktree
50
+ pai worker wait <id>... # block until workers finish (never sleep-loop)
51
+ pai worker watch # ps refreshed every 2 seconds
52
+ ```
53
+
54
+ The rest of the surface — `discard`, `resume`, `controls`, `proxy`, `mcp`, `model`, `providers`, `classes` — is in `pai help worker` and [docs/commands/worker.md](commands/worker.md).
55
+
56
+ ![Workers in the statusline](images/workers.png)
57
+
58
+ Get started in three copy-paste steps: **[docs/provider-independence.md](provider-independence.md)**. For the depth — provider registry, statusline instrumentation, seam patches, current limits — see **[docs/provider-abstraction.md](provider-abstraction.md)**.
@@ -0,0 +1,37 @@
1
+ # Zettelkasten Intelligence
2
+
3
+ PAI implements Niklas Luhmann's Zettelkasten principles as six computational operations on your Obsidian vault.
4
+
5
+ ## How it works
6
+
7
+ PAI indexes your entire vault — following symlinks, deduplicating by inode, parsing every link — and builds a graph database alongside semantic embeddings. Six tools then operate on this dual representation:
8
+
9
+ | Tool | What it does |
10
+ |------|-------------|
11
+ | `pai zettel explore` | Follow trains of thought through link chains (Folgezettel traversal) |
12
+ | `pai zettel surprise` | Find notes that are semantically close but far apart in the link graph |
13
+ | `pai zettel converse` | Ask questions and let the vault "talk back" with unexpected connections |
14
+ | `pai zettel themes` | Detect emerging clusters of related notes across folders |
15
+ | `pai zettel health` | Structural audit — dead links, orphans, disconnected clusters, health score |
16
+ | `pai zettel suggest` | Proactive connection suggestions combining semantic similarity, tags, and graph proximity |
17
+
18
+ All tools work as CLI commands (`pai zettel <command>`) and MCP tools (`zettel_*`) accessible through the daemon.
19
+
20
+ ## Vault Indexing
21
+
22
+ The vault indexer follows symlinks (critical for vaults built on symlinks), deduplicates files by inode to handle multiple paths to the same file, and builds a complete link graph with Obsidian-compatible shortest-match resolution.
23
+
24
+ All link types are parsed and resolved:
25
+
26
+ | Syntax | Type | Example |
27
+ |--------|------|---------|
28
+ | `[[Note]]` | Wikilink | `[[Daily Note]]`, `[[Note\|alias]]`, `[[Note#heading]]` |
29
+ | `![[file]]` | Embed | `![[diagram.png]]`, `![[template]]` |
30
+ | `[text](path.md)` | Markdown link | `[see here](notes/idea.md)`, `[ref](note.md#section)` |
31
+ | `![alt](file)` | Markdown embed | `![photo](assets/img.jpg)` |
32
+
33
+ External URLs (`https://`, `mailto:`, etc.) are excluded — only relative paths are treated as vault connections. URL-encoded paths (e.g. `my%20note.md`) are decoded automatically.
34
+
35
+ - Full index: ~10 seconds for ~1,000 files
36
+ - Incremental: ~2 seconds (hash-based change detection)
37
+ - Runs automatically via the daemon scheduler