pi-para 0.5.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.
Files changed (198) hide show
  1. package/CHANGELOG.md +214 -0
  2. package/README.md +305 -0
  3. package/SETUP.md +171 -0
  4. package/dist/capture.d.ts +34 -0
  5. package/dist/capture.d.ts.map +1 -0
  6. package/dist/capture.js +461 -0
  7. package/dist/capture.js.map +1 -0
  8. package/dist/cli.d.ts +15 -0
  9. package/dist/cli.d.ts.map +1 -0
  10. package/dist/cli.js +405 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/commands.d.ts +15 -0
  13. package/dist/commands.d.ts.map +1 -0
  14. package/dist/commands.js +786 -0
  15. package/dist/commands.js.map +1 -0
  16. package/dist/context.d.ts +61 -0
  17. package/dist/context.d.ts.map +1 -0
  18. package/dist/context.js +289 -0
  19. package/dist/context.js.map +1 -0
  20. package/dist/daemon.d.ts +49 -0
  21. package/dist/daemon.d.ts.map +1 -0
  22. package/dist/daemon.js +226 -0
  23. package/dist/daemon.js.map +1 -0
  24. package/dist/frontmatter.d.ts +59 -0
  25. package/dist/frontmatter.d.ts.map +1 -0
  26. package/dist/frontmatter.js +170 -0
  27. package/dist/frontmatter.js.map +1 -0
  28. package/dist/gepa/dataset.d.ts +36 -0
  29. package/dist/gepa/dataset.d.ts.map +1 -0
  30. package/dist/gepa/dataset.js +148 -0
  31. package/dist/gepa/dataset.js.map +1 -0
  32. package/dist/gepa/evaluator.d.ts +51 -0
  33. package/dist/gepa/evaluator.d.ts.map +1 -0
  34. package/dist/gepa/evaluator.js +317 -0
  35. package/dist/gepa/evaluator.js.map +1 -0
  36. package/dist/gepa/index.d.ts +66 -0
  37. package/dist/gepa/index.d.ts.map +1 -0
  38. package/dist/gepa/index.js +240 -0
  39. package/dist/gepa/index.js.map +1 -0
  40. package/dist/gepa/llm.d.ts +35 -0
  41. package/dist/gepa/llm.d.ts.map +1 -0
  42. package/dist/gepa/llm.js +268 -0
  43. package/dist/gepa/llm.js.map +1 -0
  44. package/dist/gepa/optimized/capture-prompt.txt +65 -0
  45. package/dist/gepa/optimizer.d.ts +29 -0
  46. package/dist/gepa/optimizer.d.ts.map +1 -0
  47. package/dist/gepa/optimizer.js +249 -0
  48. package/dist/gepa/optimizer.js.map +1 -0
  49. package/dist/gepa/targets.d.ts +39 -0
  50. package/dist/gepa/targets.d.ts.map +1 -0
  51. package/dist/gepa/targets.js +326 -0
  52. package/dist/gepa/targets.js.map +1 -0
  53. package/dist/gepa/types.d.ts +168 -0
  54. package/dist/gepa/types.d.ts.map +1 -0
  55. package/dist/gepa/types.js +124 -0
  56. package/dist/gepa/types.js.map +1 -0
  57. package/dist/index.d.ts +21 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +294 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/ingest.d.ts +88 -0
  62. package/dist/ingest.d.ts.map +1 -0
  63. package/dist/ingest.js +105 -0
  64. package/dist/ingest.js.map +1 -0
  65. package/dist/link-discovery.d.ts +40 -0
  66. package/dist/link-discovery.d.ts.map +1 -0
  67. package/dist/link-discovery.js +122 -0
  68. package/dist/link-discovery.js.map +1 -0
  69. package/dist/link-utils.d.ts +30 -0
  70. package/dist/link-utils.d.ts.map +1 -0
  71. package/dist/link-utils.js +145 -0
  72. package/dist/link-utils.js.map +1 -0
  73. package/dist/lint.d.ts +39 -0
  74. package/dist/lint.d.ts.map +1 -0
  75. package/dist/lint.js +827 -0
  76. package/dist/lint.js.map +1 -0
  77. package/dist/maintainer.d.ts +24 -0
  78. package/dist/maintainer.d.ts.map +1 -0
  79. package/dist/maintainer.js +358 -0
  80. package/dist/maintainer.js.map +1 -0
  81. package/dist/processor.d.ts +14 -0
  82. package/dist/processor.d.ts.map +1 -0
  83. package/dist/processor.js +361 -0
  84. package/dist/processor.js.map +1 -0
  85. package/dist/query.d.ts +69 -0
  86. package/dist/query.d.ts.map +1 -0
  87. package/dist/query.js +107 -0
  88. package/dist/query.js.map +1 -0
  89. package/dist/raw.d.ts +57 -0
  90. package/dist/raw.d.ts.map +1 -0
  91. package/dist/raw.js +219 -0
  92. package/dist/raw.js.map +1 -0
  93. package/dist/redact.d.ts +21 -0
  94. package/dist/redact.d.ts.map +1 -0
  95. package/dist/redact.js +143 -0
  96. package/dist/redact.js.map +1 -0
  97. package/dist/scope.d.ts +54 -0
  98. package/dist/scope.d.ts.map +1 -0
  99. package/dist/scope.js +161 -0
  100. package/dist/scope.js.map +1 -0
  101. package/dist/scripts/bulk-link-fix.d.ts +9 -0
  102. package/dist/scripts/bulk-link-fix.d.ts.map +1 -0
  103. package/dist/scripts/bulk-link-fix.js +106 -0
  104. package/dist/scripts/bulk-link-fix.js.map +1 -0
  105. package/dist/session-tools.d.ts +33 -0
  106. package/dist/session-tools.d.ts.map +1 -0
  107. package/dist/session-tools.js +211 -0
  108. package/dist/session-tools.js.map +1 -0
  109. package/dist/state.d.ts +54 -0
  110. package/dist/state.d.ts.map +1 -0
  111. package/dist/state.js +176 -0
  112. package/dist/state.js.map +1 -0
  113. package/dist/store.d.ts +56 -0
  114. package/dist/store.d.ts.map +1 -0
  115. package/dist/store.js +227 -0
  116. package/dist/store.js.map +1 -0
  117. package/dist/summarize.d.ts +56 -0
  118. package/dist/summarize.d.ts.map +1 -0
  119. package/dist/summarize.js +231 -0
  120. package/dist/summarize.js.map +1 -0
  121. package/dist/tag-registry.d.ts +56 -0
  122. package/dist/tag-registry.d.ts.map +1 -0
  123. package/dist/tag-registry.js +146 -0
  124. package/dist/tag-registry.js.map +1 -0
  125. package/dist/templates/prompts.d.ts +63 -0
  126. package/dist/templates/prompts.d.ts.map +1 -0
  127. package/dist/templates/prompts.js +260 -0
  128. package/dist/templates/prompts.js.map +1 -0
  129. package/dist/tools.d.ts +26 -0
  130. package/dist/tools.d.ts.map +1 -0
  131. package/dist/tools.js +1033 -0
  132. package/dist/tools.js.map +1 -0
  133. package/dist/watcher.d.ts +25 -0
  134. package/dist/watcher.d.ts.map +1 -0
  135. package/dist/watcher.js +84 -0
  136. package/dist/watcher.js.map +1 -0
  137. package/dist/webui/client/dist/index.html +1885 -0
  138. package/dist/webui/server.d.ts +31 -0
  139. package/dist/webui/server.d.ts.map +1 -0
  140. package/dist/webui/server.js +566 -0
  141. package/dist/webui/server.js.map +1 -0
  142. package/dist/wiki.d.ts +103 -0
  143. package/dist/wiki.d.ts.map +1 -0
  144. package/dist/wiki.js +428 -0
  145. package/dist/wiki.js.map +1 -0
  146. package/package.json +142 -0
  147. package/scripts/gepa/__pycache__/dataset.cpython-313.pyc +0 -0
  148. package/scripts/gepa/__pycache__/lm_providers.cpython-313.pyc +0 -0
  149. package/scripts/gepa/__pycache__/metric.cpython-313.pyc +0 -0
  150. package/scripts/gepa/__pycache__/program.cpython-313.pyc +0 -0
  151. package/scripts/gepa/__pycache__/wiki_reader.cpython-313.pyc +0 -0
  152. package/scripts/gepa/dataset.py +192 -0
  153. package/scripts/gepa/lm_providers.py +472 -0
  154. package/scripts/gepa/metric.py +279 -0
  155. package/scripts/gepa/optimize.py +367 -0
  156. package/scripts/gepa/program.py +99 -0
  157. package/scripts/gepa/pyproject.toml +19 -0
  158. package/scripts/gepa/run-all.sh +53 -0
  159. package/scripts/gepa/uv.lock +2241 -0
  160. package/scripts/gepa/wiki_reader.py +113 -0
  161. package/skills/para/SKILL.md +77 -0
  162. package/skills/setup/SKILL.md +20 -0
  163. package/src/capture.ts +563 -0
  164. package/src/cli.ts +416 -0
  165. package/src/commands.ts +878 -0
  166. package/src/context.ts +390 -0
  167. package/src/daemon.ts +288 -0
  168. package/src/frontmatter.ts +219 -0
  169. package/src/gepa/index.ts +287 -0
  170. package/src/gepa/optimized/capture-prompt.txt +65 -0
  171. package/src/index.ts +384 -0
  172. package/src/ingest.ts +177 -0
  173. package/src/link-discovery.ts +170 -0
  174. package/src/link-utils.ts +169 -0
  175. package/src/lint.ts +1018 -0
  176. package/src/maintainer.ts +404 -0
  177. package/src/processor.ts +415 -0
  178. package/src/python/__pycache__/minimax_lm.cpython-312.pyc +0 -0
  179. package/src/python/minimax_lm.py +198 -0
  180. package/src/python/rlm_capture.py +215 -0
  181. package/src/query.ts +148 -0
  182. package/src/raw.ts +276 -0
  183. package/src/redact.ts +159 -0
  184. package/src/scope.ts +214 -0
  185. package/src/scripts/bulk-link-fix.ts +126 -0
  186. package/src/session-tools.ts +260 -0
  187. package/src/state.ts +271 -0
  188. package/src/store.ts +288 -0
  189. package/src/summarize.ts +273 -0
  190. package/src/tag-registry.ts +157 -0
  191. package/src/templates/index.md +17 -0
  192. package/src/templates/prompts.ts +274 -0
  193. package/src/templates/schema.md +116 -0
  194. package/src/tools.ts +1293 -0
  195. package/src/watcher.ts +101 -0
  196. package/src/webui/client/dist/index.html +1885 -0
  197. package/src/webui/server.ts +765 -0
  198. package/src/wiki.ts +550 -0
@@ -0,0 +1,113 @@
1
+ """Read wiki pages from disk for training data.
2
+
3
+ Parses YAML frontmatter + markdown body from ~/.pi/wiki/{category}/{slug}.md.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import os
9
+ import re
10
+ from dataclasses import dataclass, field
11
+ from pathlib import Path
12
+
13
+ import yaml
14
+
15
+
16
+ PARA_CATEGORIES = ("projects", "areas", "resources", "archives")
17
+
18
+
19
+ @dataclass
20
+ class WikiPage:
21
+ """A parsed wiki page."""
22
+ category: str
23
+ slug: str
24
+ title: str
25
+ scope: list[str] = field(default_factory=list)
26
+ tags: list[str] = field(default_factory=list)
27
+ links: list[str] = field(default_factory=list)
28
+ body: str = ""
29
+ created: str = ""
30
+ updated: str = ""
31
+
32
+ @property
33
+ def path(self) -> str:
34
+ return f"{self.category}/{self.slug}"
35
+
36
+
37
+ def parse_page(filepath: str) -> WikiPage | None:
38
+ """Parse a wiki markdown file into a WikiPage."""
39
+ try:
40
+ with open(filepath, "r", encoding="utf-8") as f:
41
+ content = f.read()
42
+ except (IOError, OSError):
43
+ return None
44
+
45
+ # Split frontmatter from body
46
+ fm_match = re.match(r"^---\s*\n(.*?\n)---\s*\n(.*)", content, re.DOTALL)
47
+ if not fm_match:
48
+ return None
49
+
50
+ try:
51
+ fm = yaml.safe_load(fm_match.group(1))
52
+ except yaml.YAMLError:
53
+ return None
54
+
55
+ if not isinstance(fm, dict):
56
+ return None
57
+
58
+ body = fm_match.group(2).strip()
59
+ path = Path(filepath)
60
+ slug = path.stem
61
+ category = path.parent.name
62
+
63
+ return WikiPage(
64
+ category=category,
65
+ slug=slug,
66
+ title=fm.get("title", slug),
67
+ scope=fm.get("scope", []) or [],
68
+ tags=fm.get("tags", []) or [],
69
+ links=fm.get("links", []) or [],
70
+ body=body,
71
+ created=str(fm.get("created", "")),
72
+ updated=str(fm.get("updated", "")),
73
+ )
74
+
75
+
76
+ def load_all_pages(wiki_dir: str) -> list[WikiPage]:
77
+ """Load all wiki pages from disk."""
78
+ pages = []
79
+ for cat in PARA_CATEGORIES:
80
+ cat_dir = os.path.join(wiki_dir, cat)
81
+ if not os.path.isdir(cat_dir):
82
+ continue
83
+ for fname in sorted(os.listdir(cat_dir)):
84
+ if not fname.endswith(".md"):
85
+ continue
86
+ page = parse_page(os.path.join(cat_dir, fname))
87
+ if page:
88
+ pages.append(page)
89
+ return pages
90
+
91
+
92
+ def get_wiki_stats(wiki_dir: str) -> dict:
93
+ """Get summary stats about the wiki."""
94
+ pages = load_all_pages(wiki_dir)
95
+ cat_counts = {}
96
+ all_scopes = set()
97
+ all_tags = set()
98
+ total_links = 0
99
+
100
+ for p in pages:
101
+ cat_counts[p.category] = cat_counts.get(p.category, 0) + 1
102
+ all_scopes.update(p.scope)
103
+ all_tags.update(p.tags)
104
+ total_links += len(p.links)
105
+
106
+ return {
107
+ "total_pages": len(pages),
108
+ "categories": cat_counts,
109
+ "unique_scopes": sorted(all_scopes),
110
+ "unique_tags": sorted(all_tags)[:20], # top 20
111
+ "total_links": total_links,
112
+ "avg_links_per_page": round(total_links / max(len(pages), 1), 1),
113
+ }
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: para
3
+ description: Active PARA knowledge management during work. Consult wiki before planning, write decisions as they happen, search for past solutions when debugging, check conventions when reviewing. Use when starting any task, making architecture decisions, debugging problems, or reviewing code.
4
+ ---
5
+
6
+ # PARA Active Knowledge
7
+
8
+ Behavioral guidelines for actively using the PARA wiki during work — not just passively capturing at session end.
9
+
10
+ **The shift**: Wiki isn't just a record. It's a working tool. Consult it before acting. Write to it while acting.
11
+
12
+ ## 1. PARA Categories — Know What Goes Where
13
+
14
+ **Most things are resources. Projects and areas are special.**
15
+
16
+ | Category | What it is | When to create/update |
17
+ |----------|-----------|----------------------|
18
+ | **resources/** | Reference material — architecture docs, debugging solutions, patterns, configs, how-tos | Default for almost everything. When you learn something, it's probably a resource. |
19
+ | **projects/** | A discrete goal with an **end condition** — "Ship feature X by date Y" | When the user defines a goal with a finish line. Update status as milestones are hit. Move to archives when done. |
20
+ | **areas/** | An ongoing responsibility with **quality standards** — "Keep wiki healthy", "Monitor prod uptime" | When there's a repeating responsibility that never "finishes". Update with current health/status. |
21
+ | **archives/** | Completed or inactive items | Don't create here. Move finished projects here via `wiki_move`. |
22
+
23
+ Common mistake: putting architecture docs about a project into `projects/`. A page like "pi-para daemon architecture" is a **resource** about pi-para, not a project.
24
+
25
+ ## 2. Before You Start — Consult
26
+
27
+ **Don't plan from scratch. Check what's already known.**
28
+
29
+ Before starting any non-trivial task:
30
+ - `wiki_query` for the topic, feature area, or technology involved
31
+ - Read any relevant pages (architecture decisions, past debugging, conventions)
32
+ - Check for existing patterns that should be followed or pitfalls to avoid
33
+ - If the wiki has a `projects/` page for this work, read it for goals and constraints
34
+
35
+ Skip this for trivial tasks (typo fix, single-line change). Use judgment.
36
+
37
+ ## 3. During Work — Write As You Go
38
+
39
+ **Don't wait for session end. Capture decisions when they're fresh.**
40
+
41
+ Write to the wiki immediately when you:
42
+ - Make an architecture or design decision ("chose X over Y because Z")
43
+ - Discover a non-obvious gotcha or constraint
44
+ - Solve a debugging problem (root cause + fix)
45
+ - Learn how a system actually works (vs. how you assumed)
46
+ - Establish a convention or pattern others should follow
47
+
48
+ Use `wiki_write(mode: 'edit')` for surgical updates to existing pages. Use `wiki_write(mode: 'append')` to add new sections. Don't defer — context and reasoning degrade with time.
49
+
50
+ ## 4. When Debugging — Search First
51
+
52
+ **Someone may have solved this before.**
53
+
54
+ Before deep-diving into a bug:
55
+ - `wiki_query` for the error message, component name, or symptom
56
+ - Check for past debugging pages that describe similar root causes
57
+ - Look for operational knowledge (config paths, service dependencies, known failure modes)
58
+
59
+ After solving:
60
+ - Write the root cause + fix to the wiki immediately
61
+ - Include the exact error message (makes future searches find it)
62
+
63
+ ## 5. When Reviewing — Check Conventions
64
+
65
+ **The wiki holds the team's agreed patterns.**
66
+
67
+ When reviewing or writing code that touches architecture:
68
+ - `wiki_query` for conventions in the relevant area
69
+ - Check existing architecture decision pages before proposing new approaches
70
+ - If you're contradicting an existing decision, note why in the wiki (update the page, don't just ignore it)
71
+
72
+ ## 6. What Not To Do
73
+
74
+ - Don't dump every thought into the wiki — capture knowledge, not noise
75
+ - Don't create new pages when an existing page covers the topic — update it
76
+ - Don't skip the search step — duplicate pages degrade the wiki
77
+ - Don't include secrets — document WHERE keys are stored, not the values
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: setup
3
+ description: Set up pi-para PARA knowledge base extension. Installs qmd search engine, configures providers, starts background capture daemon. Use when user asks to install, set up, or configure pi-para wiki.
4
+ ---
5
+
6
+ # pi-para Setup
7
+
8
+ Read and follow the instructions in `SETUP.md` at the root of the pi-para package.
9
+
10
+ The setup file is at: `{{skill_dir}}/../../SETUP.md`
11
+
12
+ Steps:
13
+ 1. `pi install @picassio/pi-para` (extension)
14
+ 2. `npm install -g @picassio/qmd` (search engine)
15
+ 3. Configure `~/.config/qmd/index.yml` (providers)
16
+ 4. Set `daemonModel` in `~/.pi/wiki/config.json` (daemon LLM)
17
+ 5. Start systemd daemon service
18
+ 6. Verify with `/wiki-settings`
19
+
20
+ Ask the user for their API keys if needed. Check what's already installed before re-installing.