@tekmidian/pai 0.3.0 → 0.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekmidian/pai",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "PAI Knowledge OS — Personal AI Infrastructure with federated memory and project management",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -8,6 +8,10 @@
8
8
 
9
9
  PAI_OS="pai"
10
10
 
11
+ # Set tab color to working state while compacting
12
+ TAB_COLOR="${PAI_DIR:-$HOME/.claude}/tab-color-command.sh"
13
+ [[ -x "$TAB_COLOR" ]] && "$TAB_COLOR" working
14
+
11
15
  # Bail gracefully if pai is not installed
12
16
  command -v "$PAI_OS" &>/dev/null || exit 0
13
17
  command -v sqlite3 &>/dev/null || exit 0
@@ -90,4 +90,8 @@ fi
90
90
 
91
91
  "$PAI_OS" session handover "$PROJECT_SLUG" latest 2>/dev/null || true
92
92
 
93
+ # Set tab color to completed state when session ends
94
+ TAB_COLOR="${PAI_DIR:-$HOME/.claude}/tab-color-command.sh"
95
+ [[ -x "$TAB_COLOR" ]] && "$TAB_COLOR" completed
96
+
93
97
  exit 0
@@ -1,7 +1,3 @@
1
- ---
2
- links: "[[Ideaverse/AI/PAI/templates/templates|templates]]"
3
- ---
4
-
5
1
  # PAI Configuration Templates
6
2
 
7
3
  This directory contains example configuration files for personalizing your PAI Knowledge OS setup.
@@ -183,6 +179,3 @@ Once you've customized the basic templates, you can:
183
179
  ---
184
180
 
185
181
  **Template Version**: 1.0
186
-
187
- ---
188
- *Links:* [[Ideaverse/AI/PAI/templates/templates|templates]]
@@ -1,7 +1,3 @@
1
- ---
2
- links: "[[Ideaverse/AI/PAI/templates/templates|templates]]"
3
- ---
4
-
5
1
  # PAI Agent Preferences (Personal Configuration)
6
2
 
7
3
  Copy this file to `~/.config/pai/agent-prefs.md` and customize for your workflow. This file is **NOT** committed to any repository and contains your personal preferences.
@@ -364,6 +360,3 @@ A: `.claude.json` is for Claude Code and MCP server configuration. This file is
364
360
 
365
361
  **Q: What if I delete this file?**
366
362
  A: PAI will use defaults. You can always recreate it from this template.
367
-
368
- ---
369
- *Links:* [[Ideaverse/AI/PAI/templates/templates|templates]]
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: AI Steering Rules
3
+ description: Universal behavioral rules for AI assistants. Loaded at startup to enforce quality standards.
4
+ ---
5
+
6
+ <!-- Generated by PAI Setup -->
7
+
8
+ # AI Steering Rules
9
+
10
+ These rules apply to ALL responses, ALL tasks, ALL contexts. They are non-negotiable.
11
+
12
+ ## Surgical Fixes Only
13
+
14
+ - Make every change as simple as possible
15
+ - Impact minimal code — don't refactor unrelated areas
16
+ - The best solution is often the simplest one
17
+
18
+ ## Never Assert Without Verification
19
+
20
+ - Don't claim something works without proving it
21
+ - Run tests, check logs, demonstrate correctness
22
+ - "I believe this should work" is not verification
23
+
24
+ ## One Change When Debugging
25
+
26
+ - Change ONE thing at a time when debugging
27
+ - Verify after each change before moving on
28
+ - If you change three things and it works, you don't know which fixed it
29
+
30
+ ## Read Before Modifying
31
+
32
+ - Always read a file before editing it
33
+ - Understand existing patterns before suggesting changes
34
+ - Never propose changes to code you haven't seen
35
+
36
+ ## Find Root Causes
37
+
38
+ - No temporary fixes, no workarounds, no "good enough for now"
39
+ - If a fix feels hacky, stop and find the elegant solution
40
+ - Treat symptoms only as diagnostic clues, not as things to patch
41
+
42
+ ## Prove It Works
43
+
44
+ - For bug fixes: show the error before, show it fixed after
45
+ - For features: demonstrate end-to-end functionality
46
+ - For refactors: prove behavior is unchanged
47
+
48
+ ## Don't Over-Engineer
49
+
50
+ - Only make changes that are directly requested or clearly necessary
51
+ - Don't add features, refactor code, or make "improvements" beyond what was asked
52
+ - Three similar lines of code is better than a premature abstraction
53
+
54
+ ## Fail Honestly
55
+
56
+ - Say "I don't know" when you don't know
57
+ - Mark unverified claims explicitly
58
+ - Fabricating an answer is worse than admitting uncertainty
@@ -1,7 +1,3 @@
1
- ---
2
- links: "[[Ideaverse/AI/PAI/templates/templates|templates]]"
3
- ---
4
-
5
1
  # CLAUDE.md - PAI Global Configuration
