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.
- package/CHANGELOG.md +214 -0
- package/README.md +305 -0
- package/SETUP.md +171 -0
- package/dist/capture.d.ts +34 -0
- package/dist/capture.d.ts.map +1 -0
- package/dist/capture.js +461 -0
- package/dist/capture.js.map +1 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +405 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands.d.ts +15 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +786 -0
- package/dist/commands.js.map +1 -0
- package/dist/context.d.ts +61 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +289 -0
- package/dist/context.js.map +1 -0
- package/dist/daemon.d.ts +49 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +226 -0
- package/dist/daemon.js.map +1 -0
- package/dist/frontmatter.d.ts +59 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/frontmatter.js +170 -0
- package/dist/frontmatter.js.map +1 -0
- package/dist/gepa/dataset.d.ts +36 -0
- package/dist/gepa/dataset.d.ts.map +1 -0
- package/dist/gepa/dataset.js +148 -0
- package/dist/gepa/dataset.js.map +1 -0
- package/dist/gepa/evaluator.d.ts +51 -0
- package/dist/gepa/evaluator.d.ts.map +1 -0
- package/dist/gepa/evaluator.js +317 -0
- package/dist/gepa/evaluator.js.map +1 -0
- package/dist/gepa/index.d.ts +66 -0
- package/dist/gepa/index.d.ts.map +1 -0
- package/dist/gepa/index.js +240 -0
- package/dist/gepa/index.js.map +1 -0
- package/dist/gepa/llm.d.ts +35 -0
- package/dist/gepa/llm.d.ts.map +1 -0
- package/dist/gepa/llm.js +268 -0
- package/dist/gepa/llm.js.map +1 -0
- package/dist/gepa/optimized/capture-prompt.txt +65 -0
- package/dist/gepa/optimizer.d.ts +29 -0
- package/dist/gepa/optimizer.d.ts.map +1 -0
- package/dist/gepa/optimizer.js +249 -0
- package/dist/gepa/optimizer.js.map +1 -0
- package/dist/gepa/targets.d.ts +39 -0
- package/dist/gepa/targets.d.ts.map +1 -0
- package/dist/gepa/targets.js +326 -0
- package/dist/gepa/targets.js.map +1 -0
- package/dist/gepa/types.d.ts +168 -0
- package/dist/gepa/types.d.ts.map +1 -0
- package/dist/gepa/types.js +124 -0
- package/dist/gepa/types.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +294 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest.d.ts +88 -0
- package/dist/ingest.d.ts.map +1 -0
- package/dist/ingest.js +105 -0
- package/dist/ingest.js.map +1 -0
- package/dist/link-discovery.d.ts +40 -0
- package/dist/link-discovery.d.ts.map +1 -0
- package/dist/link-discovery.js +122 -0
- package/dist/link-discovery.js.map +1 -0
- package/dist/link-utils.d.ts +30 -0
- package/dist/link-utils.d.ts.map +1 -0
- package/dist/link-utils.js +145 -0
- package/dist/link-utils.js.map +1 -0
- package/dist/lint.d.ts +39 -0
- package/dist/lint.d.ts.map +1 -0
- package/dist/lint.js +827 -0
- package/dist/lint.js.map +1 -0
- package/dist/maintainer.d.ts +24 -0
- package/dist/maintainer.d.ts.map +1 -0
- package/dist/maintainer.js +358 -0
- package/dist/maintainer.js.map +1 -0
- package/dist/processor.d.ts +14 -0
- package/dist/processor.d.ts.map +1 -0
- package/dist/processor.js +361 -0
- package/dist/processor.js.map +1 -0
- package/dist/query.d.ts +69 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +107 -0
- package/dist/query.js.map +1 -0
- package/dist/raw.d.ts +57 -0
- package/dist/raw.d.ts.map +1 -0
- package/dist/raw.js +219 -0
- package/dist/raw.js.map +1 -0
- package/dist/redact.d.ts +21 -0
- package/dist/redact.d.ts.map +1 -0
- package/dist/redact.js +143 -0
- package/dist/redact.js.map +1 -0
- package/dist/scope.d.ts +54 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +161 -0
- package/dist/scope.js.map +1 -0
- package/dist/scripts/bulk-link-fix.d.ts +9 -0
- package/dist/scripts/bulk-link-fix.d.ts.map +1 -0
- package/dist/scripts/bulk-link-fix.js +106 -0
- package/dist/scripts/bulk-link-fix.js.map +1 -0
- package/dist/session-tools.d.ts +33 -0
- package/dist/session-tools.d.ts.map +1 -0
- package/dist/session-tools.js +211 -0
- package/dist/session-tools.js.map +1 -0
- package/dist/state.d.ts +54 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/state.js +176 -0
- package/dist/state.js.map +1 -0
- package/dist/store.d.ts +56 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +227 -0
- package/dist/store.js.map +1 -0
- package/dist/summarize.d.ts +56 -0
- package/dist/summarize.d.ts.map +1 -0
- package/dist/summarize.js +231 -0
- package/dist/summarize.js.map +1 -0
- package/dist/tag-registry.d.ts +56 -0
- package/dist/tag-registry.d.ts.map +1 -0
- package/dist/tag-registry.js +146 -0
- package/dist/tag-registry.js.map +1 -0
- package/dist/templates/prompts.d.ts +63 -0
- package/dist/templates/prompts.d.ts.map +1 -0
- package/dist/templates/prompts.js +260 -0
- package/dist/templates/prompts.js.map +1 -0
- package/dist/tools.d.ts +26 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +1033 -0
- package/dist/tools.js.map +1 -0
- package/dist/watcher.d.ts +25 -0
- package/dist/watcher.d.ts.map +1 -0
- package/dist/watcher.js +84 -0
- package/dist/watcher.js.map +1 -0
- package/dist/webui/client/dist/index.html +1885 -0
- package/dist/webui/server.d.ts +31 -0
- package/dist/webui/server.d.ts.map +1 -0
- package/dist/webui/server.js +566 -0
- package/dist/webui/server.js.map +1 -0
- package/dist/wiki.d.ts +103 -0
- package/dist/wiki.d.ts.map +1 -0
- package/dist/wiki.js +428 -0
- package/dist/wiki.js.map +1 -0
- package/package.json +142 -0
- package/scripts/gepa/__pycache__/dataset.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/lm_providers.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/metric.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/program.cpython-313.pyc +0 -0
- package/scripts/gepa/__pycache__/wiki_reader.cpython-313.pyc +0 -0
- package/scripts/gepa/dataset.py +192 -0
- package/scripts/gepa/lm_providers.py +472 -0
- package/scripts/gepa/metric.py +279 -0
- package/scripts/gepa/optimize.py +367 -0
- package/scripts/gepa/program.py +99 -0
- package/scripts/gepa/pyproject.toml +19 -0
- package/scripts/gepa/run-all.sh +53 -0
- package/scripts/gepa/uv.lock +2241 -0
- package/scripts/gepa/wiki_reader.py +113 -0
- package/skills/para/SKILL.md +77 -0
- package/skills/setup/SKILL.md +20 -0
- package/src/capture.ts +563 -0
- package/src/cli.ts +416 -0
- package/src/commands.ts +878 -0
- package/src/context.ts +390 -0
- package/src/daemon.ts +288 -0
- package/src/frontmatter.ts +219 -0
- package/src/gepa/index.ts +287 -0
- package/src/gepa/optimized/capture-prompt.txt +65 -0
- package/src/index.ts +384 -0
- package/src/ingest.ts +177 -0
- package/src/link-discovery.ts +170 -0
- package/src/link-utils.ts +169 -0
- package/src/lint.ts +1018 -0
- package/src/maintainer.ts +404 -0
- package/src/processor.ts +415 -0
- package/src/python/__pycache__/minimax_lm.cpython-312.pyc +0 -0
- package/src/python/minimax_lm.py +198 -0
- package/src/python/rlm_capture.py +215 -0
- package/src/query.ts +148 -0
- package/src/raw.ts +276 -0
- package/src/redact.ts +159 -0
- package/src/scope.ts +214 -0
- package/src/scripts/bulk-link-fix.ts +126 -0
- package/src/session-tools.ts +260 -0
- package/src/state.ts +271 -0
- package/src/store.ts +288 -0
- package/src/summarize.ts +273 -0
- package/src/tag-registry.ts +157 -0
- package/src/templates/index.md +17 -0
- package/src/templates/prompts.ts +274 -0
- package/src/templates/schema.md +116 -0
- package/src/tools.ts +1293 -0
- package/src/watcher.ts +101 -0
- package/src/webui/client/dist/index.html +1885 -0
- package/src/webui/server.ts +765 -0
- 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.
|