@zosmaai/pi-llm-wiki 0.11.4 → 0.11.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.
Files changed (62) hide show
  1. package/README.de.md +8 -0
  2. package/README.es.md +8 -0
  3. package/README.fr.md +8 -0
  4. package/README.hi.md +8 -0
  5. package/README.ja.md +8 -0
  6. package/README.ko.md +8 -0
  7. package/README.md +8 -0
  8. package/README.pt.md +8 -0
  9. package/README.ru.md +8 -0
  10. package/README.zh.md +8 -0
  11. package/assets/wiki-dashboard.png +0 -0
  12. package/commands/wiki-ingest.md +1 -0
  13. package/commands/wiki-req.md +1 -0
  14. package/commands/wiki-retro.md +1 -0
  15. package/dist/extensions/llm-wiki/lib/dashboard-command.js +86 -0
  16. package/dist/extensions/llm-wiki/lib/dashboard.js +175 -0
  17. package/dist/extensions/llm-wiki/lib/guardrails.js +30 -1
  18. package/dist/extensions/llm-wiki/lib/host.js +21 -1
  19. package/dist/extensions/llm-wiki/lib/ingest-worker.js +44 -20
  20. package/dist/extensions/llm-wiki/lib/knowledge-document.js +20 -2
  21. package/dist/extensions/llm-wiki/lib/knowledge-links.js +133 -27
  22. package/dist/extensions/llm-wiki/lib/metadata.js +6 -6
  23. package/dist/extensions/llm-wiki/lib/observation.js +22 -3
  24. package/dist/extensions/llm-wiki/lib/retro.js +38 -4
  25. package/dist/extensions/llm-wiki/lib/runtime.js +2 -2
  26. package/dist/extensions/llm-wiki/lib/settings-command.js +377 -0
  27. package/dist/extensions/llm-wiki/lib/task-config.js +100 -1
  28. package/dist/extensions/llm-wiki/lib/tools.js +47 -8
  29. package/dist/mcp/index.js +2 -1
  30. package/dist/mcp/operations.js +21 -2
  31. package/docs/api.md +24 -1
  32. package/docs/commands.md +6 -1
  33. package/docs/configuration.md +11 -0
  34. package/docs/obsidian.md +6 -6
  35. package/docs/superpowers/plans/2026-08-09-qmd-retrieval-phase-1-quality-baseline-and-compatibility.md +1520 -0
  36. package/docs/superpowers/plans/2026-08-27-wikilink-resolver-normalization.md +735 -0
  37. package/docs/superpowers/plans/2026-08-29-wikilink-gate-ensure-page-retro.md +642 -0
  38. package/docs/superpowers/plans/2026-08-29-wikilink-write-validation.md +695 -0
  39. package/docs/superpowers/roadmaps/2026-08-09-qmd-retrieval-roadmap.md +448 -0
  40. package/docs/superpowers/specs/2026-08-08-qmd-retrieval-design.md +806 -0
  41. package/extensions/llm-wiki/index.ts +4 -0
  42. package/extensions/llm-wiki/lib/dashboard-command.ts +106 -0
  43. package/extensions/llm-wiki/lib/dashboard.ts +210 -0
  44. package/extensions/llm-wiki/lib/guardrails.ts +26 -1
  45. package/extensions/llm-wiki/lib/host.ts +21 -1
  46. package/extensions/llm-wiki/lib/ingest-worker.ts +64 -27
  47. package/extensions/llm-wiki/lib/knowledge-document.ts +21 -2
  48. package/extensions/llm-wiki/lib/knowledge-links.ts +208 -35
  49. package/extensions/llm-wiki/lib/metadata.ts +10 -6
  50. package/extensions/llm-wiki/lib/observation.ts +23 -3
  51. package/extensions/llm-wiki/lib/retro.ts +48 -4
  52. package/extensions/llm-wiki/lib/runtime.ts +2 -2
  53. package/extensions/llm-wiki/lib/settings-command.ts +483 -0
  54. package/extensions/llm-wiki/lib/task-config.ts +138 -0
  55. package/extensions/llm-wiki/lib/tools.ts +62 -8
  56. package/mcp/index.ts +12 -1
  57. package/mcp/operations.ts +32 -2
  58. package/package.json +4 -4
  59. package/prompts/wiki-ingest.md +1 -0
  60. package/prompts/wiki-req.md +1 -0
  61. package/prompts/wiki-retro.md +1 -0
  62. package/skills/llm-wiki/SKILL.md +11 -1
