Skip to content
Built 26/04/15 21:42commit 9419fc3

Automation

中文 | English

对周期性的 Codex 维护任务,使用 macOS launchd

Config

全局配置位于 ~/.llm-wiki/config.json

建议的多任务调度块:

json
{
  "scheduler": {
    "enabled": true,
    "codex_path": "/absolute/path/to/codex",
    "log_dir": "/Users/name/Library/Logs/llm-wiki",
    "max_runtime_minutes": 20
  },
  "schedulers": {
    "content_patrol": {
      "interval_minutes": 30,
      "label": "com.bytedance.llmwiki.maintenance.content",
      "prompt": "$llm-wiki 对这个 vault 做一次内容巡检。"
    },
    "taxonomy_patrol": {
      "interval_minutes": 1440,
      "label": "com.bytedance.llmwiki.maintenance.taxonomy",
      "max_runtime_minutes": 45,
      "prompt": "$llm-wiki 对这个 vault 做一次目录结构巡检。"
    }
  }
}

Scripts

  • scripts/run_scheduled_maintenance.py 运行一次非交互的 Codex 维护 pass
  • scripts/manage_launch_agent.py 用于安装、卸载、查看状态,或立即运行一个或多个命名维护任务
  • scripts/move_raw_sources.py 在重写受影响仓库链接的同时安全地重组 raw/
  • scripts/extract_visual_sources.py 在 ingest 前从截图和 raw 中的本地图像提取 OCR 文本

Notes

  • interval_minutes 映射到 launchd 的 StartInterval
  • 变更与调度相关的配置后,需要重新安装 launch agents
  • 日志文件写在仓库外,避免污染 git history
  • 在 named-task 模式下,每个任务都应有各自的 lock file 和 state file 默认值,这样内容巡检和目录巡检就不会彼此阻塞
  • 调度运行应持久化结构化 state 文件,使状态检查可以报告 runningcompletedtimed_outfailedskipped
  • 如果某个任务的一次运行超时或失败,该任务下一次运行应收到该次部分总结作为 continuation context
  • 调度运行应使用简短 prompt 加结构化 stdin 上下文,让 Codex 从仓库事实出发,而不是从冗长自然语言说明出发
  • 除非用户明确想要激进的自动重组,否则 taxonomy refactor 应该比内容巡检跑得更慢