wiki-rebuild

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Wiki 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

开始前准备

  1. Read
    .env
    to get
    OBSIDIAN_VAULT_PATH
  2. Read
    .manifest.json
    to understand current state
  3. 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
  1. 读取
    .env
    获取
    OBSIDIAN_VAULT_PATH
  2. 读取
    .manifest.json
    了解当前状态
  3. 确认用户意图。 此skill支持三种模式:
    • 仅存档 — 对当前wiki拍摄快照,不执行重建
    • 存档+重建 — 拍摄快照后,从头重新处理所有数据源
    • 恢复 — 还原至之前的某个存档版本

The Archive System

存档系统

Archives live at
$OBSIDIAN_VAULT_PATH/_archives/
. Each archive is a timestamped directory containing a full copy of the wiki state at that point.
$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/
└── ...
存档存放在
$OBSIDIAN_VAULT_PATH/_archives/
路径下。每个存档都是一个带时间戳的目录,包含对应时间点wiki状态的完整副本。
$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:

步骤:

  1. Create archive directory:
    _archives/YYYY-MM-DDTHH-MM-SSZ/
  2. Copy all category directories,
    index.md
    ,
    log.md
    ,
    .manifest.json
    , and
    projects/
    into the archive
  3. Write
    archive-meta.json
    with reason
    "snapshot"
  4. Append to
    log.md
    :
    - [TIMESTAMP] ARCHIVE reason="snapshot" pages=87 destination="_archives/2026-04-06T10-30-00Z"
  5. Report: "Archived 87 pages. Current wiki is untouched."
  1. 创建存档目录:
    _archives/YYYY-MM-DDTHH-MM-SSZ/
  2. 将所有分类目录、
    index.md
    log.md
    .manifest.json
    以及
    projects/
    复制到存档中
  3. 写入
    archive-meta.json
    ,原因字段设为
    "snapshot"
  4. 追加内容到
    log.md
    - [TIMESTAMP] ARCHIVE reason="snapshot" pages=87 destination="_archives/2026-04-06T10-30-00Z"
  5. 报告提示:"已存档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 (
concepts/
,
entities/
,
skills/
, etc.) and the
projects/
directory. Keep:
  • _archives/
    (obviously)
  • .obsidian/
    (Obsidian config)
  • .env
    (if present in vault)
Reset
index.md
to the empty template. Reset
log.md
with just the rebuild entry. Delete
.manifest.json
(it'll be recreated during ingest).
移除所有分类目录(
concepts/
entities/
skills/
等)和
projects/
目录下的所有内容,保留以下文件/目录:
  • _archives/
    (显然需要保留)
  • .obsidian/
    (Obsidian配置目录)
  • .env
    (如果vault中存在的话)
index.md
重置为空模板,重置
log.md
仅保留重建记录,删除
.manifest.json
(后续数据摄入时会重新生成)。

Step 3: Rebuild

步骤3:重建

Tell the user the vault is cleared and ready for a full re-ingest. They can now run:
  1. wiki-status
    — to see all sources as "new"
  2. claude-history-ingest
    — to reprocess Claude history
  3. codex-history-ingest
    — to reprocess Codex session history
  4. wiki-ingest
    — to reprocess documents
  5. data-ingest
    — to reprocess any other data
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已清空,可执行全量重新摄入,用户可以运行以下命令:
  1. wiki-status
    — 查看所有标记为"new"的数据源
  2. claude-history-ingest
    — 重新处理Claude历史记录
  3. codex-history-ingest
    — 重新处理Codex会话历史
  4. wiki-ingest
    — 重新处理文档
  5. 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=87

Mode 3: Restore from Archive

模式3:从存档恢复

When the user wants to go back to a previous state.
当用户想要回退到之前的状态时使用。

Step 1: List available archives

步骤1:列出可用存档

Read
_archives/
directory. For each archive, read
archive-meta.json
and present:
markdown
undefined
读取
_archives/
目录,对每个存档读取
archive-meta.json
并展示如下内容:
markdown
undefined

Available Archives

可用存档

DateReasonPagesSources
2026-04-06 10:30rebuild8742
2026-03-15 08:00snapshot6531
undefined
日期原因页面数数据源数
2026-04-06 10:30rebuild8742
2026-03-15 08:00snapshot6531
undefined

Step 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:
"pre-restore"
) so nothing is lost.
执行恢复前,先存档当前状态(原因设为
"pre-restore"
),避免内容丢失。

Step 4: Restore

步骤4:执行恢复

  1. Clear the live wiki (same as Mode 2, Step 2)
  2. Copy all content from the chosen archive back into the live wiki directories
  3. Restore
    index.md
    ,
    log.md
    , and
    .manifest.json
    from the archive
  4. Append to
    log.md
    :
    - [TIMESTAMP] RESTORE from="_archives/2026-03-15T08-00-00Z" pages_restored=65
  1. 清空运行中的wiki内容(和模式2步骤2操作一致)
  2. 将选中存档的所有内容复制回运行中的wiki目录
  3. 从存档中恢复
    index.md
    log.md
    .manifest.json
  4. 追加内容到
    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
wiki-lint
to check for any issues with the restored state.
告知用户恢复的内容,建议运行
wiki-lint
检查恢复后的状态是否存在问题。

Safety Rules

安全规则

  1. Always archive before destructive operations. No exceptions.
  2. Always confirm with the user before clearing the live wiki.
  3. Never delete archives unless the user explicitly asks. Archives are cheap insurance.
  4. The
    .obsidian/
    directory is sacred.
    Never touch it during archive/rebuild/restore — it contains the user's Obsidian settings, plugins, and themes.
  5. If something goes wrong mid-rebuild, the archive is there. Tell the user they can restore.
  1. 破坏性操作前必须先存档。 无例外。
  2. 清空运行中的wiki前必须征得用户确认
  3. 不得删除存档 除非用户明确要求,存档是低成本的内容保障手段。
  4. .obsidian/
    目录是不可修改的。
    存档/重建/恢复过程中绝对不要改动该目录,它包含用户的Obsidian设置、插件和主题配置。
  5. 如果重建过程中出现问题,可以使用存档回退,告知用户可以执行恢复操作。