@@ -0,0 +1,448 @@
1
+ # QMD-Backed Second-Brain Retrieval Roadmap
2
+
3
+ > **For agentic workers:** Use /skill:writing-plans to create one detailed implementation plan per phase. Start with Phase 1 and proceed sequentially unless the user explicitly changes the order.
4
+
5
+ **Goal:** Replace heuristic wiki recall with measured QMD-backed retrieval that returns canonical knowledge, evidence, and conflicts safely across personal and project vaults.
6
+
7
+ **Design Spec:** [`docs/superpowers/specs/2026-08-08-qmd-retrieval-design.md`](../specs/2026-08-08-qmd-retrieval-design.md)
8
+
9
+ **Planning Strategy:** This change spans runtime compatibility, local native dependencies, indexing, retrieval cutover, knowledge semantics, feedback, conflict resolution, and release validation. Seven ordered phases keep each detailed plan within one context window, establish quality measurements before tuning, and leave the existing package functional at every boundary.
10
+
11
+ ---
12
+
13
+ ## Phase Map
14
+
15
+ | Phase | Outcome | Depends on |
16
+ |---|---|---|
17
+ | 1. Quality Baseline and QMD Compatibility | Reproducible benchmark plus proven Node/QMD build contract | Approved design |
18
+ | 2. Validated QMD Indexing | Rebuildable per-vault QMD indexes and `wiki_reindex` | Phase 1 |
19
+ | 3. Retrieval Modes and Recall Cutover | QMD powers Pi, MCP, and automatic recall | Phase 2 |
20
+ | 4. Card-First Memory Assembly | Canonical cards, evidence, typed links, and conflicts are packed deterministically | Phase 3 |
21
+ | 5. User Conflict Resolution | User decisions become immutable, scoped resolution records | Phase 4 |
22
+ | 6. Retrieval Feedback | Explicit and implicit signals produce bounded local reranking adjustments | Phase 5 |
23
+ | 7. Hardening and Major Release | Release gates pass and migration/documentation ship | Phases 1–6 |
24
+
25
+ ---
26
+
27
+ ## Phase 1: Quality Baseline and QMD Compatibility
28
+
29
+ **Outcome:** The repository has a versioned retrieval benchmark, current-system baseline metrics, and a verified dependency/runtime contract for the pinned QMD release without changing active recall behavior.
30
+
31
+ **Why now:** Retrieval quality cannot be improved responsibly without a baseline, and all later phases depend on QMD's actual SDK, native packages, model behavior, and supported platforms matching the design assumptions.
32
+
33
+ **Scope:**
34
+ - Define the benchmark schema for queries, graded canonical-card relevance, evidence relevance, contradiction expectations, and held-out membership.
35
+ - Build a deterministic benchmark runner for the current heuristic recall path and record baseline metrics.
36
+ - Curate 50–100 sanitized queries representing the approved query categories, including dense-retrieval false positives and multilingual cases present in the corpus.
37
+ - Raise development and CI toolchains to Node.js 22 and a TypeScript version compatible with the pinned QMD peer range.
38
+ - Pin and contract-test the published `@tobilu/qmd` 2.5.3 package, including the SDK calls required by all four retrieval modes.
39
+ - Add clean-install/native-package smoke coverage for the supported release platforms.
40
+ - Verify lexical QMD operation without model download and document default model cache/download expectations.
41
+
42
+ **Out of scope:**
43
+ - Creating persistent QMD vault indexes.
44
+ - Routing production recall through QMD.
45
+ - Tuning ranking constants against the held-out benchmark set.
46
+ - Card assembly, conflict resolution, or feedback.
47
+
48
+ **Key files/areas likely affected:**
49
+ - `package.json` and `pnpm-lock.yaml`: Node, TypeScript, and pinned QMD dependency contract.
50
+ - `.github/workflows/`: supported-platform clean-install and model-smoke jobs.
51
+ - `test/fixtures/`: sanitized benchmark corpus and graded judgments.
52
+ - `scripts/` or `test/`: benchmark runner and metric reporting.
53
+ - `extensions/llm-wiki/lib/recall.ts`: stable baseline adapter only; active behavior remains unchanged.
54
+ - `docs/`: benchmark methodology, privacy rules, and hardware/model reporting.
55
+
56
+ **Dependencies:**
57
+ - Approved design spec.
58
+ - Access to representative queries that can be sanitized before entering the repository.
59
+ - QMD 2.5.3 package and supported native binaries remaining available.
60
+
61
+ **Verification:**
62
+ - Existing typecheck, lint, and test suites pass on Node.js 22.
63
+ - Clean package installation succeeds on Linux x64, macOS arm64, and Windows x64 CI.
64
+ - QMD SDK contract tests cover lexical, typed hybrid, expanded/reranked, update, embed, status, and close operations.
65
+ - Benchmark runner reproduces the same baseline metrics from the same fixture and emits Recall@20, MRR, nDCG, card/evidence measures, contradiction coverage, and false-positive rate.
66
+ - Lexical QMD smoke test performs no model download or load.
67
+
68
+ **Phase boundary health:** Active wiki recall is still the current implementation, so users do not receive a half-integrated engine. The package has moved to its next-major runtime floor, but all existing functionality and CI remain green.
69
+
70
+ **Risks:**
71
+ - QMD's published SDK may differ from documentation; treat contract-test failure as a design dependency failure before production integration.
72
+ - Personal benchmark queries may expose private data; sanitize fixtures and keep any private source benchmark outside version control.
73
+ - Native CI may be slow or flaky; separate install smoke from cached model-heavy tests.
74
+
75
+ **Context notes:** The detailed plan should focus on measurement and compatibility, not begin production indexing. Record immutable benchmark train/held-out membership before later ranking work.
76
+
77
+ ---
78
+
79
+ ## Phase 2: Validated QMD Indexing
80
+
81
+ **Outcome:** Each vault can build, incrementally update, inspect, and safely replace a QMD index derived only from parser-valid Markdown, while active recall still has a safe existing path.
82
+
83
+ **Why now:** Retrieval cannot cut over until indexing excludes malformed or reserved pages, maintains personal/project isolation, survives interrupted rebuilds, and exposes a repair command.
84
+
85
+ **Scope:**
86
+ - Add stable `vault_id` creation and one-time backfill while preserving existing config.
87
+ - Introduce a QMD adapter boundary that hides QMD-specific types from shared wiki services.
88
+ - Build canonical/evidence mirror trees from successfully parsed `KnowledgeDocument` pages.
89
+ - Maintain the mirror-to-authoritative-path manifest and exclude reserved generated pages.
90
+ - Create one independent QMD store per vault with non-overlapping canonical and evidence collections.
91
+ - Support incremental add, update, invalidation, and deletion.
92
+ - Implement recoverable full-store replacement covering SQLite, WAL/SHM, and native sidecars as one closed artifact directory.
93
+ - Add `wiki_reindex` for lexical/vector, changed/all, force, and vault scopes.
94
+ - Extend status and lint diagnostics for index health, stale content, models, and interrupted swaps.
95
+ - Schedule incremental indexing only after successful metadata projection rebuilds.
96
+
97
+ **Out of scope:**
98
+ - Replacing `wiki_recall` ranking.
99
+ - Adaptive or quality query execution.
100
+ - Typed knowledge relations or card-first context packing.
101
+ - Feedback and conflict-resolution events.
102
+
103
+ **Key files/areas likely affected:**
104
+ - `extensions/llm-wiki/lib/indexing.ts`: indexing coordination and stale-state reporting.
105
+ - `extensions/llm-wiki/lib/knowledge-document.ts`: validated mirror input contract.
106
+ - `extensions/llm-wiki/lib/bootstrap.ts` and `extensions/llm-wiki/lib/utils.ts`: vault IDs and generated paths.
107
+ - New QMD adapter/index-store module under `extensions/llm-wiki/lib/`.
108
+ - `extensions/llm-wiki/lib/task-config.ts`: index-related configuration parsing where needed.
109
+ - `extensions/llm-wiki/lib/tools.ts` and `extensions/llm-wiki/lib/wiki-service.ts`: reindex/status shared operations.
110
+ - `extensions/llm-wiki/lib/guardrails.ts`: generated QMD ownership and post-rebuild scheduling.
111
+ - `mcp/operations.ts`: parity for reindex and status.
112
+ - `test/indexing.test.ts`, `test/indexing-fail-closed.test.ts`, and new QMD indexing tests.
113
+
114
+ **Dependencies:**
115
+ - Phase 1's pinned, contract-tested QMD SDK and Node.js 22 runtime.
116
+ - Existing shared document parser and fail-closed projection behavior.
117
+
118
+ **Verification:**
119
+ - Valid pages appear in the correct mirror collection and map back to their authoritative paths.
120
+ - Malformed, deleted, and reserved pages cannot enter QMD candidates.
121
+ - Incremental indexing reports accurate indexed, changed, unchanged, removed, and embedding-needed counts.
122
+ - Forced rebuild closes, swaps, reopens, and validates the complete QMD artifact.
123
+ - Simulated interruption at each swap phase recovers or rolls back to a usable store.
124
+ - Personal and project indexes remain isolated even when page IDs collide.
125
+ - `wiki_reindex`, status, Pi, and MCP return equivalent structured results.
126
+
127
+ **Phase boundary health:** Existing recall remains functional. QMD indexing is independently usable and repairable through `wiki_reindex` and status, but no automatic context depends on it yet.
128
+
129
+ **Risks:**
130
+ - Mirror and manifest can diverge after a crash; reconcile both from authoritative Markdown before every full rebuild and during startup recovery.
131
+ - Native stores may retain open handles; require explicit close and validation before any directory swap.
132
+ - Background embedding can consume resources unexpectedly; lexical-only indexing must remain model-free and vector work visible/cancellable.
133
+
134
+ **Context notes:** Keep QMD table details private to its SDK. The detailed plan should treat generated mirror, manifest, and store as one lifecycle without manipulating QMD's schema directly.
135
+
136
+ ---
137
+
138
+ ## Phase 3: Retrieval Modes and Recall Cutover
139
+
140
+ **Outcome:** QMD becomes the single active relevance engine for explicit recall, automatic injection, and MCP, with lexical, hybrid, adaptive, and quality modes plus deterministic fallback.
141
+
142
+ **Why now:** The validated stores and repair path from Phase 2 are prerequisites for switching production queries without risking malformed-content influence or unrecoverable failures.
143
+
144
+ **Scope:**
145
+ - Implement exact SDK mappings for lexical, typed hybrid, adaptive escalation, and quality retrieval.
146
+ - Normalize queries and construct bounded vault intent according to the spec.
147
+ - Apply deterministic adaptive triggers, confidence floors, candidate limits, and exact-match bypass.
148
+ - Merge personal/project ranked lists using rank-based normalization and project duplicate precedence.
149
+ - Preserve exact identifiers, titles, aliases, commands, paths, and filenames.
150
+ - Route `wiki_recall`, automatic `before_agent_start` recall, and MCP through one shared retrieval service.
151
+ - Keep automatic recall precision-first and explicit recall broader.
152
+ - Preserve links-first rendering and skill/case inlining behavior where applicable.
153
+ - Implement model/store fallback chains and structured diagnostics.
154
+ - Remove the old heuristic scorer and page-level embedding path from active recall after parity checks pass.
155
+ - Deprecate `wiki_reindex_embeddings` through the consolidated reindex operation.
156
+
157
+ **Out of scope:**
158
+ - Typed-link evidence expansion.
159
+ - Canonical/evidence bundle assembly beyond role labels.
160
+ - User conflict decisions.
161
+ - Learning from feedback.
162
+
163
+ **Key files/areas likely affected:**
164
+ - `extensions/llm-wiki/lib/recall.ts`: shared QMD-backed query and layered merge behavior.
165
+ - QMD adapter module from Phase 2: mode-specific SDK calls and fallback.
166
+ - `extensions/llm-wiki/lib/task-config.ts`: `retrievalMode` validation and defaults.
167
+ - `extensions/llm-wiki/index.ts`: automatic recall integration and cache-safe dynamic context.
168
+ - `extensions/llm-wiki/lib/inject.ts`: unchanged cache boundary with new structured recall blocks.
169
+ - `extensions/llm-wiki/lib/wiki-service.ts`: shared Pi/MCP operation.
170
+ - `mcp/operations.ts`: recall parity.
171
+ - `test/recall.test.ts`, `test/agent-start-injection.test.ts`, and `test/mcp-parity.test.ts`.
172
+ - `extensions/llm-wiki/lib/embeddings.ts`: retirement or compatibility handling for the old sidecar path.
173
+
174
+ **Dependencies:**
175
+ - Phase 2's validated, healthy QMD stores and status diagnostics.
176
+ - Phase 1's SDK contract tests and baseline benchmark.
177
+
178
+ **Verification:**
179
+ - Each retrieval mode invokes only its specified QMD SDK path.
180
+ - Missing vectors, model failures, reranker timeouts, and store failures follow the designed fallback chain.
181
+ - Automatic recall injects nothing below the confidence floor.
182
+ - Exact lookup remains within release-gate tolerance against the baseline.
183
+ - Personal/project merging is deterministic and duplicate-safe.
184
+ - Pi automatic recall, explicit tool recall, and MCP produce equivalent structured candidates.
185
+ - Existing tests remain green after the old scorer leaves active paths.
186
+
187
+ **Phase boundary health:** Retrieval is fully usable through QMD in every supported mode, but results still use a conservative flat presentation. Later semantic assembly can improve context without changing the retrieval engine again.
188
+
189
+ **Risks:**
190
+ - QMD scores may vary by mode or model; use them only for within-store confidence and ranks for cross-store merging.
191
+ - Query expansion can introduce drift; adaptive mode retains the initial hybrid list on reranker failure and lexical mode stays available.
192
+ - Cutover could increase cold latency; expose progress/status and retain precision-first no-injection behavior.
193
+
194
+ **Context notes:** This phase should end dual-engine behavior. Transitional comparison may exist in tests or benchmark tooling, not as two production ranking paths.
195
+
196
+ ---
197
+
198
+ ## Phase 4: Card-First Memory Assembly
199
+
200
+ **Outcome:** Recall returns deterministic memory bundles containing the best canonical card, bounded evidence, qualifiers, and competing claims instead of a flat page list.
201
+
202
+ **Why now:** QMD must first provide reliable candidates. This phase adds wiki-specific semantics without entangling them with indexing or model integration.
203
+
204
+ **Scope:**
205
+ - Classify canonical and evidence roles from parsed page types and status.
206
+ - Add the optional `relations` profile field with parse, validation, serialization, and lint behavior.
207
+ - Require matching ordinary Markdown links so Obsidian and plain Markdown navigation remain intact.
208
+ - Build typed relation adjacency without duplicate backlink edges.
209
+ - Apply bounded status, human-verification, exact-match, freshness, and trust adjustments.
210
+ - Expand at most one hop through evidence, qualification, supersession, applicability, derivation, and contradiction relations.
211
+ - Group chunks by parent page and create `MemoryBundle` structures.
212
+ - Enforce automatic bundle count, excerpt count/length, diversity, tie-break, and context-budget rules.
213
+ - Label raw matches as unpromoted evidence when no suitable canonical page exists.
214
+ - Render match reasons, provenance, scope, freshness, relation type, and conflicts.
215
+ - Keep generic `related_to` and untyped links out of automatic expansion.
216
+
217
+ **Out of scope:**
218
+ - Automatically creating or promoting canonical cards.
219
+ - Persisting user conflict choices.
220
+ - Feedback-derived score adjustments.
221
+ - Graph database or multi-hop traversal.
222
+
223
+ **Key files/areas likely affected:**
224
+ - `extensions/llm-wiki/lib/knowledge-document.ts`: typed relation extension model.
225
+ - `extensions/llm-wiki/lib/knowledge-links.ts`: relation/link coexistence and normalized target resolution.
226
+ - `extensions/llm-wiki/lib/metadata.ts`: typed adjacency projection and diagnostics.
227
+ - `extensions/llm-wiki/lib/recall.ts` or a focused memory-assembly module: grouping and bounded adjustments.
228
+ - `extensions/llm-wiki/lib/wiki-service.ts`: structured bundle output.
229
+ - `extensions/llm-wiki/lib/tools.ts`: rendering and diagnostics.
230
+ - `test/knowledge-document.test.ts`, `test/knowledge-links.test.ts`, `test/recall.test.ts`, and OKF integration fixtures.
231
+ - `docs/obsidian.md` and architecture documentation: human graph behavior and profile field.
232
+
233
+ **Dependencies:**
234
+ - Phase 3's shared, QMD-backed candidate stream.
235
+ - Existing OKF shared parser/serializer and backlink projections.
236
+
237
+ **Verification:**
238
+ - Relation metadata round-trips and unknown relation types remain preserved but inert.
239
+ - Lint catches missing body links, invalid scopes, duplicates, self-links, and unresolved targets.
240
+ - A canonical card precedes equally relevant evidence without introducing non-candidates.
241
+ - Evidence and contradictions expand only through allowed one-hop relations.
242
+ - Context packing obeys all count, length, diversity, and budget limits deterministically.
243
+ - Obsidian still sees ordinary Markdown links and backlinks do not duplicate edges.
244
+ - Card/evidence benchmark measures improve without violating exact-lookup or Recall@20 gates.
245
+
246
+ **Phase boundary health:** Recall now delivers useful card-first context with provenance and visible unresolved conflicts. It does not yet mutate knowledge based on those conflicts or usage.
247
+
248
+ **Risks:**
249
+ - Canonical boosts may overpower relevance; keep the combined multiplier clamped and benchmarked.
250
+ - Relation metadata may diverge from body links; lint makes the relation inert until both agree.
251
+ - Dense results can duplicate evidence; parent-page deduplication and fixed excerpt caps protect context.
252
+
253
+ **Context notes:** Keep all assembly logic pure where possible. Do not add card-promotion workflows; they require a separate future design.
254
+
255
+ ---
256
+
257
+ ## Phase 5: User Conflict Resolution
258
+
259
+ **Outcome:** When competing claims appear, an explicit user choice can be recorded as an immutable, scoped, idempotent resolution with identical Pi and MCP behavior.
260
+
261
+ **Why now:** Conflict records depend on Phase 4's typed relations and memory bundles. Implementing this before general feedback also establishes the durable internal-event and writer-lock foundation that feedback will reuse.
262
+
263
+ **Scope:**
264
+ - Extend the authoritative event service with internal-event visibility and cross-process per-vault locking.
265
+ - Ensure human-readable logs omit internal feedback events while full-vault backups retain them.
266
+ - Implement `wiki_resolve_conflict` with exact page IDs, relation direction, scope rules, rationale, and replacement-chain validation.
267
+ - Write one immutable resolution analysis page per semantic decision using atomic single-file publication.
268
+ - Derive active resolution state without rewriting or deleting competing claim pages.
269
+ - Add idempotent replay and replacement behavior.
270
+ - Emit `conflict_selected` internal events and keep them aligned with committed resolution pages.
271
+ - Update metadata, relation projections, indexing, status, and recall after resolution.
272
+ - Expose the same tool parameters, result codes, and validation through Pi and MCP.
273
+
274
+ **Out of scope:**
275
+ - Automatic contradiction resolution.
276
+ - General relevance/irrelevance feedback.
277
+ - Rewriting historical claim status.
278
+ - Multi-party approvals or voting.
279
+
280
+ **Key files/areas likely affected:**
281
+ - `extensions/llm-wiki/lib/metadata.ts`: event visibility, locking, replay, and projections.
282
+ - New focused conflict-resolution service under `extensions/llm-wiki/lib/`.
283
+ - `extensions/llm-wiki/lib/knowledge-document.ts`: resolution metadata validation.
284
+ - `extensions/llm-wiki/lib/knowledge-links.ts`: resolution links and derived relation direction.
285
+ - `extensions/llm-wiki/lib/tools.ts` and `extensions/llm-wiki/lib/wiki-service.ts`: shared operation and Pi tool.
286
+ - `mcp/operations.ts`: MCP parity.
287
+ - `extensions/llm-wiki/lib/indexing.ts`: post-resolution incremental update.
288
+ - Conflict, event-concurrency, mutation-guard, and parity tests.
289
+ - `docs/architecture.md` and OKF ownership documentation: internal events and resolution records.
290
+
291
+ **Dependencies:**
292
+ - Phase 4's typed relation model and contradiction bundles.
293
+ - Existing event stream and atomic knowledge-document writer patterns.
294
+
295
+ **Verification:**
296
+ - Invalid, cross-vault, same-page, or malformed-scope decisions make no writes.
297
+ - Repeating the same decision returns the existing resolution.
298
+ - Changed choices require a valid `replaces` chain and preserve old records.
299
+ - Lock contention follows explicit-event timeout behavior without partial knowledge mutation.
300
+ - Resolution pages preserve both claim links and all prior provenance.
301
+ - Recall follows the active resolution for applicable scope while retaining the competing claim for audit.
302
+ - Pi and MCP results are structurally equivalent.
303
+
304
+ **Phase boundary health:** Conflict handling is complete and useful without general behavioral learning. Existing recall remains deterministic when no resolution exists.
305
+
306
+ **Risks:**
307
+ - Event/page publication can diverge on I/O failure; acquire the event lock before publication and test rollback/replay states.
308
+ - User language can be ambiguous; only explicit resolved page IDs and relation choices reach the mutation service.
309
+ - Synced vaults may retain stale locks; use the specified owner/time recovery rule and surface unresolved locks through lint/status.
310
+
311
+ **Context notes:** The detailed plan should preserve one authoritative decision record rather than coordinating edits across both claim pages.
312
+
313
+ ---
314
+
315
+ ## Phase 6: Retrieval Feedback
316
+
317
+ **Outcome:** Local explicit and observable implicit feedback produces small, decaying, explainable ranking adjustments without rewriting facts or introducing candidates.
318
+
319
+ **Why now:** Feedback needs stable QMD result identities, card-first results, active-turn tracking, and the internal-event concurrency semantics established in earlier phases.
320
+
321
+ **Scope:**
322
+ - Add `recall_feedback` schema-versioned internal events keyed by stable vault/page identity and query hash.
323
+ - Track shown results per active turn.
324
+ - Instrument `shown`, `opened`, `cited`, and `shown_only` through the specified service and hooks.
325
+ - Implement `wiki_recall_feedback` for explicit relevance, irrelevance, and correction judgments on previously shown results.
326
+ - Preserve corrections as human-readable source observations before appending feedback events.
327
+ - Build and replay the generated feedback aggregate projection.
328
+ - Apply the 90-day half-life, signal strengths, and total `±0.02` post-retrieval clamp.
329
+ - Disable feedback safely on event-source corruption or configuration opt-out.
330
+ - Expose feedback state and diagnostics without storing raw query text.
331
+ - Add correction cases to the retrieval regression corpus.
332
+
333
+ **Out of scope:**
334
+ - Copy, dwell-time, or unavailable UI signals.
335
+ - Online model training.
336
+ - Global or cross-user feedback sharing.
337
+ - Feedback-based candidate generation or fact mutation.
338
+ - Automated card promotion.
339
+
340
+ **Key files/areas likely affected:**
341
+ - New focused feedback aggregation module under `extensions/llm-wiki/lib/`.
342
+ - `extensions/llm-wiki/lib/metadata.ts`: internal event replay and projection preservation.
343
+ - `extensions/llm-wiki/lib/guardrails.ts` or extension hooks: read/open observation.
344
+ - `extensions/llm-wiki/index.ts`: active-turn shown/cited lifecycle.
345
+ - `extensions/llm-wiki/lib/observation.ts`: correction observation producer reuse.
346
+ - `extensions/llm-wiki/lib/recall.ts` or memory-assembly module: bounded post-retrieval adjustment.
347
+ - `extensions/llm-wiki/lib/task-config.ts`: `recallFeedback` setting.
348
+ - `extensions/llm-wiki/lib/tools.ts`, `wiki-service.ts`, and `mcp/operations.ts`: explicit feedback operation and parity.
349
+ - Feedback, event replay, hook instrumentation, privacy, and ranking-bound tests.
350
+
351
+ **Dependencies:**
352
+ - Phase 3's stable QMD result identity and active recall service.
353
+ - Phase 4's final ranking/assembly boundary.
354
+ - Phase 5's internal event visibility and writer locking.
355
+
356
+ **Verification:**
357
+ - Raw query text never enters feedback events.
358
+ - Identical page IDs in different vaults receive independent signals.
359
+ - Only results shown in the active session can receive explicit feedback.
360
+ - Each observable hook emits the documented action; unavailable signals are not claimed.
361
+ - Corrupt events disable adjustments and preserve the last projection.
362
+ - Deleted pages and stale event references cannot affect ranking.
363
+ - Aggregate feedback never exceeds its clamp or introduces a non-candidate.
364
+ - Disabling implicit feedback leaves explicit corrections and conflict records working.
365
+
366
+ **Phase boundary health:** The full retrieval experience now learns conservatively from use while Markdown facts and candidate generation remain unchanged.
367
+
368
+ **Risks:**
369
+ - Position and engagement bias can reinforce popular pages; keep implicit weights tiny and decayed.
370
+ - Turn-hook instrumentation may misclassify use; `shown_only` remains a minimal proxy, never strong negative evidence.
371
+ - Event volume can grow; no compaction ships in this release, so status should report size for future evidence-based work.
372
+
373
+ **Context notes:** Keep feedback aggregation deterministic and replayable. Do not broaden the event schema into a general analytics platform.
374
+
375
+ ---
376
+
377
+ ## Phase 7: Hardening and Major Release
378
+
379
+ **Outcome:** The next major version ships with documented migration, supported-platform validation, published quality metrics, and all release gates passing.
380
+
381
+ **Why now:** Final migration, removals, documentation, and versioning should happen only after every capability is integrated and measured together.
382
+
383
+ **Scope:**
384
+ - Run all retrieval-mode ablations on train and held-out benchmark sets with recorded model/index versions and hardware context.
385
+ - Tune only implementation constants allowed by the spec while preserving the held-out set.
386
+ - Enforce exact lookup, nDCG, MRR, false-positive, contradiction, and Recall@20 release gates.
387
+ - Run model-heavy smoke tests with cached pinned models.
388
+ - Complete migration handling for `vault_id`, lazy indexes, stale old embedding sidecars, and first-run reindex prompts.
389
+ - Confirm QMD model-cache behavior, first-use download messaging, cancellation, and runtime fallback.
390
+ - Finalize deprecation behavior for `wiki_reindex_embeddings` and remove old active scorer code that no longer serves compatibility or benchmark needs.
391
+ - Update README, configuration, API, architecture, Obsidian, troubleshooting, migration, and release documentation.
392
+ - Publish supported-platform and Node.js 22 requirements prominently.
393
+ - Prepare changelog and use the release script for the major version; never edit the package version manually.
394
+
395
+ **Out of scope:**
396
+ - Automated canonical-card promotion.
397
+ - Graph database or graph viewer work beyond existing Obsidian compatibility.
398
+ - Additional QMD backends or remote rerankers.
399
+ - Feedback compaction or learned ranking models.
400
+ - Features deferred by the approved design.
401
+
402
+ **Key files/areas likely affected:**
403
+ - Benchmark fixtures, reports, and release-gate scripts.
404
+ - `package.json`, `pnpm-lock.yaml`, and `scripts/release.js` integration.
405
+ - `.github/workflows/`: full release matrix and cached model smoke.
406
+ - `README.md`, `docs/configuration.md`, `docs/api.md`, `docs/architecture.md`, `docs/obsidian.md`, and troubleshooting/migration docs.
407
+ - `CHANGELOG.md`.
408
+ - Legacy recall/embedding modules and tests retained only where still required.
409
+ - Package smoke and MCP parity tests.
410
+
411
+ **Dependencies:**
412
+ - Completion of Phases 1–6.
413
+ - Release-candidate benchmark results meeting every approved gate.
414
+ - Supported-platform CI availability.
415
+
416
+ **Verification:**
417
+ - Full typecheck, lint, unit, integration, MCP, package-smoke, and supported-platform suites pass.
418
+ - Held-out benchmark satisfies every numeric release gate.
419
+ - Fresh vault, existing personal vault, and project-plus-personal vault migration scenarios work without content loss.
420
+ - Lexical mode works without model downloads; hybrid/adaptive/quality provide clear model progress and fallback.
421
+ - Full reindex repairs stale or interrupted state.
422
+ - Documentation matches actual tool schemas, settings, model sizes, platform support, and deprecations.
423
+ - Release artifact installs and runs on each claimed platform.
424
+
425
+ **Phase boundary health:** This is the final coherent release boundary. The previous major remains available for Node.js 18 users, while the new major has one active retrieval engine and no undocumented migration requirement.
426
+
427
+ **Risks:**
428
+ - Benchmark tuning can overfit; preserve held-out judgments and publish ablations.
429
+ - Native/model packaging can regress late; require clean-install and cached model smoke before tagging.
430
+ - Major-release documentation may understate storage/model cost; include explicit generated-index and full-vault-backup implications.
431
+
432
+ **Context notes:** Use the release script only after the release candidate passes every gate. If a gate fails, return to the owning phase rather than weakening the criterion during release work.
433
+
434
+ ---
435
+
436
+ ## Deferred Follow-Up Designs
437
+
438
+ The following work remains intentionally outside this roadmap:
439
+
440
+ - evidence-driven canonical-card promotion and review queues
441
+ - graph visualization beyond Obsidian compatibility
442
+ - graph databases or multi-hop agentic retrieval
443
+ - remote or alternative reranker providers
444
+ - feedback-log compaction and retention controls
445
+ - personalized learned ranking models
446
+ - automatic contradiction detection beyond proposed, reviewable links
447
+
448
+ Each item requires evidence from production retrieval and its own reviewed design before implementation.