Community生產力與協作github.com

離線運行排程與管理

操作者離開後,由排程器輪流執行工作佇列中的項目。每個項目在全新且無頭的 Claude 進程中運行,並由 Windows 排程工作監控,最終產生早晨報告。

離線運行排程與管理 是什麼?

此技能「離線運行」允許操作者在離開電腦時,安排一個無人值守的工作佇列自動被執行。它會建立一個獨立的 Git worktree(分支名稱 `away/<日期>`),並透過 Windows 排程工作每 15 分鐘啟動一個「看門狗」腳本。看門狗腳本負責啟動一個全新的 `claude -p --agent away-orchestrator` 進程來處理佇列中的一個項目。這種設計確保任何單一項目的失敗(例如達到使用限制或崩潰)不會影響整個晚上的運作,只會損失一個迭代。佇列的狀態、決策和日誌都儲存在磁碟上,當進程退出時,會自動將工作項目歸還給佇列,讓下一個迭代可以重新嘗試。此技能支援 `project-workflow` 作為項目類型,可以協調多個步驟的專案工作,並透過檢入點(checkpoint)來銜接。操作者可以透過 `Arm`、`Status` 和 `Disarm` 三個指令來控制整個流程,最終會產出一份早晨報告供回顧。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ashley-seymour/claude-skills/tree/HEAD/away-run

Installed? Explore more 生產力與協作 skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

離線運行 (Away run)

操作者離開,佇列中的工作會依序被處理。每個項目在一個全新的無頭(headless)進程中執行,因此使用限制或崩潰只會損失一次迭代,而不是整個晚上的運作。狀態儲存在運行資料夾的磁碟上;進程退出時會取代 /clear 指令。用於標記 claude -p 事實的標誌,請參考 headless-claude 技能。

儲存庫配置與設定檔。 <repo>/.claude/project-workflow.json 是可選的;此技能會讀取其 projects_dir(預設為 my-projects)、profile(預設為 <projects_dir>/WORKFLOW.md)、backlog_file(預設為 <projects_dir>/backlog.md)和 bootstrap(一個 argv 列表,或 null)等鍵值。如果設定檔存在,請閱讀其 § 離線運行章節:測試指令、發現來源、自動允許的類別。當設定檔與此技能有衝突時,以設定檔為準。

階段 — 進入每個階段時載入一個檔案

階段執行者閱讀的檔案
武裝 (arm)操作者在場下方的 § 武裝,然後 discover.md 以建立佇列
迭代 (iteration)away-orchestrator,每個進程一個iteration.md
狀態 (status), 解除武裝 (disarm)操作者下方的 § 狀態, § 解除武裝

project-workflow 和 away-run 共用檔案(backlog 檔案,<projects_dir>/proposals/open/),但不共用呼叫,只有一個例外:一個 project 列會透過 Skill 工具以無人值守模式呼叫 /project-workflow。

一個專案工作波浪(project wave)橫跨數個 project 列,每個 wave.md 的 § Session shape 步驟組各一個(1;2-3;4-7)。每個列從 ## Resume 命名的步驟開始工作,直到其組別的結束,提交 chore(<NNNN>): checkpoint wave N at step <n>,並附加下一列的後續列,除非已達邊界。只有在完成至少一個步驟時,才會附加一個 attempts 為 0 的後續列;沒有完成任何步驟的列會保持 claimed 狀態,並在其自身的 attempts 計數下重試。這會終止:每個後續列至少會跟隨波浪的七個步驟之一,而嘗試次數上限會終結一個從未完成的步驟。檢入點和 ## Resume 是唯一的交接點(iteration.md § 3)。

佈局

<repo>-worktrees/away-<date>/            worktree,分支 away/<date> 基於 main
  <run folder>/                          在 away/<date> 上追蹤;arm.ps1 -RunFolder,
    queue.md decisions.md log.md         預設 <projects_dir>/away/<date>/
    morning-report.md                    由結尾迭代撰寫
<repo>-worktrees/away-<date>-run/        暫存區,未追蹤:away.env, watchdog.sh,
                                         entry-prompt.md, watchdog.log, iter-NNN.*, 鎖
排程工作 away-<repo>-<date>             每 15 分鐘直到硬性停止

佇列列 (Queue rows)

