Agent SkillsHmbown/Codewhale › best-of-n

best-of-n

GitHub

用于高价值或模糊任务的多方案并行生成与评审机制。通过定义明确标准,独立生成多个候选解,由评审者依据证据打分选出最优解,确保决策质量与可验证性。

crates/tui/assets/skills/best-of-n/SKILL.md Hmbown/Codewhale

触发场景

需要对比多个可行设计方案 解决存在多种实现路径的复杂调试问题 高风险或关键性的代码实现决策

安装

npx skills add Hmbown/Codewhale --skill best-of-n -g -y
更多选项

非标准路径

npx skills add https://github.com/Hmbown/Codewhale/tree/main/crates/tui/assets/skills/best-of-n -g -y

不安装直接使用

npx skills use Hmbown/Codewhale@best-of-n

指定 Agent (Claude Code)

npx skills add Hmbown/Codewhale --skill best-of-n -a claude-code -g -y

安装 repo 全部 skill

npx skills add Hmbown/Codewhale --all -g -y

预览 repo 内 skill

npx skills add Hmbown/Codewhale --list

SKILL.md

Frontmatter
{
    "name": "best-of-n",
    "metadata": {
        "short-description": "Compare independent candidates"
    },
    "description": "Generate a small set of independent candidate solutions in worktrees, judge them against one explicit rubric, and apply the winner only after PASS verification."
}

Best of N

Use this skill when a consequential design, implementation, explanation, or debugging task has several plausible solutions and comparison is worth the extra model work. In Operate mode this is the preferred ensemble pattern for high-stakes or ambiguous approaches. Do not use it for a tiny change or when the user has already chosen the approach.

Set The Tournament

  1. Define one task, one evidence packet, and one explicit scoring rubric before launching candidates. Include correctness, fit to the request, simplicity, risk, and verification.
  2. Choose N from 2 to 4 for a quick comparison (default 3). For an explicit experimental search, use the Workflow search option: 2–16 live candidates, with larger validated populations queued at the Workflow host's 16-worker concurrency gate rather than launched at once.
  3. Give every candidate the same task and rubric. Add only a candidate number; do not steer candidates toward different conclusions unless diversity is an explicit part of the request.
  4. Prefer a session goal (create_goal or active /goal) when the tournament spans more than one parent turn.

Generate Independently

Start the candidates as parallel background agent workers and return agent_ids immediately so the parent stays free. For proposals, reviews, or research, keep them read-only:

{
  "action": "start",
  "name": "candidate_1",
  "prompt": "Produce candidate 1 for the task below. Return the proposal, evidence, risks, and rubric self-score. Do not edit files.\n\n<TASK AND RUBRIC>",
  "type": "worker",
  "model_strength": "same",
  "write_authority": "read_only"
}

Launch the remaining candidates with the same contract, then use agent wait or completion events to collect every result. Do not show one candidate another candidate's answer before generation finishes.

When candidates must implement code, give each one:

  • type: "builder"
  • worktree: true
  • write_authority: "worktree_write"
  • the same bounded write_roots or exact_files

Never run parallel writers in the parent checkout. Each builder must return the structured candidate contract (candidate id, hypothesis, paths, commands, self-verdict, risks, and artifact references). A self-verdict is evidence to inspect, not a hard-gate result.

Optional diversity: pin different model / Fleet fleet_profile values when the project has multiple capable routes; otherwise keep model strength same.

Judge Once

Use one read-only reviewer worker, or the parent when the result is small, to score all candidates against the original rubric. The judge must:

  • cite evidence from each candidate rather than vote by style;
  • reject candidates that violate authority, scope, or verification gates;
  • treat candidate-reported commands and PASS claims as untrusted until replay;
  • name the winner and the decisive reasons;
  • identify useful pieces worth combining, if any;
  • say when the candidates are tied or all fail.

Do not ask candidates to vote for themselves. Do not silently merge incompatible approaches into a new unreviewed solution.

Integrate Only After PASS

