Skip to content

feat(memory-wiki): index canon/ directory in bridge (supersedes #10, with Anvil repair)#16

Merged
LightDriverCS merged 2 commits into
mainfrom
feat/memory-wiki-canon-kind-with-anvil-repair
Apr 28, 2026
Merged

feat(memory-wiki): index canon/ directory in bridge (supersedes #10, with Anvil repair)#16
LightDriverCS merged 2 commits into
mainfrom
feat/memory-wiki-canon-kind-with-anvil-repair

Conversation

@LightDriverCS

Copy link
Copy Markdown

Summary

Supersedes #10 with the original canon-kind indexing work + Codex Anvil repair pass + rebase onto current main.

Original work (squashed into commit 1)

Indexes the canon/ directory as a first-class memory-wiki page kind. Without this, wiki.search/wiki.get/wiki.status/the compile pipeline ignored daily canon roll-ups (canon/<date>.md) written by reflective-dreaming agents.

Touches: markdown.ts (WIKI_PAGE_KINDS + inferWikiPageKind), query.ts (QUERY_DIRS), status.ts (pageCounts initializers + dirs loop), compile.ts (COMPILE_PAGE_GROUPS + buildPageCounts), memory-palace.ts (PALACE_KIND_ORDER + PALACE_KIND_LABELS).

Anvil repair (commit 2)

Codex 5.5 xhigh smoke (artifact) found 3 real bugs the original PR missed:

  1. Vault init missed canon/ dir — compile groups added canon, but vault.ts INITIAL_DIRS didn't, so compileMemoryWikiVault failed with ENOENT canon/index.md on freshly-initialized vaults. Reproduced before fix.
  2. Status text + root-index count omitted canon — the pageCounts.canon field existed but rendering didn't include it. Fixed in status.ts + compile.ts.
  3. wiki repair didn't scan canonstructure-repair.ts didn't walk canon/, leaving canon pages structurally inconsistent.

Plus regression tests across markdown.test.ts, query.test.ts, status.test.ts, compile.test.ts, memory-palace.test.ts, structure-repair.test.ts.

Why a new PR vs. force-pushing #10

The repair required rebasing #10 onto current main (to pick up #15's bench-reflective-dreaming bundler stub so pnpm build clears). Rather than force-push rewritten history to a 3-day-old PR, this opens a clean replacement — close #10 once this lands.

Verification (Codex)

Anvil Handoff

🤖 Generated with Claude Code

Cory Shelton and others added 2 commits April 28, 2026 09:07
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.
…ests

Surfaced by Codex Anvil (PR #10 smoke 20260428T145529Z):

1. **Vault init missed `canon/`** — compile groups added `canon` but
   `vault.ts` `INITIAL_DIRS` didn't, so `compileMemoryWikiVault` failed
   with `ENOENT ... canon/index.md` on freshly-initialized vaults.
   Reproduced with the existing compile test before fix.

2. **Status text omitted canon count** — the `pageCounts.canon` data
   field existed but the text status renderer + root-index count
   summary didn't include it. Fixed in `status.ts` + `compile.ts`.

3. **Repair didn't scan canon** — `structure-repair.ts` didn't walk
   `canon/`, so `wiki repair` left canon pages structurally
   inconsistent.

Plus regression tests across markdown, query, status, compile,
memory-palace, structure-repair, and vault.

Also rebased onto main to pick up the dreaming bundler stub from
openclaw#15 (5bb2d95) so `pnpm build` clears.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@LightDriverCS
LightDriverCS merged commit 00a4c7b into main Apr 28, 2026
3 of 10 checks passed
@LightDriverCS
LightDriverCS deleted the feat/memory-wiki-canon-kind-with-anvil-repair branch April 28, 2026 15:11
LightDriverCS added a commit that referenced this pull request Apr 28, 2026
PR #16 accidentally committed ~7.4 MB / 98 files of local Codex
Anvil smoke artifacts (codex-anvil-{prompt,report,log}.md,
anvil-repair.patch, etc.) under artifacts/anvil/. The smoke script
writes to repo_root/artifacts/anvil/ but only `.artifacts/` (with
dot prefix) was gitignored, not `artifacts/` (no prefix).

Adds `artifacts/anvil/` to .gitignore and untracks the existing
files. The data stays in git history (no force-push); future
smokes won't add new files to the index.

Co-authored-by: Cory Shelton <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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