feat: support codex and claude reviewers

This commit is contained in:
2026-07-22 02:47:34 +08:00
parent b5618e1b0c
commit d38151ad78
13 changed files with 400 additions and 102 deletions
+18 -14
View File
@@ -1,11 +1,11 @@
---
name: agent-workflow-host
description: Drive an explicitly invoked agent-workflow in which Codex freezes the latest confirmed plan, delegates implementation to Reasonix, Claude Code, or Agy, independently reviews the result, submits fix decisions to the same executor session, and repeats until accepted or safely stopped. Use only when the user explicitly invokes $agent-workflow-host to execute, resume, inspect, or abort a stateful workflow after plan discussion.
description: Drive an explicitly invoked agent-workflow in which the host (Codex or Claude) freezes the latest confirmed plan, delegates implementation to an executor, independently reviews the result, submits fix decisions to the same executor session, and repeats until accepted or safely stopped. Use only when the user explicitly invokes $agent-workflow-host to execute, resume, inspect, or abort a stateful workflow after plan discussion.
---
# Agent Workflow Host
Act as the host planner, reviewer, and final acceptance authority. Let the selected executor implement and fix code. Use `agent-workflow`; do not replace its state machine with direct executor commands.
Act as the host planner, reviewer, and final acceptance authority. Let the selected executor implement and fix code. You must pass your own identity (codex or claude) as the `--reviewer` on lifecycle commands. Use `agent-workflow`; do not replace its state machine with direct executor commands. You cannot use the claude executor if you are the claude reviewer. On resume, you must inspect the `reviewer` field in the status output and refuse to continue if it belongs to a different host. When executing lifecycle commands, pass your concrete current identity (e.g. `--reviewer codex`) instead of using a literal `<codex|claude>` placeholder.
## Invocation Contract
@@ -26,6 +26,8 @@ $agent-workflow-host 中止 <run-id> 原因:需求变化
$agent-workflow-host 日志 <run-id> [--follow]
```
When invoked, the host (Codex or Claude) drives the workflow using its respective `--reviewer` flag.
- Treat an explicit `执行` invocation as authorization to execute the latest clearly bounded plan in the conversation.
- Do not start when the conversation contains multiple unresolved plan variants, missing scope, missing acceptance criteria, or missing verification commands. Ask only for the unresolved decision.
- If invoked without an operation, show the supported operations and do nothing.
@@ -37,9 +39,9 @@ $agent-workflow-host 日志 <run-id> [--follow]
## Host Boundaries
- Codex owns plan normalization, finding classification, verification, and acceptance.
- The executor owns implementation, tests, and fixes. During an active workflow, Codex must not edit target repository files itself.
- `agent-workflow review` only prepares evidence for Codex. Do not invoke another reviewer as an acceptance gate.
- The host (Codex or Claude) owns plan normalization, finding classification, verification, and acceptance.
- The executor owns implementation, tests, and fixes. During an active workflow, the host must not edit target repository files itself.
- `agent-workflow review` only prepares evidence for the host. Do not invoke another reviewer as an acceptance gate.
- Never run or authorize `git commit`, `git push`, `git reset`, `svn commit`, `svn switch`, `svn update`, history rewriting, or branch deletion.
- Never broaden the approved scope or silently change requirements after start. Abort and create a new plan when requirements materially change.
@@ -72,7 +74,7 @@ $agent-workflow-host 日志 <run-id> [--follow]
7. Start the run and record the emitted run ID, then immediately print a logs-follow command the user can run independently:
```bash
agent-workflow start --plan <temp-plan.json> --executor <reasonix|claude|agy> [--vcs <git|svn|none>] [--new-task]
agent-workflow start --plan <temp-plan.json> --executor <reasonix|claude|agy> --reviewer YOUR_IDENTITY [--vcs <git|svn|none>] [--new-task]
```
Do not pass `--new-task` for a follow-up plan, a correction, or another implementation slice of the same user goal. The CLI validates persisted task bindings before reuse and blocks stale or mismatched handles. An executor selected for the first time in the task starts lazily and is then recorded for later runs. Agy degraded `--continue` handles are intentionally not shared.
@@ -92,9 +94,9 @@ Continue until a terminal status. Do not stop after merely proposing a decision.
### `awaiting_review`
1. Run `agent-workflow review --run <run-id>`.
1. Run `agent-workflow review --run <run-id> --reviewer YOUR_IDENTITY`.
2. Read the emitted `hostReviewFile`. Inspect its complete `diffFile`, full `executorLogFile`, plan, acceptance criteria, repository code, changed-file scope, and HEAD evidence yourself.
3. Review for correctness, regressions, security, and missing tests. Assign stable IDs such as `codex-<cycle>-1` to concrete issues.
3. Review for correctness, regressions, security, and missing tests. Assign stable IDs such as `codex-<cycle>-<n>` (if you are Codex) or `claude-<cycle>-<n>` (if you are Claude) to concrete issues.
4. Independently run every `verificationCommands` entry from the repository root and retain concise evidence.
### While waiting for an executor
@@ -121,15 +123,15 @@ The `agent-workflow web` command starts a local web server that reads workflow s
### `awaiting_scope_resolution`
1. Confirm the Codex review bundle was not prepared and inspect every structured `scopeViolations` entry.
1. Confirm your review bundle was not prepared and inspect every structured `scopeViolations` entry.
2. Decide whether each listed path was created by the executor and can be safely removed or restored. Never broaden scope, add ignore rules, or delete automatically.
3. To use `outcome: "fix"`, accept every current `scope-*` finding ID exactly once. The CLI resumes the same executor session with a prompt limited to those exact paths.
4. Use `needs_human` when any path may contain intentional work or ownership is unclear. Never use `accept` in this state.
5. After remediation, run `agent-workflow review` again. Codex review may proceed only after HEAD and scope gates pass.
5. After remediation, run `agent-workflow review --run <run-id> --reviewer YOUR_IDENTITY` again. Review may proceed only after HEAD and scope gates pass.
### `awaiting_host`
Classify every issue found by Codex:
Classify every issue found during your review:
- `accept`: real, actionable, in scope, and required for the approved acceptance criteria.
- `reject`: unsupported or incorrect; include a concrete rationale.
@@ -140,6 +142,7 @@ Create `HostDecisionV1` in the temporary directory:
```json
{
"version": "1",
"reviewer": "YOUR_IDENTITY",
"outcome": "fix",
"findingDecisions": [
{
@@ -154,9 +157,10 @@ Create `HostDecisionV1` in the temporary directory:
"decidedAt": "ISO-8601 timestamp"
}
```
*(Use your respective prefix, e.g., `claude-2-1` if Claude).*
- Use `outcome: "fix"` when at least one accepted finding must be fixed. Every accepted Codex finding requires a non-empty `summary`; include `path` when known. Submit it with `agent-workflow decide --run <run-id> --input <temp-decision.json>`. The CLI must resume the same executor session.
- Use `outcome: "accept"` only when Codex has completed its own review, has no blocking issue, every verification command passes, HEAD is unchanged, and every changed file is in scope.
- Use `outcome: "fix"` when at least one accepted finding must be fixed. Every accepted finding requires a non-empty `summary`; include `path` when known. Submit it with `agent-workflow decide --run <run-id> --input <temp-decision.json> --reviewer YOUR_IDENTITY`. The CLI must resume the same executor session.
- Use `outcome: "accept"` only when you have completed your own review, have no blocking issue, every verification command passes, HEAD is unchanged, and every changed file is in scope.
- Use `outcome: "needs_human"` when intent, safety, architecture, or evidence cannot be resolved without the user.
- Never send rejected findings or follow-ups to the executor as required fixes.
@@ -166,7 +170,7 @@ After `fix`, repeat review and decision for the new cycle. Respect the configure
- For `查看 <run-id>`, run `agent-workflow status --run <run-id> --json`, summarize it, and do not advance the workflow.
- For `继续 <run-id>`, read status first, then continue from `awaiting_review`, `awaiting_scope_resolution`, or `awaiting_host`. Read the persisted state and referenced cycle artifacts when earlier command output is no longer in context; do not reconstruct findings from memory.
- For `清理后重试 <run-id>`, run `agent-workflow retry-review --run <run-id>` after the approved scope artifacts have been removed. It must refuse when baseline drift or out-of-scope paths remain.
- For `清理后重试 <run-id>`, run `agent-workflow retry-review --run <run-id> --reviewer YOUR_IDENTITY` after the approved scope artifacts have been removed. It must refuse when baseline drift or out-of-scope paths remain.
- For `执行器重试 <run-id>`, run `agent-workflow retry-execute --run <run-id>` after the external cause of an executor failure is cleared (e.g., session conflict resolved, transient error gone, or corrected an invalid `model` configuration). It preserves failed attempt logs and reuses the same session handle. If a Reasonix handle was not captured, the CLI may recover a persisted session only when its project directory, frozen plan title, and execution time window match the run, and must audit the recovery. Initial-cycle retries continue from the original plan; later-cycle retries resume from the preceding decision. Refuses when baseline has drifted, scope violations exist, or the cycle already produced review artifacts.
- For `执行器重试 <run-id> 使用会话 <claude-session-id>`, run `agent-workflow retry-execute --run <run-id> --session <claude-session-id>` only when a Claude run's recorded session was never created or is unavailable and a known persisted replacement session contains the same frozen plan. The CLI must validate that the session belongs to the same repository and plan before recording the rebind in the audit log and retrying. Never edit `state.json` manually or guess a session ID.
- For `延长 <run-id> 添加 <n> 个周期`, run `agent-workflow extend --run <run-id> --additional-cycles <n>` to extend a `budget_exhausted` run. This requires: the run ended at `budget_exhausted`, has a valid session handle, the last decision was `fix`, baseline hasn't drifted, and scope is clean. Returns to `awaiting_host` state to continue the same executor session.
@@ -1,6 +1,6 @@
interface:
display_name: "Agent Workflow Host"
short_description: "让 Codex 驱动已确认计划的执行、独立审查与持续修复闭环"
short_description: "让 Codex 或 Claude 驱动已确认计划的执行、独立审查与持续修复闭环"
default_prompt: "Use $agent-workflow-host to execute the latest confirmed plan with Reasonix and review until accepted."
policy: