编程

adversarial-plan

试用

Adversarial implementation planner. Takes a spec.md (from adversarial-spec) and optionally review findings, then produces a plan.md with ordered steps, dependencies, files, tests, and risks. Execute the result through focused per-step specs.

它能做什么

Adversarial implementation planner. Takes a spec.md (from adversarial-spec) and optionally review findings, then produces a plan.md with ordered steps, dependencies, files, tests, and risks. Execute the result through focused per-step specs.

技能文档

Adversarial Plan

Spec → implementation plan. Two-role adversarial pipeline that takes a spec.md (from adversarial-spec) and optionally review findings (from adversarial-code-review), and produces a plan.md with ordered steps. To implement it with adversarial-code-loop, convert each step to a focused spec and run the steps in dependency order; adversarial-code-loop has no functional --plan mode.

Installation

Requires the adversarial-common sibling repo (shared engine). One-line install:

curl -fsSL https://raw.githubusercontent.com/chpomob/adversarial-plan/main/scripts/install.sh | bash

or, from an existing checkout:

bash scripts/install.sh

Both place adversarial-plan and adversarial-common side by side under ~/.hermes/skills (override the target with $1 or $HERMES_HOME).

Workflow

PREFLIGHT ──→ optional DEEP RESEARCH ──→ GIT SETUP
                                           │
                                           ├─ delegated success ──→ FINALIZE
                                           │
                                           └─ direct/fallback ──→ PLAN ──→ CHALLENGE
                                                                          │
                                               APPROVE + no findings ──────┤
                                                                          │
                                               otherwise ──→ REVISE ──→ VERIFY
                                                                  ↑          │
                                                                  └──────────┘ up to --max-loops
                                                                          │
                                                                      FINALIZE

There is one CHALLENGE phase and no CROSS_2 phase. A successful delegated run bypasses PLAN/CHALLENGE/REVISE/VERIFY; a delegated fallback enters the normal adversarial loop. FINALIZE squash-merges an approved plan unless --no-merge is set, or records a rejection marker when findings remain.

Prompt design

The CHALLENGE prompt references plan.md and spec.md on disk and instructs the challenger to read them from the current working directory (the phase workdir). No document text is embedded in the prompt; the provider runs with the phase workdir as its cwd, so filesystem-capable providers inspect both files and the cumulative branch diff directly.

CLI

FlagValue/defaultPurpose
--help-h aliasShow command help and exit.
--specpath; /spec.mdSpecification to plan.
--findingspath; optionalJSON array, or object containing a findings array, to incorporate into the plan.
--dev-cmdcommand; $APLAN_DEV_CMD or built-in defaultExplicit plan-writer command; with a provider registry, bypasses registry selection for writer phases.
--review-cmdcommand; $APLAN_REVIEW_CMD or built-in defaultExplicit challenger/verifier command; with a provider registry, bypasses registry selection for those phases.
--provider-configpath; $ADVERSARIAL_PROVIDER_CONFIGProvider registry YAML.
--forceoffSkip quota checks and select each registry role's primary provider.
--force-providerROLE:ALIAS; repeatableForce one provider alias for writer, challenger, or verify.
--workdirdirectory; .Target Git repository and phase working directory.
--max-loopspositive integer; 2Maximum REVISE/VERIFY rounds after CHALLENGE.
--featurename; derived from specBranch and artifact name.
--timeoutpositive seconds; 600Timeout for each planner/challenger subprocess.
--outdirectory; .adversarial-planArtifact base directory; relative paths resolve under --workdir.
--no-mergeoffOn approval, leave the plan branch unmerged.
--show-costsoffPrint a per-phase cost breakdown to stderr.
--retriespositive integer; 3Maximum CLI retries for each phase call.
--max-input-charspositive integer; unlimitedCap prompt input characters for each phase call.
--max-output-charspositive integer; unlimitedCap provider output characters for each phase call.
--htmloff; optional modeRender an HTML report after final.json. This does not change the adversarial flow.
--cioff; optional modeSuppress banners, use plain stderr, and return stable CI exit codes.
--fail-onselector; optional CI modeSet CI failure conditions, for example findings,severity:blocker; used when --ci is active.
--deep-researchoff; optional modeRun bounded external research after preflight and merge its findings before planning.
--research-cmdcommand; research env/dev/default fallbackProvider command used by --deep-research.
--research-max-queriespositive integer; 5Maximum research queries.
--research-max-resultspositive integer; 5Maximum results retained per research query.
--research-timeoutpositive seconds; 60Timeout for each research query.
--delegatedoff; optional modeDecompose high-complexity work among workers. A successful delegated run bypasses the adversarial PLAN/CHALLENGE/REVISE/VERIFY loop; a direct fallback resumes it.
--delegated-concurrencypositive integer; complexity recommendationMaximum concurrent delegated workers.

Output format

plan.md with YAML frontmatter + ordered steps:

