daily-update

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Daily Update — Wiki Maintenance Cycle

每日更新 — Wiki维护流程

You run a lightweight maintenance pass over the wiki: check source freshness, refresh the index, update hot.md, and write the state file that the terminal notification reads.
你需要对Wiki执行轻量级维护:检查源文件新鲜度、刷新索引、更新hot.md,并写入终端通知读取的状态文件。

Before You Start

开始之前

  1. Read
    ~/.obsidian-wiki/config
    to get
    OBSIDIAN_VAULT_PATH
    and
    OBSIDIAN_WIKI_REPO
    .
  2. Read
    $OBSIDIAN_VAULT_PATH/.manifest.json
    .
  1. 读取
    ~/.obsidian-wiki/config
    获取
    OBSIDIAN_VAULT_PATH
    OBSIDIAN_WIKI_REPO
  2. 读取
    $OBSIDIAN_VAULT_PATH/.manifest.json

Modes

模式

Run Mode (default — triggered by cron or
/daily-update
)

运行模式(默认——由cron或
/daily-update
触发)

Execute the maintenance cycle:
Step 1: Source freshness check
Compare each source in
.manifest.json
against its file's modification time. Classify as:
  • Fresh
    mtime ≤ ingested_at
  • Stale
    mtime > ingested_at
    (new content exists, not yet ingested)
  • Missing — source file no longer exists
Step 2: Index refresh
Read
$OBSIDIAN_VAULT_PATH/index.md
. If any pages in the vault are missing from the index (or vice versa), update the index. Use
find $OBSIDIAN_VAULT_PATH -name "*.md" -not -path "*/_*"
to enumerate vault pages, then reconcile against the index.
Step 3: hot.md update
Read
hot.md
. If it's >48h old based on its
updated:
frontmatter, regenerate it: read the 10 most recently modified wiki pages and write a fresh ~500-word semantic snapshot of what the wiki covers. This keeps the next session's context warm without a full vault crawl.
Step 4: Write state
bash
mkdir -p ~/.obsidian-wiki
date +%s > ~/.obsidian-wiki/.last_update
echo "<stale_count>" > ~/.obsidian-wiki/.pending_delta
Step 5: Spawn impl-validator
After the cycle, spawn
impl-validator
as a subagent:
impl-validator check:
  goal: "Daily wiki maintenance — index reconciled, hot.md refreshed, state file written"
  artifacts:
    - $OBSIDIAN_VAULT_PATH/index.md
    - $OBSIDIAN_VAULT_PATH/hot.md
    - ~/.obsidian-wiki/.last_update
    - ~/.obsidian-wiki/.pending_delta
  checks:
    - Does .last_update contain a recent Unix timestamp (within the last 60 seconds)?
    - Does .pending_delta contain a non-negative integer?
    - Does hot.md have an updated: frontmatter field set to today?
    - Does index.md list at least as many pages as exist in the vault?
Apply any FAILs before logging.
Step 6: Log
Append to
$OBSIDIAN_VAULT_PATH/log.md
:
- [TIMESTAMP] DAILY-UPDATE fresh=N stale=N missing=N index_added=N hot_refreshed=true|false
Step 7: Report to user
undefined
执行维护流程:
步骤1:源文件新鲜度检查
.manifest.json
中的每个源文件与其修改时间对比,分类为:
  • 新鲜
    mtime ≤ ingested_at
  • 过时
    mtime > ingested_at
    (存在未纳入的新内容)
  • 缺失 — 源文件已不存在
步骤2:索引刷新
读取
$OBSIDIAN_VAULT_PATH/index.md
。如果Vault中有页面未被索引(或反之),则更新索引。使用
find $OBSIDIAN_VAULT_PATH -name "*.md" -not -path "*/_*"
枚举Vault页面,然后与索引进行协调。
步骤3:hot.md更新
读取
hot.md
。根据其
updated:
前置元数据,如果它已超过48小时,则重新生成:读取最近修改的10个Wiki页面,并撰写一份约500字的语义快照,概述Wiki涵盖的内容。这样无需完整遍历Vault即可为下一次会话保留上下文。
步骤4:写入状态
bash
mkdir -p ~/.obsidian-wiki
date +%s > ~/.obsidian-wiki/.last_update
echo "<stale_count>" > ~/.obsidian-wiki/.pending_delta
步骤5:启动impl-validator
流程结束后,启动
impl-validator
作为子代理:
impl-validator check:
  goal: "Daily wiki maintenance — index reconciled, hot.md refreshed, state file written"
  artifacts:
    - $OBSIDIAN_VAULT_PATH/index.md
    - $OBSIDIAN_VAULT_PATH/hot.md
    - ~/.obsidian-wiki/.last_update
    - ~/.obsidian-wiki/.pending_delta
  checks:
    - Does .last_update contain a recent Unix timestamp (within the last 60 seconds)?
    - Does .pending_delta contain a non-negative integer?
    - Does hot.md have an updated: frontmatter field set to today?
    - Does index.md list at least as many pages as exist in the vault?
