review 運用

review-orchestratormulti-review / adversarial-review の Go orchestration と、babysit-reviews の Copilot 完了判定に使う CLI。

review 系 skill の shell script は互換用 shim として維持し、引数検証、lock、成果物生成、per-agent timeout、prompt / argv 生成、agent runner は Go 側で扱う。

Issue 作成から PR 作成後の確認までの skill の使い分けと主要引数は Issue workflow skill guide を参照する。

review-orchestrator

review-orchestrator は multi-review / adversarial-review の実行本体であり、次の責務を持つ。

Claude Code runtime で simplify-reviewer subagent を使う場合、外側 Agent は prompt と出力を work-dir に保存し、 review-orchestrator multi-review ingest-artifact で取り込む。Go 側が JSONL finding、NO FINDINGS、 parse failure を event log / gate / report に反映するため、skill 本体では件数照合や JSONL parse を行わない。 simplify=auto の broad simplify source は claude-simplify / codex-simplify / copilot-simplify を使う。 simplify=full の観点別 source は claude-simplify-code-reuse / claude-simplify-quality / claude-simplify-efficiency のように runtime と観点を含める。どちらも ingest と report で受け入れる。

parent-assisted Codex reviewer transport

親 Codex session が subagent を起動し、Go 側は artifact だけを受け取る境界として扱う。 transport ID は parent-assisted-codex-subagent とする。 review-orchestrator の subprocess は親 session の subagent tool surface を直接呼べないため、自然言語 summary を成功証跡にせず、 request artifact、response artifact、ingest-artifact の 3 点で状態を固定する。

request artifact は tmp/multi-review/<run>/ または tmp/review-once/<run>/ 配下に置く。 schema は codex-parent-assisted-reviewer-request.v1、transport は parent-assisted-codex-subagent とし、次の field を持つ。

field 必須 意味
schema_version yes codex-parent-assisted-reviewer-request.v1
transport yes parent-assisted-codex-subagent
request_id yes 親 session と Go artifact を対応させる ID
source yes codex-subagent-reviewcodex-subagent-adversarialcodex-subagent-simplify-quality など
work_dir yes multi-review / review-once の artifact directory
run_id yes 取り込み先 run
head_sha yes reviewer 対象 HEAD
prompt_path yes 親 session が subagent に渡す prompt
expected_output_path yes subagent raw output の保存先
expected_agent yes 親 session が起動すべき agent 種別。Codex parent-assisted reviewer では codex-subagent
deadline yes 親 session 側の応答期限
sandbox_expectation yes subagent に期待する sandbox / file mutation 境界
response_path yes 親 session が保存する response artifact の期待 path
result_path review-once のみ review-once result JSON の保存先
raw_output_path no expected_output_path の legacy alias。互換用に出力するが、新規 consumer は expected_output_path を優先する
response_artifact_path no response_path の legacy alias。互換用に出力するが、新規 consumer は response_path を優先する
ingest_command no request artifact 単体 consumer 向けの legacy ingest 手順。新規 multi-review consumer は review_job_completed.details.next_commands を優先する

request artifact に新旧 field が同時にある場合、新規 consumer は expected_output_path / response_path を authoritative として読む。 raw_output_path / response_artifact_path / ingest_command は v1 consumer の移行期間向けに残す optional field であり、 新規 flow の必須入力や source of truth にはしない。

response artifact は同じ run 配下に保存し、schema は codex-parent-assisted-reviewer-response.v1、transport は同じく parent-assisted-codex-subagent とする。schema_versiontransportrequest_idrun_idhead_shasourcerequest_artifact_pathstatusraw_output_pathprompt_patherrorcleanup_status を必須 field とする。 agent_id は親 session から安定して取得できる場合だけ入れる。

response status は次の値に限定する。

status 意味 次 action
completed subagent output を raw_output_path に保存できた ingest-artifact へ進む
unavailable 親 session に subagent tool surface がない success 扱いせず reviewer transport unavailable として停止する
timeout deadline までに subagent output が揃わない timeout として停止または再実行する
parse_failure 親 session が response / output contract を満たせない format failure として停止する
cleanup_failure subagent session / resource cleanup が失敗した cleanup failure として停止する

取り込み source は correctness が codex-subagent-review / codex-subagent-adversarial、simplify が codex-subagent-simplify-code-reuse / codex-subagent-simplify-quality / codex-subagent-simplify-efficiency。 response が completed の場合だけ、同じ source と raw_output_path を使って review-orchestrator multi-review ingest-artifact へ渡す。multi-review transport では次に実行すべき取り込み command は request artifact ではなく review_job_completed.details.next_commands に残す。unavailabletimeoutparse_failurecleanup_failure は Copilot bot や local reviewer success で代替せず、required action として扱う。 review_job_completed.detailsresponse_artifact_pathraw_output_path は既存 viewer / history 互換の legacy key であり、 新規 consumer は request artifact と同じ response_path / expected_output_path を優先する。legacy key は互換維持のため当面残す。

review-orchestrator multi-review run --codex-parent-assisted --agents codex は Codex CLI reviewer を起動せず、 request artifact と ingest_codex_parent_artifacts required action を生成する。既定の agents=codex は従来通り Codex CLI transport のままであり、parent-assisted は明示 opt-in として扱う。 parent-assisted では --simplify auto も broad legacy source ではなく codex-subagent-simplify-code-reuse / codex-subagent-simplify-quality / codex-subagent-simplify-efficiency の 3 request に展開し、report の coverage source もこの 3 source に合わせる。

初期 policy は opt-in のまま継続し、default にはしない。multi-review では review-orchestrator multi-review run --codex-parent-assisted、review-once では review-orchestrator review-once run --transport parent-assisted-codex-subagent を明示した場合だけ使う。 --codex-parent-assisted は multi-review の Codex reviewer を parent-assisted-codex-subagent transport にする opt-in として扱う。 実 Codex parent session で request artifact、response artifact、subagent raw output、 実行した ingest subcommand とその stdout JSON、review-once result artifact または multi-review evidence を残せた場合でも、通常の agents=codex default は codex-cli transport のまま維持する。parent-assisted を default 化する場合は、この proof と運用結果を根拠に別 Issue で扱う。

rate limit 近接検知による自動切替は non-goal とする。安定して機械判定できる limit error の exit code / stderr / JSON field が 実証されるまでは、codex-cli から parent-assisted への自動 fallback を実装しない。 limit error 後 fallback を導入する場合も、trigger と recovery evidence を固定する別 Issue で扱う。

parent-assisted proof は自然言語 summary だけで完了扱いにしない。完了報告や PR 前メモには少なくとも request artifact path、response artifact path、subagent raw output path、実行した ingest subcommand とその stdout JSON を残す。 review-once の場合は result artifact の statusnext_required_action、 multi-review の場合は gate / evidence manifest の収束結果も確認する。

通常運用と自動化の default は --simplify auto にする。auto は cost-aware default であり、選択 runtime から 1 runtime の broad simplify source を実行する。これを full coverage 必須として扱わない。 --simplify full は、公開前の高リスク変更、reviewer 間で判断が割れた変更、または明示的に観点別 coverage が必要な場合だけ使う。 --simplify off や runtime 不在で skip された場合は、report の Simplify coverage に残る coverage_mode=skippedskip_reason を確認する。skip_reason=simplify_off は意図的な無効化、 skip_reason=no_simplify_runtime_available は実行可能 runtime 不在として扱い、未処理 finding や parse failure がなければ skip 自体を blocker にしない。ただし full coverage が受け入れ条件なら、--simplify full で再実行してから完了判断する。 spawn 後の simplify subagent が prompt を処理せず、bounded wait / cleanup でも収束しない場合は subagent_lifecycle_timeout として扱う。 これは runtime 不在、intentional skip、reviewer artifact の final timeout、JSONL parse failure のいずれでもない。coverage を成功扱いせず、 timeout した reviewer、agent id、session artifact path、fallback / stop 判断、再実行した検証コマンドを report / evidence / action log に残せる形で記録する。

