@zosmaai/pi-llm-wiki 0.6.5 → 0.6.6

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.
@@ -0,0 +1,46 @@
1
+ # Auto-Bootstrap Plan
2
+
3
+ ## Changes (3 files)
4
+
5
+ ### 1. `extensions/llm-wiki/index.ts`
6
+
7
+ **session_start hook** — Show correct status based on vault existence:
8
+ ```typescript
9
+ pi.on("session_start", async (_event, ctx) => {
10
+ const paths = resolveVaultPaths(process.cwd());
11
+ if (!existsSync(join(paths.dotWiki, "config.json"))) {
12
+ ctx.ui.setStatus("llm-wiki", "šŸ“ No wiki — call wiki_bootstrap to enable");
13
+ return;
14
+ }
15
+ ctx.ui.setStatus("llm-wiki", "🧠 LLM Wiki (12 tools, auto-recall active)");
16
+ });
17
+ ```
18
+
19
+ **before_agent_start hook** — When no wiki exists on first turn, inject a system prompt hint so the LLM knows to suggest bootstrapping:
20
+ ```typescript
21
+ pi.on("before_agent_start", async (event, _ctx) => {
22
+ const paths = resolveVaultPaths(process.cwd());
23
+ if (!existsSync(join(paths.dotWiki, "config.json"))) {
24
+ return {
25
+ systemPrompt: `${event.systemPrompt}\n\nšŸ“ No LLM Wiki found in this directory. On your first response, use ask_user to offer the user creating one via wiki_bootstrap. After suggesting once, do not repeat.`
26
+ };
27
+ }
28
+ // ... existing recall logic unchanged
29
+ });
30
+ ```
31
+
32
+ ### 2. `extensions/llm-wiki/lib/recall.ts`
33
+
34
+ **wiki_recall tool** — Improve error message when no vault exists to hint at bootstrap:
35
+ ```typescript
36
+ // Current: "No wiki vault found at this location. Initialize one with wiki_bootstrap first."
37
+ // Keep as-is but add isError flag for model to react
38
+ ```
39
+
40
+ ### 3. `skills/llm-wiki/SKILL.md`
41
+
42
+ Add a section about what to do when no wiki exists — tell the model to proactively suggest bootstrapping using `ask_user`.
43
+
44
+ ## Not in scope (separate issue)
45
+
46
+ - Migration script shipping — bcdiaconu's feedback from #22, needs its own focused PR
@@ -34,6 +34,9 @@ import { resolveVaultPaths } from "./lib/utils.js";
34
34
  * - wiki_recall tool available for explicit deep searches
35
35
  */
36
36
 
37
+ // Track whether we already suggested bootstrapping this session
38
+ let bootstrapSuggested = false;
39
+
37
40
  export default function (pi: ExtensionAPI) {
38
41
  registerWikiBootstrap(pi);
39
42
  registerWikiCaptureSource(pi);
@@ -51,6 +54,12 @@ export default function (pi: ExtensionAPI) {
51
54
  installGuardrails(pi);
52
55
 
53
56
  pi.on("session_start", async (_event, ctx) => {
57
+ bootstrapSuggested = false;
58
+ const paths = resolveVaultPaths(process.cwd());
59
+ if (!existsSync(join(paths.dotWiki, "config.json"))) {
60
+ ctx.ui.setStatus("llm-wiki", "šŸ“ No wiki — call wiki_bootstrap to enable");
61
+ return;
62
+ }
54
63
  ctx.ui.setStatus("llm-wiki", "🧠 LLM Wiki (12 tools, auto-recall active)");
55
64
  });
56
65
 
@@ -60,7 +69,14 @@ export default function (pi: ExtensionAPI) {
60
69
  pi.on("before_agent_start", async (event, _ctx) => {
61
70
  const paths = resolveVaultPaths(process.cwd());
62
71
  if (!existsSync(join(paths.dotWiki, "config.json"))) {
63
- return; // No wiki vault — nothing to recall
72
+ // No wiki — suggest bootstrap on first turn only
73
+ if (!bootstrapSuggested) {
74
+ bootstrapSuggested = true;
75
+ return {
76
+ systemPrompt: `${event.systemPrompt}\n\nšŸ“ No LLM Wiki found in this directory. On your first response, use ask_user to offer the user creating one via wiki_bootstrap. After suggesting once, do not repeat.`,
77
+ };
78
+ }
79
+ return;
64
80
  }
65
81
 
66
82
  const prompt = event.prompt || "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zosmaai/pi-llm-wiki",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "description": "Self-maintaining LLM Wiki for Pi — Karpathy-pattern knowledge base with immutable source capture, automated ingestion, search, linting, and Obsidian-compatible vault. auto-updating personal & company wiki.",
5
5
  "keywords": [
6
6
  "pi",
@@ -81,6 +81,14 @@ wiki_recall(query="specific terms...", max_results=10)
81
81
 
82
82
  This gives you more control over the search terms and returns content previews.
83
83
 
84
+ ### No Wiki Yet
85
+
86
+ If the extension injects a "No LLM Wiki found" hint, use `ask_user` to offer creating one:
87
+
88
+ > "No LLM Wiki found in this directory. Would you like to create one? It gives you a linked knowledge base with automatic recall."
89
+
90
+ If the user agrees, call `wiki_bootstrap(topic="...", mode="personal")`. Suggest only once per session.
91
+
84
92
  ## Available Tools
85
93
 
86
94
  Use these directly — they handle scaffolding, bookkeeping, recall, and capture: