From 6731d96c65a20d9a7facb1b1f48341e48e86a3a9 Mon Sep 17 00:00:00 2001 From: chiguyong Date: Fri, 12 Jun 2026 09:38:37 +0800 Subject: [PATCH] feat(configs): add code_reviewer skill and coding_harness pipeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - code_reviewer.yaml: Verifier Agent skill config for adversarial review with structured output schema for ReviewFeedback format - coding_harness.yaml: Example pipeline with adversarial loop develop → test → review (Worker↔Verifier) → archive --- configs/pipelines/coding_harness.yaml | 63 +++++++++++++++++ configs/skills/code_reviewer.yaml | 99 +++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 configs/pipelines/coding_harness.yaml create mode 100644 configs/skills/code_reviewer.yaml diff --git a/configs/pipelines/coding_harness.yaml b/configs/pipelines/coding_harness.yaml new file mode 100644 index 0000000..30223f5 --- /dev/null +++ b/configs/pipelines/coding_harness.yaml @@ -0,0 +1,63 @@ +name: coding_harness +version: "1.0" +description: "Coding pipeline with adversarial review loop - Worker ↔ Verifier 对抗闭环" + +stages: + # 阶段 1:Developer 编写代码 + - name: develop + agent: developer_agent + action: implement_feature + outputs: + - code + - test_files + timeout_seconds: 600 + retry_count: 1 + + # 阶段 2:Tester 运行测试 + - name: test + agent: tester_agent + action: run_tests + depends_on: + - develop + inputs: + code: "${develop.code}" + test_files: "${develop.test_files}" + outputs: + - test_results + timeout_seconds: 300 + retry_count: 2 + + # 阶段 3:代码审查(对抗模式) + # Worker (developer_agent) 产出 → Verifier (code_reviewer) 审查 → 不通过则打回修复 + - name: review + agent: developer_agent + action: fix_code_issues + verifier: code_reviewer + depends_on: + - test + max_adversarial_rounds: 3 + feedback_mode: "structured+natural" + escalate_on_exhaust: human_approval + inputs: + code: "${develop.code}" + test_results: "${test.test_results}" + outputs: + - final_code + - review_report + timeout_seconds: 900 + + # 阶段 4:归档提交 + - name: archive + agent: archiver_agent + action: commit_and_push + depends_on: + - review + inputs: + code: "${review.final_code}" + timeout_seconds: 120 + continue_on_failure: false + +variables: + target_branch: main + require_approval: true + commit_message_prefix: "feat" diff --git a/configs/skills/code_reviewer.yaml b/configs/skills/code_reviewer.yaml new file mode 100644 index 0000000..fde02e5 --- /dev/null +++ b/configs/skills/code_reviewer.yaml @@ -0,0 +1,99 @@ +name: code_reviewer +agent_type: dynamic_tool_chain +version: "1.0.0" +description: "代码审查 Verifier Agent,用于对抗闭环中的质量门禁" +task_mode: llm_generate +execution_mode: direct +max_concurrency: 5 + +intent: + keywords: ["review", "审查", "code review", "代码审查"] + description: "代码质量审查、逻辑检查、安全漏洞检测" + examples: + - "Review this code for quality" + - "审查这段代码" + - "Check for security vulnerabilities" + +capabilities: + - code_review + - quality_verification + - structured_feedback + +prompt: + identity: "You are a strict code reviewer specializing in quality assessment." + instructions: | + Review the provided code output for: + 1. **Logic correctness** - edge cases, error handling, boundary conditions + 2. **Security vulnerabilities** - injection risks, authentication bypass, data exposure + 3. **Architecture and design** - separation of concerns, design patterns, coupling + 4. **Test coverage** - are tests comprehensive, do they cover edge cases + 5. **Code style and readability** - naming conventions, documentation, complexity + + Return a STRICT structured review in this exact JSON format: + { + "passed": true/false, + "score": 0.0-1.0, + "summary": "Brief natural language summary of review findings", + "issues": [ + { + "severity": "critical|major|minor", + "category": "logic_error|security|style|test_failure|architecture", + "description": "Clear description of the issue", + "location": "file:line if applicable", + "suggestion": "How to fix this issue" + } + ] + } + + Be thorough and specific. If there are no issues, set passed=true and issues=[]. + +llm: + model: "default" + temperature: 0.1 + max_tokens: 2048 + +tools: + - shell + +quality_gate: + required_fields: ["passed", "issues", "summary", "score"] + max_retries: 0 + output_schema: + type: object + required: + - passed + - score + - summary + - issues + properties: + passed: + type: boolean + score: + type: number + minimum: 0 + maximum: 1 + summary: + type: string + minLength: 10 + issues: + type: array + items: + type: object + required: + - severity + - category + - description + properties: + severity: + type: string + enum: ["critical", "major", "minor"] + category: + type: string + enum: ["logic_error", "security", "style", "test_failure", "architecture"] + description: + type: string + minLength: 10 + location: + type: string + suggestion: + type: string