---
spec: "feature-name"
version: "1.0"
author: "adversarial-plan"
based-on: "adversarial-spec"
findings-input: false
---

## Steps

### P1: First task
- **Files:** [path/to/file.rs]
- **Description:** What changes in this file
- **Dependencies:** []
- **Tests:** What tests to write
- **Risks:** What could go wrong

### P2: Second task
- **Files:** [path/to/another.rs]
- **Description:** What changes
- **Dependencies:** [P1]
- **Tests:** Integration test
- **Risks:** Deadlock risk

Personas

Loaded from adversarial-common/personas/:

  • plan-writer.md — reads spec.md + optional findings, writes plan.md
  • plan-challenger.md — reads plan.md, outputs JSON findings (risks, order, gaps)

Exit codes

CodeMeaning
0APPROVED — plan squash-merged
1Infrastructure failure
2Usage error
3REJECT

Integration with dev loop

IMPORTANT: --plan mode is not wired in adversarial-code-loop. Its parser accepts --spec, not a plan file.

Instead, execute each plan step as a separate code loop with a focused per-step spec. See Running plan steps without plan mode for the step-to-spec template, launch pattern, and pre-flight checklist.

# Example: running P1 of a plan
python3 ~/.hermes/skills/adversarial-code-loop/scripts/adversarial_loop.py \
  --spec /path/to/step-P1-spec.md \
  --workdir /path/to/target-repo \
  --dev-cmd "codex exec --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check --sandbox workspace-write" \
  --review-cmd "python3 .../claude-tmux.py --timeout 900 --hard-timeout 1800 --cwd /path/to/target-repo" \
  --timeout 1800 --max-loops 3 --no-arbiter

Steps without dependencies targeting different repos can run in parallel (safe). Parallel on the same repo is forbidden (adversarial-code-loop pitfall #8).

Plan format constraints

  • Plan validation is partial. It checks frontmatter, at least one step, contiguous step IDs, and requirement-ID coverage in the spec. It does NOT enforce step field schemas, parse dependency lists, detect cycles, topologically sort, validate file paths, or verify that review findings are addressed. Most semantic correctness is delegated to the challenger model.

Pitfalls

  • The --findings flag does NOT accept adversarial-review's final.json as-is. That file contains finding counts ({blocker: 1, major: 2}), not finding objects. You must extract structured findings from the review synthesis report and craft a findings.json manually.
  • Each step must have explicit dependencies (or empty list). Circular deps cause validation failure.
  • If review findings are provided via --findings, the plan must address each finding in at least one step.
  • Step order should respect dependencies (enforced manually; no automatic topological sort).
  • The same code patterns as adversarial-code-loop v4: git branch isolation, phase modules, squash merge.
  • For implementation, treat one plan step as one code-loop spec. Run steps in dependency order. Independent steps may run concurrently only when their code loops use different repositories.
  • Plan parser is strict about bullet format. Files and Dependencies must be on a single line: - **Files:** /path1, /path2. Indented sub-lists are NOT parsed.
  • CHALLENGE reads plan.md and spec.md from disk (provider file tools). The orchestrator validates both files are regular files and are UTF-8 decodable before running the phase (fail-fast on FIFOs, device nodes, or binary content).
  • Stash pop may conflict if untracked files (e.g. findings.json) exist in the workdir at pipeline end. Fix: git add the file before launching, or pass --findings from outside the workdir.
  • write_final_json() may crash if stash state is inconsistent at finish time. The squash-merge already succeeded; only the artifact write is lost.

相关技能

Adversarial specification writer. Takes a brief (from grill-me or user) and produces a structured spec.md with YAML frontmatter, requirements, acceptance criteria, and target files. Git-aware pipeline: each run on its own branch, squash-merge on approval.

Multi-perspective adversarial code review with git-isolated worktrees. Two reviewers (Architect + Inspector), cross-validation, and synthesis report. The synthesis is the final arbiter — its verdict takes priority over individual reviewer outputs.

Convert agent execution plans into MADR-format Architecture Decision Records for audit trails and architecture progression. Use when the user asks to create...

15 次安装

Cross-vendor adversarial review. Ship a plan, proposal, or design to a model from a DIFFERENT vendor to attack it; every objection carries a verifiable anchor; the defender rules with an evidence tag on each ruling; the final round classifies into still-disputed / unresolved / verified-consensus instead of forcing agreement; a fresh-session judge is mandatory whenever the outcome looks too clean. Invoke only when the user explicitly asks for an adversarial review by a model from another vendor. One model role-playing several experts is not this skill.

BUILD → REVIEW → (FIX → VERIFY)^N → ARBITER on isolated git branches. Git-native: each loop runs on its own branch, changes are committed, reviews inspect git diffs.

规划 Agent 新框架内容层通用 Pipeline。用于沉淀创编/优化能力分流、会话状态识别、门禁校验、统一输出协议与后续接入约定;当前暂不接 agent-card 路由。