@tekmidian/pai 0.9.6 → 0.9.8

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/FEATURE.md CHANGED
@@ -48,7 +48,14 @@ different direction: persistent memory, session continuity, and deep Claude Code
48
48
  | **Session note reconstruction** | No | Yes — /reconstruct skill retroactively creates notes from JSONL + git history |
49
49
  | **Backup / restore** | No | Yes — timestamped pg_dump + registry export |
50
50
  | **Multi-session concurrency** | n/a | Yes — daemon multiplexes Claude sessions |
51
- | **Custom statusline** | No | Yes — model, MCPs, context meter, colors |
51
+ | **Budget-aware advisor mode** | No | Yes — auto-adjusts subagent model tiering based on weekly usage (normal/conservative/strict/critical) |
52
+ | **Natural language mode switching** | No | Yes — say "go easy on the budget" or "lock it down" to change advisor mode |
53
+ | **22 built-in skills** | No | Yes — /review, /plan, /journal, /share, /whisper, /advisor, /reconstruct, /consolidate, /vault-*, /research, /art, and more |
54
+ | **God-note detection** | No | Yes — detects overgrown session notes with confidence tagging, Louvain community detection |
55
+ | **Privacy tags** | Yes — `<private>` blocks excluded from memory | Yes — `<private>` blocks stripped before indexing, never stored or searched |
56
+ | **3-layer search pattern** | Yes — search index → timeline → get_observations | Yes — compact format (~50 tokens/result) → memory_get for full content |
57
+ | **One-command install** | Yes — `npx claude-mem install` | Yes — `npx @tekmidian/pai install` |
58
+ | **Custom statusline** | No | Yes — model, MCPs, context meter, usage limits, advisor mode, pace indicator, colors |
52
59
  | **Local / private** | Yes | Yes — no cloud, no external API for core |
53
60
  | **Docker required** | No | Only for full mode (PostgreSQL); SQLite mode needs none |
54
61
  | **macOS / Linux** | Yes | Yes |
package/README.md CHANGED
@@ -1,7 +1,59 @@
1
- # PAI Knowledge OS — v0.8.0
1
+ # PAI Knowledge OS — v0.9.7
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
 
5
+ Install PAI and Claude remembers. Ask it what you were working on. Ask it to find that conversation about the database schema. Ask it to pick up exactly where the last session ended. It knows.
6
+
7
+ ## Quick Start
8
+
9
+ Tell Claude Code:
10
+
11
+ > Clone https://github.com/mnott/PAI and set it up for me
12
+
13
+ Or install with a single command:
14
+
15
+ ```bash
16
+ npx @tekmidian/pai install
17
+ ```
18
+
19
+ Or manually:
20
+
21
+ ### 1. Install
22
+
23
+ ```bash
24
+ git clone https://github.com/mnott/PAI
25
+ cd PAI
26
+ bun install
27
+ bun run build
28
+ ```
29
+
30
+ ### 2. Run the setup wizard
31
+
32
+ ```bash
33
+ pai setup
34
+ ```
35
+
36
+ The wizard walks you through: storage mode (SQLite or PostgreSQL), project directories, Obsidian vault path, MCP server registration, CLAUDE.md template, and daemon configuration. It's idempotent — safe to re-run anytime.
37
+
38
+ ### 3. Start the daemon
39
+
40
+ ```bash
41
+ pai daemon start
42
+ ```
43
+
44
+ The daemon runs in the background via launchd, indexing your sessions and serving the MCP tools. It starts automatically on login.
45
+
46
+ ### 4. Verify
47
+
48
+ ```bash
49
+ pai daemon status # should show "running"
50
+ pai memory search "test" # should return results after indexing
51
+ ```
52
+
53
+ That's it. Claude Code now has persistent memory across all sessions.
54
+
55
+ ---
56
+
5
57
  ## Automatic Session Notes — by Topic
6
58
 
7
59
  PAI's headline feature: **every session is automatically documented.** No manual note-taking, no "pause session" commands, no forgetting to save what you did.
