Skip to content

feat(memory-wiki): index canon/ directory in bridge#10

Closed
LightDriverCS wants to merge 1 commit into
mainfrom
canon-bridge-indexing
Closed

feat(memory-wiki): index canon/ directory in bridge#10
LightDriverCS wants to merge 1 commit into
mainfrom
canon-bridge-indexing

Conversation

@LightDriverCS

Copy link
Copy Markdown

Summary

Add canon as a recognized WikiPageKind so files in the vault's canon/ directory are indexed by wiki.search, wiki.get, wiki.status, and the compile pipeline. Until now the bridge only walked entities/, concepts/, sources/, syntheses/, and reports/ — daily canon roll-ups (canon/<date>.md) written directly into the vault by reflective dreaming agents were invisible to MCP queries despite being valid wiki pages.

Why

Reflective-dreaming agents write canon/<date>.md daily roll-ups directly to the vault. They aren't MemoryPluginPublicArtifacts (which the existing bridge.ts dispatcher handles), so they bypassed the import path entirely. The vault-walker side (QUERY_DIRS, COMPILE_PAGE_GROUPS, collectVaultCounts) didn't know about the canon/ directory either, so:

  • wiki.get canon/2026-04-25.md returned null
  • wiki.search for canon body text returned 0 hits from the wiki corpus
  • wiki.status.pageCounts had no canon field
  • The agent digest didn't persist canon pages

Changes

  • markdown.ts: add "canon" to WIKI_PAGE_KINDS + canon/ branch in inferWikiPageKind so toWikiPageSummary can classify these pages.
  • query.ts: add "canon" to QUERY_DIRS so listWikiMarkdownFiles + resolveQueryableWikiPageByLookup pick up canon pages.
  • status.ts: add canon: 0 to both pageCounts initializers (live and vault-missing fallback) + extend dirs loop in collectVaultCounts.
  • compile.ts: add canon entry to COMPILE_PAGE_GROUPS so readPageSummaries walks canon/ during compile and writeAgentDigestArtifacts persists canon pages into the agent digest. Add canon counter to buildPageCounts.
  • memory-palace.ts: add canon to PALACE_KIND_ORDER + PRIMARY_PALACE_KINDS + PALACE_KIND_LABELS so canon shows up alongside syntheses/entities/concepts in the palace view.
  • status.test.ts: update vault-missing fixture for the new field.

Test plan

  • Local verification on Mac mini: wiki.status reports canon: 4, wiki.get canon/2026-04-25.md returns full content with kind: "canon", wiki.search returns canon hits ranked above memory-corpus matches for queries that match canon body text, openclaw wiki compile regenerates the digest with canon entries.
  • tsgo + oxlint + madge cycle check all pass on commit (pre-commit hooks green).
  • CI pipeline (vitest, type-check, build) — pending merge gate.
  • No regression to existing dirs (entities/concepts/sources/syntheses/reports) — verified locally; counts unchanged for those buckets.

Related

Patches the same area as the dist-side patches in ~/.openclaw/patches/apply-memory-bridge-fixes.sh Fix 5 (which retires once this lands).

Add `canon` as a recognized WikiPageKind so files in the vault's canon/
directory are indexed by wiki.search, wiki.get, wiki.status, and the
compile pipeline. Until now the bridge only walked entities/, concepts/,
sources/, syntheses/, and reports/ — files written directly into the
vault by reflective dreaming agents (canon/<date>.md daily roll-ups)
were invisible to MCP queries despite being valid wiki pages.

Changes:
- markdown.ts: add "canon" to WIKI_PAGE_KINDS + canon/ branch in
  inferWikiPageKind so toWikiPageSummary can classify these pages.
- query.ts: add "canon" to QUERY_DIRS so listWikiMarkdownFiles +
  resolveQueryableWikiPageByLookup pick up canon pages.
- status.ts: add canon: 0 to both pageCounts initializers (live and
  vault-missing fallback) + extend dirs loop in collectVaultCounts.
- compile.ts: add canon entry to COMPILE_PAGE_GROUPS so readPageSummaries
  walks canon/ during compile and writeAgentDigestArtifacts persists
  canon pages into the agent digest. Add canon counter to buildPageCounts.
- memory-palace.ts: add canon to PALACE_KIND_ORDER + PRIMARY_PALACE_KINDS
  + PALACE_KIND_LABELS so canon shows up alongside syntheses/entities/
  concepts in the palace view.
- status.test.ts: update vault-missing fixture for the new field.

Verified locally on Mac mini: wiki.status reports canon: 4, wiki.get
returns full canon content with kind: "canon", and wiki.search returns
canon hits ranked above memory-corpus matches for queries that match
canon body text.
LightDriverCS added a commit that referenced this pull request Apr 28, 2026
Phase D2.1 — threads appConfig.instanceId into resolveMemoryWikiConfig and resolveDefaultMemoryWikiVaultPath. Vault becomes ~/.openclaw/wiki/{instanceId}/ when set; falls back to main/ otherwise. Path-traversal inputs safely fall back. Orthogonal to #10.

Codex Anvil (gpt-5.5 xhigh) verdict: REPAIR. Repair applied: updated cli-metadata.test.ts to assert the new {instanceId} second-arg; updated README + docs/plugins/memory-wiki.md + openclaw.plugin.json to omit hardcoded vault.path examples that would override the new instance-scoped default.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@LightDriverCS

Copy link
Copy Markdown
Author

Superseded by #16, which includes:

  1. The original canon-kind indexing work (squashed)
  2. Codex Anvil repair pass — 3 real bugs the original missed:
    • Vault init didn't create canon/ (would crash on compileMemoryWikiVault)
    • Status text + root-index count omitted canon
    • wiki repair didn't scan canon
    • Plus regression tests across 7 test files
  3. Rebase onto current main (picks up chore(dreaming): commit bench-reflective-dreaming bundler stub #15's bench-reflective-dreaming bundler stub)

Closing this in favor of #16 once it merges. Anvil artifact: ~/clawd/openclaw/artifacts/anvil/pr-10-20260428T145529Z/

LightDriverCS added a commit that referenced this pull request Apr 28, 2026
…with Anvil repair) (#16)

Indexes the canon/ directory as a first-class memory-wiki page kind. Without this, daily canon roll-ups written by reflective-dreaming agents were invisible to wiki.search / wiki.get / wiki.status / compile pipeline.

Includes Codex Anvil 5.5 xhigh repair (verdict REPAIR → applied):
- Vault init now creates canon/ (was crashing compileMemoryWikiVault with ENOENT)
- Status text + root-index count include canon
- wiki repair scans canon for structure consistency
- Regression tests across 7 test files

Supersedes #10. Rebased onto post-#15 main so pnpm build clears.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant