@tekmidian/pai 0.9.16 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -2
- package/dist/cli/index.mjs +987 -71
- package/dist/cli/index.mjs.map +1 -1
- package/dist/hooks/stop-hook.mjs +69 -0
- package/dist/hooks/stop-hook.mjs.map +2 -2
- package/package.json +1 -1
- package/src/hooks/ts/stop/stop-hook.ts +80 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# PAI Knowledge OS — v0.
|
|
1
|
+
# PAI Knowledge OS — v0.10.0
|
|
2
2
|
|
|
3
3
|
Claude Code has a memory problem. Every new session starts cold — no idea what you built yesterday, what decisions you made, or where you left off. PAI fixes this.
|
|
4
4
|
|
|
@@ -295,6 +295,118 @@ All hooks are TypeScript compiled to `.mjs` modules. They run as separate proces
|
|
|
295
295
|
|
|
296
296
|
---
|
|
297
297
|
|
|
298
|
+
## Session Management
|
|
299
|
+
|
|
300
|
+
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.
|
|
301
|
+
|
|
302
|
+
### The Core Idea: Think in Topics
|
|
303
|
+
|
|
304
|
+
The user's mental model is simple: "I did something on a given subject. Where was I working on it? Let me continue."
|
|
305
|
+
|
|
306
|
+
PAI v0.10.0 is built around this. You think in **topics**, not project names or session UUIDs. PAI handles the lookup.
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
pai mdf # Find every session where you worked on MDF
|
|
310
|
+
pai solar panels # Free-text search across your prompt history
|
|
311
|
+
pai 0856d40b # Resume by UUID prefix (from pai sessions)
|
|
312
|
+
pai # Show all recent sessions (interactive picker)
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
When you type `pai mdf`, PAI checks:
|
|
316
|
+
1. Is "mdf" a named session in the catalog? → launch immediately, no picker
|
|
317
|
+
2. Is "mdf" a UUID prefix? → direct filesystem resume
|
|
318
|
+
3. Otherwise → grep `~/.claude/history.jsonl` for matching prompts, show candidate list, you pick a number
|
|
319
|
+
|
|
320
|
+
The picked session resolves to the best resumable snapshot in the same project directory. PAI probes `claude --resume` automatically. If the snapshot is stale, it starts a fresh Claude in the same directory.
|
|
321
|
+
|
|
322
|
+
### Daily Verbs
|
|
323
|
+
|
|
324
|
+
The commands you'll use every day:
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
pai # Recent sessions picker (live + disk)
|
|
328
|
+
pai <topic> # Find + launch session by topic/keyword/UUID
|
|
329
|
+
pai cd <name> # cd to a project directory (no Claude launch)
|
|
330
|
+
pai pause # Save state checkpoint (write ## Continue to TODO.md)
|
|
331
|
+
pai pause all # Pause every live Claude session at once
|
|
332
|
+
pai end # Finalize: save state + mark session note Completed
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
And inside Claude Code, the two slash commands that matter:
|
|
336
|
+
|
|
337
|
+
```
|
|
338
|
+
/pause → write checkpoint to TODO.md, print handoff block, then type /exit
|
|
339
|
+
/end → same as /pause, plus marks the session note Completed
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Finding Sessions
|
|
343
|
+
|
|
344
|
+
`pai` (no args) shows two sections:
|
|
345
|
+
|
|
346
|
+
**Live Sessions** — pulled from AIBroker in real time. One row per active iTerm2 pane running Claude Code. Columns: `#`, `id`, `name`, `at prompt`.
|
|
347
|
+
|
|
348
|
+
**Recent Sessions** — disk scan of `~/.claude/projects/`, sorted by last-modified.
|
|
349
|
+
|
|
350
|
+
`pai <topic>` searches your prompt history in `~/.claude/history.jsonl`, groups results by session, and shows a table:
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
Sessions matching "mdf":
|
|
354
|
+
|
|
355
|
+
# id when project last matching prompt
|
|
356
|
+
- -------- ---------------- ----------------------------------- -------------------------
|
|
357
|
+
1 6269cf64 2026-05-21 08:20 /…MDF/Infrastruktur/20 - Webseiten "ok so we recently had an order…"
|
|
358
|
+
2 abe2d977 2026-02-23 08:40 /…MDF/Infrastruktur/20 - Webseiten "yes the session notes for Whazaa…"
|
|
359
|
+
|
|
360
|
+
Enter # to launch (1-2), or press Enter to cancel:
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Type the number and press Enter. PAI launches Claude, resumes if possible, starts fresh if not.
|
|
364
|
+
|
|
365
|
+
Use `pai <topic> --auto` (or `-y`) to auto-pick #1 without the prompt. Use `pai <topic> 2` to pick #2 directly.
|
|
366
|
+
|
|
367
|
+
### Power User Access
|
|
368
|
+
|
|
369
|
+
The full session management namespace is still available for power users:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
pai sessions # Live + disk listing (same as bare pai, with more columns)
|
|
373
|
+
pai sessions --all # Include unnamed orphan sessions
|
|
374
|
+
pai sessions --all-tabs # Include shell tabs in the live section
|
|
375
|
+
pai sessions goto <name> # Named-session resolver (same as pai <name>)
|
|
376
|
+
pai sessions list # Explicit listing (same as pai sessions)
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Pausing All Sessions at Once
|
|
380
|
+
|
|
381
|
+
When you're done for the day and have multiple Claude windows open:
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
pai pause all # send "pause session" to every live Claude pane
|
|
385
|
+
pai pause all --dry-run # preview what would be sent
|
|
386
|
+
pai pause all --exit # also send /exit after each session saves state
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
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.
|
|
390
|
+
|
|
391
|
+
### /pause and /end Inside Claude Code
|
|
392
|
+
|
|
393
|
+
Type `/pause` or `/end` from inside an active Claude Code session (not from a shell — these are Claude Code slash commands, not CLI commands):
|
|
394
|
+
|
|
395
|
+
- `/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.
|
|
396
|
+
- `/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.
|
|
397
|
+
|
|
398
|
+
After either command, type `/exit` to exit Claude Code cleanly.
|
|
399
|
+
|
|
400
|
+
### Why /exit and Not Ctrl+C
|
|
401
|
+
|
|
402
|
+
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`.
|
|
403
|
+
|
|
404
|
+
`/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.
|
|
405
|
+
|
|
406
|
+
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.
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
298
410
|
## Automatic Session Notes
|
|
299
411
|
|
|
300
412
|
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.
|
|
@@ -801,7 +913,7 @@ External URLs (`https://`, `mailto:`, etc.) are excluded — only relative paths
|
|
|
801
913
|
|
|
802
914
|
## Release History
|
|
803
915
|
|
|
804
|
-
|
|
916
|
+
31 releases shipped from v0.7.2 to v0.10.0 (March 19 – May 21, 2026):
|
|
805
917
|
|
|
806
918
|
| Version | Feature |
|
|
807
919
|
|---------|---------|
|
|
@@ -829,6 +941,15 @@ External URLs (`https://`, `mailto:`, etc.) are excluded — only relative paths
|
|
|
829
941
|
| v0.9.8 | Privacy tags, compact search format, npx install |
|
|
830
942
|
| v0.9.9 | Fix advisor mode to delegate to haiku instead of hoarding in opus |
|
|
831
943
|
| v0.9.10 | Cognee-inspired three-tier memory: entity deduplication, graph-completion search, feedback EMA |
|
|
944
|
+
| v0.9.11 | Session-commands hook for truncation resilience |
|
|
945
|
+
| v0.9.12 | Dispatcher uses openFederation directly for kg_search/feedback |
|
|
946
|
+
| v0.9.13 | Emit chunk IDs in memory_search output |
|
|
947
|
+
| v0.9.14 | AIBroker live-session integration: `pai sessions` shows live iTerm2 panes |
|
|
948
|
+
| v0.9.15 | `pai pause all`: pause every live Claude session at once via AIBroker |
|
|
949
|
+
| v0.9.16 | createHash import fix, registry scan clc fallback map |
|
|
950
|
+
| v0.9.17 | Switch live-session listing to `sessions` IPC (metadata-only, faster); `--all-tabs` flag |
|
|
951
|
+
| v0.9.18 | `pai projects`: moved-project auto-detect, rebind command, active-only default listing |
|
|
952
|
+
| v0.10.0 | Topic-first redesign: `pai <topic>` universal resolver, history search, sticky tab titles |
|
|
832
953
|
|
|
833
954
|
---
|
|
834
955
|
|