6
2
  <!-- Generated by PAI Setup — Do not edit directly. Run `pai setup` to regenerate. -->
7
3
  <!-- Personal preferences and project mappings are read from ~/.config/pai/agent-prefs.md -->
@@ -735,6 +731,3 @@ For personal preferences (notification channels, voice settings, agent defaults)
735
731
  13. **Task management** - plan to tasks/todo.md first, track progress, document results
736
732
 
737
733
  This is constitutional. Violations waste time, money, and context.
738
-
739
- ---
740
- *Links:* [[Ideaverse/AI/PAI/templates/templates|templates]]
@@ -1,11 +1,13 @@
1
1
  ---
2
- links: "[[Ideaverse/AI/PAI/templates/templates|templates]]"
2
+ pai:
3
+ slug: "${SLUG}"
4
+ registered: "${DATE}"
5
+ last_indexed: null
6
+ status: active
3
7
  ---
8
+
4
9
  # ${DISPLAY_NAME}
5
10
 
6
11
  <!-- Everything below the YAML frontmatter is yours — PAI never modifies content here. -->
7
12
  <!-- Use this file for project notes, decisions, preferences, or anything you want. -->
8
13
  <!-- PAI only reads and updates the `pai:` block in the frontmatter above. -->
9
-
10
- ---
11
- *Links:* [[Ideaverse/AI/PAI/templates/templates|templates]]
@@ -5,16 +5,38 @@ description: PAI session lifecycle automation. USE WHEN user says "go", "continu
5
5
 
6
6
  <!-- Generated by PAI Setup -->
7
7
 
8
+ ## RESPONSE MODE CLASSIFICATION (Always Active)
9
+
10
+ **Classify EVERY request into one of three modes BEFORE emitting any response token.**
11
+
12
+ | Mode | When | Format |
13
+ |------|------|--------|
14
+ | **MINIMAL** | Greetings, thanks, acks, simple yes/no, one-word answers | Natural conversational response. No structured format. 1-3 sentences max. |
15
+ | **STANDARD** | Single-step tasks, quick lookups, simple file reads, direct questions | Compact: just answer the question directly. |
16
+ | **FULL** | Multi-step work, research, implementation, analysis, 3+ tool calls | Full structured format with SUMMARY/ANALYSIS/ACTIONS/RESULTS/STATUS/NEXT. |
17
+
18
+ **Decision rule:** If you can answer in under 3 sentences without tools → MINIMAL. If it's one action or lookup → STANDARD. Everything else → FULL.
19
+
20
+ ---
21
+
8
22
  ## TOKEN MONITORING (Always Active)
9
23
 
10
24
  **Token Limit:** ~200k total context window
11
25
  **Auto-Reset Threshold:** ~100k tokens (50%)
12
26
 
