daily-update
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDaily 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
开始之前
- Read to get
~/.obsidian-wiki/configandOBSIDIAN_VAULT_PATH.OBSIDIAN_WIKI_REPO - Read .
$OBSIDIAN_VAULT_PATH/.manifest.json
- 读取 获取
~/.obsidian-wiki/config和OBSIDIAN_VAULT_PATH。OBSIDIAN_WIKI_REPO - 读取 。
$OBSIDIAN_VAULT_PATH/.manifest.json
Modes
模式
Run Mode (default — triggered by cron or /daily-update
)
/daily-update运行模式(默认——由cron或/daily-update
触发)
/daily-updateExecute the maintenance cycle:
Step 1: Source freshness check
Compare each source in against its file's modification time. Classify as:
.manifest.json- Fresh —
mtime ≤ ingested_at - Stale — (new content exists, not yet ingested)
mtime > ingested_at - Missing — source file no longer exists
Step 2: Index refresh
Read . If any pages in the vault are missing from the index (or vice versa), update the index. Use to enumerate vault pages, then reconcile against the index.
$OBSIDIAN_VAULT_PATH/index.mdfind $OBSIDIAN_VAULT_PATH -name "*.md" -not -path "*/_*"Step 3: hot.md update
Read . If it's >48h old based on its 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.
hot.mdupdated:Step 4: Write state
bash
mkdir -p ~/.obsidian-wiki
date +%s > ~/.obsidian-wiki/.last_update
echo "<stale_count>" > ~/.obsidian-wiki/.pending_deltaStep 5: Spawn impl-validator
After the cycle, spawn as a subagent:
impl-validatorimpl-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|falseStep 7: Report to user
undefined执行维护流程:
步骤1:源文件新鲜度检查
将中的每个源文件与其修改时间对比,分类为:
.manifest.json- 新鲜 —
mtime ≤ ingested_at - 过时 — (存在未纳入的新内容)
mtime > ingested_at - 缺失 — 源文件已不存在
步骤2:索引刷新
读取。如果Vault中有页面未被索引(或反之),则更新索引。使用枚举Vault页面,然后与索引进行协调。
$OBSIDIAN_VAULT_PATH/index.mdfind $OBSIDIAN_VAULT_PATH -name "*.md" -not -path "*/_*"步骤3:hot.md更新
读取。根据其前置元数据,如果它已超过48小时,则重新生成:读取最近修改的10个Wiki页面,并撰写一份约500字的语义快照,概述Wiki涵盖的内容。这样无需完整遍历Vault即可为下一次会话保留上下文。
hot.mdupdated:步骤4:写入状态
bash
mkdir -p ~/.obsidian-wiki
date +%s > ~/.obsidian-wiki/.last_update
echo "<stale_count>" > ~/.obsidian-wiki/.pending_delta步骤5:启动impl-validator
流程结束后,启动作为子代理:
impl-validatorimpl-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:向用户汇报
undefinedDaily 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
undefinedSetup 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 exists and is executable. If not, point the user to it.
$OBSIDIAN_WIKI_REPO/scripts/daily-update.shStep 2: Install launchd plist
bash
undefined引导用户完成首次设置:
步骤1:验证脚本存在
检查是否存在且可执行。如果不存在,引导用户找到该脚本。
$OBSIDIAN_WIKI_REPO/scripts/daily-update.sh步骤2:安装launchd plist
bash
undefinedReplace 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" \
"$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" \
"$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" >> ~/.zshrcStep 4: Run the script once
bash
bash "$OBSIDIAN_WIKI_REPO/scripts/daily-update.sh"This initializes so the terminal notification works immediately.
~/.obsidian-wiki/.last_updateStep 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 anytime to force a sync
/daily-update - 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