@@ -96,15 +148,112 @@ This is not a template or a skeleton. These are real notes with build error chro
96
148
  - "Suggest connections for this note" — proactive link suggestions using semantic + graph signals
97
149
  - "What does my vault say about knowledge management?" — use the vault as a thinking partner
98
150
 
151
+ ### Budget Management
152
+
153
+ - "How much budget do I have left?" — shows current weekly usage and advisor mode
154
+ - "Go easy on the budget" — switches to conservative mode (prefer haiku subagents)
155
+ - "Lock it down" — switches to critical mode (minimize all token usage)
156
+ - "Go full power" — switches to normal mode (no constraints)
157
+ - "Back to auto" — resets to auto mode (derives from weekly budget percentage)
158
+
99
159
  ---
100
160
 
101
- ## Quick Start
161
+ ## Skills
102
162
 
103
- Tell Claude Code:
163
+ PAI ships 22 skills — slash commands that activate specialized workflows. Each responds to natural language triggers as well as the `/command` syntax.
104
164
 
105
- > Clone https://github.com/mnott/PAI and set it up for me
165
+ ### Productivity
166
+
167
+ | Skill | Trigger | What it does |
168
+ |-------|---------|-------------|
169
+ | `/advisor` | "budget mode", "save budget", "go easy on the budget" | Manage budget-aware model tiering for subagents |
170
+ | `/plan` | "plan my week", "what should I focus on", "priorities" | Plan tomorrow/week/month based on open tasks and calendar |
171
+ | `/review` | "review my week", "what did I do", "recap" | Daily/weekly/monthly review of work accomplished |
172
+ | `/journal` | "journal", "note to self", "capture this thought" | Create, read, or search personal journal entries |
173
+ | `/share` | "share on LinkedIn", "tweet about", "post to Bluesky" | Generate social media posts about completed work |
174
+
175
+ ### Session Management
176
+
177
+ | Skill | Trigger | What it does |
178
+ |-------|---------|-------------|
179
+ | `/sessions` | "list sessions", "where was I working" | Navigate sessions, projects, switch working context |
180
+ | `/route` | "what project is this", "tag this session" | Detect which PAI project the current session belongs to |
181
+ | `/name` | "name this session", "rename session" | Name or rename the current session |
182
+ | `/search-history` | "search history", "find past", "what did we do" | Search past sessions and previous work by keyword |
183
+ | `/consolidate` | "consolidate notes", "clean up notes", "merge duplicates" | Merge duplicate session notes, fix titles, renumber |
184
+ | `/reconstruct` | "reconstruct sessions", "backfill session notes" | Retroactively create notes from JSONL transcripts and git history |
185
+
186
+ ### Obsidian Vault
106
187
 