For proposal-only work, return the winning answer with a compact score summary. For code work:

  1. Freeze the baseline, evaluator, hard gates, score rule, and authority before a larger search admits candidates. Any evaluator change starts a revision.
  2. After a worker loses write authority, apply its patch to a clean baseline and let the runtime—not that worker—run hard gates and scoring.
  3. Inspect the winning worktree diff and independently replay it on the clean baseline. A different read-only model may look for gaming, but deterministic tests remain the authority.
  4. Present the verified winner for review. Applying or merging is a separate, explicit user action; NONE is valid when every candidate fails.
  5. Preserve losing and failed candidate receipts as useful negative results.

The checked-in operate_best_of_n.workflow.js recipe supports strategy: "search" for structured 2–16 candidate generation and review. It does not yet turn prompt-listed commands into hidden runtime gates. Do not advertise those gates until the runtime evaluator host consumes a frozen WorkflowSearchSpec.

Stop early when one candidate reveals a hard constraint that invalidates the tournament. Report the negative result rather than spending the remaining budget to manufacture variety.

版本历史

  • 0fe366b 当前 2026-08-16 09:02

    修复提示词中使用的已废弃工具名称(如read_file),替换为正确的内部调度键(如File read),防止模型因无效工具名导致执行失败。

  • b0e4926 2026-07-24 17:42

同 Skill 集合

crates/tui/assets/skills/batch/SKILL.md
crates/tui/assets/skills/contributor-onboarding/SKILL.md
crates/tui/assets/skills/dataviz/SKILL.md
crates/tui/assets/skills/debug/SKILL.md
crates/tui/assets/skills/delegate/SKILL.md
crates/tui/assets/skills/dependency-update/SKILL.md
crates/tui/assets/skills/docx/SKILL.md
crates/tui/assets/skills/feishu/SKILL.md
crates/tui/assets/skills/fleet-manager/SKILL.md
crates/tui/assets/skills/frontend-design/SKILL.md
crates/tui/assets/skills/handoff/SKILL.md
crates/tui/assets/skills/help/SKILL.md
crates/tui/assets/skills/implement/SKILL.md
crates/tui/assets/skills/interview/SKILL.md
crates/tui/assets/skills/mcp-builder/SKILL.md
crates/tui/assets/skills/mcp-discovery/SKILL.md
crates/tui/assets/skills/pdf/SKILL.md
crates/tui/assets/skills/plan/SKILL.md
crates/tui/assets/skills/plugin-creator/SKILL.md
crates/tui/assets/skills/pptx/SKILL.md
crates/tui/assets/skills/research/SKILL.md
crates/tui/assets/skills/review/SKILL.md
crates/tui/assets/skills/security-review/SKILL.md
crates/tui/assets/skills/simplify/SKILL.md
crates/tui/assets/skills/skill-creator/SKILL.md
crates/tui/assets/skills/skill-installer/SKILL.md
crates/tui/assets/skills/test/SKILL.md
crates/tui/assets/skills/v4-best-practices/SKILL.md
crates/tui/assets/skills/verify/SKILL.md
crates/tui/assets/skills/webapp-testing/SKILL.md
crates/tui/assets/skills/xlsx/SKILL.md
docs/skills/codew-release-qa-sweep/SKILL.md
docs/skills/cw-dogfood/SKILL.md
docs/skills/cw-gates/SKILL.md
docs/skills/cw-handoff/SKILL.md
docs/skills/cw-land/SKILL.md
docs/skills/cw-orient/SKILL.md
docs/skills/cw-slice/SKILL.md
docs/skills/gh-assign-issues/SKILL.md
docs/skills/gh-close-issues/SKILL.md
docs/skills/gh-compile-issues/SKILL.md
docs/skills/gh-credit-harvest/SKILL.md
docs/skills/gh-file-issue/SKILL.md
docs/skills/gh-find-prs/SKILL.md
docs/skills/gh-treasure-hunt/SKILL.md
crates/tui/assets/skills/documents/SKILL.md
crates/tui/assets/skills/presentations/SKILL.md
crates/tui/assets/skills/spreadsheets/SKILL.md

元信息

文件数
0
版本
aedb88b
Hash
dc90f575
收录时间
2026-07-24 17:42

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-16 17:00
浙ICP备14020137号-1 $访客地图$