@tekmidian/pai 0.6.0 → 0.6.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.
- package/ARCHITECTURE.md +136 -56
- package/FEATURE.md +2 -2
- package/package.json +1 -1
package/ARCHITECTURE.md
CHANGED
|
@@ -95,15 +95,22 @@ docker run -d \
|
|
|
95
95
|
pai setup
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
The interactive wizard walks through
|
|
98
|
+
The interactive wizard walks through 14 steps:
|
|
99
99
|
|
|
100
|
-
1.
|
|
101
|
-
2.
|
|
102
|
-
3.
|
|
100
|
+
1. Welcome and version check
|
|
101
|
+
2. Storage backend selection (SQLite or PostgreSQL)
|
|
102
|
+
3. Embedding model configuration
|
|
103
103
|
4. CLAUDE.md template installation
|
|
104
|
-
5.
|
|
105
|
-
6.
|
|
106
|
-
7.
|
|
104
|
+
5. PAI skill installation
|
|
105
|
+
6. Steering rules installation
|
|
106
|
+
7. Hook system deployment
|
|
107
|
+
8. TypeScript hook compilation
|
|
108
|
+
9. Claude Code settings configuration
|
|
109
|
+
10. Daemon installation
|
|
110
|
+
11. MCP server registration
|
|
111
|
+
12. Directory creation
|
|
112
|
+
13. Initial indexing
|
|
113
|
+
14. Verification
|
|
107
114
|
|
|
108
115
|
### 4. Install the Daemon
|
|
109
116
|
|
|
@@ -143,7 +150,7 @@ If both commands return healthy output, PAI is running. Open a new Claude Code s
|
|
|
143
150
|
|
|
144
151
|
## MCP Server
|
|
145
152
|
|
|
146
|
-
PAI exposes
|
|
153
|
+
PAI exposes 9 tools, 18 on-demand prompts (skills), and 11 reference resources to Claude Code via a daemon-backed MCP shim. The shim speaks stdio (what Claude Code expects) and proxies each request to the background daemon over NDJSON on a Unix socket.
|
|
147
154
|
|
|
148
155
|
```
|
|
149
156
|
Claude Code (stdio)
|
|
@@ -164,14 +171,8 @@ Claude Code (stdio)
|
|
|
164
171
|
| `session_list` | List session notes, optionally filtered by project |
|
|
165
172
|
| `registry_search` | Search project metadata (names, paths, tags) |
|
|
166
173
|
| `project_detect` | Identify which project a given path belongs to |
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `zettel_explore` | BFS traversal of wikilink graph from a seed note |
|
|
170
|
-
| `zettel_surprise` | Find semantically distant but graph-close notes |
|
|
171
|
-
| `zettel_converse` | Hybrid search with graph expansion and cross-domain connections |
|
|
172
|
-
| `zettel_themes` | Cluster vault notes into thematic groups by embedding similarity |
|
|
173
|
-
| `zettel_health` | Audit vault for broken links, orphans, and isolated clusters |
|
|
174
|
-
| `zettel_suggest` | Suggest link targets weighted by semantics, tags, and graph neighborhood |
|
|
174
|
+
| `project_health` | Audit all registered paths for moved or deleted directories |
|
|
175
|
+
| `project_todo` | Read a project's TODO.md and continuation prompt |
|
|
175
176
|
|
|
176
177
|
### Tool Reference
|
|
177
178
|
|
|
@@ -189,21 +190,52 @@ Claude Code (stdio)
|
|
|
189
190
|
|
|
190
191
|
**`project_detect(path?)`** — Given a filesystem path (defaults to CWD), returns the matching project.
|
|
191
192
|
|
|
192
|
-
**`
|
|
193
|
+
**`project_health(category?)`** — Audits all registered projects to find moved or deleted directories. Categorizes each as `active` (path exists), `stale` (path missing but candidate found nearby), or `dead` (path missing, no candidate). Also reports TODO.md presence and continuation prompts.
|
|
193
194
|
|
|
194
|
-
**`
|
|
195
|
+
**`project_todo(project?)`** — Reads a project's TODO.md without needing the exact file path. Searches Notes/TODO.md, .claude/Notes/TODO.md, tasks/todo.md, and project-root TODO.md in order. Surfaces any `## Continue` section at the top for quick context recovery.
|
|
195
196
|
|
|
196
|
-
|
|
197
|
+
### On-Demand Prompts (Skills)
|
|
197
198
|
|
|
198
|
-
|
|
199
|
+
The MCP server registers 18 prompts that Claude can invoke as on-demand skills. Each prompt provides a focused workflow with instructions, examples, and constraints — loaded only when needed to conserve context.
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
201
|
+
| Prompt | Purpose |
|
|
202
|
+
|--------|---------|
|
|
203
|
+
| `art` | Visual art direction and creative guidance |
|
|
204
|
+
| `createskill` | Scaffold new PAI skills |
|
|
205
|
+
| `journal` | Structured journaling workflow |
|
|
206
|
+
| `name` | Session and project naming conventions |
|
|
207
|
+
| `observability` | Observation system usage and querying |
|
|
208
|
+
| `plan` | Forward-looking planning from TODOs and recent activity |
|
|
209
|
+
| `research` | Structured research methodology |
|
|
210
|
+
| `review` | Retrospective review of work over a time period |
|
|
211
|
+
| `route` | Session note routing across projects |
|
|
212
|
+
| `search-history` | Search history analysis and patterns |
|
|
213
|
+
| `sessions` | Session lifecycle management |
|
|
214
|
+
| `share` | Generate social media posts from recent work |
|
|
215
|
+
| `story-explanation` | Narrative explanations of technical concepts |
|
|
216
|
+
| `vault-connect` | Suggest and create vault connections |
|
|
217
|
+
| `vault-context` | Use vault as conversational context |
|
|
218
|
+
| `vault-emerge` | Detect emerging themes in the vault |
|
|
219
|
+
| `vault-orphans` | Find and fix orphaned vault notes |
|
|
220
|
+
| `vault-trace` | Trace idea lineage through vault links |
|
|
221
|
+
|
|
222
|
+
### Reference Resources
|
|
223
|
+
|
|
224
|
+
11 resources available via `pai://` URIs. Claude reads these on demand for reference documentation.
|
|
225
|
+
|
|
226
|
+
| URI | Content |
|
|
227
|
+
|-----|---------|
|
|
228
|
+
| `pai://aesthetic` | Visual and output style guidelines |
|
|
229
|
+
| `pai://constitution` | Core philosophy and principles |
|
|
230
|
+
| `pai://history-system` | Search history tracking system |
|
|
231
|
+
| `pai://hook-system` | Hook architecture and development guide |
|
|
232
|
+
| `pai://mcp-dev-guide` | MCP server development patterns |
|
|
233
|
+
| `pai://prompting` | Prompt engineering best practices |
|
|
234
|
+
| `pai://prosody-agent-template` | Voice agent template |
|
|
235
|
+
| `pai://prosody-guide` | Voice and prosody guidelines |
|
|
236
|
+
| `pai://skill-system` | Skill authoring reference |
|
|
237
|
+
| `pai://terminal-tabs` | Terminal tab management |
|
|
238
|
+
| `pai://voice` | Voice configuration reference |
|
|
207
239
|
|
|
208
240
|
### Installation
|
|
209
241
|
|
|
@@ -418,7 +450,7 @@ pai observation stats
|
|
|
418
450
|
```bash
|
|
419
451
|
pai backup # Backup registry, config, and Postgres
|
|
420
452
|
pai restore <path> # Restore from backup (--no-postgres to skip DB)
|
|
421
|
-
pai setup # Interactive
|
|
453
|
+
pai setup # Interactive 14-step setup wizard
|
|
422
454
|
pai search "query" # Quick full-text search shortcut
|
|
423
455
|
```
|
|
424
456
|
|
|
@@ -819,41 +851,89 @@ bun run lint # tsc --noEmit
|
|
|
819
851
|
| Output | Purpose |
|
|
820
852
|
|--------|---------|
|
|
821
853
|
| `dist/cli/index.mjs` | `pai` CLI |
|
|
822
|
-
| `dist/mcp/index.mjs` | Direct MCP server (legacy) |
|
|
823
854
|
| `dist/daemon/index.mjs` | Daemon server |
|
|
824
855
|
| `dist/daemon-mcp/index.mjs` | MCP shim (stdio → daemon socket) |
|
|
856
|
+
| `dist/hooks/*.mjs` | Compiled lifecycle hooks |
|
|
825
857
|
|
|
826
858
|
### Source Structure
|
|
827
859
|
|
|
828
860
|
```
|
|
829
861
|
src/
|
|
830
|
-
├── cli/
|
|
831
|
-
│
|
|
832
|
-
├──
|
|
833
|
-
├── daemon
|
|
834
|
-
├──
|
|
835
|
-
├──
|
|
836
|
-
├──
|
|
837
|
-
├──
|
|
838
|
-
│ ├──
|
|
839
|
-
│
|
|
840
|
-
├──
|
|
841
|
-
│ ├──
|
|
842
|
-
│
|
|
843
|
-
│ └──
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
├──
|
|
847
|
-
├──
|
|
848
|
-
├──
|
|
849
|
-
└──
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
862
|
+
├── cli/
|
|
863
|
+
│ ├── commands/ # CLI command modules
|
|
864
|
+
│ │ ├── backup.ts
|
|
865
|
+
│ │ ├── daemon.ts
|
|
866
|
+
│ │ ├── memory.ts
|
|
867
|
+
│ │ ├── observation.ts
|
|
868
|
+
│ │ ├── obsidian.ts
|
|
869
|
+
│ │ ├── project.ts
|
|
870
|
+
│ │ ├── registry.ts
|
|
871
|
+
│ │ ├── session.ts
|
|
872
|
+
│ │ ├── setup/ # 14-step interactive wizard
|
|
873
|
+
│ │ │ ├── steps/ # 01-welcome through 15-verify
|
|
874
|
+
│ │ │ └── index.ts
|
|
875
|
+
│ │ └── zettel.ts
|
|
876
|
+
│ └── index.ts # CLI entry point
|
|
877
|
+
├── daemon/
|
|
878
|
+
│ ├── daemon/ # Daemon server internals
|
|
879
|
+
│ │ ├── dispatcher.ts # Tool dispatch (zettel, observation, memory)
|
|
880
|
+
│ │ ├── handler.ts # NDJSON request handler
|
|
881
|
+
│ │ └── server.ts # Socket server
|
|
882
|
+
│ ├── indexer/ # Background index scheduler
|
|
883
|
+
│ ├── config.ts # Runtime configuration
|
|
884
|
+
│ └── index.ts # Daemon entry point
|
|
885
|
+
├── daemon-mcp/
|
|
886
|
+
│ ├── instructions.ts # MCP server instructions (~1.5KB routing table)
|
|
887
|
+
│ ├── prompts/ # 18 on-demand skill prompts
|
|
888
|
+
│ ├── resources/ # 11 reference resources (pai:// URIs)
|
|
889
|
+
│ └── index.ts # MCP shim entry point (stdio → socket)
|
|
890
|
+
├── hooks/
|
|
891
|
+
│ └── ts/ # TypeScript hook sources by event
|
|
892
|
+
│ ├── PreCompact/
|
|
893
|
+
│ ├── PreToolUse/
|
|
894
|
+
│ ├── PostToolUse/
|
|
895
|
+
│ ├── SessionStart/
|
|
896
|
+
│ ├── Stop/
|
|
897
|
+
│ └── UserPromptSubmit/
|
|
898
|
+
├── mcp/
|
|
899
|
+
│ └── tools/ # Shared tool implementations
|
|
900
|
+
│ ├── memory.ts
|
|
901
|
+
│ ├── observations.ts
|
|
902
|
+
│ ├── projects.ts
|
|
903
|
+
│ ├── registry.ts
|
|
904
|
+
│ ├── sessions.ts
|
|
905
|
+
│ └── zettel.ts
|
|
906
|
+
├── memory/
|
|
907
|
+
│ ├── chunker/ # Text chunking strategies
|
|
908
|
+
│ ├── embeddings.ts # Snowflake Arctic embedding generation
|
|
909
|
+
│ ├── indexer.ts # File indexer with change detection
|
|
910
|
+
│ ├── reranker.ts # Cross-encoder reranking (ms-marco-MiniLM)
|
|
911
|
+
│ ├── search.ts # Multi-mode search (keyword/semantic/hybrid)
|
|
912
|
+
│ └── vault-indexer.ts # Obsidian vault indexing
|
|
913
|
+
├── observations/ # Automatic observation capture
|
|
914
|
+
│ ├── classifier.ts # Rule-based tool call classifier
|
|
915
|
+
│ ├── store.ts # PostgreSQL persistence with deduplication
|
|
916
|
+
│ └── schema.sql # DDL for observation tables
|
|
917
|
+
├── obsidian/ # Obsidian vault bridge
|
|
918
|
+
│ └── vault-fixer.ts # Repairs broken wikilinks and orphans
|
|
919
|
+
├── registry/ # SQLite registry queries and migrations
|
|
920
|
+
├── session/ # Session slug generator
|
|
921
|
+
├── storage/ # Pluggable storage backend
|
|
922
|
+
│ ├── factory.ts # Backend selection (SQLite/PostgreSQL)
|
|
923
|
+
│ ├── interface.ts # StorageInterface contract
|
|
924
|
+
│ ├── postgres.ts # PostgreSQL + pgvector backend
|
|
925
|
+
│ └── sqlite.ts # SQLite backend
|
|
926
|
+
├── utils/ # Shared utilities
|
|
927
|
+
│ ├── hash.ts # SHA-256 hashing
|
|
928
|
+
│ └── stop-words.ts # Stop word lists for search
|
|
929
|
+
├── zettelkasten/ # Luhmann-inspired operations
|
|
930
|
+
│ ├── explore.ts # BFS traversal
|
|
931
|
+
│ ├── surprise.ts # Serendipitous bridge discovery
|
|
932
|
+
│ ├── converse.ts # Hybrid search + graph expansion
|
|
933
|
+
│ ├── themes.ts # Embedding clustering
|
|
934
|
+
│ ├── health.ts # Vault structural audit
|
|
935
|
+
│ └── suggest.ts # Weighted link suggestions
|
|
936
|
+
└── index.ts # Package entry point
|
|
857
937
|
```
|
|
858
938
|
|
|
859
939
|
### Important Notes
|
package/FEATURE.md
CHANGED
|
@@ -28,13 +28,13 @@ different direction: persistent memory, session continuity, and deep Claude Code
|
|
|
28
28
|
| **Persistent session memory** | No | Yes — auto-indexed, 449K+ chunks |
|
|
29
29
|
| **Session registry** | No | Yes — SQLite, tracks 77+ projects |
|
|
30
30
|
| **Background daemon** | No | Yes — launchd, IPC via Unix socket |
|
|
31
|
-
| **MCP server** | No | Yes —
|
|
31
|
+
| **MCP server** | No | Yes — 9 tools, 18 prompts, 11 resources exposed to Claude Code |
|
|
32
32
|
| **Keyword search (BM25)** | No | Yes — GIN full-text index, PostgreSQL |
|
|
33
33
|
| **Semantic search (vector)** | No | Yes — pgvector HNSW, Snowflake Arctic 768-dim |
|
|
34
34
|
| **Multi-backend storage** | No | Yes — SQLite (simple) or PostgreSQL (full) |
|
|
35
35
|
| **Obsidian vault bridge** | No | Yes — symlinks + auto-generated topic pages |
|
|
36
36
|
| **Project lifecycle** | No | Yes — promote, archive, move, detect from cwd |
|
|
37
|
-
| **Setup wizard** | No | Yes — idempotent
|
|
37
|
+
| **Setup wizard** | No | Yes — idempotent 14-step interactive wizard |
|
|
38
38
|
| **Hook system** | No | Yes — pre-compact, session-stop, auto-cleanup |
|
|
39
39
|
| **Backup / restore** | No | Yes — timestamped pg_dump + registry export |
|
|
40
40
|
| **Multi-session concurrency** | n/a | Yes — daemon multiplexes Claude sessions |
|