107
- Claude finds the setup skill, checks your system, runs the interactive wizard, and configures itself. You answer a few questions — simple mode or full mode, where your projects live, whether you use Obsidian — and Claude does the rest.
188
+ | Skill | Trigger | What it does |
189
+ |-------|---------|-------------|
190
+ | `/vault-context` | "morning briefing", "load vault context" | Load Obsidian vault context for a briefing |
191
+ | `/vault-connect` | "connect X and Y", "how does X relate to Y" | Find connections between two topics in the vault |
192
+ | `/vault-emerge` | "what's emerging", "find patterns", "themes in vault" | Surface emerging themes and clusters |
193
+ | `/vault-orphans` | "find orphans", "unlinked notes" | Find and reconnect orphaned notes with zero inbound links |
194
+ | `/vault-trace` | "trace idea", "how did X evolve", "idea history" | Trace the evolution of an idea across vault notes over time |
195
+
196
+ ### Tools & System
197
+
198
+ | Skill | Trigger | What it does |
199
+ |-------|---------|-------------|
200
+ | `/whisper` | "add whisper rule", "show whisper rules" | Manage persistent behavioral constraints injected on every prompt |
201
+ | `/research` | "do research", "extract wisdom", "analyze content" | Web research, content extraction, and analysis via parallel agents |
202
+ | `/art` | "create diagram", "flowchart", "visualize" | Create visual content, diagrams, flowcharts, and AI-generated images |
203
+ | `/story` | "explain this as a story", "create story explanation" | Create numbered narrative story explanations of any content |
204
+ | `/observability` | "start observability", "monitor agents" | Start, stop, or check the multi-agent observability dashboard |
205
+ | `/createskill` | "create skill", "validate skill" | Create, validate, update, or canonicalize a PAI skill |
206
+
207
+ ---
208
+
209
+ ## Budget-Aware Advisor Mode
210
+
211
+ PAI tracks your weekly Claude usage and automatically adjusts subagent model selection to stay within budget. The statusline shows your current mode at a glance.
212
+
213
+ ### How it works
214
+
215
+ The statusline reads your OAuth usage from the Anthropic API (5-hour and 7-day windows) and writes the weekly budget percentage to `~/.claude/advisor-mode.json`. A whisper-rules hook reads this file on every prompt and injects model-tiering guidance.
216
+
217
+ ### Automatic thresholds
218
+
219
+ | Budget Used | Mode | Subagent Model | Behavior |
220
+ |-------------|------|----------------|----------|
221
+ | < 60% | normal | Any | No constraints |
222
+ | 60–80% | conservative | Haiku preferred | Escalate to sonnet only if haiku insufficient |
223
+ | 80–92% | strict | Haiku only | Minimize spawning, no opus subagents |
224
+ | > 92% | critical | Haiku or none | Essential work only, minimize all token usage |
225
+
226
+ ### Statusline display
227
+
228
+ The advisor mode label appears on the context line:
229
+
230
+ ```
231
+ 💎 Context: 12K / 1000K (68%) │ 5h: 3% → 13:18 │ 1d: 5% / 8% │ 7d: strict 91% → Fr. 08:00
232
+ ```
233
+
234
+ Manually forced modes show a 📌 prefix (e.g. `📌normal 91%`) so you always know whether the mode was auto-calculated or manually set.
235
+
236
+ ### Switching modes
237
+
238
+ Use `/budget` commands, `/Advisor` skill, or plain language:
239
+
240
+ ```
241
+ /budget auto — reset to auto (budget-driven)
242
+ /budget mode normal — force normal mode
243
+ /budget force haiku — force all subagents to haiku
244
+
245
+ /Advisor auto — same, via skill (note: capital A)
246
+ /Advisor mode strict — force strict mode
247
+
248
+ "go full power" — normal mode (plain language)
249
+ "be conservative" — conservative mode
250
+ "lock it down" — critical mode
251
+ "back to auto" — auto mode
252
+ ```
253
+
254
+ Changes take effect on the next prompt — no restart needed.
255
+
256
+ > **Note:** `/advisor` (lowercase) conflicts with a Claude Code built-in command. Use `/budget` or `/Advisor` (capital A) instead.
108
257
 
109
258
  ---
110
259
 
@@ -134,8 +283,8 @@ PAI runs hooks at every stage of a Claude Code session:
134
283
 
135
284
  | Event | What PAI Does |
136
285
  |-------|--------------|
137
- | **Session Start** | Loads project context, detects which project you're in, auto-registers new projects, creates a session note |
138
- | **User Prompt** | Cleans up temp files, updates terminal tab titles, injects whisper rules on every prompt |
286
+ | **Session Start** | Loads project context, detects which project you're in, auto-registers new projects, creates a session note, injects recent observations |
287
+ | **User Prompt** | Cleans up temp files, updates terminal tab titles, injects whisper rules and advisor mode guidance on every prompt |
139
288
  | **Pre-Compact** | Saves session state checkpoint, pushes `session-summary` work item to daemon, sends notification |
140
289
  | **Post-Compact** | Injects preserved state back into Claude's context |
141
290
  | **Tool Use** | Classifies tool calls into structured observations (decision/bugfix/feature/refactor/discovery/change) |
