Loading...
Loading...
Compare original and translation side by side
agentcodex exec~/.agents/skills/agentcodex exec~/.agents/skills/| Role | Harness | Default | Mode |
|---|---|---|---|
| Critic | Cursor | | Read-only ( |
| Validator | | | Read-only sandbox |
| Fixer | Parent | configurable | Writes + commits |
| Parent | This session | — | Orchestrates, adjudicates |
| 角色 | 工具 | 默认配置 | 模式 |
|---|---|---|---|
| 审查器 | Cursor | | 只读( |
| 验证器 | | | 只读沙箱 |
| 修复器 | 父进程 | 可配置 | 写入 + 提交 |
| 父进程 | 当前会话 | — | 编排、裁决 |
~/.config/adversarial-review/config.toml[critic]
command = "agent"
model = "composer-2.5"
args = ["--print", "--trust", "--mode", "plan"]
[validator]
command = "codex"
model = "gpt-5.5-medium"
args = ["exec", "--sandbox", "read-only"]
timeout_seconds = 600
[review]
skills = ["grug-review", "thermo-nuclear-code-quality-review"]
[session]
max_rounds = 10
push_on_complete = false
base_ref = "auto"
dir = ".adversarial-review/sessions"~/.config/adversarial-review/config.toml[critic]
command = "agent"
model = "composer-2.5"
args = ["--print", "--trust", "--mode", "plan"]
[validator]
command = "codex"
model = "gpt-5.5-medium"
args = ["exec", "--sandbox", "read-only"]
timeout_seconds = 600
[review]
skills = ["grug-review", "thermo-nuclear-code-quality-review"]
[session]
max_rounds = 10
push_on_complete = false
base_ref = "auto"
dir = ".adversarial-review/sessions"SKILLS_REPOskillsadversarial-review/grug-review/[review].skillsSKILL.md$SKILLS_REPO/<name>/SKILL.md~/.agents/skills/<name>/SKILL.md~/.cursor/skills/<name>/SKILL.md.cursor/skills/<name>/SKILL.mdSKILLS_REPOadversarial-review/grug-review/skills[review].skillsSKILL.md$SKILLS_REPO/<name>/SKILL.md~/.agents/skills/<name>/SKILL.md~/.cursor/skills/<name>/SKILL.md.cursor/skills/<name>/SKILL.md<repo>/.adversarial-review/sessions/<run-id>/
session.json
round-NN/
branch.diff
fixes-since-last.diff # round > 1 only
findings.json
validator-prompt.txt
validator-last.txt
validated.json
adjudication.json
summary.md<run-id>20260531-214539-codex-implement-8--workspacecd.adversarial-review/.gitignore[session] mirror_to_config = true~/.config/adversarial-review/sessions/<run-id>/~/.config/...agent/tmp/<repo>/.adversarial-review/sessions/<run-id>/
session.json
round-NN/
branch.diff
fixes-since-last.diff # 仅当轮次>1时存在
findings.json
validator-prompt.txt
validator-last.txt
validated.json
adjudication.json
summary.md<run-id>20260531-214539-codex-implement-8--workspacecd.adversarial-review/.gitignore[session] mirror_to_config = true~/.config/adversarial-review/sessions/<run-id>/~/.config/...agent/tmp/base_refbase_ref = "auto"mainmastergit diff <base_ref>...HEADfixes-since-last.diffgit diff <last_review_sha>..HEADlast_review_shaHEADfixes-since-last.diffbase_refbase_ref = "auto"mainmastergit diff <base_ref>...HEADfixes-since-last.diffgit diff <last_review_sha>..HEADlast_review_shaHEADfixes-since-last.diffadjudication.json{ "id": "F8", "action": "skip", "reason": "user-intent" }adjudication.json{ "id": "F8", "action": "skip", "reason": "user-intent" }Progress:
- [ ] Config loaded (or defaults written)
- [ ] Session initialized under <repo>/.adversarial-review/..., base_ref pinned, branch.diff saved
- [ ] Round N: critic → validator → adjudicate → fix → advance sha
- [ ] Close-out进度:
- [ ] 配置已加载(或已写入默认配置)
- [ ] 会话已初始化至<repo>/.adversarial-review/...,base_ref已固定,branch.diff已保存
- [ ] 第N轮:审查器 → 验证器 → 裁决 → 修复 → 更新提交哈希
- [ ] 会话结束REPO="$(git rev-parse --show-toplevel)"
BASE_REF="$(git merge-base HEAD @{upstream} 2>/dev/null || git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)"
HEAD_SHA="$(git rev-parse HEAD)"
RUN_ID="$(date +%Y%m%d-%H%M%S)-$(git branch --show-current | tr '/' '-')"
SESSION="$REPO/.adversarial-review/sessions/$RUN_ID"
ROUND="$SESSION/round-$(printf '%02d' "$ROUND_NUM")"
mkdir -p "$ROUND"
git diff "${BASE_REF}...HEAD" > "$ROUND/branch.diff"REPO="$(git rev-parse --show-toplevel)"
BASE_REF="$(git merge-base HEAD @{upstream} 2>/dev/null || git merge-base HEAD main 2>/dev/null || git merge-base HEAD master)"
HEAD_SHA="$(git rev-parse HEAD)"
RUN_ID="$(date +%Y%m%d-%H%M%S)-$(git branch --show-current | tr '/' '-')"
SESSION="$REPO/.adversarial-review/sessions/$RUN_ID"
ROUND="$SESSION/round-$(printf '%02d' "$ROUND_NUM")"
mkdir -p "$ROUND"
git diff "${BASE_REF}...HEAD" > "$ROUND/branch.diff"
Use `required_permissions: ["all"]` for subprocesses when the environment blocks auth, git, or long-running CLIs.
当环境限制权限、git操作或长时间运行的CLI时,需为子进程设置`required_permissions: ["all"]`。agentagentSKILL.mdbranch.difffixes-since-last.diffadjudication.jsonfindings.json/tmp/findings-*.json$ROUND/findings.json"round": N"head_sha": "<current HEAD>"agent --print --trust --mode plan --model "<critic.model>" --workspace "$REPO" \
"<prompt as above>"HEAD_SHA="$(git rev-parse HEAD)"
test -f "$ROUND/findings.json" || cp /tmp/findings-round-*.json "$ROUND/findings.json" 2>/dev/null || true
test -f "$ROUND/findings.json" || { echo "critic produced no findings.json"; exit 1; }SKILL.mdbranch.difffixes-since-last.diffadjudication.jsonfindings.json/tmp/findings-*.json$ROUND/findings.json"round": N"head_sha": "<current HEAD>"agent --print --trust --mode plan --model "<critic.model>" --workspace "$REPO" \
"<prompt as above>"HEAD_SHA="$(git rev-parse HEAD)"
test -f "$ROUND/findings.json" || cp /tmp/findings-round-*.json "$ROUND/findings.json" 2>/dev/null || true
test -f "$ROUND/findings.json" || { echo "critic produced no findings.json"; exit 1; }
Do not continue to the validator until JSON parses and freshness checks pass (or parent intentionally normalizes after a failed re-run).
在JSON解析通过且新鲜度检查通过之前(或父进程在重新运行失败后有意标准化内容),请勿继续运行验证器。codexcodexregression_risk$(cat <<'EOF' ...)Reading additional input from stdin...~/.config/$ROUND/validator-prompt.txtfindings.jsontimeoutvalidator-prompt.txtregression_risklowmediumhighSKILL_DIR="<absolute path to adversarial-review skill>"
timeout "${VALIDATOR_TIMEOUT:-600}" codex exec \
-C "$REPO" \
-s read-only \
-m "<validator.model>" \
--output-schema "$SKILL_DIR/schemas/validated-findings.schema.json" \
-o "$ROUND/validator-last.txt" \
- < "$ROUND/validator-prompt.txt"timeout "${VALIDATOR_TIMEOUT:-600}" codex exec \
-C "$REPO" -s read-only -m "<validator.model>" \
--output-schema "$SKILL_DIR/schemas/validated-findings.schema.json" \
-o "$ROUND/validator-last.txt" \
"$(cat "$ROUND/validator-prompt.txt")" < /dev/nullvalidator-last.txt$ROUND/validated.jsonregression_risk$(cat <<'EOF' ...)Reading additional input from stdin...~/.config/$ROUND/validator-prompt.txtfindings.jsonvalidator-prompt.txtregression_risklowmediumhighSKILL_DIR="<absolute path to adversarial-review skill>"
timeout "${VALIDATOR_TIMEOUT:-600}" codex exec \
-C "$REPO" \
-s read-only \
-m "<validator.model>" \
--output-schema "$SKILL_DIR/schemas/validated-findings.schema.json" \
-o "$ROUND/validator-last.txt" \
- < "$ROUND/validator-prompt.txt"timeout "${VALIDATOR_TIMEOUT:-600}" codex exec \
-C "$REPO" -s read-only -m "<validator.model>" \
--output-schema "$SKILL_DIR/schemas/validated-findings.schema.json" \
-o "$ROUND/validator-last.txt" \
"$(cat "$ROUND/validator-prompt.txt")" < /dev/nullvalidator-last.txt$ROUND/validated.jsonfindings.jsonvalidated.jsonadjudication.json"validator": "parent-fallback"findings.jsonvalidated.jsonadjudication.json"validator": "parent-fallback"adjudication.json| Validator | Risk | Parent action |
|---|---|---|
| low / medium | Address — fixer |
| high | Ask user |
| any | Skip |
| any | Ask user |
| user-intent (prior round) | — | Skip — do not re-raise |
regression_riskadjudication.json| 验证器结果 | 风险 | 父进程操作 |
|---|---|---|
| low / medium | 处理 — 调用修复器 |
| high | 询问用户 |
| 任意 | 跳过 |
| 任意 | 询问用户 |
| user-intent(上一轮) | — | 跳过 — 请勿重复提出 |
regression_riskTasksubagent_type = "generalPurpose"AGENTS.mdAGENTS.local.mdgit add -Agit add <paths>
git commit -m "$(cat <<'EOF'
refactor: <short topic> (adversarial F<N>)
<One sentence: what changed and why.>
EOF
)"Tasksubagent_type = "generalPurpose"AGENTS.mdAGENTS.local.mdgit add -Agit add <paths>
git commit -m "$(cat <<'EOF'
refactor: <short topic> (adversarial F<N>)
<一句话说明:修改内容及原因。>
EOF
)"findings.jsonidround >= session.max_roundslast_review_shaHEADfindings.jsonround >= session.max_roundslast_review_shaHEADgit pushpush_on_complete = truesummary.md~/.config/adversarial-review/sessions/base_refpush_on_complete = truegit pushsummary.md~/.config/adversarial-review/sessions/base_refevaleval~/.config/codex exectimeoutfindings.json/tmpfindings.jsonhead_shagit rev-parse HEAD~/.config/codex exectimeoutfindings.json/tmphead_shagit rev-parse HEADfindings.json| Symptom | Likely cause | Fix |
|---|---|---|
| Critic wrote findings but file missing | Path outside workspace | Repo-local |
| Round 2 findings duplicate round 1 | Stale critic cache | |
| Stdin never closed | |
| Validator >10 min, no output | Hung / wrong cwd | Kill; parent fallback; |
| 症状 | 可能原因 | 修复方案 |
|---|---|---|
| 审查器生成了结果但文件缺失 | 路径位于工作区外 | 使用仓库本地的 |
| 第2轮审查结果重复第1轮内容 | 审查器缓存过时 | 使用 |
| 标准输入未关闭 | 使用 |
| 验证器运行超过10分钟无输出 | 进程挂起/工作目录错误 | 终止进程;使用父进程回退方案;添加 |