pi-para 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 +0 -9
- package/CHANGELOG.md +13 -0
- package/CONFIGURATION.md +0 -23
- package/README.md +1 -29
- package/SETUP.md +1 -1
- package/STRUCTURE.md +0 -9
- package/dist/atomic-write.d.ts +2 -0
- package/dist/atomic-write.d.ts.map +1 -0
- package/dist/atomic-write.js +18 -0
- package/dist/atomic-write.js.map +1 -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-legacy.d.ts +4 -0
- package/dist/cli-legacy.d.ts.map +1 -0
- package/dist/cli-legacy.js +41 -0
- package/dist/cli-legacy.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +427 -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 +719 -0
- package/dist/commands.js.map +1 -0
- package/dist/config.d.ts +94 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +228 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +63 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +311 -0
- package/dist/context.js.map +1 -0
- package/dist/credentials.d.ts +27 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +85 -0
- package/dist/credentials.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/doctor.d.ts +20 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +176 -0
- package/dist/doctor.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/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +342 -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/model-resolver.d.ts +30 -0
- package/dist/model-resolver.d.ts.map +1 -0
- package/dist/model-resolver.js +71 -0
- package/dist/model-resolver.js.map +1 -0
- package/dist/paths.d.ts +20 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +33 -0
- package/dist/paths.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/qmd-providers.d.ts +12 -0
- package/dist/qmd-providers.d.ts.map +1 -0
- package/dist/qmd-providers.js +45 -0
- package/dist/qmd-providers.js.map +1 -0
- package/dist/query.d.ts +69 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +120 -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/repair.d.ts +11 -0
- package/dist/repair.d.ts.map +1 -0
- package/dist/repair.js +41 -0
- package/dist/repair.js.map +1 -0
- package/dist/scheduler/controls.d.ts +35 -0
- package/dist/scheduler/controls.d.ts.map +1 -0
- package/dist/scheduler/controls.js +98 -0
- package/dist/scheduler/controls.js.map +1 -0
- package/dist/scheduler/index.d.ts +48 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js +193 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/scheduler/leases.d.ts +22 -0
- package/dist/scheduler/leases.d.ts.map +1 -0
- package/dist/scheduler/leases.js +74 -0
- package/dist/scheduler/leases.js.map +1 -0
- package/dist/scheduler/session-capture.d.ts +33 -0
- package/dist/scheduler/session-capture.d.ts.map +1 -0
- package/dist/scheduler/session-capture.js +108 -0
- package/dist/scheduler/session-capture.js.map +1 -0
- package/dist/scheduler/state.d.ts +56 -0
- package/dist/scheduler/state.d.ts.map +1 -0
- package/dist/scheduler/state.js +210 -0
- package/dist/scheduler/state.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/settings.d.ts +19 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +106 -0
- package/dist/settings.js.map +1 -0
- package/dist/setup.d.ts +29 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +90 -0
- package/dist/setup.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/status.d.ts +22 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +93 -0
- package/dist/status.js.map +1 -0
- package/dist/store.d.ts +71 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +282 -0
- package/dist/store.js.map +1 -0
- package/dist/summarize.d.ts +60 -0
- package/dist/summarize.d.ts.map +1 -0
- package/dist/summarize.js +266 -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 +51 -0
- package/dist/templates/prompts.d.ts.map +1 -0
- package/dist/templates/prompts.js +203 -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 +1198 -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-tool-guidance.d.ts +6 -0
- package/dist/wiki-tool-guidance.d.ts.map +1 -0
- package/dist/wiki-tool-guidance.js +70 -0
- package/dist/wiki-tool-guidance.js.map +1 -0
- package/dist/wiki.d.ts +108 -0
- package/dist/wiki.d.ts.map +1 -0
- package/dist/wiki.js +497 -0
- package/dist/wiki.js.map +1 -0
- package/package.json +2 -1
- package/scripts/build-assets.mjs +1 -13
- package/skills/setup/SKILL.md +1 -1
- package/src/cli.ts +0 -70
- package/src/config.ts +0 -25
- package/src/index.ts +1 -38
- package/src/templates/prompts.ts +0 -56
- package/scripts/gepa/dataset.py +0 -192
- package/scripts/gepa/lm_providers.py +0 -472
- package/scripts/gepa/metric.py +0 -279
- package/scripts/gepa/optimize.py +0 -367
- package/scripts/gepa/program.py +0 -99
- package/scripts/gepa/pyproject.toml +0 -19
- package/scripts/gepa/run-all.sh +0 -53
- package/scripts/gepa/wiki_reader.py +0 -113
- package/src/gepa/index.ts +0 -287
- package/src/gepa/optimized/capture-prompt.txt +0 -65
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical tag registry — normalizes and deduplicates wiki page tags.
|
|
3
|
+
*
|
|
4
|
+
* Rules:
|
|
5
|
+
* 1. Spaces → hyphens ("session files" → "session-files")
|
|
6
|
+
* 2. Lowercase everything
|
|
7
|
+
* 3. Map aliases → canonical tags
|
|
8
|
+
* 4. Remove tags that duplicate scope values on the same page
|
|
9
|
+
* 5. Deduplicate
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Normalize a scope value.
|
|
13
|
+
*
|
|
14
|
+
* Scope should be a project name (kebab-case, single token), not a topic
|
|
15
|
+
* description. The daemon LLM sometimes writes freeform multi-word
|
|
16
|
+
* descriptions like "session exploration" or "mono project" as scope.
|
|
17
|
+
*
|
|
18
|
+
* Rules:
|
|
19
|
+
* 1. Trim + lowercase
|
|
20
|
+
* 2. If the value contains a known project name as a prefix, extract it
|
|
21
|
+
* (e.g. "pi-para daemon" → "pi-para", "pi-mono project" → "pi-mono")
|
|
22
|
+
* 3. If still multi-word after extraction, drop it — it's a topic
|
|
23
|
+
* description, not a project name
|
|
24
|
+
* 4. Return the clean kebab-case scope
|
|
25
|
+
*
|
|
26
|
+
* This is project-agnostic — works for any project, not just pi-para.
|
|
27
|
+
*/
|
|
28
|
+
export declare function normalizeScope(scope: string): string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Normalize a full scope list:
|
|
31
|
+
* 1. Normalize each value
|
|
32
|
+
* 2. Deduplicate
|
|
33
|
+
* 3. Ensure at least one scope remains (fallback to "global")
|
|
34
|
+
*/
|
|
35
|
+
export declare function normalizeScopes(scopes: string[]): string[];
|
|
36
|
+
/**
|
|
37
|
+
* Normalize a single tag:
|
|
38
|
+
* 1. Trim + lowercase
|
|
39
|
+
* 2. Spaces → hyphens
|
|
40
|
+
* 3. Resolve alias → canonical
|
|
41
|
+
*/
|
|
42
|
+
export declare function normalizeTag(tag: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Normalize a full tag list for a page, given its scope.
|
|
45
|
+
*
|
|
46
|
+
* 1. Normalize each tag
|
|
47
|
+
* 2. Remove tags that exactly match a scope value
|
|
48
|
+
* 3. Deduplicate
|
|
49
|
+
* 4. Sort alphabetically
|
|
50
|
+
*/
|
|
51
|
+
export declare function normalizeTags(tags: string[], scope: string[]): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Get the full alias map for external inspection (e.g., lint reporting).
|
|
54
|
+
*/
|
|
55
|
+
export declare function getAliasMap(): ReadonlyMap<string, string>;
|
|
56
|
+
//# sourceMappingURL=tag-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-registry.d.ts","sourceRoot":"","sources":["../src/tag-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB3D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAQ1D;AAkDD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAavE;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAEzD"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical tag registry — normalizes and deduplicates wiki page tags.
|
|
3
|
+
*
|
|
4
|
+
* Rules:
|
|
5
|
+
* 1. Spaces → hyphens ("session files" → "session-files")
|
|
6
|
+
* 2. Lowercase everything
|
|
7
|
+
* 3. Map aliases → canonical tags
|
|
8
|
+
* 4. Remove tags that duplicate scope values on the same page
|
|
9
|
+
* 5. Deduplicate
|
|
10
|
+
*/
|
|
11
|
+
// -- Scope normalization -----------------------------------------------------
|
|
12
|
+
/**
|
|
13
|
+
* Normalize a scope value.
|
|
14
|
+
*
|
|
15
|
+
* Scope should be a project name (kebab-case, single token), not a topic
|
|
16
|
+
* description. The daemon LLM sometimes writes freeform multi-word
|
|
17
|
+
* descriptions like "session exploration" or "mono project" as scope.
|
|
18
|
+
*
|
|
19
|
+
* Rules:
|
|
20
|
+
* 1. Trim + lowercase
|
|
21
|
+
* 2. If the value contains a known project name as a prefix, extract it
|
|
22
|
+
* (e.g. "pi-para daemon" → "pi-para", "pi-mono project" → "pi-mono")
|
|
23
|
+
* 3. If still multi-word after extraction, drop it — it's a topic
|
|
24
|
+
* description, not a project name
|
|
25
|
+
* 4. Return the clean kebab-case scope
|
|
26
|
+
*
|
|
27
|
+
* This is project-agnostic — works for any project, not just pi-para.
|
|
28
|
+
*/
|
|
29
|
+
export function normalizeScope(scope) {
|
|
30
|
+
const s = scope.trim().toLowerCase();
|
|
31
|
+
if (!s)
|
|
32
|
+
return null;
|
|
33
|
+
// Already clean (no spaces) — pass through
|
|
34
|
+
if (!s.includes(" "))
|
|
35
|
+
return s;
|
|
36
|
+
// Try to extract a kebab-case project name prefix.
|
|
37
|
+
// Multi-word scopes from the LLM follow the pattern:
|
|
38
|
+
// "<project-name> <topic words>" e.g. "pi-mono project", "pi-para daemon"
|
|
39
|
+
// Extract the first kebab-case token if it looks like a project name.
|
|
40
|
+
const firstToken = s.split(" ")[0];
|
|
41
|
+
if (firstToken && firstToken.includes("-")) {
|
|
42
|
+
// Looks like a kebab-case project name (e.g. "pi-mono", "pi-para")
|
|
43
|
+
return firstToken;
|
|
44
|
+
}
|
|
45
|
+
// Multi-word without a kebab prefix → topic description, drop it
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Normalize a full scope list:
|
|
50
|
+
* 1. Normalize each value
|
|
51
|
+
* 2. Deduplicate
|
|
52
|
+
* 3. Ensure at least one scope remains (fallback to "global")
|
|
53
|
+
*/
|
|
54
|
+
export function normalizeScopes(scopes) {
|
|
55
|
+
const result = new Set();
|
|
56
|
+
for (const s of scopes) {
|
|
57
|
+
const normalized = normalizeScope(s);
|
|
58
|
+
if (normalized)
|
|
59
|
+
result.add(normalized);
|
|
60
|
+
}
|
|
61
|
+
if (result.size === 0)
|
|
62
|
+
result.add("global");
|
|
63
|
+
return [...result].sort();
|
|
64
|
+
}
|
|
65
|
+
// -- Tag normalization -------------------------------------------------------
|
|
66
|
+
/** Canonical tag → list of aliases that map to it. */
|
|
67
|
+
const TAG_ALIASES = {
|
|
68
|
+
// session/capture family
|
|
69
|
+
"session-capture": ["capture", "background-capture", "session"],
|
|
70
|
+
"session-files": ["session files"],
|
|
71
|
+
// project identity
|
|
72
|
+
"pi-para": ["para"],
|
|
73
|
+
"pi-mono": ["mono"],
|
|
74
|
+
"coding-agent": ["agent"],
|
|
75
|
+
// tech
|
|
76
|
+
"node-llama-cpp": [],
|
|
77
|
+
"qmd-search": ["bm25"],
|
|
78
|
+
"lazy-loading": [],
|
|
79
|
+
// kebab-case normalization
|
|
80
|
+
"scope-detection": ["scope detection"],
|
|
81
|
+
"project-structure": ["project structure", "structure"],
|
|
82
|
+
"model-registry": ["model registry"],
|
|
83
|
+
"thinking-level": ["thinking level"],
|
|
84
|
+
"interactive-mode": ["interactive mode"],
|
|
85
|
+
"exploration-incomplete": ["exploration incomplete"],
|
|
86
|
+
"ui-component": ["UI component"],
|
|
87
|
+
"scoped-models": ["scopedModels"],
|
|
88
|
+
"github-packages": [],
|
|
89
|
+
"architecture-pattern": [],
|
|
90
|
+
"knowledge-management": ["knowledge-base"],
|
|
91
|
+
// UI
|
|
92
|
+
"webui": ["ui", "frontend", "react"],
|
|
93
|
+
};
|
|
94
|
+
/** Build reverse lookup: alias → canonical. */
|
|
95
|
+
function buildAliasMap() {
|
|
96
|
+
const map = new Map();
|
|
97
|
+
for (const [canonical, aliases] of Object.entries(TAG_ALIASES)) {
|
|
98
|
+
for (const alias of aliases) {
|
|
99
|
+
map.set(alias.toLowerCase(), canonical);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return map;
|
|
103
|
+
}
|
|
104
|
+
const ALIAS_MAP = buildAliasMap();
|
|
105
|
+
/**
|
|
106
|
+
* Normalize a single tag:
|
|
107
|
+
* 1. Trim + lowercase
|
|
108
|
+
* 2. Spaces → hyphens
|
|
109
|
+
* 3. Resolve alias → canonical
|
|
110
|
+
*/
|
|
111
|
+
export function normalizeTag(tag) {
|
|
112
|
+
let t = tag.trim().toLowerCase().replace(/\s+/g, "-");
|
|
113
|
+
const canonical = ALIAS_MAP.get(t);
|
|
114
|
+
if (canonical)
|
|
115
|
+
t = canonical;
|
|
116
|
+
return t;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Normalize a full tag list for a page, given its scope.
|
|
120
|
+
*
|
|
121
|
+
* 1. Normalize each tag
|
|
122
|
+
* 2. Remove tags that exactly match a scope value
|
|
123
|
+
* 3. Deduplicate
|
|
124
|
+
* 4. Sort alphabetically
|
|
125
|
+
*/
|
|
126
|
+
export function normalizeTags(tags, scope) {
|
|
127
|
+
const scopeSet = new Set(scope.map(s => s.toLowerCase()));
|
|
128
|
+
const normalized = new Set();
|
|
129
|
+
for (const tag of tags) {
|
|
130
|
+
const t = normalizeTag(tag);
|
|
131
|
+
if (!t)
|
|
132
|
+
continue;
|
|
133
|
+
// Don't add tags that duplicate scope
|
|
134
|
+
if (scopeSet.has(t))
|
|
135
|
+
continue;
|
|
136
|
+
normalized.add(t);
|
|
137
|
+
}
|
|
138
|
+
return [...normalized].sort();
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get the full alias map for external inspection (e.g., lint reporting).
|
|
142
|
+
*/
|
|
143
|
+
export function getAliasMap() {
|
|
144
|
+
return ALIAS_MAP;
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=tag-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-registry.js","sourceRoot":"","sources":["../src/tag-registry.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM prompt templates for ingest, query, lint, capture, and summarize operations.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* System prompt for the standalone wiki agent used in capture, lint, and
|
|
6
|
+
* summarize operations. This agent runs outside the session's agent loop.
|
|
7
|
+
*/
|
|
8
|
+
export declare const WIKI_SYSTEM_PROMPT = "You are a wiki knowledge management agent. You maintain a PARA-structured knowledge base.\n\nYour job is to read content, extract knowledge, and write structured wiki pages. You operate autonomously \u2014 no user confirmation needed.\n\nPARA category rules:\n- **resources/**: Use for almost everything \u2014 architecture docs, how-tos, debugging solutions, configs, patterns, implementation notes. This is the default.\n- **areas/**: Only for ongoing responsibilities with no end date (e.g. server config, deployment procedures).\n- **projects/**: ONLY for actual goals with a defined end date and completion criteria. Do NOT use for documentation about a project's internals.\n- **archives/**: Never create pages here \u2014 pages get moved here when completed.\n\nWhen the user defines a specific goal with a completion condition, create a projects/ page. When identifying a repeating responsibility (monitoring, maintenance, quality), create an areas/ page.\n\nScope and tag rules:\n- scope must be a kebab-case project name (e.g. \"pi-para\", \"qmd\"). NOT topic descriptions like \"session exploration\".\n- tags must be kebab-case (no spaces). Don't duplicate scope values as tags.\n\nContent rules:\n- Use [[wikilinks]] to connect related pages. Always add a ## Connections section.\n- Use the wiki summary format: Topic, Key Facts, Insights, Connections, Open Questions, Sources\n- Keep pages focused on one concept each\n- Be concise and factual \u2014 no fluff\n- Check for existing similar pages before creating new ones to avoid duplicates\n- NEVER include API keys, tokens, passwords, or secrets. Document WHERE they are stored, not the values.\n- Index is auto-rebuilt after every write \u2014 do not manage index.md manually. Do NOT pass indexContent to wiki_write.";
|
|
9
|
+
/**
|
|
10
|
+
* Prompt included in the tool result when the LLM processes an ingested source.
|
|
11
|
+
* The LLM reads this along with the source content, schema, and current index.
|
|
12
|
+
*/
|
|
13
|
+
export declare const INGEST_PROMPT = "Analyze the source content below and integrate it into the wiki.\n\nInstructions:\n1. Identify key entities, concepts, facts, and relationships in the source\n2. Review the current index to find existing pages that should be updated\n3. Decide which existing wiki pages need updates and what new pages to create\n4. For each page, use the wiki summary format:\n - Topic: what this page covers\n - Key Facts: established knowledge points\n - Insights: non-obvious findings, patterns, implications\n - Connections: [[wikilinks]] to related pages with descriptions\n - Open Questions: gaps in knowledge, unresolved contradictions\n - Sources: source URLs, file paths, session references\n5. Assign PARA category correctly:\n - resources/ for reference material (DEFAULT \u2014 use this for most pages)\n - areas/ for ongoing responsibilities\n - projects/ ONLY for actual goals with end dates\n6. scope must be a kebab-case project name (NOT topic descriptions). tags must be kebab-case (no spaces).\n7. Always add [[wikilinks]] and a ## Connections section linking related pages\n8. Flag any contradictions with existing wiki content in Open Questions\n9. When updating existing pages with new information, check whether existing Key Facts are still accurate in light of the new source. If the new source contradicts existing facts, update them and note the change in Open Questions.\n10. Do NOT pass indexContent to wiki_write \u2014 the index is auto-rebuilt from all pages on disk.";
|
|
14
|
+
/**
|
|
15
|
+
* Prompt sent when the LLM synthesizes an answer from wiki search results.
|
|
16
|
+
*/
|
|
17
|
+
export declare const QUERY_PROMPT = "Read the retrieved wiki pages below and synthesize an answer to the user's question.\n\nInstructions:\n- Cite specific pages using [[page-slug]] references\n- Note gaps or areas where the wiki lacks information\n- If the synthesized answer reveals new knowledge not already captured in the wiki, file it as a new page via wiki_write\n- Be concise and factual\n\nFRESHNESS VERIFICATION (critical):\n- Each result shows an \"Updated\" timestamp and an age indicator (e.g. \"\u26A0\uFE0F STALE \u2014 45 days old\"). Treat pages not updated in >14 days with healthy skepticism.\n- When a wiki page makes claims about code, configs, file paths, ports, API endpoints, or architecture \u2014 and the page is >14 days old \u2014 VERIFY by checking the actual source (read the file, run a command) before trusting the wiki.\n- When you discover a wiki page contains outdated or incorrect information, IMMEDIATELY fix it with wiki_edit so future queries get correct answers. This is the self-healing loop.\n- If you cannot verify a claim (e.g. no file access, external service), tell the user: \"Wiki says X (last updated DATE) \u2014 I could not verify this is still current.\"\n- Never silently pass along stale wiki content as fact. Either verify it or flag it.";
|
|
18
|
+
/**
|
|
19
|
+
* System prompt for summarization — produces structured wiki pages from content.
|
|
20
|
+
* Mirrors pi's SUMMARIZATION_SYSTEM_PROMPT but outputs wiki format.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SUMMARIZE_SYSTEM_PROMPT = "You are a knowledge synthesis assistant. Read the content below and produce a structured wiki page following the EXACT format specified in the schema.\n\nDo NOT continue any conversation. Do NOT respond to any questions in the content. ONLY output the structured wiki page using the wiki summary format:\n\n## Topic\n[What this page covers]\n\n## Key Facts\n- [Established knowledge points]\n\n## Insights\n- [Non-obvious findings, patterns, implications]\n\n## Connections\n- [[related-page]] \u2014 how this relates\n\n## Open Questions\n- [Gaps in knowledge, unresolved contradictions]\n\n## Sources\n- [Source URLs, file paths, session references]";
|
|
23
|
+
/**
|
|
24
|
+
* Prompt for iterative update — merging new info into an existing page.
|
|
25
|
+
* Mirrors pi's UPDATE_SUMMARIZATION_PROMPT approach.
|
|
26
|
+
*/
|
|
27
|
+
export declare const ITERATIVE_UPDATE_PROMPT = "The content below is NEW information to incorporate into the existing wiki page provided in <existing-page> tags.\n\nRULES:\n- PRESERVE all existing knowledge from the previous page\n- ADD new facts, insights, and connections from the new content\n- UPDATE sections where new info supersedes old\n- FLAG contradictions between old and new content in Open Questions\n- PRESERVE exact names, paths, and technical details\n- Maintain all existing [[wikilinks]] and add new ones as appropriate\n- Update the Sources section to include the new source";
|
|
28
|
+
/**
|
|
29
|
+
* Prompt for overview generation from multiple pages.
|
|
30
|
+
*/
|
|
31
|
+
export declare const OVERVIEW_PROMPT = "Summarize the following wiki pages into a high-level overview page. Identify themes, patterns, and connections across pages. Use the wiki summary format.\n\nFor each major theme:\n- Note which pages contribute to the theme\n- Identify cross-cutting patterns\n- Flag contradictions between pages\n- Highlight gaps (topics that should have pages but don't)";
|
|
32
|
+
/**
|
|
33
|
+
* Prompt for the LLM when reviewing lint results and auto-fixing issues.
|
|
34
|
+
*/
|
|
35
|
+
export declare const LINT_PROMPT = "Review the lint results below and fix all auto-fixable issues.\n\nFor each issue:\n- Prioritize by impact (errors first, then warnings, then info)\n- Fix broken wikilinks by finding the correct target page or removing dead links\n- Add missing pages for concepts referenced across multiple pages\n- Move stale projects to archives if inactive for 90+ days\n- Fix frontmatter issues (missing fields, invalid dates, empty scope)\n- Update index.md to include any pages missing from the index\n- Propose archiving for inactive projects\n\nReport unfixable issues that require human judgment.";
|
|
36
|
+
/**
|
|
37
|
+
* System prompt for the standalone capture agent.
|
|
38
|
+
* Used as WIKI_SYSTEM_PROMPT for the capture agent instance.
|
|
39
|
+
*/
|
|
40
|
+
export declare const CAPTURE_SYSTEM_PROMPT = "You are a knowledge capture assistant. Your job is to extract persistent knowledge from coding sessions and write it to a PARA-structured wiki.\n\nCapture ANY of the following \u2014 even from short sessions:\n- Architecture decisions and rationale (\"we chose X because Y\")\n- Debugging solutions (root cause + fix)\n- Server/infrastructure details (IPs, paths, credentials locations, configs)\n- Build and deployment procedures (commands, steps, gotchas)\n- API keys, service endpoints, and where they are stored\n- Project conventions and coding patterns\n- Tool configurations and setup steps\n- Dependencies and version constraints\n- Environment-specific knowledge (dev vs prod differences)\n- Operational runbooks (how to restart, deploy, rollback)\n\nIndex is auto-rebuilt after every write \u2014 do not manage index.md manually. Do NOT pass indexContent to wiki_write.\n\nRules:\n- If the session was ONLY greetings or completely off-topic chitchat with zero project knowledge, respond with \"nothing to capture\"\n- Otherwise, always capture \u2014 even small facts are valuable (\"the deploy key is at /path/to/key\")\n- Classify each piece of knowledge by PARA category autonomously\n- When the user defines a specific goal with a completion condition, create a projects/ page. When identifying a repeating responsibility (monitoring, maintenance, quality), create an areas/ page.\n- Produce wiki pages in the standard wiki summary format (Topic, Key Facts, Insights, Connections, Open Questions, Sources)\n- Include the full session file path in the Sources section for traceability\n- ALWAYS search wiki_query BEFORE creating any page \u2014 update existing pages instead of creating duplicates\n- If wiki_query finds a page on the same topic (even with a different title/slug), update THAT page using its existing slug\n- The conversation may include compaction summaries from earlier in the session \u2014 treat these as authoritative records of prior work\n- Write directly via wiki_write \u2014 no user confirmation needed\n- NEVER include API keys, tokens, passwords, or secrets in wiki pages. Document WHERE they are stored, not the actual values.";
|
|
41
|
+
/**
|
|
42
|
+
* Prompt template for auto-capture at session_shutdown.
|
|
43
|
+
* The serialized conversation is appended after this prompt.
|
|
44
|
+
*/
|
|
45
|
+
export declare const CAPTURE_PROMPT = "Analyze the session conversation below and capture ALL project-relevant knowledge into the wiki.\n\nCapture bias: when in doubt, capture it. Small operational facts (paths, configs, server details, commands) are often the most valuable because they are hard to rediscover.\n\nOnly respond with \"nothing to capture\" if the session was purely greetings or off-topic chitchat with zero project knowledge.\n\nFor everything else:\n1. Use wiki_query to search for EXISTING pages on each topic FIRST\n2. If a matching page exists, use wiki_read to get its content, then wiki_write with its EXACT slug to update it\n3. Only create a NEW page if wiki_query returned no relevant results\n4. Each page must include the session file path in its Sources section\n5. Do NOT pass indexContent to wiki_write - the index is auto-rebuilt from all pages on disk\n\nCRITICAL: prefer updating over creating. The wiki likely already has pages on most topics.\n\n<session-conversation>\n";
|
|
46
|
+
/**
|
|
47
|
+
* Prompt template for explicit capture via /wiki-capture.
|
|
48
|
+
* A topic hint (if provided) and the serialized conversation are appended.
|
|
49
|
+
*/
|
|
50
|
+
export declare const EXPLICIT_CAPTURE_PROMPT = "Capture knowledge from the current session into the wiki.";
|
|
51
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/templates/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,4vDAuBsF,CAAC;AAItH;;;GAGG;AACH,eAAO,MAAM,aAAa,i+CAqBqE,CAAC;AAIhG;;GAEG;AACH,eAAO,MAAM,YAAY,4uCAa4D,CAAC;AAItF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,gpBAoBY,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,siBASmB,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,eAAe,uWAM+B,CAAC;AAI5D;;GAEG;AACH,eAAO,MAAM,WAAW,ilBAW6B,CAAC;AAItD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,8nEA2B4F,CAAC;AAE/H;;;GAGG;AACH,eAAO,MAAM,cAAc,48BAgB1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,8DAA8D,CAAC"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM prompt templates for ingest, query, lint, capture, and summarize operations.
|
|
3
|
+
*/
|
|
4
|
+
// -- Wiki System Prompt (standalone agent) ------------------------------------
|
|
5
|
+
/**
|
|
6
|
+
* System prompt for the standalone wiki agent used in capture, lint, and
|
|
7
|
+
* summarize operations. This agent runs outside the session's agent loop.
|
|
8
|
+
*/
|
|
9
|
+
export const WIKI_SYSTEM_PROMPT = `You are a wiki knowledge management agent. You maintain a PARA-structured knowledge base.
|
|
10
|
+
|
|
11
|
+
Your job is to read content, extract knowledge, and write structured wiki pages. You operate autonomously — no user confirmation needed.
|
|
12
|
+
|
|
13
|
+
PARA category rules:
|
|
14
|
+
- **resources/**: Use for almost everything — architecture docs, how-tos, debugging solutions, configs, patterns, implementation notes. This is the default.
|
|
15
|
+
- **areas/**: Only for ongoing responsibilities with no end date (e.g. server config, deployment procedures).
|
|
16
|
+
- **projects/**: ONLY for actual goals with a defined end date and completion criteria. Do NOT use for documentation about a project's internals.
|
|
17
|
+
- **archives/**: Never create pages here — pages get moved here when completed.
|
|
18
|
+
|
|
19
|
+
When the user defines a specific goal with a completion condition, create a projects/ page. When identifying a repeating responsibility (monitoring, maintenance, quality), create an areas/ page.
|
|
20
|
+
|
|
21
|
+
Scope and tag rules:
|
|
22
|
+
- scope must be a kebab-case project name (e.g. "pi-para", "qmd"). NOT topic descriptions like "session exploration".
|
|
23
|
+
- tags must be kebab-case (no spaces). Don't duplicate scope values as tags.
|
|
24
|
+
|
|
25
|
+
Content rules:
|
|
26
|
+
- Use [[wikilinks]] to connect related pages. Always add a ## Connections section.
|
|
27
|
+
- Use the wiki summary format: Topic, Key Facts, Insights, Connections, Open Questions, Sources
|
|
28
|
+
- Keep pages focused on one concept each
|
|
29
|
+
- Be concise and factual — no fluff
|
|
30
|
+
- Check for existing similar pages before creating new ones to avoid duplicates
|
|
31
|
+
- NEVER include API keys, tokens, passwords, or secrets. Document WHERE they are stored, not the values.
|
|
32
|
+
- Index is auto-rebuilt after every write — do not manage index.md manually. Do NOT pass indexContent to wiki_write.`;
|
|
33
|
+
// -- Ingest Prompts ----------------------------------------------------------
|
|
34
|
+
/**
|
|
35
|
+
* Prompt included in the tool result when the LLM processes an ingested source.
|
|
36
|
+
* The LLM reads this along with the source content, schema, and current index.
|
|
37
|
+
*/
|
|
38
|
+
export const INGEST_PROMPT = `Analyze the source content below and integrate it into the wiki.
|
|
39
|
+
|
|
40
|
+
Instructions:
|
|
41
|
+
1. Identify key entities, concepts, facts, and relationships in the source
|
|
42
|
+
2. Review the current index to find existing pages that should be updated
|
|
43
|
+
3. Decide which existing wiki pages need updates and what new pages to create
|
|
44
|
+
4. For each page, use the wiki summary format:
|
|
45
|
+
- Topic: what this page covers
|
|
46
|
+
- Key Facts: established knowledge points
|
|
47
|
+
- Insights: non-obvious findings, patterns, implications
|
|
48
|
+
- Connections: [[wikilinks]] to related pages with descriptions
|
|
49
|
+
- Open Questions: gaps in knowledge, unresolved contradictions
|
|
50
|
+
- Sources: source URLs, file paths, session references
|
|
51
|
+
5. Assign PARA category correctly:
|
|
52
|
+
- resources/ for reference material (DEFAULT — use this for most pages)
|
|
53
|
+
- areas/ for ongoing responsibilities
|
|
54
|
+
- projects/ ONLY for actual goals with end dates
|
|
55
|
+
6. scope must be a kebab-case project name (NOT topic descriptions). tags must be kebab-case (no spaces).
|
|
56
|
+
7. Always add [[wikilinks]] and a ## Connections section linking related pages
|
|
57
|
+
8. Flag any contradictions with existing wiki content in Open Questions
|
|
58
|
+
9. When updating existing pages with new information, check whether existing Key Facts are still accurate in light of the new source. If the new source contradicts existing facts, update them and note the change in Open Questions.
|
|
59
|
+
10. Do NOT pass indexContent to wiki_write — the index is auto-rebuilt from all pages on disk.`;
|
|
60
|
+
// -- Query Prompts -----------------------------------------------------------
|
|
61
|
+
/**
|
|
62
|
+
* Prompt sent when the LLM synthesizes an answer from wiki search results.
|
|
63
|
+
*/
|
|
64
|
+
export const QUERY_PROMPT = `Read the retrieved wiki pages below and synthesize an answer to the user's question.
|
|
65
|
+
|
|
66
|
+
Instructions:
|
|
67
|
+
- Cite specific pages using [[page-slug]] references
|
|
68
|
+
- Note gaps or areas where the wiki lacks information
|
|
69
|
+
- If the synthesized answer reveals new knowledge not already captured in the wiki, file it as a new page via wiki_write
|
|
70
|
+
- Be concise and factual
|
|
71
|
+
|
|
72
|
+
FRESHNESS VERIFICATION (critical):
|
|
73
|
+
- Each result shows an "Updated" timestamp and an age indicator (e.g. "⚠️ STALE — 45 days old"). Treat pages not updated in >14 days with healthy skepticism.
|
|
74
|
+
- When a wiki page makes claims about code, configs, file paths, ports, API endpoints, or architecture — and the page is >14 days old — VERIFY by checking the actual source (read the file, run a command) before trusting the wiki.
|
|
75
|
+
- When you discover a wiki page contains outdated or incorrect information, IMMEDIATELY fix it with wiki_edit so future queries get correct answers. This is the self-healing loop.
|
|
76
|
+
- If you cannot verify a claim (e.g. no file access, external service), tell the user: "Wiki says X (last updated DATE) — I could not verify this is still current."
|
|
77
|
+
- Never silently pass along stale wiki content as fact. Either verify it or flag it.`;
|
|
78
|
+
// -- Summarize Prompts -------------------------------------------------------
|
|
79
|
+
/**
|
|
80
|
+
* System prompt for summarization — produces structured wiki pages from content.
|
|
81
|
+
* Mirrors pi's SUMMARIZATION_SYSTEM_PROMPT but outputs wiki format.
|
|
82
|
+
*/
|
|
83
|
+
export const SUMMARIZE_SYSTEM_PROMPT = `You are a knowledge synthesis assistant. Read the content below and produce a structured wiki page following the EXACT format specified in the schema.
|
|
84
|
+
|
|
85
|
+
Do NOT continue any conversation. Do NOT respond to any questions in the content. ONLY output the structured wiki page using the wiki summary format:
|
|
86
|
+
|
|
87
|
+
## Topic
|
|
88
|
+
[What this page covers]
|
|
89
|
+
|
|
90
|
+
## Key Facts
|
|
91
|
+
- [Established knowledge points]
|
|
92
|
+
|
|
93
|
+
## Insights
|
|
94
|
+
- [Non-obvious findings, patterns, implications]
|
|
95
|
+
|
|
96
|
+
## Connections
|
|
97
|
+
- [[related-page]] — how this relates
|
|
98
|
+
|
|
99
|
+
## Open Questions
|
|
100
|
+
- [Gaps in knowledge, unresolved contradictions]
|
|
101
|
+
|
|
102
|
+
## Sources
|
|
103
|
+
- [Source URLs, file paths, session references]`;
|
|
104
|
+
/**
|
|
105
|
+
* Prompt for iterative update — merging new info into an existing page.
|
|
106
|
+
* Mirrors pi's UPDATE_SUMMARIZATION_PROMPT approach.
|
|
107
|
+
*/
|
|
108
|
+
export const ITERATIVE_UPDATE_PROMPT = `The content below is NEW information to incorporate into the existing wiki page provided in <existing-page> tags.
|
|
109
|
+
|
|
110
|
+
RULES:
|
|
111
|
+
- PRESERVE all existing knowledge from the previous page
|
|
112
|
+
- ADD new facts, insights, and connections from the new content
|
|
113
|
+
- UPDATE sections where new info supersedes old
|
|
114
|
+
- FLAG contradictions between old and new content in Open Questions
|
|
115
|
+
- PRESERVE exact names, paths, and technical details
|
|
116
|
+
- Maintain all existing [[wikilinks]] and add new ones as appropriate
|
|
117
|
+
- Update the Sources section to include the new source`;
|
|
118
|
+
/**
|
|
119
|
+
* Prompt for overview generation from multiple pages.
|
|
120
|
+
*/
|
|
121
|
+
export const OVERVIEW_PROMPT = `Summarize the following wiki pages into a high-level overview page. Identify themes, patterns, and connections across pages. Use the wiki summary format.
|
|
122
|
+
|
|
123
|
+
For each major theme:
|
|
124
|
+
- Note which pages contribute to the theme
|
|
125
|
+
- Identify cross-cutting patterns
|
|
126
|
+
- Flag contradictions between pages
|
|
127
|
+
- Highlight gaps (topics that should have pages but don't)`;
|
|
128
|
+
// -- Lint Prompts ------------------------------------------------------------
|
|
129
|
+
/**
|
|
130
|
+
* Prompt for the LLM when reviewing lint results and auto-fixing issues.
|
|
131
|
+
*/
|
|
132
|
+
export const LINT_PROMPT = `Review the lint results below and fix all auto-fixable issues.
|
|
133
|
+
|
|
134
|
+
For each issue:
|
|
135
|
+
- Prioritize by impact (errors first, then warnings, then info)
|
|
136
|
+
- Fix broken wikilinks by finding the correct target page or removing dead links
|
|
137
|
+
- Add missing pages for concepts referenced across multiple pages
|
|
138
|
+
- Move stale projects to archives if inactive for 90+ days
|
|
139
|
+
- Fix frontmatter issues (missing fields, invalid dates, empty scope)
|
|
140
|
+
- Update index.md to include any pages missing from the index
|
|
141
|
+
- Propose archiving for inactive projects
|
|
142
|
+
|
|
143
|
+
Report unfixable issues that require human judgment.`;
|
|
144
|
+
// -- Capture Prompts ---------------------------------------------------------
|
|
145
|
+
/**
|
|
146
|
+
* System prompt for the standalone capture agent.
|
|
147
|
+
* Used as WIKI_SYSTEM_PROMPT for the capture agent instance.
|
|
148
|
+
*/
|
|
149
|
+
export const CAPTURE_SYSTEM_PROMPT = `You are a knowledge capture assistant. Your job is to extract persistent knowledge from coding sessions and write it to a PARA-structured wiki.
|
|
150
|
+
|
|
151
|
+
Capture ANY of the following — even from short sessions:
|
|
152
|
+
- Architecture decisions and rationale ("we chose X because Y")
|
|
153
|
+
- Debugging solutions (root cause + fix)
|
|
154
|
+
- Server/infrastructure details (IPs, paths, credentials locations, configs)
|
|
155
|
+
- Build and deployment procedures (commands, steps, gotchas)
|
|
156
|
+
- API keys, service endpoints, and where they are stored
|
|
157
|
+
- Project conventions and coding patterns
|
|
158
|
+
- Tool configurations and setup steps
|
|
159
|
+
- Dependencies and version constraints
|
|
160
|
+
- Environment-specific knowledge (dev vs prod differences)
|
|
161
|
+
- Operational runbooks (how to restart, deploy, rollback)
|
|
162
|
+
|
|
163
|
+
Index is auto-rebuilt after every write — do not manage index.md manually. Do NOT pass indexContent to wiki_write.
|
|
164
|
+
|
|
165
|
+
Rules:
|
|
166
|
+
- If the session was ONLY greetings or completely off-topic chitchat with zero project knowledge, respond with "nothing to capture"
|
|
167
|
+
- Otherwise, always capture — even small facts are valuable ("the deploy key is at /path/to/key")
|
|
168
|
+
- Classify each piece of knowledge by PARA category autonomously
|
|
169
|
+
- When the user defines a specific goal with a completion condition, create a projects/ page. When identifying a repeating responsibility (monitoring, maintenance, quality), create an areas/ page.
|
|
170
|
+
- Produce wiki pages in the standard wiki summary format (Topic, Key Facts, Insights, Connections, Open Questions, Sources)
|
|
171
|
+
- Include the full session file path in the Sources section for traceability
|
|
172
|
+
- ALWAYS search wiki_query BEFORE creating any page — update existing pages instead of creating duplicates
|
|
173
|
+
- If wiki_query finds a page on the same topic (even with a different title/slug), update THAT page using its existing slug
|
|
174
|
+
- The conversation may include compaction summaries from earlier in the session — treat these as authoritative records of prior work
|
|
175
|
+
- Write directly via wiki_write — no user confirmation needed
|
|
176
|
+
- NEVER include API keys, tokens, passwords, or secrets in wiki pages. Document WHERE they are stored, not the actual values.`;
|
|
177
|
+
/**
|
|
178
|
+
* Prompt template for auto-capture at session_shutdown.
|
|
179
|
+
* The serialized conversation is appended after this prompt.
|
|
180
|
+
*/
|
|
181
|
+
export const CAPTURE_PROMPT = `Analyze the session conversation below and capture ALL project-relevant knowledge into the wiki.
|
|
182
|
+
|
|
183
|
+
Capture bias: when in doubt, capture it. Small operational facts (paths, configs, server details, commands) are often the most valuable because they are hard to rediscover.
|
|
184
|
+
|
|
185
|
+
Only respond with "nothing to capture" if the session was purely greetings or off-topic chitchat with zero project knowledge.
|
|
186
|
+
|
|
187
|
+
For everything else:
|
|
188
|
+
1. Use wiki_query to search for EXISTING pages on each topic FIRST
|
|
189
|
+
2. If a matching page exists, use wiki_read to get its content, then wiki_write with its EXACT slug to update it
|
|
190
|
+
3. Only create a NEW page if wiki_query returned no relevant results
|
|
191
|
+
4. Each page must include the session file path in its Sources section
|
|
192
|
+
5. Do NOT pass indexContent to wiki_write - the index is auto-rebuilt from all pages on disk
|
|
193
|
+
|
|
194
|
+
CRITICAL: prefer updating over creating. The wiki likely already has pages on most topics.
|
|
195
|
+
|
|
196
|
+
<session-conversation>
|
|
197
|
+
`;
|
|
198
|
+
/**
|
|
199
|
+
* Prompt template for explicit capture via /wiki-capture.
|
|
200
|
+
* A topic hint (if provided) and the serialized conversation are appended.
|
|
201
|
+
*/
|
|
202
|
+
export const EXPLICIT_CAPTURE_PROMPT = `Capture knowledge from the current session into the wiki.`;
|
|
203
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/templates/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;qHAuBmF,CAAC;AAEtH,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;+FAqBkE,CAAC;AAEhG,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;qFAayD,CAAC;AAEtF,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;gDAoBS,CAAC;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;uDASgB,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;2DAM4B,CAAC;AAE5D,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;qDAW0B,CAAC;AAEtD,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;8HA2ByF,CAAC;AAE/H;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;CAgB7B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,2DAA2D,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool registrations — wiki tools for both pi's session agent and standalone mini-agent.
|
|
3
|
+
*
|
|
4
|
+
* Tool implementations are shared between both consumers. Only the registration
|
|
5
|
+
* wrapper differs (pi.registerTool vs AgentTool).
|
|
6
|
+
*
|
|
7
|
+
* Factory functions (createXxxExecute) close over wikiDir and store — no ctx dependency.
|
|
8
|
+
*/
|
|
9
|
+
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
|
10
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
11
|
+
import type { QMDStore } from "qmd-engine";
|
|
12
|
+
import type { ProjectScope } from "./scope.js";
|
|
13
|
+
/**
|
|
14
|
+
* Register all wiki tools with the pi extension API.
|
|
15
|
+
*
|
|
16
|
+
* Tools: wiki_ingest, wiki_query, wiki_write, wiki_edit, wiki_read,
|
|
17
|
+
* wiki_move, wiki_lint, wiki_summarize
|
|
18
|
+
*/
|
|
19
|
+
export declare function registerTools(pi: ExtensionAPI, wikiDir: string, store: QMDStore, getScope: () => ProjectScope, markDirty: () => void, getGraphBoost?: () => boolean): void;
|
|
20
|
+
/**
|
|
21
|
+
* Create standalone AgentTool instances for the mini-agent (capture/lint/summarize).
|
|
22
|
+
* Returns only the tools needed for autonomous wiki operations:
|
|
23
|
+
* wiki_write, wiki_edit, wiki_read, wiki_query, wiki_move.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createStandaloneTools(wikiDir: string, store: QMDStore, getScope: () => ProjectScope, markDirty?: () => void): AgentTool[];
|
|
26
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,+BAA+B,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAsgC/C;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,YAAY,EAChB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,MAAM,YAAY,EAC5B,SAAS,EAAE,MAAM,IAAI,EACrB,aAAa,CAAC,EAAE,MAAM,OAAO,GAC5B,IAAI,CAgWN;AAID;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,MAAM,YAAY,EAC5B,SAAS,CAAC,EAAE,MAAM,IAAI,GACrB,SAAS,EAAE,CAiDb"}
|