@@ -261,7 +410,7 @@ A PostToolUse hook fires after every Claude Code tool call. A rule-based classif
261
410
  | **discovery** | File reads, searches | Reading code, grep searches, glob patterns |
262
411
  | **change** | File edits | Editing source files, updating configs |
263
412
 
264
- Observations are stored in PostgreSQL with content-hash deduplication (30-second window) to prevent duplicates from rapid tool calls.
413
+ Observations are stored with content-hash deduplication (30-second window) to prevent duplicates from rapid tool calls.
265
414
 
266
415
  ### Progressive context injection
267
416
 
@@ -326,6 +475,50 @@ The pattern is inspired by [Letta's claude-subconscious](https://github.com/lett
326
475
 
327
476
  ---
328
477
 
478
+ ## Privacy Tags
479
+
480
+ Wrap any content in `<private>...</private>` tags to exclude it from PAI's memory index. Private content is stripped before chunking — it's never stored, never searched, never surfaced.
481
+
482
+ ```markdown
483
+ ## API Keys
484
+ <private>
485
+ STRIPE_KEY=sk_live_abc123
486
+ DATABASE_URL=postgres://user:pass@host/db
487
+ </private>
488
+
489
+ ## Architecture Notes
490
+ The payment system uses Stripe webhooks...
491
+ ```
492
+
493
+ The architecture notes get indexed. The API keys don't. Works in session notes, memory files, and any markdown PAI indexes.
494
+
495
+ ---
496
+
497
+ ## Token-Efficient Search (3-Layer Pattern)
498
+
499
+ For budget-conscious usage, PAI supports a compact search format that returns ~10x fewer tokens per result. Instead of fetching full snippets upfront, get a compact index first, then drill into interesting results.
500
+
501
+ ### The workflow
502
+
503
+ ```
504
+ 1. Search with format="compact" → IDs + paths + scores (~50 tokens/result)
505
+ 2. Review the index, pick interesting results
506
+ 3. Use memory_get to read full content for those specific files
507
+ ```
508
+
509
+ ### Example
510
+
511
+ ```
512
+ "Search for authentication with compact format"
513
+ → Claude passes format: "compact" to memory_search
514
+ → Gets a tight index: [1] pai — src/auth.ts L10-45 score=0.892
515
+ → Then reads only the files that matter
516
+ ```
517
+
518
+ Via MCP, pass `format: "compact"` to the `memory_search` tool. Default is `"full"` (current behavior with snippets).
519
+
520
+ ---
521
+
329
522
  ## Auto-Compact Context Window
330
523
 
331
524
  Claude Code can automatically compact your context window when it fills up, preventing session interruptions mid-task. PAI's statusline shows you at a glance whether auto-compact is active.
@@ -350,7 +543,7 @@ The value is the context percentage at which compaction triggers. `80` means com
350
543
 
351
544
  ### Statusline indicator
352
545
 
353
- Once set, PAI's statusline shows `[auto-compact:80%]` next to the context meter on line 3, so you always know auto-compact is active and at what threshold.
546
+ PAI's statusline shows the remaining context until auto-compact triggers as a percentage on line 3, along with your 5-hour and 7-day usage limits, daily pace indicator, and advisor mode label.
354
547
 
355
548
  ### Set it up with one prompt
356
549
 
@@ -559,6 +752,36 @@ External URLs (`https://`, `mailto:`, etc.) are excluded — only relative paths
559
752
 
560
753
  ---
561
754
 
755
+ ## Release History
756
+
757
+ 18 releases shipped from v0.7.2 to v0.9.7 (March 19 – April 10, 2026):
758
+
759
+ | Version | Feature |
760
+ |---------|---------|
761
+ | v0.7.2 | Auto-registration, one-note-per-session, Reconstruct skill |
762
+ | v0.7.3 | Automatic AI-powered session notes via daemon |
763
+ | v0.7.4 | Auto-register on parent match |
764
+ | v0.7.5 | Tiered model selection (opus/sonnet/haiku) |
765
+ | v0.7.6 | Find claude binary in launchd |
766
+ | v0.7.7 | Whisper rules hook |
767
+ | v0.7.8 | Strip API key from daemon (prevent billing) |
768
+ | v0.8.0 | Topic-based note splitting |
769
+ | v0.8.1 | /whisper skill, remove hardcoded defaults |
770
+ | v0.8.2 | Reduce topic split sensitivity |
771
+ | v0.8.3 | /consolidate skill |
772
+ | v0.8.4 | Store TOPIC in HTML comment |
773
+ | v0.8.5 | God-note detection, confidence tagging, Louvain communities, query feedback |
774
+ | v0.9.0 | 4-layer wake-up, temporal KG, taxonomy, tunnels, mid-session auto-save |
775
+ | v0.9.1 | KG backfill CLI, shared kg-extraction module |
776
+ | v0.9.2 | Stop-hook first-run safeguard |
777
+ | v0.9.3 | Silence stop-hook diagnostics |
778
+ | v0.9.4 | Remove exit(2) noise |
779
+ | v0.9.5 | Budget-aware advisor mode |
780
+ | v0.9.6 | Statusline auto-writes budget to advisor |
781
+ | v0.9.7 | Advisor mode label in statusline, natural language mode switching |
782
+
783
+ ---
784
+
562
785
  ## Companion Projects
563
786
 
564
787
  PAI works great alongside these tools (also by the same author):
@@ -582,4 +805,3 @@ The automatic observation capture system — classifying tool calls into structu
582
805
  ## License
583
806
 
584
807
  MIT
585
-
@@ -4,8 +4,8 @@ import { _ as warn, a as fmtDate, c as ok, d as scaffoldProjectDirs, f as shorte
4
4
  import { a as slugify$1, i as parseSessionFilename, n as decodeEncodedDir, t as buildEncodedDirMap } from "../migrate-jokLenje.mjs";
5
5
  import { n as ensurePaiMarker, t as discoverPaiMarkers } from "../pai-marker-CXQPX2P6.mjs";
6
6
  import { n as openFederation } from "../db-DdUperSl.mjs";
7
- import "../helpers-BEST-4Gx.mjs";
8
- import { i as indexProject, n as indexAll, t as embedChunks } from "../sync-BOsnEj2-.mjs";
7
+ import "../helpers-OCVFgprQ.mjs";
8
+ import { i as indexProject, n as indexAll, t as embedChunks } from "../sync-CdHSL9Kc.mjs";
9
9
  import "../embeddings-DGRAPAYb.mjs";
10
10
  import { t as STOP_WORDS } from "../stop-words-BaMEGVeY.mjs";
11
11
  import { n as populateSlugs, r as searchMemory } from "../search-DC1qhkKn.mjs";
@@ -3794,7 +3794,7 @@ function cmdLogs(opts) {
3794
3794
  }
3795
3795
  function registerDaemonCommands(daemonCmd) {
3796
3796
  daemonCmd.command("serve").description("Start the PAI daemon in the foreground").action(async () => {
3797
- const { serve } = await import("../daemon-kp49BE7u.mjs").then((n) => n.t);
3797
+ const { serve } = await import("../daemon-WQY1kwOF.mjs").then((n) => n.t);
3798
3798
  const { loadConfig: lc, ensureConfigDir } = await import("../config-BuhHWyOK.mjs").then((n) => n.r);
3799
3799
  ensureConfigDir();
3800
3800
  await serve(lc());
@@ -5531,7 +5531,7 @@ async function runSetup() {
5531
5531
  }
5532
5532
  }
5533
5533
  function registerSetupCommand(program) {
5534
- program.command("setup").description("Interactive setup wizard — configure storage, embeddings, agent config, and indexing").action(async () => {
5534
+ program.command("setup").alias("install").description("Interactive setup wizard — configure storage, embeddings, agent config, and indexing").action(async () => {
5535
5535
  await runSetup();
5536
5536
  });
5537
5537
  }