-
Notifications
You must be signed in to change notification settings - Fork 0
refactoring a wiki
aniongithub edited this page May 19, 2026
·
1 revision
Renaming and reorganizing a wiki used to be risky — file-rename plus create-elsewhere left orphan pages and dead concepts/wikilinks. agents/mcp-tools makes it atomic.
move_page from="projects/foo" to="projects/bar"
What happens:
- The file is renamed on disk.
- The
pagesrow is updated. - The
linksrows wheresource = "projects/foo"are rewritten tosource = "projects/bar". - The concepts/backlinks (
linksrows wheretarget = "projects/foo") are intentionally not rewritten — those rows reflect[[projects/foo]]text in other pages' source markdown. Rewriting them would make the index lie.
If you want those updates too, you have to do them yourself — search_pages "projects/foo" and update each source.
Move every page under one prefix:
# pseudocode
for page in list_pages(prefix="old/"):
new_path = "new/" + page.path[len("old/"):]
move_page(from=page.path, to=new_path)Agents can do this in one tool-call sequence. Safe to interrupt — each move is atomic.
A naive shell rename:
mv ~/.mind-map/wiki/old.md ~/.mind-map/wiki/new.md…works for the file, but on the next architecture/wiki-engine the engine will:
- Notice
old.mdis gone and drop its index row. - Notice
new.mdappeared and add an index row. - Update
linksrows wheresource = "old"tosource = "new"✓ - Leave
linksrows wheretarget = "old"alone — but now those target a deleted page.
move_page does the same plus preserves the link table cleanly.