templates/queue.md 包含架構。欄位:id | item | agent | status | claimed_by | lease_until | attempts | evidence。agent 可以是 mechanical-worker、stream-worker、researcher、project 或 discover。每次佇列編輯都需取得鎖:mkdir <scratch>/queue.lock(原子操作;如果失敗,每 10 秒重試一次,最多 2 分鐘;最後修改時間超過 10 分鐘的鎖資料夾視為過期,無論是否包含其 owner 檔案:將其移除),編輯,然後 rm -rf 該鎖。2 分鐘重試後仍失敗的後續處理,請參考 iteration.md 的 § 2 和 § 4。一個聲明(claim)會將 claimed_by 設定為迭代的聲明標籤(iter-NNN,與入口提示給的完全一致)以及 lease_until;一個已過期的租約代表該迭代已死亡,該列可再次被聲明,attempts 加 1。

武裝 (Arm) — 操作者在場

  1. 佇列。 使用 discover.md 建立它:僅限 tier-1 列,每個都帶有命名的檢查。Tier-2 的工作會變成提案。為每個列可能遇到的每個決策命名預設值;一個有開放決策且無預設值的列不會被加入佇列。
  2. 姿態。 明確說明:此運行使用 --permission-mode bypassPermissions,因此每個工具呼叫都會在未提示的情況下執行;全域拒絕規則仍然適用。「無閘門」(開放的問題變成具名預設值,失敗則跳過並重試)是每個運行可選擇加入的,在佇列標頭中設定為 gates: none;絕不能從先前的運行推斷。
  3. 武裝。 先試執行,然後真正執行,從 PowerShell 執行: powershell -NoProfile -File <skill>/arm.ps1 -Repo <path> -StopAt "<YYYY-MM-DD HH:MM>" -Queue <queue.md> -WhatIf。 它會從 main 分支建立 away/<date> 的 worktree,從 templates/ 種子資料到運行資料夾,並連同佇列一起提交,執行配置中的 bootstrap argv({worktree} 會替換為 worktree 路徑,當前工作目錄為主要 checkout 目錄;若該鍵缺失或為 null 則跳過)並等待其完成,將 watchdog.sh 和 entry-prompt.md 複製到暫存區,寫入 away.env,並註冊排程工作(Register-ScheduledTask,絕不使用 schtasks /Create:PowerShell 5.1 會搞亂 /TR 的引號)。非零的 bootstrap 退出碼會在任何任務存在之前拒絕執行;worktree 和分支會保留以供檢查。該工作沒有主體(principal),因此僅在操作者登入時執行,並在一個控制台視窗中執行,關閉該視窗會終止它:請鎖定螢幕,不要登出。
  4. 檢查。 Get-ScheduledTask -TaskName 'away-*' 會顯示該工作;第一次觸發會將 watchdog up 寫入 watchdog.log。
  5. 後續佇列編輯。 arm.ps1 只提交佇列一次。在武裝後對佇列進行的任何編輯,請自行提交到 away/<date> 分支上(在排程工作已觸發後,需在佇列鎖定下進行):迭代會將它們未建立的未提交變更視為他人的工作,絕不會暫存它們。

看門狗的功能 (watchdog.sh)

  • 啟動 claude -p --agent away-orchestrator --max-turns N,提示訊息從標準輸入提供。模型和努力程度來自 agent 的前言(frontmatter);不使用 --effort、沒有 TTL 標誌、沒有 --disable-slash-commands(它會停用 Skill)。
  • 根據 is_error/api_error_status 以及 queue.md 是否改變來判斷一次迭代的成敗,絕不根據 num_turns。連續三次沒有佇列變化的迭代會結束運行。
  • 使用限制:睡眠直到重置訊息狀態。「您已達到 Opus 限制」會繼續使用 Sonnet(--model sonnet),但僅限於 mechanical-worker 列;如果沒有可聲明的此類列,則睡眠直到重置。
  • 預算超支(subtype error_max_budget_usd,kind budget):不睡眠,因為上限是按進程計算的。它會保留該列的聲明,因此下一個迭代會處理下一列,而此列會在其租約到期時返回;超支次數會像錯誤一樣計入 FAIL_MAX。
  • 配額保留:在滾動的 5 小時內,若推算花費達到 WINDOW_CAP_USD,則會睡眠直到視窗釋放;最後的 RESERVE_MIN 分鐘留給結尾工作。
  • 佇列為空:一次結尾迭代會撰寫早晨報告,然後退出。任何其他退出都會留下由看門狗撰寫的簡短報告。每次退出都會寫入 STOP,因此後續的排程工作觸發都將是無操作;刪除它即可恢復。
  • 在每個項目迭代之後,它會釋放該迭代的聲明標籤下所持有的租約,以便被限制或錯誤中斷的列可以被重試,而不是一直被擱置到結尾。它會在結尾迭代(不聲明任何東西)和預算超支(見上文)之後跳過此步驟。
  • 在每次迭代開始時記錄 claude: <path>:這是它將要執行的二進位檔案路徑。
  • 拒絕在 main 分支、main 的 checkout 目錄或非 away/* 的分支上執行。
  • 試執行:CLAUDE=<stub script> AWAY_NO_SLEEP=1 bash watchdog.sh <away.env> 在 away/* 上的暫存 worktree 中執行;睡眠會被記錄,但不會實際發生。環境中設定的 CLAUDE 或 PY 會覆蓋 away.env 中指定的,因此即使有 arm 寫入的 away.env,存根腳本仍然會執行;請透過 claude: <stub> 日誌行來確認。

狀態 (Status)

監控 <scratch>/watchdog.log 的結尾;讀取 queue.md。在相信「另一個看門狗正在運行」之前,請確認有一個 claude.exe 進程(tasklist)和一個近期的 iteration N starting 行:一個孤立的鎖會使每次觸發都靜默地停留在佇列上。Git Bash 沒有 pgrep 指令。

解除武裝 (Disarm)

powershell -NoProfile -File <skill>/disarm.ps1 -Repo <path> -Date <date>:它會寫入 STOP,取消註冊排程工作,並檢查 Get-ScheduledTask -TaskName 'away-*' 回傳空值。仍保持註冊的工作會每隔 15 分鐘持續產生 bash 進程。worktree 和分支會保留以供審查:閱讀早晨報告,然後透過儲存庫的常規方式合併 away/<date>,或將其刪除。

為何這樣建構

  • 韌性存在於 CLI 之外。CronCreate durable:true 回歸為僅限工作階段(2026-09-19);/loop 會重新進入同一個工作階段;從 Bash 工具呼叫發起的 nohup … & 會以該 shell 為父進程;Git Bash 沒有 setsid。
  • 使用限制會透過睡眠直到重置訊息狀態來處理,而不是透過遞增的退避;迭代也絕不會因為 num_turns 低而被判定為失敗:退避會超過重置時間,而迭代可能在一個回報的回合內完成一個列的工作。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

ashley-seymour/claude-skills

Read this skill before the first step that uses the built-in browser, the browser pane inside the Claude desktop app (also called the in-app browser, the browser pane, Claude's browser, or \"your own browser\"), whose tools are named mcp__Claude_Browser__* when the session runs in the desktop app and mcp__remote-devices__Claude_Browser__* when a cloud session is linked to the person's computer; before those tools are turned on there may be a single enable__mcp__remote-devices__Claude_Browser tool instead. It covers the pane's persistent sign-ins, tabs and preview_start, reading pages as text, site approvals, what the pane cannot open, and what to do when it cannot be reached. It is not for Claude in Chrome (mcp__claude-in-chrome__* tools), which has its own skill, and it does not decide which browser to use.

ashley-seymour/claude-skills

Use this skill when the user's prompt requires (1) researching a topic across multiple sources, comparing options or alternatives, analyzing trends or history, understanding markets or industries, or reviewing literature or studies and (2) synthesizing that research into a comprehensive, narrative report. If you're planning to search the web or internal knowledge bases, consider using this skill. This skill coordinates research subagents, so use it only when you have a tool for spawning subagents (the Agent or Task tool); otherwise, research the question directly.

ashley-seymour/claude-skills

Read this skill before the first step that uses Claude in Chrome, the browser extension whose tools are named mcp__claude-in-chrome__* (also called Chrome, the browser extension, or the external browser) and which acts in the person's real Chrome with their own sign-ins; before those tools are turned on there may be a single enable__mcp__claude-in-chrome tool instead. It covers loading the tools in one ToolSearch call, checking the person's open tabs and working in a new tab, site permissions, GIF recordings, console logs, dialogs to avoid, and when to stop and ask. It is not for the built-in browser (mcp__Claude_Browser__* or mcp__remote-devices__Claude_Browser__* tools), which has its own skill, and it does not decide which browser to use.

ashley-seymour/claude-skills

Read this skill before the first step of any request to do something in an app on the person's own computer (Notes, Finder, System Settings, any desktop app), to look at their screen, or for \"computer use\". Computer use (desktop control) lets Claude take screenshots of the person's desktop and control it with clicks, typing and scrolling through the Claude desktop app; its tools are named mcp__computer-use__* when the session runs in the desktop app and mcp__remote-devices__computer_* when a cloud session is linked to the person's computer; before computer use is turned on for a conversation there may be no such tools, only an enable__mcp__remote-devices__computer tool, which turns it on. It covers turning it on, picking the right tool, the access flow, and the safety rules for tiered apps, links and financial actions. It is not for websites, which go through Claude in Chrome or the built-in browser and their own skills.

相關技能