在记录日志前处理所有FAIL结果。
步骤6:记录日志
追加内容到
$OBSIDIAN_VAULT_PATH/log.md
- [TIMESTAMP] DAILY-UPDATE fresh=N stale=N missing=N index_added=N hot_refreshed=true|false
步骤7:向用户汇报
undefined

Daily Wiki Update

Daily Wiki Update

  • Sources: N fresh · N stale · N missing
  • Index: N pages (N added, N removed)
  • hot.md: refreshed / up to date
Stale sources (run to sync): /wiki-history-ingest claude — N sessions since last ingest /wiki-history-ingest codex — N sessions since last ingest
undefined
  • Sources: N fresh · N stale · N missing
  • Index: N pages (N added, N removed)
  • hot.md: refreshed / up to date
Stale sources (run to sync): /wiki-history-ingest claude — N sessions since last ingest /wiki-history-ingest codex — N sessions since last ingest
undefined

Setup Mode (triggered by "set up the daily cron" or "install terminal notification")

设置模式(由“设置每日cron”或“安装终端通知”触发)

Walk the user through first-time setup:
Step 1: Verify script exists
Check that
$OBSIDIAN_WIKI_REPO/scripts/daily-update.sh
exists and is executable. If not, point the user to it.
Step 2: Install launchd plist
bash
undefined
引导用户完成首次设置:
步骤1:验证脚本存在
检查
$OBSIDIAN_WIKI_REPO/scripts/daily-update.sh
是否存在且可执行。如果不存在,引导用户找到该脚本。
步骤2:安装launchd plist
bash
undefined

Replace placeholder in plist

Replace placeholder in plist

sed "s|OBSIDIAN_WIKI_REPO|$OBSIDIAN_WIKI_REPO|g"
"$OBSIDIAN_WIKI_REPO/scripts/com.obsidian-wiki.daily-update.plist" \
"$HOME/Library/LaunchAgents/com.obsidian-wiki.daily-update.plist"
sed "s|OBSIDIAN_WIKI_REPO|$OBSIDIAN_WIKI_REPO|g"
"$OBSIDIAN_WIKI_REPO/scripts/com.obsidian-wiki.daily-update.plist" \
"$HOME/Library/LaunchAgents/com.obsidian-wiki.daily-update.plist"

Load it

Load it

launchctl load "$HOME/Library/LaunchAgents/com.obsidian-wiki.daily-update.plist"

**Step 3: Install terminal notification**

Check if `~/.zshrc` already sources `wiki-notify.sh`. If not, append:

```bash
echo "" >> ~/.zshrc
echo "# obsidian-wiki terminal notification" >> ~/.zshrc
echo "source $OBSIDIAN_WIKI_REPO/scripts/wiki-notify.sh" >> ~/.zshrc
Step 4: Run the script once
bash
bash "$OBSIDIAN_WIKI_REPO/scripts/daily-update.sh"
This initializes
~/.obsidian-wiki/.last_update
so the terminal notification works immediately.
Step 5: Confirm
Tell the user:
  • The cron runs daily at 9 AM (or on next login if missed)
  • Terminal notifications appear when the wiki is >20 hours stale
  • They can run
    /daily-update
    anytime to force a sync
  • Logs go to
    /tmp/obsidian-wiki-daily.log
launchctl load "$HOME/Library/LaunchAgents/com.obsidian-wiki.daily-update.plist"

**步骤3:安装终端通知**

检查`~/.zshrc`是否已引入`wiki-notify.sh`。如果没有,追加以下内容:

```bash
echo "" >> ~/.zshrc
echo "# obsidian-wiki terminal notification" >> ~/.zshrc
echo "source $OBSIDIAN_WIKI_REPO/scripts/wiki-notify.sh" >> ~/.zshrc
步骤4:运行一次脚本
bash
bash "$OBSIDIAN_WIKI_REPO/scripts/daily-update.sh"
此操作将初始化
~/.obsidian-wiki/.last_update
,使终端通知立即生效。
步骤5:确认设置
告知用户:
  • cron每日上午9点运行(如果错过则在下次登录时运行)
  • 当Wiki超过20小时未更新时,终端会显示通知
  • 可随时运行
    /daily-update
    强制同步
  • 日志存储在
    /tmp/obsidian-wiki-daily.log