pi-para 0.5.2 → 0.6.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 (195) hide show
  1. package/ARCHITECTURE.md +160 -0
  2. package/CHANGELOG.md +51 -0
  3. package/CONFIGURATION.md +243 -0
  4. package/README.md +140 -237
  5. package/SETUP.md +196 -112
  6. package/STRUCTURE.md +140 -0
  7. package/package.json +86 -18
  8. package/scripts/build-assets.mjs +29 -0
  9. package/scripts/install.ps1 +55 -0
  10. package/scripts/install.sh +63 -0
  11. package/scripts/smoke-install.mjs +63 -0
  12. package/skills/para/SKILL.md +1 -1
  13. package/skills/setup/SKILL.md +1 -1
  14. package/src/atomic-write.ts +17 -0
  15. package/src/capture.ts +4 -4
  16. package/src/cli-legacy.ts +43 -0
  17. package/src/cli.ts +133 -28
  18. package/src/commands.ts +203 -243
  19. package/src/config.ts +355 -0
  20. package/src/context.ts +29 -14
  21. package/src/credentials.ts +100 -0
  22. package/src/daemon.ts +1 -1
  23. package/src/doctor.ts +209 -0
  24. package/src/gepa/index.ts +1 -1
  25. package/src/index.ts +119 -40
  26. package/src/maintainer.ts +4 -4
  27. package/src/model-resolver.ts +96 -0
  28. package/src/paths.ts +48 -0
  29. package/src/processor.ts +4 -4
  30. package/src/qmd-providers.ts +63 -0
  31. package/src/query.ts +15 -1
  32. package/src/repair.ts +49 -0
  33. package/src/scheduler/controls.ts +125 -0
  34. package/src/scheduler/index.ts +210 -0
  35. package/src/scheduler/leases.ts +98 -0
  36. package/src/scheduler/session-capture.ts +146 -0
  37. package/src/scheduler/state.ts +304 -0
  38. package/src/session-tools.ts +1 -1
  39. package/src/settings.ts +126 -0
  40. package/src/setup.ts +116 -0
  41. package/src/status.ts +115 -0
  42. package/src/store.ts +116 -31
  43. package/src/summarize.ts +72 -16
  44. package/src/templates/prompts.ts +1 -1
  45. package/src/tools.ts +280 -90
  46. package/src/wiki-tool-guidance.ts +84 -0
  47. package/src/wiki.ts +98 -26
  48. package/dist/capture.d.ts +0 -34
  49. package/dist/capture.d.ts.map +0 -1
  50. package/dist/capture.js +0 -461
  51. package/dist/capture.js.map +0 -1
  52. package/dist/cli.d.ts +0 -15
  53. package/dist/cli.d.ts.map +0 -1
  54. package/dist/cli.js +0 -405
  55. package/dist/cli.js.map +0 -1
  56. package/dist/commands.d.ts +0 -15
  57. package/dist/commands.d.ts.map +0 -1
  58. package/dist/commands.js +0 -786
  59. package/dist/commands.js.map +0 -1
  60. package/dist/context.d.ts +0 -61
  61. package/dist/context.d.ts.map +0 -1
  62. package/dist/context.js +0 -289
  63. package/dist/context.js.map +0 -1
  64. package/dist/daemon.d.ts +0 -49
  65. package/dist/daemon.d.ts.map +0 -1
  66. package/dist/daemon.js +0 -226
  67. package/dist/daemon.js.map +0 -1
  68. package/dist/frontmatter.d.ts +0 -59
  69. package/dist/frontmatter.d.ts.map +0 -1
  70. package/dist/frontmatter.js +0 -170
  71. package/dist/frontmatter.js.map +0 -1
  72. package/dist/gepa/dataset.d.ts +0 -36
  73. package/dist/gepa/dataset.d.ts.map +0 -1
  74. package/dist/gepa/dataset.js +0 -148
  75. package/dist/gepa/dataset.js.map +0 -1
  76. package/dist/gepa/evaluator.d.ts +0 -51
  77. package/dist/gepa/evaluator.d.ts.map +0 -1
  78. package/dist/gepa/evaluator.js +0 -317
  79. package/dist/gepa/evaluator.js.map +0 -1
  80. package/dist/gepa/index.d.ts +0 -66
  81. package/dist/gepa/index.d.ts.map +0 -1
  82. package/dist/gepa/index.js +0 -240
  83. package/dist/gepa/index.js.map +0 -1
  84. package/dist/gepa/llm.d.ts +0 -35
  85. package/dist/gepa/llm.d.ts.map +0 -1
  86. package/dist/gepa/llm.js +0 -268
  87. package/dist/gepa/llm.js.map +0 -1
  88. package/dist/gepa/optimized/capture-prompt.txt +0 -65
  89. package/dist/gepa/optimizer.d.ts +0 -29
  90. package/dist/gepa/optimizer.d.ts.map +0 -1
  91. package/dist/gepa/optimizer.js +0 -249
  92. package/dist/gepa/optimizer.js.map +0 -1
  93. package/dist/gepa/targets.d.ts +0 -39
  94. package/dist/gepa/targets.d.ts.map +0 -1
  95. package/dist/gepa/targets.js +0 -326
  96. package/dist/gepa/targets.js.map +0 -1
  97. package/dist/gepa/types.d.ts +0 -168
  98. package/dist/gepa/types.d.ts.map +0 -1
  99. package/dist/gepa/types.js +0 -124
  100. package/dist/gepa/types.js.map +0 -1
  101. package/dist/index.d.ts +0 -21
  102. package/dist/index.d.ts.map +0 -1
  103. package/dist/index.js +0 -294
  104. package/dist/index.js.map +0 -1
  105. package/dist/ingest.d.ts +0 -88
  106. package/dist/ingest.d.ts.map +0 -1
  107. package/dist/ingest.js +0 -105
  108. package/dist/ingest.js.map +0 -1
  109. package/dist/link-discovery.d.ts +0 -40
  110. package/dist/link-discovery.d.ts.map +0 -1
  111. package/dist/link-discovery.js +0 -122
  112. package/dist/link-discovery.js.map +0 -1
  113. package/dist/link-utils.d.ts +0 -30
  114. package/dist/link-utils.d.ts.map +0 -1
  115. package/dist/link-utils.js +0 -145
  116. package/dist/link-utils.js.map +0 -1
  117. package/dist/lint.d.ts +0 -39
  118. package/dist/lint.d.ts.map +0 -1
  119. package/dist/lint.js +0 -827
  120. package/dist/lint.js.map +0 -1
  121. package/dist/maintainer.d.ts +0 -24
  122. package/dist/maintainer.d.ts.map +0 -1
  123. package/dist/maintainer.js +0 -358
  124. package/dist/maintainer.js.map +0 -1
  125. package/dist/processor.d.ts +0 -14
  126. package/dist/processor.d.ts.map +0 -1
  127. package/dist/processor.js +0 -361
  128. package/dist/processor.js.map +0 -1
  129. package/dist/query.d.ts +0 -69
  130. package/dist/query.d.ts.map +0 -1
  131. package/dist/query.js +0 -107
  132. package/dist/query.js.map +0 -1
  133. package/dist/raw.d.ts +0 -57
  134. package/dist/raw.d.ts.map +0 -1
  135. package/dist/raw.js +0 -219
  136. package/dist/raw.js.map +0 -1
  137. package/dist/redact.d.ts +0 -21
  138. package/dist/redact.d.ts.map +0 -1
  139. package/dist/redact.js +0 -143
  140. package/dist/redact.js.map +0 -1
  141. package/dist/scope.d.ts +0 -54
  142. package/dist/scope.d.ts.map +0 -1
  143. package/dist/scope.js +0 -161
  144. package/dist/scope.js.map +0 -1
  145. package/dist/scripts/bulk-link-fix.d.ts +0 -9
  146. package/dist/scripts/bulk-link-fix.d.ts.map +0 -1
  147. package/dist/scripts/bulk-link-fix.js +0 -106
  148. package/dist/scripts/bulk-link-fix.js.map +0 -1
  149. package/dist/session-tools.d.ts +0 -33
  150. package/dist/session-tools.d.ts.map +0 -1
  151. package/dist/session-tools.js +0 -211
  152. package/dist/session-tools.js.map +0 -1
  153. package/dist/state.d.ts +0 -54
  154. package/dist/state.d.ts.map +0 -1
  155. package/dist/state.js +0 -176
  156. package/dist/state.js.map +0 -1
  157. package/dist/store.d.ts +0 -56
  158. package/dist/store.d.ts.map +0 -1
  159. package/dist/store.js +0 -227
  160. package/dist/store.js.map +0 -1
  161. package/dist/summarize.d.ts +0 -56
  162. package/dist/summarize.d.ts.map +0 -1
  163. package/dist/summarize.js +0 -231
  164. package/dist/summarize.js.map +0 -1
  165. package/dist/tag-registry.d.ts +0 -56
  166. package/dist/tag-registry.d.ts.map +0 -1
  167. package/dist/tag-registry.js +0 -146
  168. package/dist/tag-registry.js.map +0 -1
  169. package/dist/templates/prompts.d.ts +0 -63
  170. package/dist/templates/prompts.d.ts.map +0 -1
  171. package/dist/templates/prompts.js +0 -260
  172. package/dist/templates/prompts.js.map +0 -1
  173. package/dist/tools.d.ts +0 -26
  174. package/dist/tools.d.ts.map +0 -1
  175. package/dist/tools.js +0 -1033
  176. package/dist/tools.js.map +0 -1
  177. package/dist/watcher.d.ts +0 -25
  178. package/dist/watcher.d.ts.map +0 -1
  179. package/dist/watcher.js +0 -84
  180. package/dist/watcher.js.map +0 -1
  181. package/dist/webui/client/dist/index.html +0 -1885
  182. package/dist/webui/server.d.ts +0 -31
  183. package/dist/webui/server.d.ts.map +0 -1
  184. package/dist/webui/server.js +0 -566
  185. package/dist/webui/server.js.map +0 -1
  186. package/dist/wiki.d.ts +0 -103
  187. package/dist/wiki.d.ts.map +0 -1
  188. package/dist/wiki.js +0 -428
  189. package/dist/wiki.js.map +0 -1
  190. package/scripts/gepa/__pycache__/dataset.cpython-313.pyc +0 -0
  191. package/scripts/gepa/__pycache__/lm_providers.cpython-313.pyc +0 -0
  192. package/scripts/gepa/__pycache__/metric.cpython-313.pyc +0 -0
  193. package/scripts/gepa/__pycache__/program.cpython-313.pyc +0 -0
  194. package/scripts/gepa/__pycache__/wiki_reader.cpython-313.pyc +0 -0
  195. package/scripts/gepa/uv.lock +0 -2241
