@tekmidian/pai 0.1.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.
Files changed (66) hide show
  1. package/ARCHITECTURE.md +567 -0
  2. package/FEATURE.md +108 -0
  3. package/LICENSE +21 -0
  4. package/README.md +101 -0
  5. package/dist/auto-route-D7W6RE06.mjs +86 -0
  6. package/dist/auto-route-D7W6RE06.mjs.map +1 -0
  7. package/dist/cli/index.d.mts +1 -0
  8. package/dist/cli/index.mjs +5927 -0
  9. package/dist/cli/index.mjs.map +1 -0
  10. package/dist/config-DBh1bYM2.mjs +151 -0
  11. package/dist/config-DBh1bYM2.mjs.map +1 -0
  12. package/dist/daemon/index.d.mts +1 -0
  13. package/dist/daemon/index.mjs +56 -0
  14. package/dist/daemon/index.mjs.map +1 -0
  15. package/dist/daemon-mcp/index.d.mts +1 -0
  16. package/dist/daemon-mcp/index.mjs +185 -0
  17. package/dist/daemon-mcp/index.mjs.map +1 -0
  18. package/dist/daemon-v5O897D4.mjs +773 -0
  19. package/dist/daemon-v5O897D4.mjs.map +1 -0
  20. package/dist/db-4lSqLFb8.mjs +199 -0
  21. package/dist/db-4lSqLFb8.mjs.map +1 -0
  22. package/dist/db-BcDxXVBu.mjs +110 -0
  23. package/dist/db-BcDxXVBu.mjs.map +1 -0
  24. package/dist/detect-BHqYcjJ1.mjs +86 -0
  25. package/dist/detect-BHqYcjJ1.mjs.map +1 -0
  26. package/dist/detector-DKA83aTZ.mjs +74 -0
  27. package/dist/detector-DKA83aTZ.mjs.map +1 -0
  28. package/dist/embeddings-mfqv-jFu.mjs +91 -0
  29. package/dist/embeddings-mfqv-jFu.mjs.map +1 -0
  30. package/dist/factory-BDAiKtYR.mjs +42 -0
  31. package/dist/factory-BDAiKtYR.mjs.map +1 -0
  32. package/dist/index.d.mts +307 -0
  33. package/dist/index.d.mts.map +1 -0
  34. package/dist/index.mjs +11 -0
  35. package/dist/indexer-B20bPHL-.mjs +677 -0
  36. package/dist/indexer-B20bPHL-.mjs.map +1 -0
  37. package/dist/indexer-backend-BXaocO5r.mjs +360 -0
  38. package/dist/indexer-backend-BXaocO5r.mjs.map +1 -0
  39. package/dist/ipc-client-DPy7s3iu.mjs +156 -0
  40. package/dist/ipc-client-DPy7s3iu.mjs.map +1 -0
  41. package/dist/mcp/index.d.mts +1 -0
  42. package/dist/mcp/index.mjs +373 -0
  43. package/dist/mcp/index.mjs.map +1 -0
  44. package/dist/migrate-Bwj7qPaE.mjs +241 -0
  45. package/dist/migrate-Bwj7qPaE.mjs.map +1 -0
  46. package/dist/pai-marker-DX_mFLum.mjs +186 -0
  47. package/dist/pai-marker-DX_mFLum.mjs.map +1 -0
  48. package/dist/postgres-Ccvpc6fC.mjs +335 -0
  49. package/dist/postgres-Ccvpc6fC.mjs.map +1 -0
  50. package/dist/rolldown-runtime-95iHPtFO.mjs +18 -0
  51. package/dist/schemas-DjdwzIQ8.mjs +3405 -0
  52. package/dist/schemas-DjdwzIQ8.mjs.map +1 -0
  53. package/dist/search-PjftDxxs.mjs +282 -0
  54. package/dist/search-PjftDxxs.mjs.map +1 -0
  55. package/dist/sqlite-CHUrNtbI.mjs +90 -0
  56. package/dist/sqlite-CHUrNtbI.mjs.map +1 -0
  57. package/dist/tools-CLK4080-.mjs +805 -0
  58. package/dist/tools-CLK4080-.mjs.map +1 -0
  59. package/dist/utils-DEWdIFQ0.mjs +160 -0
  60. package/dist/utils-DEWdIFQ0.mjs.map +1 -0
  61. package/package.json +72 -0
  62. package/templates/README.md +181 -0
  63. package/templates/agent-prefs.example.md +362 -0
  64. package/templates/claude-md.template.md +733 -0
  65. package/templates/pai-project.template.md +13 -0
  66. package/templates/voices.example.json +251 -0