13
- **After major actions, estimate token usage:**
14
- - Each file read ≈ 1-3k tokens
15
- - Each file written/edited 0.5-2k tokens
16
- - Each user message + response ≈ 2-5k tokens
17
- - Large search results 2-5k tokens
27
+ ### Proactive Context Management
28
+
29
+ **After every 5+ sequential tool calls, PAUSE and self-assess:**
30
+ 1. Estimate current context usage (each file read ≈ 1-3k, edit 0.5-2k, message+response ≈ 2-5k, search results ≈ 2-5k)
31
+ 2. If estimated usage > 60% of window (~120k tokens): **self-summarize before continuing**
32
+ - **Preserve:** key decisions, numbers, code references, file paths, next actions
33
+ - **Discard:** verbose tool output, intermediate reasoning, raw search results
34
+ - Write a 1-3 paragraph summary replacing prior phase content
35
+ 3. If > 80%: consider whether to checkpoint and suggest `/clear`
36
+
37
+ **This is proactive, not reactive.** Don't wait for auto-compact to surprise you. Manage context like a budget.
38
+
39
+ ### Auto-Reset Protocol
18
40
 
19
41
  **When approaching ~100k tokens, initiate AUTO-RESET:**
20
42
 
@@ -77,6 +99,28 @@ The GDPR requires consent for processing personal data ([GDPR Art. 6](https://gd
77
99
 
78
100
  ---
79
101
 
102
+ ## ANTI-CRITERIA IN PLANNING (Always Active)
103
+
104
+ **When planning non-trivial work, define what MUST NOT happen alongside what must happen.**
105
+
106
+ - Prefix negative requirements with `ISC-A` (Anti-Criteria): `ISC-A1: No personal data in exported files`
107
+ - Anti-criteria are first-class verifiable requirements — verify them in the same pass as positive criteria
108
+ - Common anti-criteria: no regressions, no secrets in commits, no breaking changes to public API, no data loss
109
+
110
+ ---
111
+
112
+ ## INVOCATION OBLIGATION (Always Active)
113
+
114
+ **If you mention a tool or capability during planning, you MUST actually invoke it.**
115
+
116
+ - Listing a capability but never calling it via tool is dishonest — it's "capability theater."
117
+ - If you say "let me search for that" → you MUST call a search tool. Don't generate from memory.
118
+ - If you plan to use a skill → you MUST call the Skill tool. Don't simulate the output.
119
+ - If you decide NOT to use a planned capability → explicitly state why: "Skipping X because Y."
120
+ - At the end of multi-step work, verify: every tool/skill you mentioned was either invoked or explicitly declined.
121
+
122
+ ---
123
+
80
124
  ## GIT COMMIT RULES (Always Active)
81
125
 
82
126
  **MANDATORY FOR ALL COMMITS:**
@@ -292,4 +336,117 @@ Session notes are stored in: `~/.claude/projects/{encoded-cwd}/Notes/` or local
292
336
 
293
337
  ---
294
338
 
295
- **This skill is installed by `pai setup`. For personal customization (identity, personality, response format, notification preferences), create your own skill in `~/.claude/skills/`.**
339
+ ## DELEGATION & PARALLELIZATION (Always Active)
340
+
341
+ **Whenever a task can be parallelized, use multiple agents.**
342
+
343
+ ### Model Selection for Agents
344
+
345
+ | Task Type | Model | Why |
346
+ |-----------|-------|-----|
347
+ | Deep reasoning, complex architecture | `opus` | Maximum intelligence needed |
348
+ | Standard implementation, most coding | `sonnet` | Good balance of speed + capability |
349
+ | Simple lookups, quick checks, grunt work | `haiku` | 10-20x faster, sufficient intelligence |
350
+
351
+ **Rule of Thumb:**
352
+ - Grunt work or verification → `haiku`
353
+ - Implementation or research → `sonnet`
354
+ - Deep strategic thinking → `opus`
355
+
356
+ ### How to Parallelize
357
+
358
+ - Use a SINGLE message with MULTIPLE Agent/Task tool calls = parallel execution
359
+ - Each agent gets FULL CONTEXT and DETAILED INSTRUCTIONS
360
+ - **ALWAYS launch a spotcheck agent after parallel work completes**
361
+
362
+ ### Context Conservation
363
+
364
+ Bulk/repetitive work consumes context. Delegate it to conserve your main conversation space for planning and decisions.
365
+
366
+ **When to delegate:** Updating many files, batch refactoring, repetitive transformations, large-scale testing, batch file operations.
367
+
368
+ **Pattern:**
369
+ 1. Plan the work in main conversation
370
+ 2. Delegate to agent(s) with detailed instructions
371
+ 3. Agent executes bulk changes efficiently
372
+ 4. Review results and iterate if needed
373
+ 5. Main conversation remains lean and focused
374
+
375
+ ---
376
+
377
+ ## TIME BUDGET AWARENESS (Always Active)
378
+
379
+ **Estimate effort tier BEFORE starting work, then stay within budget.**
380
+
381
+ | Tier | Budget | When |
382
+ |------|--------|------|
383
+ | **Quick** | < 2 min | Simple lookups, one-line fixes, direct answers |
384
+ | **Standard** | < 5 min | Single-file changes, focused research, one feature |
385
+ | **Extended** | < 15 min | Multi-file changes, moderate research, debugging |
386
+ | **Deep** | < 45 min | Architecture work, complex debugging, large features |
387
+ | **Comprehensive** | < 120 min | Major refactors, full implementations, deep research |
388
+
389
+ ### Rules
390
+
391
+ 1. **Estimate at start:** Before beginning work, classify the effort tier and announce it: "This is a Standard task (~5 min)."
392
+ 2. **Check at midpoint:** If you've used > 50% of the budget and aren't > 50% done, reassess.
393
+ 3. **Compress if over budget:** If elapsed > 150% of budget, simplify the approach:
394
+ - Drop nice-to-haves, focus on core requirement
395
+ - Use existing patterns instead of novel solutions
396
+ - Deliver partial result with clear "what's left" summary
397
+ 4. **Never silently overrun:** If a task needs more time than budgeted, say so: "This is taking longer than expected. The Quick fix became Extended because [reason]. Continuing."
398
+
399
+ ---
400
+
401
+ ## STACK PREFERENCES (Always Active)
402
+
403
+ - **TypeScript > Python** — Use TypeScript unless explicitly told otherwise
404
+ - **Package managers:** bun for JS/TS (NOT npm/yarn/pnpm), uv for Python (NOT pip)
405
+ - **Markdown > HTML:** Never use HTML tags for basic content
406
+ - **Analysis vs Action:** If asked to analyze, do analysis only — don't change things unless asked
407
+
408
+ ---
409
+
410
+ ## FILE ORGANIZATION (Always Active)
411
+
412
+ - **Scratchpad** (`${PAI_DIR}/scratchpad/`) — Temporary files only. Delete when done.
413
+ - **History** (`${PAI_DIR}/History/`) — Permanent valuable outputs.
414
+ - **Backups** (`${PAI_DIR}/History/backups/`) — All backups go here, NEVER inside skill directories.
415
+
416
+ **Rules:**
417
+ - Save valuable work to history, not scratchpad
418
+ - Never create `backups/` directories inside skills
419
+ - Never use `.bak` suffixes
420
+
421
+ ---
422
+
423
+ ## HISTORY SYSTEM — Past Work Lookup (Always Active)
424
+
425
+ **When the user asks about anything done in the past, check the history system first.**
426
+
427
+ The history system at `${PAI_DIR}/History/` contains all past work — sessions, learnings, research, decisions.
428
+
429
+ ### How to Search History
430
+
431
+ ```bash
432
+ # Quick keyword search across all history
433
+ rg -i "keyword" ${PAI_DIR}/History/
434
+
435
+ # Search sessions specifically
436
+ rg -i "keyword" ${PAI_DIR}/History/sessions/
437
+
438
+ # List recent files
439
+ ls -lt ${PAI_DIR}/History/sessions/ | head -20
440
+ ```
441
+
442
+ ### Directory Quick Reference
443
+
444
+ | What you're looking for | Where to search |
445
+ |------------------------|-----------------|
446
+ | Session summaries | `History/sessions/YYYY-MM/` |
447
+ | Problem-solving narratives | `History/learnings/YYYY-MM/` |
448
+ | Research & investigations | `History/research/YYYY-MM/` |
449
+
450
+ ---
451
+
452
+ **This skill is installed by `pai setup`. For personal customization (identity, personality, notification preferences), create your own skill in `~/.claude/skills/`.**