package/README.md CHANGED
@@ -1,287 +1,184 @@
1
1
  # pi-para
2
2
 
3
- A [pi](https://github.com/badlogic/pi-mono) extension that maintains a persistent, LLM-curated personal knowledge base structured by the [PARA method](https://fortelabs.com/blog/para/) (Projects, Areas, Resources, Archives). Inspired by [Karpathy's LLM wiki pattern](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f).
3
+ A [pi](https://github.com/badlogic/pi-mono) extension that maintains a persistent, LLM-curated personal knowledge base structured by the [PARA method](https://fortelabs.com/blog/para/) — Projects, Areas, Resources, Archives.
4
4
 
5
- The LLM writes and maintains the wiki autonomously. You provide sources and ask questions. Search powered by [@picassio/qmd](https://github.com/picassio/qmd-1).
5
+ pi-para runs as a normal Pi extension: no required daemon, no `systemd`, and no global QMD CLI. Search/indexing uses the embedded QMD SDK, and background capture/maintenance is coordinated by an in-process scheduler while Pi is open.
6
6
 
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- pi install @picassio/pi-para
10
+ pi install pi-para
11
+ # or, for npm/npx setup flows:
12
+ npx pi-para@latest setup
11
13
  ```
12
14
 
13
- Start pi — the extension loads automatically. Wiki directory is created on first session.
15
+ POSIX one-liner:
14
16
 
15
- ## Features
17
+ ```bash
18
+ curl -fsSL https://raw.githubusercontent.com/picassio/pi-para/main/scripts/install.sh | bash
19
+ ```
16
20
 
17
- ### Wiki Tools (8)
21
+ Windows PowerShell:
18
22
 
19
- | Tool | Description |
20
- |------|-------------|
21
- | `wiki_ingest` | Ingest a URL, file, or text into the wiki |
22
- | `wiki_query` | Search the wiki with scope filtering, graph boost, freshness indicators |
23
- | `wiki_write` | Create or update wiki pages |
24
- | `wiki_read` | Read a specific wiki page + freshness indicator |
25
- | `wiki_move` | Move pages between PARA categories |
26
- | `wiki_lint` | Run health checks and auto-fix |
27
- | `wiki_summarize` | Summarize pages, categories, or entire wiki |
28
- | `wiki_migrate` | Batch-migrate all pages to current schema version |
29
-
30
- ### Commands (11)
31
-
32
- | Command | Description |
33
- |---------|-------------|
34
- | `/wiki` | Status overview (scope, pages, log) |
35
- | `/wiki-search <query>` | Search the wiki |
36
- | `/wiki-ingest <url>` | Quick ingest |
37
- | `/wiki-capture [topic]` | Ask LLM to save knowledge via wiki_write |
38
- | `/wiki-scope` | Show or override project scope |
39
- | `/wiki-lint` | Run health checks |
40
- | `/wiki-summarize [target]` | Summarize wiki content |
41
- | `/wiki-settings` | Interactive settings (search, context, daemon, web UI, providers) |
42
- | `/wiki-daemon <cmd>` | Manage background capture daemon |
43
- | `/wiki-migrate` | Migrate all pages to current schema version |
44
- | `/wiki-project <name> <goal>` | Create or archive (`done`) a project page |
23
+ ```powershell
24
+ irm https://raw.githubusercontent.com/picassio/pi-para/main/scripts/install.ps1 | iex
25
+ ```
45
26
 
46
- ### Web Wiki UI
27
+ Restart Pi after installing or changing extension registration.
47
28
 
48
- Browser-based wiki viewer, editor, and graph visualization.
29
+ Then run:
49
30
 
31
+ ```bash
32
+ pi-para doctor
50
33
  ```
51
- /wiki-settings → [WebWiki] → Enabled: true
34
+
35
+ ## What pi-para creates
36
+
37
+ Default user files:
38
+
39
+ ```text
40
+ ~/.pi/para/config.jsonc # canonical pi-para config
41
+ ~/.pi/para/secrets.json # optional local secrets, chmod 0600
42
+ ~/.pi/wiki/ # PARA markdown wiki
43
+ ~/.pi/wiki/.pi-para.sqlite # scheduler queue/history/leases
44
+ ~/.pi/wiki/.qmd.sqlite # QMD SDK search index
52
45
  ```
53
46
 
54
- Access at `http://<LAN-IP>:10973`. Features:
55
- - Page tree by PARA category (sidebar)
56
- - Markdown viewer with clickable `[[wikilinks]]`
57
- - Inline page editor
58
- - D3 force-directed graph view (page relationships)
59
- - Search
60
- - Move pages between categories
61
- - Activity log and session digests
62
- - Mobile-first responsive design, dark/light theme
47
+ Legacy files such as `~/.pi/wiki/config.json`, `~/.pi/wiki/.daemon.sqlite`, and `~/.config/qmd/index.yml` are still read for migration/compatibility.
48
+
49
+ ## Core commands
63
50
 
64
- ### GEPA Prompt Optimizer
51
+ ### Pi slash commands
65
52
 
66
- Automatically optimize all pi-para prompts, tool instructions, and skill guidelines using [DSPy GEPA](https://arxiv.org/abs/2507.19457) (Genetic-Pareto optimizer). Runs via `uv` with custom LLM providers — no litellm.
53
+ | Command | Description |
54
+ |---|---|
55
+ | `/wiki` | Wiki status, current scope, page counts, recent log |
56
+ | `/wiki-search <query>` | Search the wiki |
57
+ | `/wiki-ingest <url-or-path-or-text>` | Ingest a source into `raw/` and synthesize pages |
58
+ | `/wiki-capture [topic]` | Queue/capture current session knowledge |
59
+ | `/wiki-scope [scope]` | Show or override current project scope |
60
+ | `/wiki-lint [--report-only]` | Run wiki health checks |
61
+ | `/wiki-summarize [target]` | Summarize a page/category/all |
62
+ | `/wiki-settings` | Interactive settings for config/providers/scheduler |
63
+ | `/wiki-scheduler [status\|queue\|history\|capture-history]` | Scheduler/capture observability |
64
+ | `/wiki-daemon ...` | Compatibility alias for `/wiki-scheduler` |
65
+ | `/wiki-migrate` | Batch-migrate pages to current schema |
66
+ | `/wiki-project <name> <goal>` | Create/archive project pages |
67
+
68
+ ### CLI
67
69
 
68
70
  ```bash
69
- # List all 22 optimization targets
70
- pi-para-daemon gepa targets
71
+ pi-para setup [--yes] [--dry-run] [--local PATH]
72
+ pi-para doctor [--fix] [--json] [--test-capture-model]
73
+ pi-para tasks [--status queued|running|done|failed]
74
+ pi-para tasks show <id>
75
+ pi-para tasks history [--task NAME] [--limit N]
76
+ pi-para tasks retry [--task NAME]
77
+ pi-para status [--json]
78
+ pi-para capture-recent --hours 24
79
+ pi-para providers
80
+ pi-para providers set-secret <name> <value>
81
+ pi-para providers remove-secret <name>
82
+ pi-para gepa optimize --target capture-prompt
83
+ ```
71
84
 
72
- # Optimize a single target (uses config defaults: sonnet student + opus teacher)
73
- pi-para-daemon gepa optimize --target capture-prompt
85
+ `pi-para-daemon` remains as a temporary compatibility binary, but the primary runtime is the in-process scheduler. Legacy daemon status is available as `pi-para legacy-status` for troubleshooting old installs.
74
86
 
75
- # Optimize all targets sequentially
76
- bash scripts/gepa/run-all.sh
87
+ ## Tools available to agents
77
88
 
78
- # Override models via CLI
79
- pi-para-daemon gepa optimize --target skill-para \
80
- --student-model anthropic/claude-sonnet-4-20250514 \
81
- --teacher-model anthropic/claude-opus-4-6 \
82
- --judge-model anthropic/claude-sonnet-4-20250514
89
+ | Tool | Description |
90
+ |---|---|
91
+ | `wiki_ingest` | Ingest URL/file/text into the wiki |
92
+ | `wiki_query` | Search with scope/category/freshness context |
93
+ | `wiki_edit` | Atomic exact `oldText → newText` page edits |
94
+ | `wiki_write` | Create/append/replace pages, or legacy edit mode |
95
+ | `wiki_read` | Read a page with freshness indicator |
96
+ | `wiki_move` | Move a page between PARA categories |
97
+ | `wiki_lint` | Run health checks and optional autofix |
98
+ | `wiki_migrate` | Batch-migrate pages to current schema |
99
+ | `wiki_summarize` | Summarize pages/categories/all |
83
100
 
84
- # Shorthand (--model = student, --reflection-model = teacher)
85
- pi-para-daemon gepa optimize --model anthropic/claude-sonnet-4-20250514 --reflection-model anthropic/claude-opus-4-6
101
+ Prefer `wiki_edit` for surgical updates to existing pages.
86
102
 
87
- # See results
88
- pi-para-daemon gepa list
103
+ ## Configuration
89
104
 
90
- # Compare original vs optimized
91
- pi-para-daemon gepa compare --target capture-prompt
92
- ```
105
+ Use `/wiki-settings` or edit:
93
106
 
94
- **How it works:**
95
-
96
- 1. TypeScript extracts all prompt/tool/skill texts from source files
97
- 2. Calls `uv run scripts/gepa/optimize.py` with API keys from `~/.pi/agent/auth.json`
98
- 3. Python builds a trainset from real wiki pages (93 pages → 30 train / 20 val)
99
- 4. DSPy GEPA evolves each instruction using a lightweight proxy module (1 LLM call per eval, not 10-50)
100
- 5. **Teacher** (Opus) proposes instruction mutations based on metric feedback
101
- 6. **Student** (Sonnet) runs the proxy to generate output from the instruction
102
- 7. **Judge** (Sonnet) scores on 6 dimensions: structure, PARA compliance, cross-references, security, completeness, actionability
103
- 8. Optimized prompts saved to `~/.pi/wiki/gepa/optimized/`
104
-
105
- **Teacher/Student/Judge pattern** (DSPy GEPA):
106
-
107
- | Role | Default Model | What It Does | Calls/target |
108
- |------|---------------|--------------|--------|
109
- | **Student** | `claude-sonnet-4` | Runs proxy (generates wiki output) | ~460 |
110
- | **Teacher** | `claude-opus-4-6` | Proposes mutations via reflection | ~30 |
111
- | **Judge** | `claude-sonnet-4` | Scores output (LLM-as-judge metric) | ~460 |
112
-
113
- **22 optimization targets:**
114
-
115
- | Category | Targets |
116
- |----------|--------|
117
- | Prompt templates (12) | System, ingest, query, capture (×3), maintenance, processor, summarize, iterative, overview, lint |
118
- | Tool instructions (8) | wiki_ingest, wiki_query, wiki_write, wiki_read, wiki_move, wiki_lint, wiki_migrate, wiki_summarize |
119
- | Skills (2) | para (active PARA workflow), setup (installation guide) |
120
-
121
- **LLM providers** (custom `dspy.BaseLM` subclasses, no litellm):
122
-
123
- | Provider | Auth | Notes |
124
- |----------|------|-------|
125
- | Anthropic | OAuth token from `auth.json` | Claude Code billing headers + user-agent, auto token refresh |
126
- | MiniMax | API key | Via Anthropic-compatible API |
127
- | OpenRouter | API key | Via OpenAI-compatible API |
128
-
129
- **Configuration** (`~/.pi/wiki/config.json`):
130
-
131
- ```json
132
- {
133
- "gepa": {
134
- "useOptimized": true,
135
- "studentModel": "anthropic/claude-sonnet-4-20250514",
136
- "teacherModel": "anthropic/claude-opus-4-6",
137
- "judgeModel": null,
138
- "auto": "light",
139
- "threads": 2,
140
- "seed": 42
141
- }
142
- }
107
+ ```text
108
+ ~/.pi/para/config.jsonc
143
109
  ```
144
110
 
145
- - `useOptimized: true` — load optimized prompts at runtime (enabled by default)
146
- - `studentModel` — fast model for running proxy + judging (Sonnet recommended)
147
- - `teacherModel` — smart model for proposing mutations (Opus recommended)
148
- - `judgeModel` — model for scoring output (defaults to studentModel if null)
149
- - All settings overridable via CLI flags
111
+ Credential refs use one of:
150
112
 
151
- When `useOptimized` is enabled, `getPrompt(name)` checks: user-generated → bundled optimized → original. Originals are always preserved.
113
+ ```text
114
+ pi-auth:<provider> # Pi AuthStorage, e.g. ~/.pi/agent/auth.json
115
+ secret:<name> # ~/.pi/para/secrets.json
116
+ none # local/no-auth provider
117
+ ```
152
118
 
153
- **Budget presets:**
119
+ Setup does not require or write API-key environment variables.
154
120
 
155
- | Preset | Rollouts | Time estimate | When to use |
156
- |--------|----------|---------------|-------------|
157
- | `light` | ~460 | 1-2 hours | Quick sanity check |
158
- | `medium` | ~1500 | 4-6 hours | Everyday optimization |
159
- | `heavy` | ~5000 | 12-24 hours | Final tuning |
121
+ See [CONFIGURATION.md](./CONFIGURATION.md) for the full schema.
160
122
 
161
- **Prerequisites:** `uv` (Python package manager). DSPy + anthropic SDK installed automatically on first run.
123
+ ## Search and QMD
162
124
 
163
- ### Background Capture Daemon
125
+ QMD is used as an embedded SDK through `qmd-engine`; users do not need to install a global `qmd` CLI.
164
126
 
165
- Processes session files in the background after you quit pi:
127
+ - BM25 keyword search works immediately.
128
+ - Embedding/rerank can be configured in `/wiki-settings` or `~/.pi/para/config.jsonc`.
129
+ - Legacy `~/.config/qmd/index.yml` is only a compatibility fallback.
166
130
 
167
- ```bash
168
- # Via extension command
169
- /wiki-daemon start
170
- /wiki-daemon status
131
+ ## Background capture and maintenance
171
132
 
172
- # Via CLI
173
- pi-para-daemon start
174
- pi-para-daemon process-recent --hours 24
175
- ```
133
+ When Pi is running, pi-para starts an in-process scheduler. It handles:
176
134
 
177
- The daemon uses an Agent with session exploration tools (session_slice, session_search, session_stats) to iteratively explore sessions of any size and extract knowledge.
135
+ - queued session capture,
136
+ - startup catch-up from `.completed-sessions`,
137
+ - index/search maintenance,
138
+ - queue/history/lease tracking in `.pi-para.sqlite`.
178
139
 
179
- Auto-starts via systemd on Linux — run `./setup.sh` once for daemon service setup.
140
+ No background OS service is required. If Pi is closed, queued work resumes on the next Pi session.
180
141
 
181
- ## Architecture
142
+ ## Web Wiki UI
182
143
 
183
- ```
184
- ~/.pi/wiki/
185
- ├── config.json # all settings (context, search, daemon, web UI, gepa)
186
- ├── schema.md # PARA conventions
187
- ├── index.md # page catalog (auto-rebuilt)
188
- ├── log.md # activity log
189
- ├── sessions.md # session digest log
190
- ├── .completed-sessions # daemon registry
191
- ├── .daemon.sqlite # daemon state
192
- ├── .qmd.sqlite # search index
193
- ├── projects/ # active, goal-defined work
194
- ├── areas/ # ongoing responsibilities
195
- ├── resources/ # reference material
196
- ├── archives/ # completed/deprecated
197
- ├── raw/ # immutable source material
198
- └── gepa/ # GEPA optimizer state
199
- ├── input/ # targets.json (generated per run)
200
- ├── output/ # results.json (GEPA output)
201
- ├── optimized/ # deployed optimized prompts (*.txt)
202
- └── history/ # version history per target
144
+ The optional web wiki can be enabled from `/wiki-settings`:
145
+
146
+ ```text
147
+ /wiki-settings → [WebWiki] Enabled
203
148
  ```
204
149
 
205
- **Python scripts (GEPA optimizer):**
150
+ It serves the wiki viewer/editor/graph on the configured host/port.
206
151
 
207
- ```
208
- scripts/gepa/
209
- ├── pyproject.toml # uv project (dspy, anthropic, openai deps)
210
- ├── optimize.py # Main entry — runs DSPy GEPA
211
- ├── lm_providers.py # Custom BaseLM: AnthropicOAuthLM, MiniMaxLM, OpenRouterLM
212
- ├── program.py # PromptProxy DSPy Module (1 LLM call per eval)
213
- ├── metric.py # LLM-as-judge metric (6 dimensions)
214
- ├── dataset.py # Build train/val from real wiki pages
215
- └── wiki_reader.py # Read wiki pages from disk
216
- ```
152
+ ## GEPA Prompt Optimizer
217
153
 
218
- ### How it works
219
-
220
- 1. **During a session** — LLM uses wiki tools (query, write, ingest). Context injection provides wiki knowledge on every turn.
221
- 2. **On /quit** — session registered in `.completed-sessions` (instant, <10ms)
222
- 3. **Background** — daemon picks up session, Agent explores with tools, writes wiki pages
223
- 4. **Next session** — new wiki pages appear in context injection
224
-
225
- ### Freshness Verification
226
-
227
- Every `wiki_query` and `wiki_read` result includes a freshness indicator based on the page's last-updated date:
228
-
229
- | Age | Indicator | LLM Behavior |
230
- |-----|-----------|---------------|
231
- | < 7 days | ✅ FRESH | Trust normally |
232
- | 7-14 days | ✅ Recent | Trust normally |
233
- | 14-30 days | ⚠️ AGING | Verify claims about code/configs before trusting |
234
- | 30-90 days | ⚠️ STALE | Verify before trusting |
235
- | > 90 days | 🚨 VERY STALE | Likely outdated, verify everything |
236
-
237
- The LLM is instructed to:
238
- - **Verify** stale claims by checking actual code, configs, or files
239
- - **Self-heal** — fix incorrect wiki pages via `wiki_write(mode: 'edit')` when it discovers they're wrong
240
- - **Flag uncertainty** — tell the user when a claim can't be verified (e.g. external services)
241
-
242
- ### Configuration
243
-
244
- All settings via `/wiki-settings` interactive menu, or edit `~/.pi/wiki/config.json`:
245
-
246
- ```json
247
- {
248
- "contextMaxTokens": 4000,
249
- "searchLimit": 10,
250
- "searchGraphBoost": true,
251
- "lintAutoFix": true,
252
- "lintStaleDays": 90,
253
- "daemonModel": null,
254
- "webWiki": { "enabled": true, "host": "0.0.0.0", "port": 10973 },
255
- "gepa": { "useOptimized": false }
256
- }
257
- ```
154
+ pi-para can optimize prompts/tools/skills using DSPy GEPA via `uv` and custom DSPy `BaseLM` providers.
258
155
 
259
- Search providers in `~/.config/qmd/index.yml`:
260
-
261
- ```yaml
262
- providers:
263
- embed:
264
- url: https://openrouter.ai/api/v1
265
- key: sk-or-...
266
- model: openai/text-embedding-3-small
267
- chat:
268
- url: https://api.minimaxi.com/anthropic
269
- key: sk-cp-...
270
- model: MiniMax-M2.7-highspeed
271
- api: anthropic
272
- ```
156
+ Recommended roles:
273
157
 
274
- ### Optional: Enhanced search
158
+ | Role | Default |
159
+ |---|---|
160
+ | Student | `anthropic/claude-sonnet-4-20250514` |
161
+ | Teacher/reflection | `anthropic/claude-opus-4-6` |
162
+ | Judge | `anthropic/claude-sonnet-4-20250514` |
163
+
164
+ Examples:
275
165
 
276
166
  ```bash
277
- npm install -g @picassio/qmd
167
+ pi-para gepa targets
168
+ pi-para gepa optimize --target capture-prompt
169
+ pi-para gepa optimize --target skill-para \
170
+ --student-model anthropic/claude-sonnet-4-20250514 \
171
+ --teacher-model anthropic/claude-opus-4-6 \
172
+ --judge-model anthropic/claude-sonnet-4-20250514
173
+ pi-para gepa list
174
+ pi-para gepa compare --target capture-prompt
278
175
  ```
279
176
 
280
- Without qmd: BM25 keyword search. With qmd + providers: hybrid BM25 + vector + rerank.
177
+ GEPA uses `~/.pi/agent/auth.json`/custom providers; it does not use LiteLLM.
281
178
 
282
- ## Obsidian Compatibility
179
+ ## Obsidian compatibility
283
180
 
284
- The wiki is a directory of markdown files with YAML frontmatter and `[[wikilinks]]`. Open `~/.pi/wiki/` as an Obsidian vault for graph view, Dataview queries, and manual editing.
181
+ The wiki is plain markdown with YAML frontmatter and `[[wikilinks]]`. You can open `~/.pi/wiki/` as an Obsidian vault.
285
182
 
286
183
  ## Development
287
184
 
@@ -289,16 +186,22 @@ The wiki is a directory of markdown files with YAML frontmatter and `[[wikilinks
289
186
  git clone https://github.com/picassio/pi-para.git
290
187
  cd pi-para
291
188
  npm install
292
- npm run check # TypeScript check
293
- npm test # Run tests (301 tests)
294
- npm run build # Compile to dist/
189
+ npm run check
190
+ npm test
191
+ npm run test:coverage
192
+ npm run build
193
+ npm run smoke:install
194
+
195
+ # Local setup into Pi settings
196
+ node ./dist/cli.js setup --local .
197
+ ```
295
198
 
296
- # Dev mode: symlink extension
297
- ln -sf $(pwd) ~/.pi/agent/extensions/pi-para
199
+ More docs:
298
200
 
299
- # Run daemon locally
300
- npx tsx src/cli.ts start
301
- ```
201
+ - [SETUP.md](./SETUP.md)
202
+ - [ARCHITECTURE.md](./ARCHITECTURE.md)
203
+ - [STRUCTURE.md](./STRUCTURE.md)
204
+ - [CONFIGURATION.md](./CONFIGURATION.md)
302
205
 
303
206
  ## License
304
207