@@ -0,0 +1,362 @@
1
+ # PAI Agent Preferences (Personal Configuration)
2
+
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.
4
+
5
+ ---
6
+
7
+ ## Your Identity
8
+
9
+ ```markdown
10
+ - Name: [Your Name]
11
+ - Role: [Your professional role, e.g., "Senior Software Engineer", "CTO", "Product Manager"]
12
+ - Location: [City/Timezone, optional]
13
+ - Default Language: [en, de, fr, etc.]
14
+ ```
15
+
16
+ **Why this matters**: Agents use this context when generating personalized recommendations and documentation. It helps them understand your expertise level and tailor responses accordingly.
17
+
18
+ ---
19
+
20
+ ## Directory and Search Restrictions
21
+
22
+ **CRITICAL**: These restrictions prevent expensive, timeout-prone searches.
23
+
24
+ ```markdown
25
+ ## Never Search (Home Directory)
26
+ - ~
27
+ - ~/Library
28
+ - ~/Desktop (usually cluttered)
29
+ - ~/Downloads (usually temporary)
30
+
31
+ ## Always Use Specific Paths
32
+ - ~/Projects (code repositories)
33
+ - ~/.claude (Claude Code configuration)
34
+ - ~/dev (active development)
35
+ - ~/.config (system configuration)
36
+ ```
37
+
38
+ **Rule**: If you need to search, pick the most specific subdirectory possible.
39
+
40
+ **Example**: Instead of `grep -r "TODO" ~`, use `grep -r "TODO" ~/dev`.
41
+
42
+ ---
43
+
44
+ ## Project-Code Directory Mappings
45
+
46
+ Map your Obsidian projects to code repositories. This helps end-session automation find the right directories to commit and push.
47
+
48
+ ```markdown
49
+ | Obsidian/Notes Project | Code Directory | Notes |
50
+ |------------------------|----------------|-------|
51
+ | PAI Knowledge OS | ~/dev/ai/PAI | Main project |
52
+ | My App | ~/dev/my-app | Primary development |
53
+ | Blog | ~/projects/blog| Publishing project |
54
+ ```
55
+
56
+ **During end-session cleanup**, these mappings tell PAI which code directories to commit changes to.
57
+
58
+ **Format**: Obsidian vault name (or note project name) → absolute path to code directory.
59
+
60
+ ---
61
+
62
+ ## Notification Preferences
63
+
64
+ Configure how PAI notifies you of important events (long-running tasks, completions, errors).
65
+
66
+ ```markdown
67
+ ## Primary Notification Channel
68
+ - Method: WhatsApp (via Whazaa MCP)
69
+ - Contact: [your phone number or contact name]
70
+
71
+ ## Fallback Channel (when WhatsApp unavailable)
72
+ - Method: ntfy.sh (cloud pubsub)
73
+ - Topic: [your-private-ntfy-topic] # Must be >20 chars or use cryptographically random
74
+
75
+ ## Important Events to Notify
76
+ - [ ] Long-running task started (>30 seconds)
77
+ - [ ] Task completed successfully
78
+ - [ ] Task failed or encountered error
79
+ - [ ] Manual intervention required
80
+ ```
81
+
82
+ **Security Note**: ntfy.sh topics are publicly readable if someone guesses the URL. Use a long, random topic name or disable cloud notifications if sensitive.
83
+
84
+ **Configuration**: Set `NTFY_TOPIC` and `NTFY_URL` environment variables if using ntfy.sh fallback.
85
+
86
+ ---
87
+
88
+ ## Voice Configuration
89
+
90
+ Optional: Configure voice output for agents (WhatsApp voice notes, local speakers).
91
+
92
+ ### ElevenLabs Setup (Optional)
93
+
94
+ ```markdown
95
+ API Key: [set via ELEVENLABS_API_KEY environment variable]
96
+ Default Voice ID: [your preferred voice ID, e.g., "21m00Tcm4TlvDq8ikWAM"]
97
+ ```
98
+
99
+ Get your API key from https://elevenlabs.io/app/keys (requires account).
100
+
101
+ ### Voice Assignments by Agent
102
+
103
+ ```markdown
104
+ Agent Type | Voice ID / Name | Use Case
105
+ -----------------|---------------------------|-----------------------------------
106
+ main | [main-voice-id] | General responses, default
107
+ intern | [intern-voice-id] | Quick summaries, status updates
108
+ engineer | [engineer-voice-id] | Code reviews, technical details
109
+ architect | [architect-voice-id] | System design, high-level planning
110
+ researcher | [researcher-voice-id] | Research summaries, findings
111
+ ```
112
+
113
+ **Alternative**: Use Kokoro TTS (local, free):
114
+ - Available voices: `af_bella`, `af_nova`, `bm_george`, `bm_daniel`, `bf_emma`, etc.
115
+ - No API key needed — runs entirely locally
116
+ - Better for privacy-sensitive workflows
117
+
118
+ **Configuration**: Store voice preferences in `~/.config/pai/voices.json` (see voices.example.json).
119
+
120
+ ---
121
+
122
+ ## Git Commit Rules
123
+
124
+ Configure how changes are committed to code repositories.
125
+
126
+ ```markdown
127
+ ## Commit Signatures
128
+ - Include AI signature: false (default) # "Co-Authored-By: Claude <...>"
129
+ - Verify commits: false (default)
130
+
131
+ ## Commit Message Format
132
+ - Style: conventional commits (feat:, fix:, refactor:, docs:, test:)
133
+ - Include scope: true (e.g., "feat(auth): add JWT validation")
134
+ - Include ticket number: [optional, e.g., "#123"]
135
+
136
+ ## Auto-Commit Behavior
137
+ - Commit after tests pass: true
138
+ - Commit after code review: false (manual review first)
139
+ - Require branch protection: false
140
+ ```
141
+
142
+ **Conventional Commits Examples**:
143
+ - `feat(api): add user authentication endpoint`
144
+ - `fix(database): resolve connection pooling issue`
145
+ - `refactor(ui): simplify button component logic`
146
+ - `docs(readme): update installation instructions`
147
+ - `test(auth): add JWT validation tests`
148
+
149
+ ---
150
+
151
+ ## Code Quality Preferences
152
+
153
+ Configure code review and quality standards.
154
+
155
+ ```markdown
156
+ ## Testing Requirements
157
+ - Minimum test coverage: 80%
158
+ - Test types required: unit, integration, e2e
159
+ - Test runner: [jest, vitest, pytest, etc.]
160
+
161
+ ## Code Style
162
+ - Linter: [eslint, ruff, pylint, etc.]
163
+ - Formatter: [prettier, black, autopep8, etc.]
164
+ - Max line length: 100
165
+ - Tabs vs Spaces: spaces (2 or 4?)
166
+
167
+ ## TypeScript/JavaScript
168
+ - Strict mode: true
169
+ - Package manager: bun (default)
170
+ - Node version: [18, 20, 22, etc.]
171
+
172
+ ## Python
173
+ - Python version: [3.11, 3.12, etc.]
174
+ - Package manager: uv (default) or pip
175
+ - Type checking: pyright or mypy
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Language and Framework Preferences
181
+
182
+ ```markdown
183
+ ## Language Preferences (ranked)
184
+ 1. TypeScript / JavaScript (primary)
185
+ 2. Python (data/ML work)
186
+ 3. [Other language]
187
+
188
+ ## Web Framework
189
+ - Backend: [Express, Fastify, Django, FastAPI, etc.]
190
+ - Frontend: [React, Vue, Svelte, etc.]
191
+ - Build tool: [Vite, Webpack, esbuild, etc.]
192
+
193
+ ## Database
194
+ - Primary: [PostgreSQL, MySQL, SQLite, etc.]
195
+ - Cache: [Redis, Memcached, etc.]
196
+ - Vector DB: [Pinecone, Supabase pgvector, etc.]
197
+
198
+ ## Cloud Platform
199
+ - Primary: [AWS, Azure, GCP, etc.]
200
+ - Preferred services: [Lambda, CloudRun, etc.]
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Workflow Preferences
206
+
207
+ ```markdown
208
+ ## Planning and Documentation
209
+ - Use plan mode for tasks with 3+ steps: true
210
+ - Write technical specs before implementation: true
211
+ - Update task progress in real-time: true
212
+
213
+ ## Task Management
214
+ - Task file location: tasks/todo.md
215
+ - Lesson file location: tasks/lessons.md
216
+ - Review lessons at session start: true
217
+
218
+ ## Code Review Standards
219
+ - Auto-approve trivial changes: false
220
+ - Require spotcheck for parallel work: true
221
+ - Demand elegance for non-trivial changes: true
222
+
223
+ ## Verification Before Completion
224
+ - Prove it works with tests/demo: true
225
+ - Check logs and error handling: true
226
+ - Measure performance improvements: true
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Custom Preferences
232
+
233
+ Add any additional personal preferences or workflow rules:
234
+
235
+ ```markdown
236
+ ## Custom Rules
237
+ - [Your rule 1: e.g., "Never install packages globally without approval"]
238
+ - [Your rule 2: e.g., "Always backup databases before migrations"]
239
+ - [Your rule 3: e.g., "Use feature branches for all changes"]
240
+
241
+ ## Avoid These Patterns
242
+ - [Anti-pattern 1: e.g., "Don't use eval() in JavaScript"]
243
+ - [Anti-pattern 2: e.g., "Don't skip error handling for brevity"]
244
+
245
+ ## Team Standards
246
+ - [Team rule 1]
247
+ - [Team rule 2]
248
+
249
+ ## Security Requirements
250
+ - [Requirement 1: e.g., "All API keys in .env files, never in code"]
251
+ - [Requirement 2: e.g., "Sanitize user input before database queries"]
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Example Customized Configuration
257
+
258
+ Here's a sample filled-in configuration:
259
+
260
+ ```markdown
261
+ # My PAI Agent Preferences
262
+
263
+ ## Your Identity
264
+ - Name: Alice Chen
265
+ - Role: Senior Full-Stack Engineer
266
+ - Location: San Francisco, PST
267
+ - Default Language: en
268
+
269
+ ## Directory Restrictions
270
+ Never Search: ~, ~/Library, ~/Downloads
271
+ Always Use: ~/dev, ~/Projects, ~/.claude
272
+
273
+ ## Project-Code Directory Mappings
274
+ | Obsidian Project | Code Directory |
275
+ |------------------|----------------|
276
+ | Work Notes | ~/dev/company-product |
277
+ | Learning | ~/projects/learning |
278
+ | PAI | ~/dev/ai/PAI |
279
+
280
+ ## Notification Preferences
281
+ - Primary: WhatsApp to my number
282
+ - Fallback: ntfy.sh/alice-projects-82934
283
+
284
+ ## Voice Configuration
285
+ - Default: Kokoro (bm_george)
286
+ - Engineer: Kokoro (bm_daniel)
287
+
288
+ ## Git Commit Rules
289
+ - Format: conventional commits
290
+ - Include scope: true
291
+ - AI signature: false
292
+
293
+ ## Language Preferences
294
+ 1. TypeScript / Node.js
295
+ 2. Python (data pipelines)
296
+
297
+ ## Workflow Preferences
298
+ - Use plan mode: always
299
+ - Verify before completion: always
300
+ - Task file: tasks/todo.md
301
+ ```
302
+
303
+ ---
304
+
305
+ ## How to Use This File
306
+
307
+ 1. **Copy to config directory**:
308
+ ```bash
309
+ cp ~/dev/ai/PAI/templates/agent-prefs.example.md ~/.config/pai/agent-prefs.md
310
+ ```
311
+
312
+ 2. **Customize for your workflow**: Edit `~/.config/pai/agent-prefs.md` with your settings.
313
+
314
+ 3. **Make it executable** (optional):
315
+ ```bash
316
+ chmod 600 ~/.config/pai/agent-prefs.md # Restrict permissions if sensitive
317
+ ```
318
+
319
+ 4. **Load in your scripts**: Your PAI daemon/CLI reads this automatically on startup.
320
+
321
+ ---
322
+
323
+ ## File Permissions and Privacy
324
+
325
+ This file contains personal preferences and may reference sensitive information:
326
+
327
+ ```bash
328
+ # Recommended permissions (user read/write only)
329
+ chmod 600 ~/.config/pai/agent-prefs.md
330
+ ```
331
+
332
+ Keep it **out of version control** — add to `.gitignore`:
333
+ ```
334
+ ~/.config/pai/
335
+ .config/pai/
336
+ ```
337
+
338
+ ---
339
+
340
+ ## Updating Your Preferences
341
+
342
+ Preferences can be updated at any time:
343
+
344
+ - **Session active**: Changes take effect on next agent spawn
345
+ - **No daemon restart required**: PAI reads the file fresh on each operation
346
+ - **Version control**: Use git to track changes if desired in a private repo
347
+
348
+ ---
349
+
350
+ ## Questions and Troubleshooting
351
+
352
+ **Q: What if I leave a field blank?**
353
+ A: PAI uses sensible defaults (see daemon configuration). Your preferences override defaults when set.
354
+
355
+ **Q: Can I use environment variables instead?**
356
+ A: Yes. PAI checks environment variables first, then falls back to this file.
357
+
358
+ **Q: How does this relate to ~/.claude.json?**
359
+ A: `.claude.json` is for Claude Code and MCP server configuration. This file is for PAI-specific agent preferences.
360
+
361
+ **Q: What if I delete this file?**
362
+ A: PAI will use defaults. You can always recreate it from this template.