@zosmaai/pi-llm-wiki 0.9.0 → 0.9.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 CHANGED
@@ -3,9 +3,16 @@
3
3
  ## [Unreleased]
4
4
 
5
5
  ### Fixed
6
+ - **`wiki_watch` referred to a fictional `schedule_prompt` tool** (Issue #81): `wiki_watch` emitted instructions to run `schedule_prompt action=add ...` — a tool that doesn't exist in pi-coding-agent or any pi extension — so `/wiki-run --schedule weekly` printed a command the user couldn't execute. The emitted payload also contained the typo `/wiki:run` (real slash-command is `/wiki-run`), and the tool description claimed it scheduled jobs when it only ever printed instructions. Now emits a real, copy-pasteable **POSIX 5-field crontab line** wrapped in `/bin/bash -lc` (so npm-global / bun / nvm PATH is imported under cron's minimal env), with defensive `mkdir -p` of the log dir and a `# llm-wiki-autoupdate` removal tag. The tool description, output text, `prompts/wiki-run.md`, `docs/api.md` and all 10 i18n READMEs now explicitly say "prints — does not install". `details` now carries `cronLine` and `installed: false`. New `test/wiki-watch.test.ts` (10 tests) locks down all three regressions plus the portability contract (login-shell wrapper, defensive `mkdir`, quoted `$HOME`).
6
7
  - **Personal wiki created at doubled path `~/.llm-wiki/.llm-wiki/…`**: `getPersonalWikiRoot()` returned the dot-dir itself (`~/.llm-wiki`) while `getVaultPaths()` then appended another `.llm-wiki/` segment, so the personal vault was written to `~/.llm-wiki/.llm-wiki/wiki/…`. Fixed by aligning `getPersonalWikiRoot()` with the same "root = parent of `.llm-wiki/`" contract used by project vaults. `WIKI_HOME` continues to override the parent.
7
8
 
8
9
  ### Added
10
+ - **Visible wiki activity + background/reported mutations** (Issue #77): the wiki was effectively invisible — recall was appended only to the **system prompt**, the observe/retro reminder was sent with `display: false`, and the lone user-facing cue was a static status line. The wiki now surfaces what it does, and mutating work is pushed off the agent's critical path.
11
+ - **Visible surfaces**: a one-time **session notice** (`buildSessionNotice`) announces the full loop — retrieval (recall → `wiki_search` → `read`, all synchronous because the LLM consumes their output) and capture (`wiki_observe` → `wiki_retro`, background + reported); the periodic reminder is now `display: true` and names **both** capture tools (`buildReminderText`); and the status line becomes **recall-aware** (`🧠 LLM Wiki — recalled N page(s) for this task`) when auto-recall matches.
12
+ - **Background + reported principle**: only `wiki_search` / `read` / `wiki_recall` stay synchronous. Heavy mutations — `wiki_rebuild_meta`, `wiki_reindex_embeddings`, `wiki_lint` — now dispatch to the background runtime and **report a visible completion message** instead of blocking the turn; `wiki_ingest` gained a persistent completion report alongside its toast. New `Runtime.report()` / `Runtime.launchReported()` primitives and a `dispatchReported()` tool helper (with a synchronous fallback when no runtime is available, preserving prior behavior and unit tests).
13
+ - **`notices` setting** (namespaced `llm-wiki`, default **on**): set `false` to restore the previous quiet behavior — static status line and silently-injected (`display: false`) reminders/reports.
14
+ - **Fixed** a dangling reference to a non-existent `wiki_read` tool in the links-first recall output (now points at `read`).
15
+ - **16 tests** (`test/visible-activity.test.ts`, `test/background-tools.test.ts`): `notices` parsing/defaulting, reminder + session-notice content, `Runtime.report`/`launchReported` (display gating, no-pi no-op, error isolation, null-summary skip), and `wiki_rebuild_meta` background-dispatch + report vs synchronous fallback.
9
16
  - **Model selection surface for background tasks** (Issue #69, part of epic #63): the wiki background lane (ingest synthesis, etc.) now has a user-facing surface to choose its model, defaulting to the **session model** with zero config.
10
17
  - **`/wiki-model` slash command**: run with no argument for an interactive picker (lists `modelRegistry.getAvailable()`); `/wiki-model provider/id` to set directly (scriptable, no UI needed); `/wiki-model session` (or `clear`/`default`/`reset`) to revert to the session model. The choice is **persisted** to project settings (`.pi/settings.json` under `llm-wiki.taskModel`, preserving other keys) and applied immediately, with a status-bar label of the active model.
11
18
  - **Per-call `model` override** on heavy tools (`wiki_ingest`): an optional `'provider/id'` param that overrides the configured `taskModel` for that one call. Precedence is **override > configured taskModel > session model**; each layer is applied only when the model is in the registry, and a missing/unknown layer warns (when UI is available) and falls through — so a bad ref degrades gracefully instead of failing.
package/README.de.md CHANGED
@@ -78,7 +78,7 @@ Das Ergebnis ist ein Wiki, das wächst, während du Quellen erfasst, Fragen stel
78
78
  | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
79
  | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
80
  | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
82
  | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
83
  | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
84
  | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
@@ -105,7 +105,7 @@ Das Ergebnis ist ein Wiki, das wächst, während du Quellen erfasst, Fragen stel
105
105
  | `wiki_status` | Show counts, source states, and recent activity |
106
106
  | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
107
  | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
108
+ | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
109
109
 
110
110
  ### Schrägstrich-Befehle
111
111
 
package/README.es.md CHANGED
@@ -78,7 +78,7 @@ El resultado es un wiki que se acumula a medida que capturas fuentes, haces preg
78
78
  | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
79
  | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
80
  | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
82
  | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
83
  | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
84
  | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
@@ -105,7 +105,7 @@ El resultado es un wiki que se acumula a medida que capturas fuentes, haces preg
105
105
  | `wiki_status` | Show counts, source states, and recent activity |
106
106
  | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
107
  | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
108
+ | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
109
109
 
110
110
  ### Comandos de Barra
111
111
 
package/README.fr.md CHANGED
@@ -78,7 +78,7 @@ Le résultat est un wiki qui s'accumule au fur et à mesure que vous capturez de
78
78
  | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
79
  | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
80
  | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
82
  | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
83
  | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
84
  | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
@@ -105,7 +105,7 @@ Le résultat est un wiki qui s'accumule au fur et à mesure que vous capturez de
105
105
  | `wiki_status` | Show counts, source states, and recent activity |
106
106
  | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
107
  | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
108
+ | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
109
109
 
110
110
  ### Commandes Slash
111
111
 
package/README.hi.md CHANGED
@@ -78,7 +78,7 @@ The extension will proactively suggest creating a wiki on your first session. Al
78
78
  | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
79
  | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
80
  | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
82
  | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
83
  | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
84
  | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
@@ -105,7 +105,7 @@ The extension will proactively suggest creating a wiki on your first session. Al
105
105
  | `wiki_status` | Show counts, source states, and recent activity |
106
106
  | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
107
  | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
108
+ | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
109
109
 
110
110
  ### स्लैश कमांड
111
111
 
package/README.ja.md CHANGED
@@ -78,7 +78,7 @@ The extension will proactively suggest creating a wiki on your first session. Al
78
78
  | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
79
  | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
80
  | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
82
  | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
83
  | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
84
  | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
@@ -105,7 +105,7 @@ The extension will proactively suggest creating a wiki on your first session. Al
105
105
  | `wiki_status` | Show counts, source states, and recent activity |
106
106
  | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
107
  | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
108
+ | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
109
109
 
110
110
  ### スラッシュコマンド
111
111
 
package/README.ko.md CHANGED
@@ -78,7 +78,7 @@ The extension will proactively suggest creating a wiki on your first session. Al
78
78
  | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
79
  | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
80
  | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
82
  | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
83
  | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
84
  | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
@@ -105,7 +105,7 @@ The extension will proactively suggest creating a wiki on your first session. Al
105
105
  | `wiki_status` | Show counts, source states, and recent activity |
106
106
  | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
107
  | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
108
+ | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
109
109
 
110
110
  ### 슬래시 명령
111
111
 
package/README.md CHANGED
@@ -78,10 +78,11 @@ The result is a wiki that **compounds** as you capture sources, ask questions, a
78
78
  | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
79
  | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
80
  | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
82
  | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
83
  | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
84
  | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
85
+ | 🧭 **Agent working-memory** _(opt-in)_ | `wiki_capture_trajectory` records *how* a task was solved (tool-call trajectory) → distill into reusable `skill`/`case` pages → `wiki_recall_skill` surfaces them next time. Off by default; enable with `/wiki-trajectories on` |
85
86
  | 🌐 **MCP Server** | Use with Claude Code, Cursor, Windsurf via stdio MCP transport |
86
87
  | 📝 **Obsidian-friendly** | Folder-qualified wikilinks, stable source-ID citations, compatible vault |
87
88
  | 🛡️ **Guardrails** | Blocks direct edits to raw sources and generated metadata |
@@ -105,7 +106,12 @@ The result is a wiki that **compounds** as you capture sources, ask questions, a
105
106
  | `wiki_status` | Show counts, source states, and recent activity |
106
107
  | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
108
  | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
109
+ | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
110
+ | `wiki_capture_trajectory` _(opt-in)_ | Capture the completed task's tool-call trajectory (agent working-memory) |
111
+ | `wiki_distill_skills` _(opt-in)_ | Batch undistilled trajectories for synthesis into reusable skill pages |
112
+ | `wiki_recall_skill` _(opt-in)_ | Recall distilled skills + similar past cases — "have I done this before?" |
113
+
114
+ > The three agent-trajectory tools are **off by default** (issue #80). Enable them with `/wiki-trajectories on` (sets `llm-wiki.trajectories`); when off they are not registered at all.
109
115
 
110
116
  ### Slash Commands
111
117
 
@@ -121,6 +127,9 @@ The result is a wiki that **compounds** as you capture sources, ask questions, a
121
127
  | `/wiki-digest [--period daily\|weekly]` | Generate a digest of recent activity |
122
128
  | `/wiki-retro` | Save atomic insights from completed tasks |
123
129
  | `/wiki-req <concept>` | Decompose a concept into atomic, traceable requirement pages |
130
+ | `/wiki-trajectories <on\|off>` | Enable/disable agent working-memory (opt-in, off by default) |
131
+ | `/wiki-record <title>` | Capture the completed task's trajectory (requires trajectories enabled) |
132
+ | `/wiki-skills [query]` | Search distilled skills + past cases (requires trajectories enabled) |
124
133
 
125
134
  ---
126
135
 
@@ -425,6 +434,20 @@ Thanks to everyone who has contributed! This list is regenerated automatically b
425
434
  <br />
426
435
  <sub><b>Shanvit S Shetty</b></sub>
427
436
  </a>
437
+ </td>
438
+ <td align="center">
439
+ <a href="https://github.com/CelestialCreator">
440
+ <img src="https://avatars.githubusercontent.com/u/177931942?v=4" width="64;" alt="CelestialCreator"/>
441
+ <br />
442
+ <sub><b>Akshay</b></sub>
443
+ </a>
444
+ </td>
445
+ <td align="center">
446
+ <a href="https://github.com/mystery4f">
447
+ <img src="https://avatars.githubusercontent.com/u/40482524?v=4" width="64;" alt="mystery4f"/>
448
+ <br />
449
+ <sub><b>标准萌新</b></sub>
450
+ </a>
428
451
  </td>
429
452
  </tr>
430
453
  <tbody>
package/README.pt.md CHANGED
@@ -78,7 +78,7 @@ O resultado é um wiki que se acumula conforme você captura fontes, faz pergunt
78
78
  | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
79
  | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
80
  | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
82
  | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
83
  | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
84
  | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
@@ -105,7 +105,7 @@ O resultado é um wiki que se acumula conforme você captura fontes, faz pergunt
105
105
  | `wiki_status` | Show counts, source states, and recent activity |
106
106
  | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
107
  | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
108
+ | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
109
109
 
110
110
  ### Comandos de Barra
111
111
 
package/README.ru.md CHANGED
@@ -78,7 +78,7 @@ The extension will proactively suggest creating a wiki on your first session. Al
78
78
  | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
79
  | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
80
  | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
82
  | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
83
  | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
84
  | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
@@ -105,7 +105,7 @@ The extension will proactively suggest creating a wiki on your first session. Al
105
105
  | `wiki_status` | Show counts, source states, and recent activity |
106
106
  | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
107
  | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
108
+ | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
109
109
 
110
110
  ### Слэш-команды
111
111
 
package/README.zh.md CHANGED
@@ -78,7 +78,7 @@ The extension will proactively suggest creating a wiki on your first session. Al
78
78
  | 🔍 **Full-text search** | Generated registry with keyword lookup across all pages and sources |
79
79
  | 🩺 **Mechanical linting** | Orphans, broken links, duplicate aliases, coverage gaps, stale captures |
80
80
  | 📊 **Dashboard** | `wiki_status` — counts, source states, recent activity |
81
- | 🤖 **Auto-update watch** | `wiki_watch` — schedule periodic discovery + ingest |
81
+ | 🤖 **Auto-update watch** | `wiki_watch` — print a `crontab` line that runs the full cycle on a schedule |
82
82
  | 🧠 **Layered recall** | Searches both personal (`~/.llm-wiki/`) and project (`.llm-wiki/`) vaults — personal knowledge follows you everywhere |
83
83
  | 📝 **Auto-bootstrap** | Extension suggests creating a wiki when none exists in the current directory |
84
84
  | 💾 **Lightweight capture** | `wiki_retro` — save atomic insights as a single markdown file; full 4-layer pipeline also available via `wiki_capture_source` |
@@ -105,7 +105,7 @@ The extension will proactively suggest creating a wiki on your first session. Al
105
105
  | `wiki_status` | Show counts, source states, and recent activity |
106
106
  | `wiki_rebuild_meta` | Force a full metadata rebuild (registry, backlinks, index, log) |
107
107
  | `wiki_log_event` | Append a structured event to the wiki activity log |
108
- | `wiki_watch` | Schedule automatic wiki updates (daily / weekly / hourly) |
108
+ | `wiki_watch` | Print a `crontab` line for automatic wiki updates (daily / weekly / hourly) — does not install it |
109
109
 
110
110
  ### 斜杠命令
111
111
 
package/docs/api.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # API Reference
2
2
 
3
- All 13 tools registered by the extension. Parameters marked `?` are optional.
3
+ All tools registered by the extension. Parameters marked `?` are optional.
4
+
5
+ 13 tools are always registered. The 3 agent-trajectory tools
6
+ (`wiki_capture_trajectory`, `wiki_distill_skills`, `wiki_recall_skill`) are **opt-in,
7
+ off by default** (issue #80) — they are only registered when `llm-wiki.trajectories`
8
+ is `true`; enable with `/wiki-trajectories on`.
4
9
 
5
10
  ---
6
11
 
@@ -92,7 +97,7 @@ Resolve or safely create a canonical wiki page. Returns immediately if the page
92
97
 
93
98
  | Name | Type | Required | Description |
94
99
  |------|------|----------|-------------|
95
- | `type` | `string` | ✅ | Page type: `"entity"`, `"concept"`, `"synthesis"`, `"analysis"`, or `"requirement"` |
100
+ | `type` | `string` | ✅ | Page type: `"entity"`, `"concept"`, `"synthesis"`, `"analysis"`, `"requirement"`, `"skill"`, or `"case"` |
96
101
  | `title` | `string` | ✅ | Human-readable page title; auto-slugified to a kebab-case filename |
97
102
  | `content` | `string` | — | Full markdown content for the page; if omitted, the type-appropriate template is used |
98
103
 
@@ -309,28 +314,136 @@ details: { kind: string }
309
314
 
310
315
  ## wiki_watch
311
316
 
312
- Output the shell command needed to schedule automatic wiki updates (discover → ingest → lint) via
313
- pi's `schedule_prompt` cron system. Does not schedule anything directly it returns the command
314
- for the user to run.
317
+ Print a ready-to-paste **POSIX crontab line** that runs the full wiki cycle (discover → ingest →
318
+ lint) on a schedule by invoking `pi -p "/wiki-run"` headlessly under `/bin/bash -lc` so the
319
+ user's shell profile (and the `pi` binary on npm-global / bun / nvm PATH) is imported. **Does
320
+ not schedule anything directly** — it returns the command for the user to install with
321
+ `crontab -e`. Calling agents should surface the output verbatim and avoid claiming the schedule
322
+ is active.
315
323
 
316
324
  **Parameters**
317
325
 
318
326
  | Name | Type | Required | Description |
319
327
  |------|------|----------|-------------|
320
- | `interval` | `string` | ✅ | `"daily"` (8:00 AM), `"weekly"` (Monday 9:00 AM), `"hourly"`, or `"stop"` (prints removal instructions) |
328
+ | `interval` | `string` | ✅ | `"daily"` (8:00 AM), `"weekly"` (Monday 9:00 AM), `"hourly"`, or `"stop"` (prints crontab removal instructions) |
321
329
 
322
330
  **Returns**
323
331
 
324
332
  ```
325
333
  details: {
326
334
  interval: string,
327
- cronSchedule: string, // e.g. "0 0 8 * * *"
328
- label: string // e.g. "Daily at 8:00 AM"
335
+ cronSchedule: string, // 5-field POSIX expression, e.g. "0 8 * * *"
336
+ label: string, // e.g. "Daily at 8:00 AM"
337
+ cronLine: string, // full crontab line, tagged "# llm-wiki-autoupdate"
338
+ installed: false // tool never installs — always false
339
+ }
340
+ ```
341
+
342
+ Output is appended to `~/.llm-wiki/cron.log` (the directory is created by the cron line itself
343
+ via `mkdir -p`). On systems without `/bin/bash`, replace the wrapper with `/bin/sh -c` and
344
+ ensure `pi` is in cron's PATH yourself.
345
+
346
+ When `interval` is `"stop"`, returns `details: { action: "stop_instructions" }` with
347
+ instructions for removing the line via `crontab -e` (look for the `# llm-wiki-autoupdate` tag).
348
+
349
+ ---
350
+
351
+ ## wiki_capture_trajectory
352
+
353
+ Capture the just-completed task's tool-call trajectory into an immutable packet
354
+ (`raw/trajectories/TRJ-*`) with a self-contained summary (`extracted.md`). The working-memory
355
+ counterpart to `wiki_capture_source`. By default the trajectory is auto-extracted from the live
356
+ session; pass `steps` to override. **Opt-in** (issue #80): only available when
357
+ `llm-wiki.trajectories` is enabled (`/wiki-trajectories on`).
358
+
359
+ **Parameters**
360
+
361
+ | Name | Type | Required | Description |
362
+ |------|------|----------|-------------|
363
+ | `title` | `string` | — | Short descriptive title for the task (≤60 chars). Inferred from the prompt if omitted. |
364
+ | `task` | `string` | — | The task/prompt that started the work. Inferred from the session if omitted. |
365
+ | `outcome` | `string` | — | `"success"` (default), `"failure"`, or `"partial"` — recorded in the packet manifest |
366
+ | `steps` | `array` | — | Explicit trajectory steps (tool-call history). Omit to auto-extract from the live session. |
367
+ | `model` | `string` | — | Model that ran the task. Inferred from the session if omitted. |
368
+
369
+ **Returns**
370
+
371
+ ```
372
+ details: {
373
+ trajectoryId: string, // e.g. "TRJ-2026-06-07-001"
374
+ packetPath: string, // path to raw/trajectories/TRJ-*/ (packet.json + extracted.md)
375
+ stepCount: number
376
+ }
377
+ ```
378
+
379
+ Errors with `isError: true` if no vault exists, or with `error: "empty_trajectory"` when no
380
+ trajectory can be extracted and no `steps` are provided.
381
+
382
+ ---
383
+
384
+ ## wiki_distill_skills
385
+
386
+ Return a batch of captured trajectories that have not yet been distilled into `skill` pages. Does
387
+ not write anything itself — the model reads each packet and synthesizes reusable skill pages (via
388
+ `wiki_ensure_page(type="skill")`) that cite the trajectory IDs. A trajectory counts as "distilled"
389
+ once a `skills/` page links to it.
390
+
391
+ **Parameters**
392
+
393
+ | Name | Type | Required | Description |
394
+ |------|------|----------|-------------|
395
+ | `trajectory_id` | `string` | — | Distill a specific trajectory only; omit for all undistilled |
396
+ | `batch_size` | `number` | — | Max trajectories to return (default: `3`, max: `5`) |
397
+
398
+ **Returns**
399
+
400
+ ```
401
+ details: {
402
+ batch: string[], // trajectory IDs in this batch, e.g. ["TRJ-2026-06-07-001"]
403
+ remaining: number // undistilled trajectories still waiting after this batch
404
+ }
405
+ ```
406
+
407
+ Each batch entry includes the title, step/tool-call counts, and paths to read
408
+ (`raw/trajectories/{id}/packet.json` and `extracted.md`). Returns an "all trajectories distilled"
409
+ message with `{ distilled, total }` when nothing is pending.
410
+
411
+ ---
412
+
413
+ ## wiki_recall_skill
414
+
415
+ Search distilled `skill` pages and past `case` pages for patterns relevant to the current task —
416
+ answers "have I done something like this before?". Filters layered recall (`searchWikiLayered`) to
417
+ skill/case pages. Call at the START of a task.
418
+
419
+ **Parameters**
420
+
421
+ | Name | Type | Required | Description |
422
+ |------|------|----------|-------------|
423
+ | `query` | `string` | ✅ | Search query — use the task description or key terms |
424
+ | `kind` | `string` | — | `"skill"`, `"case"`, or `"any"` (default) |
425
+ | `max_results` | `number` | — | Maximum pages to return (default: `5`, max: `10`) |
426
+
427
+ **Returns**
428
+
429
+ ```
430
+ details: {
431
+ query: string,
432
+ kind: string,
433
+ matches: Array<{
434
+ id: string, // folder-qualified page ID, e.g. "skills/jwt-revocation"
435
+ title: string,
436
+ type: string, // "skill" | "case"
437
+ preview: string,
438
+ path: string,
439
+ score: number,
440
+ vaultLabel?: string // "📓 personal" when result is from the personal vault
441
+ }>
329
442
  }
330
443
  ```
331
444
 
332
- When `interval` is `"stop"`, returns `details: { action: "stop_instructions" }` with instructions
333
- for removing existing jobs via `schedule_prompt action=remove`.
445
+ Returns empty `matches: []` with a hint to capture work via `wiki_capture_trajectory` /
446
+ `wiki_distill_skills` when nothing matches.
334
447
 
335
448
  ---
336
449
 
@@ -43,12 +43,18 @@ WIKI_ROOT/
43
43
  │ ├── original/ # Original artifact
44
44
  │ ├── extracted.md # Normalized markdown
45
45
  │ └── attachments/ # Downloaded images, PDFs
46
+ ├── raw/trajectories/TRJ-*/ # Immutable agent task packets (extension-owned)
47
+ │ ├── manifest.json # Capture metadata (format: trajectory)
48
+ │ ├── packet.json # Full tool-call sequence
49
+ │ └── extracted.md # README summary
46
50
  ├── wiki/ # Editable knowledge pages (you + LLM)
47
51
  │ ├── sources/ # One summary per source
48
52
  │ ├── entities/ # People, orgs, tools, products
49
53
  │ ├── concepts/ # Ideas, patterns, frameworks
50
54
  │ ├── syntheses/ # Cross-cutting analyses
51
- └── analyses/ # Durable query answers
55
+ ├── analyses/ # Durable query answers
56
+ │ ├── cases/ # One specific past task per trajectory
57
+ │ └── skills/ # Reusable patterns distilled from trajectories
52
58
  ├── meta/ # Auto-generated (extension-owned)
53
59
  │ ├── registry.json # Master page catalog
54
60
  │ ├── backlinks.json # Inbound link map
@@ -89,11 +95,42 @@ Each captured source becomes a packet:
89
95
  - **concept** — ideas, patterns, frameworks
90
96
  - **synthesis** — cross-source theses and tensions
91
97
  - **analysis** — durable filed answers from queries
98
+ - **requirement** — atomic requirements with status, priority, and traceability
99
+ - **trajectory** — an immutable captured agent task run (working-memory source)
100
+ - **case** — one specific past task implementation, citing its trajectory
101
+ - **skill** — a reusable pattern distilled from one or more trajectories
102
+
103
+ ## Agent Working-Memory (Trajectories)
104
+
105
+ The wiki captures not only what the agent *reads* (sources) but what it *does*
106
+ (trajectories). A completed task is just another kind of source, so it flows
107
+ through the same pipeline:
108
+
109
+ ```
110
+ raw/trajectories/TRJ-* → wiki/skills/* (+ optional wiki/cases/*) → meta/*
111
+ ```
112
+
113
+ This is **opt-in, off by default** (issue #80): the three tools below are only
114
+ registered when `llm-wiki.trajectories` is enabled (`/wiki-trajectories on`), and
115
+ the `raw/trajectories`, `wiki/skills`, `wiki/cases` directories are created lazily
116
+ on first use — so a vault with the feature off carries no trace of it.
117
+
118
+ - `wiki_capture_trajectory` writes the immutable packet + a self-contained summary
119
+ (`extracted.md`), auto-extracting the tool-call sequence from the live session.
120
+ It does not emit a to-be-fleshed skeleton — capture is a single lightweight call.
121
+ - `wiki_distill_skills` batches undistilled trajectories so the model can
122
+ generalize them into reusable `skill` pages.
123
+ - `wiki_recall_skill` filters layered recall to `skill`/`case` pages —
124
+ "have I done something like this before?".
125
+
126
+ Trajectory packets live under `raw/**` and are therefore immutable under the
127
+ same guardrail as source packets — no new ownership rule required.
92
128
 
93
129
  ## Linking Style
94
130
 
95
131
  - Internal: `[[folder/page-name]]`
96
132
  - Citation: `[[sources/SRC-YYYY-MM-DD-NNN]]`
133
+ - Trajectory citation: `[[trajectories/TRJ-YYYY-MM-DD-NNN]]`
97
134
 
98
135
  ## Guardrails
99
136
 
package/docs/commands.md CHANGED
@@ -13,10 +13,17 @@
13
13
  | `/wiki-status` | Show wiki health |
14
14
  | `/wiki-digest` | Daily/weekly summary |
15
15
  | `/wiki-retro` | Save atomic insights from tasks |
16
+ | `/wiki-model` | View/set the background-task model |
17
+ | `/wiki-trajectories` | Enable/disable agent working-memory (`on`/`off`, opt-in) |
18
+ | `/wiki-record` | Capture the completed task's trajectory (requires trajectories enabled) |
19
+ | `/wiki-skills` | Search distilled skills + past cases (requires trajectories enabled) |
16
20
 
17
21
  ## Extension Tools
18
22
 
19
- The extension registers 12 tools the LLM can call directly:
23
+ The extension always registers 13 tools the LLM can call directly. The 3 agent-trajectory
24
+ tools (`wiki_capture_trajectory`, `wiki_distill_skills`, `wiki_recall_skill`) are **opt-in,
25
+ off by default** (issue #80) — registered only when `llm-wiki.trajectories` is enabled
26
+ (`/wiki-trajectories on`).
20
27
 
21
28
  | Tool | Purpose |
22
29
  | --------------------- | ------------------------------------------- |
@@ -32,6 +39,9 @@ The extension registers 12 tools the LLM can call directly:
32
39
  | `wiki_rebuild_meta` | Force metadata rebuild |
33
40
  | `wiki_log_event` | Record custom event |
34
41
  | `wiki_watch` | Schedule auto-updates |
42
+ | `wiki_capture_trajectory` | Capture the completed task's tool-call trajectory |
43
+ | `wiki_distill_skills` | Batch undistilled trajectories for skill synthesis |
44
+ | `wiki_recall_skill` | Recall distilled skills + similar past cases |
35
45
 
36
46
  ## Workflows
37
47
 
@@ -52,3 +62,13 @@ The extension registers 12 tools the LLM can call directly:
52
62
  3. Synthesize answer with `[[wikilink]]` citations
53
63
  4. If novel: create analysis page via `wiki_ensure_page(type="analysis")`
54
64
  5. Extension auto-updates metadata
65
+
66
+ ### Task → Record → Distill (agent working-memory)
67
+
68
+ _Opt-in: enable first with `/wiki-trajectories on`._
69
+
70
+ 1. Finish a non-trivial task (debug, refactor, integration)
71
+ 2. `wiki_capture_trajectory(title="...")` — auto-extracts the tool-call trajectory from the live session into `raw/trajectories/TRJ-*` with a self-contained summary (no skeleton to flesh)
72
+ 3. `wiki_distill_skills()` — get undistilled trajectories
73
+ 4. `wiki_ensure_page(type="skill", title="...")` — generalize into a reusable skill citing `[[trajectories/TRJ-...]]` (and optionally a `case` page)
74
+ 5. Next time, `wiki_recall_skill(query="...")` surfaces the skill/case before you start