tinyorbit-ai/skills/tree/main/mods/forge-gate
forge-gate
forge フェーズゲートを強制する Claude Code mod。手元にあるファイルだけで現在フェーズの Verifiable gate が green かを示し、そうでなければ gate green と主張する forge ステージを差し戻します。/gate で実行します。
この mod について
forge-gate
Claude Code 内で forge フェーズゲートを強制します。
Phase 3 繚 Billing API ??gate green 4m ago + written checks [ Run gate ]
Phase 3 繚 Billing API ??changed since the last run [ Run gate ]
Phase 3 繚 Billing API ??gate red: bun run gate:phase-03 [ Run gate ]
Phase 5 繚 App icon ??written checks, not checked [ Checked ]
- どのフェーズか: 現在の git ブランチを wiki/plan.md の Branch: 行と照合します。フェーズブランチ以外では mod は何もしません。/gate 3 はフェーズを固定し、/gate auto は解除します。
- どのコマンドか: ゲートのバッククォート部分で、最初の語が実行可能ファイルであるものを対象にします。デプロイ、リリース、インストール、送信、rm 型のコマンドや <placeholders> を含む部分は実行しません。
- green: すべてのゲートコマンドが、現在手元にあるファイルで成功した状態です。実行前に取得した git tree id で内容を比較するため、コミットでは古くなりませんが、編集すると古くなります。forge が実行後にビルドログと学習記録を書くため wiki/ は除外します。成功はセッション間で記憶されます。
- 証拠:
- Claude Bash の実行は、ゲートコマンドがコマンド全体の一部で、リポジトリルートのフォアグラウンドで完了した場合だけ数えます。前に置けるのは && または ;、後ろに置けるのは && だけです。true || bun test、echo bun test、cd sub && bun test、bun test | tail、バックグラウンドに移した実行は対象外です。
- bun run gate && tsc --noEmit のようなチェーンでは、含まれる各ゲートコマンドを数えます。チェーンが失敗した場合は最後のコマンドだけ失敗扱いです。
- サブ agent の実行は、シェルのディレクトリが不明なため、前に明示的な cd <repo root> && がある場合だけ数えます。
- 実行はブランチに関係なくリポジトリとコマンドごとに保存されます。git switch -c phase/3-?圳 の直後に行った実行も対象です。
- /gate(または Run gate)も対象です。コマンドを一覧表示し、実行前に確認します。
- forge stage の守衛: 各 forge stage は結果行 FORGE_RESULT {"skill":"...","phase":3,"gate":"green",...} で終わります。gate green の行は現在のファイルで実際に実行された内容と照合されます。真でなければ、不足内容とともに一度だけ差し戻し、ゲートを実行するか gate を red または deferred に変更するよう求めます。フェーズは行が示すものなので、forge-ship の行も main に到着した後に検査されます。メインセッションとサブ agent の両方で動き、正直な red、deferred、blocked は常に通過します。
- その他の場所の守衛: 結果行がなければフレーズを監視します。Claude がフェーズ完了、レビュー可能、ship 可能、またはゲート通過と言い、実際には green でない場合は一度だけ差し戻します。質問で止まったターンは差し戻しません。
- 記述チェック: コマンドで証明できない文章のチェックを各レポートに表示します。コマンドがないゲートは Checked を押すまで待ちます。
- Run gate: バンドのボタンまたは /gate は、現在のファイルでフェーズのゲートコマンドを実行し、結果を表示します。Claude に尋ねず、done を信じる前に確認できます。通常は押す必要はなく、Claude の実行が自動更新します。
コマンド:/gate は確認後に実行、/gate status は実行せず報告、/gate <n> は別ブランチからフェーズ n を固定、/gate auto は解除します。
forge ループとの関係
forge-plan は各フェーズの Verifiable gate: を書き、mod は読むだけです。forge-build は引き渡し前にゲートを一度実行し、その結果行とレビューへの引き渡し主張を検査します。forge-review は実行時検証と修正ループで再実行します。forge-ship は先に rebase してファイルを変えるため古い成功が無効になり、規則どおり再実行してから着地します。crack-on と Arnold workers は無人で動き、守衛が各 green を確認します。
通常のループでは skills の動作を確認します。価値は可視状態、スキップや古い実行の検出、セッションをまたいだ成功の記憶です。
制限:終了コードだけを確認し、引用された期待出力は検査しません。手動チェックだけのゲートは検証できません。.gitignore 外に書き込むゲートは tree を変えるため green にならず、出力を無視してください。独自 worktree のサブ agent はこのリポジトリのルートへ cd しない限り追跡されません。バンドはブランチに従い、別ブランチでは /gate <n> で固定します。
guardDoneClaims をオフにすると結果行とフレーズの両方の守衛を無効にできます。バンドと /gate は動作します。
インストールは ../README.md を参照してください。
インストール
まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。
claude plugin marketplace add tinyorbit-ai/skills claude plugin install forge-gate
原文 / README
forge-gate
The forge phase gate, enforced inside Claude Code.
Phase 3 · Billing API ✓ gate green 4m ago + written checks [ Run gate ]
Phase 3 · Billing API ◐ changed since the last run [ Run gate ]
Phase 3 · Billing API ✗ gate red: bun run gate:phase-03 [ Run gate ]
Phase 5 · App icon ◐ written checks, not checked [ Checked ]
- Which phase: your current git branch, matched against the
**Branch:**lines inwiki/plan.md. Off a phase branch the mod does nothing./gate 3pins a phase and/gate autounpins it. - Which commands: the gate's backticked spans whose first word is a real
executable. Deploy, release, install, send and rm-style commands are never run, and
nor are spans with
<placeholders>. - Green: every gate command passed on exactly the files you have now. It
compares file contents (a git tree id, taken before the command ran), so committing
doesn't make a pass stale, but any edit does.
wiki/is left out, because forge writes its build log and learnings after the gate runs. A pass is remembered across sessions. - Evidence:
- A Claude Bash run counts when the gate command is a whole piece of the command,
run in the repo root, finished in the foreground. Only
&∨may come before it, and only&&after it. Sotrue || bun test,echo bun test,cd sub && bun test,bun test | tailand a run moved to the background don't count. - A chain like
bun run gate && tsc --noEmitcounts every gate command in it. If the chain fails, only its last command is marked failed. - A subagent's run counts only with an explicit
cd <repo root> &&in front, since its shell directory isn't known. - Runs are kept per repo and command, whichever branch is out. So a run made right
after
git switch -c phase/3-…counts. /gate(or Run gate) also counts. It lists the commands and asks before it runs anything.
- A Claude Bash run counts when the gate command is a whole piece of the command,
run in the repo root, finished in the foreground. Only
- The guard, for forge stages: every forge stage ends with a result line,
FORGE_RESULT {"skill":…,"phase":3,"gate":"green",…}. When that line says"gate":"green", it's checked against what actually ran on the current files. If it isn't true, the stage is sent back once with what's missing, told to run the gate or to change"gate"to"red"or"deferred". The phase is the one the line names, so forge-ship's line is still checked after it lands on main. It works in the main session and in subagents. An honestred,deferredorblockedline always passes. - The guard, everywhere else: with no result line, it watches for phrases. When Claude says the phase is done, ready for review or ship, or that the gate passes, while it isn't green, it's sent back once. A turn that stops to ask a question is never sent back.
- Written checks: prose the commands can't prove is shown with every report. A gate with no commands at all waits for you to press Checked.
- Run gate (the band's button, or
/gate) runs the phase's gate commands now, on the files as they are, and shows the result in the band. It's your own way to check without asking Claude, e.g. before trusting a "done". Most of the time you never press it: Claude's runs update the band by themselves.
Commands: /gate runs the gate (it asks first), /gate status reports without
running, /gate <n> pins phase n when you're off its branch, /gate auto unpins.
How it fits the forge loop
- forge-plan writes each phase's
**Verifiable gate:**. The mod only reads it. - forge-build must run the gate once before handing off. Its result line and its "handing to review" claim are checked.
- forge-review reruns the gate during runtime verification and its fix loop. Each run updates the band.
- forge-ship rebases first, which changes the files, so the old pass goes stale. Ship reruns the gate as its own rules require, then lands. Its result line is checked by phase number after the merge.
- crack-on and Arnold workers run unattended. The guard is what checks each "green" there.
Inside the normal loop the mod mostly confirms what the skills already do. Its value is the visible state, catching a skipped or stale run, and remembering a pass across sessions.
Limits:
- Exit codes only, so a gate's quoted expected output isn't checked.
- Gates with only manual checks can't be verified.
- A gate that writes files outside
.gitignorechanges the tree it ran on, so it never reads green. Ignore its outputs. - A subagent in its own worktree isn't tracked unless it
cds to this repo's root. - The band follows the branch. Off a phase branch,
/gate <n>pins a phase.
Turn the guardDoneClaims setting off to disable both guards (result lines and
phrases). The band and /gate keep working.
Install: see ../README.md.