PR 作成前の local multi-review の履歴を PR 作成後の target へ引き継ぐ場合は、PR 側の run で review-orchestrator --pr <PR> multi-review run --with-history <local-work-dir> を明示する。 この handoff は指定された work-dir の local reviewer artifact、event log、rejected.txt、 structured finding action、run metadata だけを current work-dir へ取り込み、古い unrelated run は自動探索しない。 shared context には prior action decision が untrusted history として入り、report の timeline には local phase と PR phase が続けて表示される。

multi-review の判断根拠は次の責務で読む。

成果物 責務
stdout JSON 現在 run の gate、follow-up、report.path / report.html_path / report.evidence_path を返す
multi-review-events.jsonl reviewer 出力、parse failure、action 記録、gate event の append-only log
multi-review-evidence.json event log と run artifacts から再生成された source of truth。accepted / fixed / rejected / nit、verification、artifact 参照を確認する
run artifacts reviewer prompt、raw output、status、stderr、local validation summary などの詳細
multi-review-report.md 軽量 summary と record command の一覧
multi-review-report.html ユーザー確認用 viewer。HTML の要約だけを完了判断の根拠にしない

pause / per-agent-timeout / quiescence は、stdout JSON の durationsduration_sources、report の Runtime options、evidence の runtime_options で effective value と default|explicit を確認する。 呼び出し側 Agent は、ユーザー未指定の timeout 系 option を explicit flag として補完しない。未指定時の per-agent-timeoutreview-orchestrator が effective pause から正規化し、source は default のまま記録する。

reviewer job の *.status=timeout は実行開始時に置かれる sentinel であり、最終 timeout の証跡ではない。 最終 timeout は review_job_completed.timed_out=true、exit status 124、または evidence の artifacts.status_finality=final_timeout で判断する。 artifacts.status_finality=running_sentinel の場合は、orchestrator.done、stdout JSON、final report / evidence の生成を待つ。

呼び出し側 Agent の最終報告項目は claude/skills/multi-review/SKILL.md の完了前チェックに従う。 --work-dir 未指定時の default work-dir は repo root 配下の tmp/multi-review/ になり、対象 repo の local exclude に /tmp/multi-review/ がなければ追加される。

review-orchestrator multi-review ingest-artifact \
  --work-dir tmp/multi-review/owner-repo-pr-123 \
  --run-id run-20260514 \
  --head-sha abc123 \
  --source claude-simplify-quality \
  --prompt-path tmp/multi-review/owner-repo-pr-123/claude-simplify-quality-prompt.txt \
  --output-path tmp/multi-review/owner-repo-pr-123/claude-simplify-quality.out

