fix(memory-wiki): standardize page schema + repair pipeline#3
Merged
Conversation
Kill the three pipeline bugs that accounted for the majority of vault lint noise (42 errors + 682 warnings): 1. `extractWikiLinks` now strips fenced code blocks and inline code before scanning — `[[reply_to_current]]` tokens inside transcript fences no longer look like wikilinks (~288 false positives gone). 2. `collectBrokenLinkIssues` normalizes `.md` suffix and path prefix on both sides — native-mode dashboard links like `[Title](sources/foo.md)` now resolve instead of lint-broken. 3. `refreshPageRelatedBlocks` skips pages with no frontmatter and no body, so compile no longer synthesizes empty "orphan shell" files by adding `## Related` blocks to nothing. Also codify the canonical standard so drift is repairable, not chronic: - New `structure-repair.ts` module with `ensurePageStructure`, `repairMemoryWikiVault`, and `findOrphanSourceShells`. - Compile auto-runs the structure sweep, so any generated artifact ends up with `id`, `pageType`, `title`, and `updatedAt` — never rewriting human-authored body text or existing frontmatter. - New `openclaw wiki repair [--dry-run] [--remove-orphans]` CLI for legacy backfill and explicit orphan cleanup. - Lint report page includes `updatedAt` on first creation. - README gains the canonical standard table, provenance discipline notes, orphan-shell explanation, and daily operator workflow. 16 new unit + integration tests cover the link extractor code-fence handling, the `.md` link validator, structure backfill, orphan detection, compile's self-heal, and the full repair -> compile -> lint loop. Full suite: 97/97 green. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Harden the memory-wiki vault so it's deterministic and trustworthy for daily use. Kills three pipeline bugs responsible for most of the current 42 lint errors + 682 warnings, codifies the canonical page standard in code + docs, and adds a deterministic repair command for legacy content.
Pipeline bugs fixed
extractWikiLinksnow strips fenced code blocks and inline code before scanning.[[reply_to_current]]tokens inside transcript fences no longer count as wikilinks (~288 false-positive broken-link warnings).collectBrokenLinkIssuesnormalizes.mdsuffix and path prefix on both sides so[Title](sources/foo.md)in dashboard reports resolves. Previously every native-mode markdown link was lint-broken.refreshPageRelatedBlocksnow skips pages with no frontmatter and no body, so compile no longer papers over empty source files by adding## Relatedblocks to them.Canonical standard + repair
structure-repair.tsmodule withensurePageStructure,repairMemoryWikiVault, andfindOrphanSourceShells.id,pageType,title,updatedAt. Human-authored body text and existing frontmatter are never rewritten.openclaw wiki repair [--dry-run] [--remove-orphans]CLI for explicit legacy backfill and orphan cleanup.updatedAton first creation.Operator workflow
Daily loop is unchanged:
One-time legacy cleanup:
Test plan
pnpm oxlint --type-aware extensions/memory-wiki/srcclean.pnpm tsgo --noEmit -p extensions/memory-wiki/tsconfig.jsonclean.[[reply_to_current]]inside a code fence, native-mode dashboard link) and verifies the fullrepair -> compile -> lintloop drops errors and broken-link warnings to zero.openclaw wiki repair --dry-runagainst the live vault to confirm orphan count matches, thenopenclaw wiki repair --remove-orphans && openclaw wiki compile && openclaw wiki lintand inspect the reduction.🤖 Generated with Claude Code