wiki-rebuild
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWiki Rebuild — Archive, Rebuild, Restore
Wiki 重建 — 存档、重建、恢复
You are performing a destructive operation on the wiki. Always archive first, always confirm with the user before proceeding.
你正在对wiki执行破坏性操作,请务必先进行存档,且操作前必须征得用户确认。
Before You Start
开始前准备
- Read to get
.envOBSIDIAN_VAULT_PATH - Read to understand current state
.manifest.json - Confirm the user's intent. This skill supports three modes:
- Archive only — snapshot current wiki, no rebuild
- Archive + Rebuild — snapshot, then reprocess all sources from scratch
- Restore — bring back a previous archive
- 读取 获取
.envOBSIDIAN_VAULT_PATH - 读取 了解当前状态
.manifest.json - 确认用户意图。 此skill支持三种模式:
- 仅存档 — 对当前wiki拍摄快照,不执行重建
- 存档+重建 — 拍摄快照后,从头重新处理所有数据源
- 恢复 — 还原至之前的某个存档版本
The Archive System
存档系统
Archives live at . Each archive is a timestamped directory containing a full copy of the wiki state at that point.
$OBSIDIAN_VAULT_PATH/_archives/$OBSIDIAN_VAULT_PATH/
├── _archives/
│ ├── 2026-04-01T10-30-00Z/
│ │ ├── archive-meta.json
│ │ ├── concepts/
│ │ ├── entities/
│ │ ├── skills/
│ │ ├── references/
│ │ ├── synthesis/
│ │ ├── journal/
│ │ ├── projects/
│ │ ├── index.md
│ │ ├── log.md
│ │ └── .manifest.json
│ └── 2026-03-15T08-00-00Z/
│ └── ...
├── concepts/ ← live wiki
├── entities/
└── ...存档存放在 路径下。每个存档都是一个带时间戳的目录,包含对应时间点wiki状态的完整副本。
$OBSIDIAN_VAULT_PATH/_archives/$OBSIDIAN_VAULT_PATH/
├── _archives/
│ ├── 2026-04-01T10-30-00Z/
│ │ ├── archive-meta.json
│ │ ├── concepts/
│ │ ├── entities/
│ │ ├── skills/
│ │ ├── references/
│ │ ├── synthesis/
│ │ ├── journal/
│ │ ├── projects/
│ │ ├── index.md
│ │ ├── log.md
│ │ └── .manifest.json
│ └── 2026-03-15T08-00-00Z/
│ └── ...
├── concepts/ ← 运行中的wiki
├── entities/
└── ...archive-meta.json
archive-meta.json
json
{
"archived_at": "2026-04-06T10:30:00Z",
"reason": "rebuild",
"total_pages": 87,
"total_sources": 42,
"total_projects": 6,
"vault_path": "/Users/name/Knowledge",
"manifest_snapshot": ".manifest.json"
}json
{
"archived_at": "2026-04-06T10:30:00Z",
"reason": "rebuild",
"total_pages": 87,
"total_sources": 42,
"total_projects": 6,
"vault_path": "/Users/name/Knowledge",
"manifest_snapshot": ".manifest.json"
}Mode 1: Archive Only
模式1:仅存档
When the user wants to snapshot the current state without rebuilding.
当用户只想对当前状态拍摄快照、不需要重建时使用。
Steps:
步骤:
- Create archive directory:
_archives/YYYY-MM-DDTHH-MM-SSZ/ - Copy all category directories, ,
index.md,log.md, and.manifest.jsoninto the archiveprojects/ - Write with reason
archive-meta.json"snapshot" - Append to :
log.md- [TIMESTAMP] ARCHIVE reason="snapshot" pages=87 destination="_archives/2026-04-06T10-30-00Z" - Report: "Archived 87 pages. Current wiki is untouched."
- 创建存档目录:
_archives/YYYY-MM-DDTHH-MM-SSZ/ - 将所有分类目录、、
index.md、log.md以及.manifest.json复制到存档中projects/ - 写入 ,原因字段设为
archive-meta.json"snapshot" - 追加内容到 :
log.md- [TIMESTAMP] ARCHIVE reason="snapshot" pages=87 destination="_archives/2026-04-06T10-30-00Z" - 报告提示:"已存档87个页面,当前wiki内容未改动。"
Mode 2: Archive + Rebuild
模式2:存档+重建
When the user wants to start fresh. This is the full sequence:
当用户想要重新开始时使用,完整流程如下:
Step 1: Archive current state
步骤1:存档当前状态
Same as Mode 1 above, but with reason .
"rebuild"和上述模式1操作一致,但原因字段设为 。
"rebuild"Step 2: Clear live wiki
步骤2:清空运行中的wiki内容
Remove all content from the category directories (, , , etc.) and the directory. Keep:
concepts/entities/skills/projects/- (obviously)
_archives/ - (Obsidian config)
.obsidian/ - (if present in vault)
.env
Reset to the empty template. Reset with just the rebuild entry. Delete (it'll be recreated during ingest).
index.mdlog.md.manifest.json移除所有分类目录(、、等)和 目录下的所有内容,保留以下文件/目录:
concepts/entities/skills/projects/- (显然需要保留)
_archives/ - (Obsidian配置目录)
.obsidian/ - (如果vault中存在的话)
.env
将 重置为空模板,重置 仅保留重建记录,删除 (后续数据摄入时会重新生成)。
index.mdlog.md.manifest.jsonStep 3: Rebuild
步骤3:重建
Tell the user the vault is cleared and ready for a full re-ingest. They can now run:
- — to see all sources as "new"
wiki-status - — to reprocess Claude history
claude-history-ingest - — to reprocess Codex session history
codex-history-ingest - — to reprocess documents
wiki-ingest - — to reprocess any other data
data-ingest
Each of these will rebuild the manifest as they go.
Important: Don't run the ingest yourself automatically. The user should choose what to re-ingest and in what order. Some sources may no longer be relevant.
告知用户vault已清空,可执行全量重新摄入,用户可以运行以下命令:
- — 查看所有标记为"new"的数据源
wiki-status - — 重新处理Claude历史记录
claude-history-ingest - — 重新处理Codex会话历史
codex-history-ingest - — 重新处理文档
wiki-ingest - — 重新处理其他任意数据
data-ingest
以上每个命令运行时都会逐步重建manifest。
重要提示: 不要自动执行摄入操作,用户应该自主选择需要重新摄入的内容和执行顺序,部分数据源可能已经不再相关。
Step 4: Log the rebuild
步骤4:记录重建日志
Append to :
log.md- [TIMESTAMP] REBUILD archived_to="_archives/2026-04-06T10-30-00Z" previous_pages=87追加内容到 :
log.md- [TIMESTAMP] REBUILD archived_to="_archives/2026-04-06T10-30-00Z" previous_pages=87Mode 3: Restore from Archive
模式3:从存档恢复
When the user wants to go back to a previous state.
当用户想要回退到之前的状态时使用。
Step 1: List available archives
步骤1:列出可用存档
Read directory. For each archive, read and present:
_archives/archive-meta.jsonmarkdown
undefined读取 目录,对每个存档读取 并展示如下内容:
_archives/archive-meta.jsonmarkdown
undefinedAvailable Archives
可用存档
| Date | Reason | Pages | Sources |
|---|---|---|---|
| 2026-04-06 10:30 | rebuild | 87 | 42 |
| 2026-03-15 08:00 | snapshot | 65 | 31 |
undefined| 日期 | 原因 | 页面数 | 数据源数 |
|---|---|---|---|
| 2026-04-06 10:30 | rebuild | 87 | 42 |
| 2026-03-15 08:00 | snapshot | 65 | 31 |
undefinedStep 2: Confirm which archive to restore
步骤2:确认要恢复的存档
Ask the user which archive they want. Warn them that restoring will overwrite the current live wiki.
询问用户想要恢复哪个存档,警告用户恢复操作会覆盖当前运行的wiki内容。
Step 3: Archive current state first
步骤3:先存档当前状态
Before restoring, archive the current state (reason: ) so nothing is lost.
"pre-restore"执行恢复前,先存档当前状态(原因设为 ),避免内容丢失。
"pre-restore"Step 4: Restore
步骤4:执行恢复
- Clear the live wiki (same as Mode 2, Step 2)
- Copy all content from the chosen archive back into the live wiki directories
- Restore ,
index.md, andlog.mdfrom the archive.manifest.json - Append to :
log.md- [TIMESTAMP] RESTORE from="_archives/2026-03-15T08-00-00Z" pages_restored=65
- 清空运行中的wiki内容(和模式2步骤2操作一致)
- 将选中存档的所有内容复制回运行中的wiki目录
- 从存档中恢复 、
index.md和log.md.manifest.json - 追加内容到 :
log.md- [TIMESTAMP] RESTORE from="_archives/2026-03-15T08-00-00Z" pages_restored=65
Step 5: Report
步骤5:结果报告
Tell the user what was restored and suggest running to check for any issues with the restored state.
wiki-lint告知用户恢复的内容,建议运行 检查恢复后的状态是否存在问题。
wiki-lintSafety Rules
安全规则
- Always archive before destructive operations. No exceptions.
- Always confirm with the user before clearing the live wiki.
- Never delete archives unless the user explicitly asks. Archives are cheap insurance.
- The directory is sacred. Never touch it during archive/rebuild/restore — it contains the user's Obsidian settings, plugins, and themes.
.obsidian/ - If something goes wrong mid-rebuild, the archive is there. Tell the user they can restore.
- 破坏性操作前必须先存档。 无例外。
- 清空运行中的wiki前必须征得用户确认。
- 不得删除存档 除非用户明确要求,存档是低成本的内容保障手段。
- 目录是不可修改的。 存档/重建/恢复过程中绝对不要改动该目录,它包含用户的Obsidian设置、插件和主题配置。
.obsidian/ - 如果重建过程中出现问题,可以使用存档回退,告知用户可以执行恢复操作。