claude/skills/multi-review/scripts/run.shclaude/skills/adversarial-review/scripts/*.sh は旧 entrypoint 互換の shim として残す。実処理は review-orchestrator に寄せる。

agent team capability probe

複数 Issue を coordinator / worker で処理する agent team workflow は、実装前に native worker lifecycle を probe する。 contract、status model、artifact schema、後続 Issue 起票条件は docs/agent-team-issue-workflow-contract.md に固定する。

review-orchestrator agent-team probe --runtime all
review-orchestrator agent-team probe --runtime claude --live --work-dir tmp/agent-team/claude-live-probe

default probe は static / non-destructive で、Codex / Claude の command surface と protocol surface だけを確認する。 --live は opt-in で、Claude の safe no-op background worker を tmp workspace で起動できる場合だけ lifecycle を確認する。 supported は live worker 起動、status 取得、result artifact 回収、cleanup まで確認できた場合だけ返す。 Claude の background start surface が現在の CLI に無い場合も probe 自体は JSON artifact を返し、runtime を unsupported として理由を記録する。 static probe で surface が見えた runtime は partial とし、queue runner や runtime adapter 実装 Issue を起票する根拠にしない。

Issue claim gate

Issue を実装対象として扱う skill は、Issue 本文分析や実装に入る前に reusable gate を通す。 現在の呼び出し元は fix-github-issuereview-and-fix-pr は PR または branch diff の review/fix が入口で、 Issue URL を実装対象として受け取らないため対象外。babysit-reviews は既存 PR の Bot review 処理であり、 Issue 直接着手ではないため対象外。

command details と stdout JSON / exit code の判定契約は claude/skills/github-issue-prepare/SKILL.md に集約し、 呼び出し元 skill 側では blocked 時に branch 作成、実装、PR 作成、multi-review を開始しないことだけを明示する。

Issue implementation readiness gate

claim gate が proceed になった後、実装開始可否は review-orchestrator issue readiness で機械的に判定できる。 contract、brief JSON schema、result JSON schema、decision boundary、path validation scope は docs/implementation-readiness-contract.md に固定する。

review-orchestrator --repo TomoakiMizuno/agent-dotfiles issue readiness \
  --issue <number-or-url> \
  --brief tmp/fix-github-issue/implementation-brief-<issue>.json

stdout JSON が現在の実行結果の authoritative source で、artifact_path は再開や handoff 用の保存先である。 Agent は validation_commands の command 文字列から path を shell parse せず、brief / handoff / observed artifact 内の path field だけを検証対象にする。

Issue post-create availability

Issue 作成直後の metadata 整備は review-orchestrator issue post-create で行う。post-create は assignee を設定しない。 作業開始時の assignee / ProjectV2 Status 更新は review-orchestrator issue prepare の責務として分ける。

review-orchestrator --repo TomoakiMizuno/agent-dotfiles issue post-create --issue <number-or-url> --type task

2026-05-18 に TomoakiMizuno/agent-dotfiles の Issue #354 で実測した結果は次の通り。

この repo は user repo であり、GitHub の Issue Types は organization API で提供されるため、Issue Type 候補は取得しない。 その結果、issue_type_unavailable は正常系の unavailable skip として扱い、Issue 作成後処理全体は success / proceed で完了する。 repo-linked ProjectV2 も存在しないため project_discovery.actionskippedproject_discovery.reasonno_repository_projects になり、projects は空配列、Project item 追加 action は発生しない。

ProjectV2 の作成や repository link は issue post-create では行わない。必要な運用だけが明示的に次の command を呼ぶ。

review-orchestrator --repo <owner>/<repo> project ensure --title "<project-title>" --link-repo

project ensure は owner / repo / title / repository link の有無を input として受け取り、既存 Project、作成、repo link、権限不足、duplicate を stdout JSON と exit code で返す。Project が見つからないことを理由に、Issue 作成 skill や AI Agent が ad-hoc な gh project create を実行してはならない。

unavailable skipAPI error は次の基準で分ける。

状態 JSON の見方 呼び出し側の扱い
Issue Type が user repo、plan、permission、disabled state などで利用できない status: "success"type.action: "skipped"type.reason: "issue_type_unavailable" など、next_required_action: "proceed" metadata は設定できなかったが想定内の no-op として続行する
repo-linked ProjectV2 がない status: "success"project_discovery.action: "skipped"project_discovery.reason: "no_repository_projects"projects: []actions: []next_required_action: "proceed" 追加対象がない no-op として続行する
open な repo-linked ProjectV2 がない status: "success"project_discovery.action: "skipped"project_discovery.reason: "no_open_repository_projects"next_required_action: "proceed" 追加対象がない no-op として続行する
ProjectV2 一覧取得、Project item 追加、Issue Type 更新、snapshot 取得などの API が失敗した status: "failure"next_required_action: "github_api_error"、ProjectV2 一覧取得失敗なら reasonlist repository ProjectV2 が入る。mutation 後の失敗では completed_actions も入る Project が存在しない状態とは区別する。自動 retry や --continue-on-error へは進まず、出力 JSON を確認して停止または人間確認へ戻す

organization repo の success path は、この repo では実機検証していない。公式 docs 上は Issue Types は organization REST API GET /orgs/{org}/issue-types で取得し、 Projects V2 では GraphQL APIaddProjectV2ItemById で item を追加してから updateProjectV2ItemFieldValue で Status などの field を更新する。 ローカル unit test では Project item 追加、Issue Type 設定、silent drop、API error を test double で固定しているが、 org repo での実 mutation は未検証 capability として扱う。 後続で org repo 検証が可能になった場合は、この Issue 群を reopen せずフォローアップ Issue で扱う。

インストール

make installagent-dotfilesreview-orchestrator をまとめてインストールする。

make install

リポジトリを clone せずに入れる場合:

go install github.com/TomoakiMizuno/agent-dotfiles/cmd/agent-dotfiles@latest
go install github.com/TomoakiMizuno/agent-dotfiles/cmd/review-orchestrator@latest

agent-dotfiles だけが必要であれば 1 行目のみで足りる。review-orchestrator は multi-review / adversarial-review の実行本体であり、babysit-reviews skill からも呼ばれる。

Windows でも go install ./cmd/review-orchestrator でインストールでき、review-orchestrator.exe --help を実行できる。Windows では Unix と同じ process group kill は行わず、multi-review 実行時の完全な子プロセス制御互換性は後続対応とする。

multi-review prerequisites

multi-review 実行前の外部ツールは、実行 target と選択 agent、local validation profile によって変わる。agent-dotfiles doctor は review toolchain の条件付き command を warning として表示するため、新規環境や Windows 環境ではまず次を実行する。

agent-dotfiles doctor --repo /path/to/agent-dotfiles
gh auth status --hostname github.com
分類 ツール 必要になる条件
中核 review-orchestrator, git review-orchestrator multi-review run の実行に必要。review-orchestrator は review 系 skill の実行本体、git は diff / head sha / repository state の取得に使う
PR target / GitHub 連携 gh と認証状態 PR を target にする場合、Copilot bot review request / PR thread / status check / PR metadata の取得に必要。認証は gh auth status --hostname github.com で確認する
選択 agent codex, claude, copilot --agents または .multi-review.json で選んだ local reviewer だけ必要。未選択 agent の CLI は不要
Windows wrapper bash Windows の PR target + local reviewers で gh guard wrapper shim など shell wrapper を経由する場合に必要。常時必須ではない
local validation make, go, npm / yarn / pnpm / bun, 任意の validation-command local validation profile が推定または明示した install / test / lint 経路でだけ必要。Go package なら go、Makefile 経路なら make、JS install 経路なら選ばれた package manager が必要
隣接 review skill jq review-orchestrator multi-review run の中核 dependency ではない。babysit-reviews など隣接 skill の shell glue で使われる

agent-dotfiles doctor は条件付き command が見つからない場合も error にはせず warning に留める。JS package manager は npm / yarn / pnpm / bun を個別に表示するため、実際の multi-review で必要かどうかは target、--agents、validation profile を見て判断する。jq は warning に出ても、Go 実装の multi-review 中核 dependency として扱わない。

PR 作成前に local target を使う場合は review-orchestrator multi-review run --local --local-phase pre-pr を使う。 この phase の validation は関連テスト・lintに限定し、GitHub Actions CI や CI 相当の重い fallback は prerequisites に含めない。 --validation-command または明示的な --validation-profile が必須で、未指定なら reviewer 起動前に usage error で停止する。 既存の PR なし standalone local target は従来通り、validation profile や repo からの推定 fallback を許可する。

PR 作成後に Copilot bot thread や local reviewer finding へ対応した修正 commit を push 前 local phase で再レビューする場合は、root --pr <PR>--local --local-phase pre-pr を併用する。 この形では GitHub 側の既存 Copilot bot unresolved thread を local reviewer 起動前に確認し、local HEAD が PR HEAD より進んでいる場合は push_required_for_copilot_thread_fixdrain_copilot_threads を返す。 通常の修正 commit は review-orchestrator が自動 push しないため、呼び出し側 skill が push 後に thread close / PR target rerun へ進む。

deferred CI follow-up

PR target の CI pending は、review loop を止める required_actions ではなく gates.follow_up_actionscheck_ci_later として返る。 この follow-up だけが残る場合、review-orchestrator multi-review run は exit 0 で result_status=follow_up_pending を返し、reviewer finding / Copilot bot thread / local reviewer result の triage は先に進めてよい。 ただし PR ready / 完全完了 / merge-ready とは報告しない。

follow-up action には next_command として次の形の再確認 command が入る。

review-orchestrator multi-review check-ci --work-dir tmp/multi-review/owner-repo-pr-123 --run-id run-1

呼び出し側 Agent は pending follow-up が残る限り、数分後または final report 前に next_command を実行し、結果をユーザー報告に含める。 in-progress CI を待つためだけに reviewer を再実行しない。

結果別の扱い:

結果 対応
success CI follow-up 完了。未処理 finding と required action がなければ完全完了として報告してよい
follow_up_pending / pending 再確認を続ける。報告では「レビューは収束、CI follow-up は pending」と明示する
failure / validation failure fix_ci_failure / fix_validation_failure など出力された required action に従って調査・修正する
stale / api_error / closed success 扱いにせず、PR head、API 状態、PR state を確認して再実行または原因調査する

CI failure / validation failure を見ないまま完了宣言しないという既存 gate は維持する。 pending だけを review loop blocker から外し、failure が確認された時点で required action として扱う。

multi-review.json

multi-review の agent 別設定は agent-dotfiles import/export の管理 root に含めない。現状の探索順は以下の通り。

  1. review-orchestrator multi-review run --config PATH の明示指定
  2. リポジトリ root の .multi-review.json
  3. カレントディレクトリの .multi-review.json
  4. ${XDG_CONFIG_HOME:-$HOME/.config}/agent-dotfiles/multi-review.json

個人環境のデフォルトは dotfiles 側の host profile として ${XDG_CONFIG_HOME:-$HOME/.config}/agent-dotfiles/multi-review.json に置く。repo-local な挙動を固定したいプロジェクトだけ .multi-review.json を置き、agent/model の実験的な引数は --config か XDG config 側に寄せる。Claude MCP policy や legacy worker relay のように multi-review 以外の workflow からも使う host-local な実行設定は agent-runtime.json に置く。

agent-runtime.json

${XDG_CONFIG_HOME:-$HOME/.config}/agent-dotfiles/agent-runtime.json は、review workflow 全体で共有する host-local な agent 実行設定であり、agent-dotfiles import/export の管理 root に含めない。 現時点では Codex runtime から Claude reviewer を direct PTY で呼ぶ場合の Claude MCP policy と、legacy agmsg transport 用の worker 設定を読む。 review-orchestrator multi-review run--claude-mcp が未指定の場合に claude.mcp を読み、さらに無ければ default off とする。--worker-mode / --worker-helper / --worker-lifecycle は legacy agmsg transport 用の互換設定として残るが、通常の direct PTY reviewer では挙動を変えない。 Claude 起動前 fallback 用の判定 helper は review-orchestrator claude-rate-limit decision から利用する。claude.rate_limit_checker.command が未設定の場合、この helper は既存挙動維持のため allow_claude と判定する。実際の Claude 起動経路へこの判定を適用する処理は別 Issue の責務とする。 外部 AI Agent へ Issue 文脈や未公開差分を渡す承認 intent も、workflow 横断の host-local runtime policy として external_ai.approval_policy に置く。.multi-review.json は multi-review 専用の reviewer 設定であり、github-issue-validation や Claude / Copilot から Codex を呼ぶ逆方向の承認 intent には使わない。

{
  "claude": {
    "worker_mode": "prefer",
    "worker_helper": "~/.agents/skills/agmsg/scripts/request-claude-worker.sh",
    "worker_project_path": "~/ghq/github.com/TomoakiMizuno/agent-dotfiles",
    "mcp": "off",
    "worker_lifecycle": "close",
    "opus_fallback_model": "opus",
    "rate_limit_checker": {
      "command": ["review-orchestrator", "claude-rate-limit", "probe"],
      "thresholds": {
        "five_hour": 90,
        "seven_day": 95,
        "seven_day_sonnet": 95
      }
    }
  },
  "external_ai": {
    "approval_policy": [
      {
        "workflow": "fix-github-issue",
        "caller_runtime": "codex",
        "target_agent": "copilot",
        "transport": "cli",
        "data_classes": ["issue_context", "uncommitted_diff"],
        "tool_modes": ["read_only_review"],
        "decision": "allow"
      }
    ]
  }
}

worker_project_path は legacy long-lived Claude worker / watch.sh を所有する project path であり、レビュー対象 repo path ではない。通常の direct PTY reviewer では worker_project_pathworker_modeworker_helperworker_lifecycle は使わない。legacy agmsg transport を明示的に使う経路では、worker_project_path 単独では worker relay を有効化しない。request-claude-worker.sh を直接呼ぶ経路では、AGMSG_WORKER_PROJECT_PATH が未指定なら同じ agent-runtime.jsonclaude.worker_project_path を fallback として読む。

claude.mcpoff|on のみ許可する。優先順位は --claude-mcp 明示、agent-runtime.jsonclaude.mcp、default off の順。off では direct PTY wrapper が user-level MCP server を起動せず LeanCTX MCP だけを許可する。on は full user-level MCP が必要な workflow だけで明示する。

external_ai.approval_policy は workflow 実装が preflight で参照する承認 intent の source of truth であり、Codex / Claude / Copilot の provider 認証状態や global permission mode を管理しない。各 rule は次の field を持つ。

field 内容
workflow fix-github-issuegithub-issue-validation などの呼び出し元 workflow
caller_runtime 外部 AI Agent を呼び出す側の runtime。例: codex, claude, copilot
target_agent 呼び出し先の AI Agent。例: codex, claude, copilot
transport 呼び出し経路。例: cli, direct-pty, parent-assisted-codex-subagent
data_classes 渡すデータ分類。例: issue_context, uncommitted_diff, pr_diff, repo_metadata
tool_modes 呼び出し先に許す操作分類。例: read_only_review, validation, planning
decision allow または block

token は小文字化して読み込まれ、空文字や空配列は拒否される。workflow / target_agent / data_classes / tool_modes の値は registry 固定しない。後続 workflow が必要な語彙を docs や Issue contract で定義し、parser は JSON shape と安全な token だけを検証する。

現在の codex/hooks.jsonPermissionRequest hook は Superset / cmux など通知系へイベントを forward する経路であり、外部 AI approval policy の source of truth ではない。Codex hook が machine-readable な approve / block decision を返せることを workflow 側で実証できるまでは、完全自動承認は agent-runtime.json の policy と workflow preflight / wrapper / subcommand の組み合わせで扱う。hook だけで承認できない shell 実行は、通常の Codex sandbox approval または安全に scoped された prefix rule を使い、global な approval_policy 低下や broad shell allow で回避しない。

review-orchestrator claude-rate-limit probe は Claude Code の OAuth token を読み取り、https://api.anthropic.com/api/oauth/usage から現在の usage を取得して checker JSON schema を stdout に出す。macOS では /usr/bin/security find-generic-password -a $USER -s "Claude Code-credentials" -w の JSON から claudeAiOauth.accessToken を読む。non-macOS では ~/.claude/.credentials.json の同じ JSON schema を読む。token refresh、Keychain / credentials file の書き換え、cache 永続化はしない。HTTP request は Bearer 認証ヘッダと anthropic-beta: oauth-2025-04-20 を付け、redirect は許可しない。

review-orchestrator claude-rate-limit decision --model <model> --format json は host-local checker command を実行し、decisionreasonrequested_modelfallback_targetobserved_limitsthresholdschecker_status を JSON で返す。valid decision は allow_claudeuse_opususe_codexskip_guard で、checker command missing / non-zero / invalid JSON / required key missing による fail-closed use_codex も exit 0 とする。checker command 未設定時は常に既存挙動維持の allow_claude とし、checker failure は常に use_codex に倒す。non-zero は CLI usage error、config parse 不能、decision JSON を信頼できない内部 error に限定する。

checker command の stable JSON schema は次の形に固定する。used_percentage は required number、resets_at は optional Unix timestamp seconds、overage は optional boolean とする。five_hourseven_day は required global limit で、sonnet 系 model を要求している場合だけ seven_day_sonnet も required とする。non-sonnet request では seven_day_sonnet 欠落を sonnet_limit_not_applicable として無視する。

{
  "rate_limits": {
    "five_hour": { "used_percentage": 89.1, "resets_at": 1780000000 },
    "seven_day": { "used_percentage": 94.2, "resets_at": 1780000000 },
    "seven_day_sonnet": { "used_percentage": 95.1, "resets_at": 1780000000 }
  },
  "overage": false
}

decision precedence は overage=true、global 5h >= 90、global 7days >= 95 を最優先で use_codex にする。次に sonnet 系 model で seven_day_sonnet >= 95 の場合だけ use_opus にし、fallback target は claude.opus_fallback_model、未指定時は opus とする。claude.opus_fallback_model が sonnet 系 alias の場合は config error として Claude を起動せず use_codex に倒す。CLAUDECODE=1 の caller env では checker command を実行せず skip_guard / reason=claude_code_runtime を返す。

probe が読む Anthropic usage response は five_hour / seven_day / seven_day_sonnet の各 bucket にある utilization と、存在する場合だけ RFC3339 / RFC3339Nano resets_at を checker schema へ写す。seven_day_sonnet が response に無い場合は出力から省略する。overage は取得手段がないため出力しない。token 取得不能、HTTP 401 / 429 / 非 200、decode 失敗、used_percentage 範囲外、存在する resets_at の parse 失敗は probe の non-zero exit と stderr reason になり、decision 側では checker failure として fail-closed use_codex に倒す。

provider billing 設定、host-local 実運用 config への適用はこの repo の責務外とする。usage endpoint の schema が変わった場合は decode 失敗として扱い、agent-dotfiles 側で曖昧 alias を推測で増やさない。

request-claude-worker.sh は worker project path で必要な identity / delivery / watcher を自動準備する。AGMSG_AUTO_JOIN=1 の既定では caller の codex identity と worker の claude-code identity を登録し、delivery が off / turn の場合は monitor 経路を有効化する。live watch.sh がない場合は ensure-claude-worker.sh で detached Claude Code worker を起動し、watcher が立ってから request を送る。 worker identity は claude.mcp の resolved policy ごとに分け、MCP disabled worker と enabled worker の live session を混ぜない。

dotfiles との責務境界

包括的な責務境界は README.md の dotfiles との責務境界 を参照する。

review 運用では、agent-dotfiles / review-orchestrator を解決できる shell PATH、個人環境の ${XDG_CONFIG_HOME:-$HOME/.config}/agent-dotfiles/multi-review.json、必要に応じて ${XDG_CONFIG_HOME:-$HOME/.config}/agent-dotfiles/agent-runtime.json を dotfiles 側の host profile として先に用意する。agent-dotfiles 側は review 系 skill と review-orchestrator の配布を扱い、個人ごとの agent 実行設定は import/export の管理 root に含めない。