Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add ggwhite/4x --skill 4x-autopilotgit clone --depth 1 https://github.com/ggwhite/4xWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/ggwhite/4x/4x-autopilot)<a href="https://agentmods.dev/skills/ggwhite/4x/4x-autopilot"><img src="https://agentmods.dev/badge/skills/ggwhite/4x/4x-autopilot.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00106 | $0.04679 |
| Opus 5 | $0.00053 | $0.02339 |
| Sonnet 5 | $0.00021 | $0.00936 |
| Haiku 4.5 | $0.00011 | $0.00468 |
Grade C, and why
4x-autopilot scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
2. `rm -rf .worktrees/4x/<feature>/` How it starts
The opening of the file, as written. The whole thing — 387 lines — stays where its author put it; the contents beside it link to each section on GitHub.
4x Autopilot
WARNING:owner-only,非 owner 請勿安裝或執行。(全自動行為定義見下方「核心原則」)
搭配 /loop 持續輪詢 4x 狀態,驅動 feature 完整生命週期。
核心原則
- 無狀態:每次 wakeup 從 4x 側重新讀狀態,session 斷線重連即接上
- 序列執行:一次只跑一個 feature,完成後才 pick 下一個
- 全自動:不停頓等確認,包括 merge MR
- 專案無關:所有專案特定值(repo 清單、GitLab 路徑)從
.4x/settings.json動態讀取 - 永不停機:除非「沒有 not-started feature 可跑」或「使用者主動說暫停/停止」,否則不可停下來。完成一個 feature 後必須立即 IDLE-PICK 下一個,不可印 session 摘要、不可問「要繼續嗎?」、不可等確認。這是最高優先規則,違反等同 bug。
前置:讀取專案設定
每次 wakeup 開始時,先讀 .4x/settings.json 取得:
REPOS = Object.keys(settings.workspace.repos) # 所有 repo 名稱(動態,不硬寫)
HUB_REPOS = settings.hub_repos || [] # hub repo(同步時包含,scope 檢查時排除)
USE_GITLAB = settings.issue_tracker?.enabled == true # 是否啟用 GitLab MR 流程
取得 GitLab group(僅 USE_GITLAB 時需要):
# 從第一個 repo 的 git remote 推導
GITLAB_GROUP=$(git -C <first-repo> remote get-url origin | sed -E 's|.*[:/](.+)/[^/]+\.git$|\1|')
# 例如 [email protected]:server/kairos/kairos-core.git → server/kairos
參數
- 無參數:自動從
4x status --json --pending按 priority + id 選下一個 - 帶 feature-id:優先跑指定 feature
每次 Wakeup 決策樹
每次被 /loop 喚醒時,依序檢查:
1. 讀取狀態
4x status --json --pending
解析 JSON,對每個 feature 取 id, name, status, priority, active 和對應的 state.phase。
2. 判斷當前階段
按以下優先順序判斷,命中第一個就執行,不繼續往下:
| 優先 | 條件 | 動作 | 下次 wakeup |
|---|---|---|---|
| 1 | 有 feature active: true |
→ 執行 RUNNING | 270s |
| 2 | 有 feature phase: pending-review |
→ 執行 FINISHING | 不排(連續執行) |
| 3 | 有 feature phase: needs-attention 或 blocked,且累計失敗 < 2 |
→ 執行 AUTO-FIX | 270s |
| 4 | 有 feature phase: needs-attention 或 blocked,且累計失敗 ≥ 2 |
→ log 跳過該 feature | 立即回到判斷 |
| 5 | 有 status: not-started 的 feature |
→ 執行 IDLE-PICK | 270s |
| 6 | 都沒有 | → log 全部完成 | 1800s |
IDLE-PICK:前置同步 + 選擇 + 啟動
觸發條件:決策樹優先 5(有 not-started feature 可跑)。
Step A: 前置同步(每次 pick 前必做)
對 REPOS 中每個 repo 依序執行(跳過 path 不存在的):
# 跳過不存在的 repo 目錄
[ -d <repo> ] || continue
git -C <repo> fetch origin main
git -C <repo> merge --ff-only origin/main
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 387 lines · 106 tokens per session scan C ea6fa9b837d7
4x-autopilot is a skill published in the GitHub repository ggwhite/4x (33 stars, last pushed 14d ago), licensed MIT. It adds 106 tokens to every session and 4,679 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
commit-pr
Mandatory Codex/Copilot publication adapter for opencode-swarm. Use for every GitHub issue assignment that results in code changes, commits, pushes, draft PRs, PR body edits, PR readying, release notes, or CI closeout. Must be loaded before git push, gh pr create, gh pr edit, or gh pr ready. Routes to the single…
contributing
Codex adapter for the opencode-swarm contribution checklist. Use when preparing user-visible changes, release note fragments, local validation, branch hygiene, PR checklist items, or contribution-policy compliance before publishing work.
git-ship
An automated Git release workflow that takes code changes through a branch, commit, pull request, review checks, squash merge, and return to the main branch. A pull request is a request to review and merge changes into a shared branch.
mk:ship
Ship workflow with explicit scopes: prepare stages and commits locally; release pushes and creates a PR; publish manages issues and versioning. Use when asked to "ship", "deploy", "push to main", "create a PR", or "merge and push". Proactively suggest when the user says code is ready or asks about deploying. Supports…
ship
Use when changes are ready to ship — takes the working tree to a pull request with code review, Conventional Commit, automatic SemVer bump and a PR template. Part of the cys flow (after cys:check).
e2e-delivery
End-to-end software house delivery. Use whenever the user asks to build a feature, fix a non-trivial bug, start a project, or run the full workflow. Orchestrates all roles and executes through Release unless blocked. Skip when WORKMODE is manual unless user/command forces E2E.