adversarial-agent-verifier
Execute rigorous runtime verification including DAG seam analysis, inspect-before-edit protocols, test contracts, and harsh adversarial reviews. Do not use for superficial linting or rubber-stamping code.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- adversarial-agent-verifier
- description
- Execute rigorous runtime verification including DAG seam analysis, inspect-before-edit protocols, test contracts, and harsh adversarial reviews. Do not use for superficial linting or rubber-stamping code.
02 资源文件 2
- 参考文档CARD.md3.8 KB
- 参考文档config.default.yaml302 B
03 SKILL.md 正文
Adversarial Agent Verifier
adversarial-agent-verifier is the quality assurance and adversarial verification engine for agentic workflows. Because AI models default to polite, non-critical feedback and generate code with subtle seam vulnerabilities in up to 40% of cases, this engine enforces the Adversarial Verification Protocol: non-modifying inspection, DAG-based seam analysis (Michael Feathers seams), test-driven contracts, harsh rubric scoring (1–10 severity scale), and clean-up audits.
Every adversarial verification session executes this five-stage progression:
[1. Inspect-Before-Edit Seam Triage] → [2. DAG Component Seam Analysis] → [3. Test-Driven Contract Authoring] → [4. Minimal-Diff Implementation] → [5. Adversarial Review & Clean-Up Commit]
See CARD.md for the companion summary card, prompt catalog, and verification rubrics.
Consult /code-review for PR standards and /questio-reflection for Aquinas-style adversarial reflection.
1. Inspect-Before-Edit Seam Triage
Halt immediate code modification and force repository inspection before writing changes:
┌─────────────────────────────────────────────────────────────┐
│ INSPECT-BEFORE-EDIT PROTOCOL │
├─────────────────────────────────────────────────────────────┤
│ 1. Locate: Which files control the target subsystem? │
│ 2. Trace: Where does the root cause / edge case live? │
│ 3. Inventory: What existing tests cover this boundary? │
│ 4. Boundary: What is the smallest safe diff to fix it? │
│ 5. Constraint: Modify ZERO files until summary is approved. │
└─────────────────────────────────────────────────────────────┘
- Execute Inspection Prompt:
- For non-trivial bugs or refactors, enforce the inspect-first directive:
"Before editing any files, inspect the repository and summarize: (1) which files control this subsystem, (2) where the bug likely lives, (3) what tests cover this area, and (4) the smallest safe change. Do not modify files until after this summary."
- For non-trivial bugs or refactors, enforce the inspect-first directive:
- Prevent Shotgun Editing:
- Prevent the failure mode where the agent creates 10 unnecessary files in the wrong location because it acted before locating the architectural seam.
Completion criterion: Non-modifying inspection summary produced, identifying root cause file, covering tests, and smallest safe diff.
2. DAG Component Seam Analysis
Model application workflows as Directed Acyclic Graphs (DAGs) to identify high-risk component boundaries (Michael Feathers seams):
- Map System Workflow as a DAG:
- Identify nodes (data models, service handlers, database adapters, API routes).
- Identify directed edges (function calls, network requests, message bus events).
- Isolate Seam Vulnerabilities:
- Pinpoint high-risk seams where components interface:
- Serialization/Deserialization boundaries.
- Database transaction boundaries and rollbacks.
- External network calls and timeout handling.
- Permission and compliance gates.
- Markdown token delimiter boundaries (parsing commands or references wrapped in backticks
`or brackets[).
- Pinpoint high-risk seams where components interface:
- Generate Seam Opportunity Table:
- Produce a prioritized table of integration test opportunities ranked by risk and blast radius.
| Seam ID | Origin Node | Destination Node | Risk Factor | Proposed Test Assertion |
| :--- | :--- | :--- | :--- | :--- |
| S-01 | AuthHandler | TokenService | Token Expiry Race | Expired token returns 401, not 500 |
| S-02 | PaymentEngine | LedgerDB | Transaction Abort | Failed stripe charge rolls back ledger row |
Completion criterion: Workflow DAG mapped and prioritized Seam Opportunity Table generated.
3. Test-Driven Contract Authoring
Make tests the immutable contract before writing production code:
- Author Failing Tests First (Red Stage):
- Write unit or integration tests that precisely reproduce the reported bug or assert the new feature behavior.
- Run the test suite to confirm tests fail with the expected error.
- Lock the Test Contract:
- Do not modify the test assertions during implementation unless the test specification itself is demonstrably flawed.
- Execution Directive:
"Write failing tests first for this bug. Confirm they fail. Then implement the smallest fix. Do not modify the tests after implementation. Run the relevant test suite before finishing."
Completion criterion: Failing tests authored, failure mode confirmed, and test contract locked.
4. Minimal-Diff Implementation
Implement the fix strictly bounded by the test contract and architectural constraints:
- Smallest Safe Diff:
- Restrict code modifications exclusively to the located root cause seam.
- Avoid speculative abstractions, unnecessary helper classes, or refactoring unrelated files.
- Dependency Guardrail:
- Zero new production dependencies without prior review.
- Run Feedback Loop:
- Execute the targeted test suite against the change.
- Read tracebacks, isolate regressions, and refine until all tests pass green.
Completion criterion: Minimal code diff implemented; 100% of targeted and regression tests passing green.
5. Adversarial Review & Clean-Up Commit
Cut through polite AI praise by running harsh adversarial code reviews and clean-up audits:
┌─────────────────────────────────────────────────────────────┐
│ THE ADVERSARIAL REVIEW RUBRIC │
├─────────────────────────────────────────────────────────────┤
│ 1. Harsh Severity Scale: Grade the diff from 1 (broken) to │
│ 10 (bulletproof). Assume adversarial production traffic. │
│ 2. Failure Mode Hunt: Identify uncaught exceptions, leaks, │
│ missing index joins, race conditions, or silent errors. │
│ 3. Actionable Git Diff: Provide exact patch diffs to fix │
│ every identified flaw immediately. │
└─────────────────────────────────────────────────────────────┘
- Execute Harsh Adversarial Review:
- Review the final diff against the 8-point checklist:
- [ ] Did it solve the exact problem requested?
- [ ] Did it change unrelated behavior?
- [ ] Did it add unnecessary abstraction?
- [ ] Did it introduce security or permission vulnerabilities?
- [ ] Did it hide/swallow errors instead of handling them?
- [ ] Did it update all relevant tests?
- [ ] Did it follow project conventions?
- [ ] Can the diff be made smaller and simpler?
- Review the final diff against the 8-point checklist:
- Clean-Up Commit Audit:
- Hunt for left-over
TODO,FIXME, debuggingprint()statements, and unhandled edge cases. - Strip all debugging debris before finalizing.
- Hunt for left-over
Completion criterion: Adversarial review completed with severity scoring, zero debugging debris remaining, and clean-up commit ready.
In-File Reference: The 5 Must-Run Verification Prompts
Prompt 1: The Adversarial Reviewer
Review this git diff critically on a scale of 1 to 10. Do not give polite compliments.
Act as an uncompromising principal engineer hunting for production outages, race conditions,
swallowed exceptions, unindexed queries, and subtle edge-case failures.
For every issue found, explain why it will fail and provide the exact git diff to fix it.
Prompt 2: The DAG Seam Hunter
Analyze the components touched in this change as a Directed Acyclic Graph (DAG).
Identify all component seams (boundaries between modules, network interfaces, and database writes).
Generate a prioritized table of the 3 most critical edge-case failure modes at these seams
and output the test code required to verify them.
Prompt 3: The Edge-Case & Clean-Up Hunter
Inspect the current branch for:
1. Forgotten TODO or FIXME comments.
2. Debugging logs or console prints left behind.
3. Edge cases on non-happy paths that lack unit test coverage.
Output a clean-up checklist and provide the exact tests for any missing edge cases.
The Three Foundational Pillars
1. The Visual Brief
Synthesize findings, structural matrices, and execution DAGs into a self-contained HTML visual brief written to %TEMP%\adversarial-agent-verifier-<timestamp>.html (or /tmp/adversarial-agent-verifier-<timestamp>.html on Unix) loading Tailwind CSS and Mermaid.js via CDN. Present the absolute clickable path to the user for visual review.
2. The Mandatory Checkpoint
When proposing structural modifications, refactors, or execution pipelines, always author an implementation_plan.md artifact with RequestFeedback: true. The agent must STOP and wait for explicit human confirmation before executing mutating actions.
3. Explicit Anti-Patterns
Rigid behavioral boundaries must be maintained to prevent catastrophic failure modes.
Anti-Patterns
- Polite Rubber-Stamping — Accepting pleasant LLM responses ("Looks great, clean code!") without demanding failure mode analysis.
- Shotgun Editing — Modifying multiple files across the codebase before inspecting the repository architecture.
- Moving the Goalposts (Test Mutation) — Modifying test assertions to make a flawed implementation pass instead of fixing the code.
- Debugging Debris Pollution — Leaving temporary print statements, comments, or commented-out code in final commits.
- Speculative Complexity — Introducing complex design patterns or unrequested dependencies for simple bug fixes.
04 同仓库更多 Skills
ui-behavior-primitive-architect
Architect, audit, and verify zero-dependency headless UI behavior primitives, WebMCP agent bridges, WAI-ARIA/SSR/RTL tri-modal checks, and framework expert routing. Do not use for static CSS theme styling or backend database migrations.
trustgraph-ontology-governor
Govern knowledge graphs, SHACL-AF triple policies, OntologyRAG subclass validation, PROV-O dual named graphs, and Laya entropy decision scoring. Do not use for relational SQL queries or generic web scraping.
shim-harness-governor
Govern universal CLI agent loops, 4-tier tool permissions, ancestor-symlink workspace sandboxes, deterministic-first command routing, collision-safe MCP namespacing, and layered skill loading. Do not use for static UI styling or external SQL analytics.
graphiti-zep-memory-governor
Govern bi-temporal knowledge graphs with Graphiti future-edge clamping, MinHash/LSH entity dedup, RRF/MMR reranking, and Zep typed ontologies. Do not use for static SQL joins or generic web crawling.
agora-mcp-workbench-architect
Architect, audit, and orchestrate Agora Workbench MCP servers, loopback sidecars, unified state graphs, gateway/dispatcher connectors, and policy-enforced data lakes. Do not use for static frontend CSS styling or non-MCP desktop GUI automation.
skill-eval-assurance-runner
Evaluate and assure agent skills using small-N Wilson confidence intervals, unbiased pass^k reliability, deterministic trajectory graders, preflight boundary honesty, and sealed digest verification. Do not use for subjective prose review or unconstrained production deployment.