4x-autopilot

4x-autopilot is a skill for Claude Code, Codex from ggwhite/4x. It costs 106 tokens per session (5,200 once invoked), scanned C, original, MIT.

An owner-only automation mode for the 4x feature pipeline, which manages tracked development tasks from selection through completion and merging. It runs one feature at a time and reads project settings to determine the repositories and workflow.

In plain words
What is it for?
Use it to pick pending features, run them, mark them done, create and merge merge requests when configured, synchronize repositories, clean up, and continue with the next feature.
Why use it?
It removes repeated manual steps from a feature’s lifecycle. Once started, it continues through available work without pausing for routine confirmation, unless there is no runnable feature or the user stops it.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents.

Good fit Use it to pick pending features, run them, mark them done, create and merge merge requests when configured, synchronize repositories, clean up, and continue with the next feature.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ggwhite/4x/4x-autopilot
Install

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.

Any agent
npx skills add ggwhite/4x --skill 4x-autopilot
Clone the repo
git clone --depth 1 https://github.com/ggwhite/4x

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for 4x-autopilot

README.md
[![agentmods](https://agentmods.dev/badge/skills/ggwhite/4x/4x-autopilot/github.svg)](https://agentmods.dev/skills/ggwhite/4x/4x-autopilot)
Your own site
<a href="https://agentmods.dev/skills/ggwhite/4x/4x-autopilot"><img src="https://agentmods.dev/badge/skills/ggwhite/4x/4x-autopilot/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for 4x-autopilot

Your own site · 80×15
<a href="https://agentmods.dev/skills/ggwhite/4x/4x-autopilot"><img src="https://agentmods.dev/badge/skills/ggwhite/4x/4x-autopilot.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 106 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,200 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00106 $0.05200
Opus 5.5 $0.00042 $0.02080
Sonnet 5.5 $0.00021 $0.01040
Haiku 4.5 $0.00011 $0.00520

Measured 1mo ago against content hash 519e80854f5a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 1mo 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>/`
skills/4x-autopilot/SKILL.md · 416 lines

How it starts

The opening of the file, as written. The whole thing — 416 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 流程
POST_CLEANUP = settings.worktree?.post_cleanup || []     # 清 worktree 後要跑的專案清理指令

POST_CLEANUP 每個元素是一行 shell 指令,字串中的 {feature-id} 會被替換成當前 feature ID。 用途是清掉 worktree 以外的 feature 環境資源(Docker 容器/image/volume、測試資料庫、暫存目錄等)—— 這些東西 git worktree remove 不會碰,沒清就會逐輪累積。沒設定就跳過。

取得 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

Read the full file on GitHub · 416 lines

Changes

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.

  1. 1mo ago Changed · +29 lines 519e80854f5a
  2. 1mo ago First seen · 387 lines · 106 tokens per session scan C ea6fa9b837d7

Subscribe to this mod's changes

4x-autopilot is a skill published in the GitHub repository ggwhite/4x (34 stars, last pushed 1mo ago), licensed MIT. It adds 106 tokens to every session and 5,200 once invoked, about $0.0004 per session on Opus 5.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.