Agent Optimize 标志

Agent Optimize

组织
skillberry-ai
agent-optimize

适用于智能体编排模式的自由形式优化算法:对话式智能体负责整个搜索过程——读取摘要,根据失败簇假设提出大幅且连贯的能力修改,只探测缺失项,根据后验结果进行晋级或剪枝,合并互补分支,并仅在最后封定测试。仅在 orchestration_mode 为 agent 且 algorithm_skill 为 agent-optimize 时使用。若要使用确定性循环,请改用 hill-climb、gepa 或 skillopt。

Add to TypingMind

概览

发布者skillberry-ai
代码仓库cap-evolve
技能名称agent-optimize
星标数
67
复刻数
18
附带文件
49
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 49 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 skillberry-ai 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Agent Optimize AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/skillberry-ai/cap-evolve/tree/main/skills/algorithms/agent-optimize
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/skillberry-ai/cap-evolve.git /tmp/cap-evolve
mkdir -p .claude/skills
cp -r /tmp/cap-evolve/skills/algorithms/agent-optimize .claude/skills/agent-optimize
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Agent Optimize,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Agent Optimize。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Agent Optimize 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

agent-optimize — the loop you own

You are the optimizer. cap-evolve run (agent mode) does check -> baseline and hands you R. Everything else is six act.py verbs and one digest.py; the scripts decide, you judge.

Honest statistics (read twice)

  1. Noise sd of a full-val mean is ~0.05 (30 tasks x 3 trials): only big effects are resolvable. Never re-test a within-noise delta; make a bigger edit instead.
  2. Never view test traces. Test is sealed, scored ONCE at finalize, and development-exposed after use.

Details only when needed: references/stats.md.

Setup

The loop REQUIRES the new engine. Put this in capevolve.yaml (or export CAPEVOLVE_<NAME>=1):

yaml
optimizer:
  ablation: {dag_parallel: true, active_eval: true, smart_merge: true, cost_gating: true,
             failure_clustering: true, pregate: true, context_digest: true}

Stock default has active_eval OFF: probe --auto then silently runs FULL val. The digest prints !! CONFIG: ... at the top (after any INFRA line) when any switch is off; fix it before looping. Switches: references/ablation.md.

bash
R="<run_dir from the handoff>"; P="<project dir>"
S="${CAPEVOLVE_SKILLS_DIR:?set to the skills/ dir}"; A="$S/algorithms/agent-optimize/scripts"
mkdir -p "$R/work"
python "$A/spend.py" --run-dir "$R" --project "$P"      # parses stop_condition; ask the user if constraints.ambiguous
python "$A/digest.py" --run-dir "$R" --project "$P"     # first line must NOT start with "!! CONFIG"
BEST=$(python "$A/digest.py" --run-dir "$R" --project "$P" --format json | python -c 'import json,sys;print(json.load(sys.stdin)["champion"]["id"])')

BEST is the digest's champion (re-read it after every promote). Read once: PROJECT.md, capevolve.yaml, the adapter, the files under capability_path, optimizer/INSTRUCTIONS.md if present (benchmark facts only; ignore its "one edit" advice).

The loop

bash
python "$S/phases/diagnose/scripts/run.py" --run-dir "$R" --tag "$BEST" --split val --cluster v2 > /dev/null
python "$A/digest.py" --run-dir "$R" --project "$P"

Diagnose writes a SLIM $R/clusters.json (ids, labels, exemplar trace ids) and the heavy clusters_full.json. Never cat/Read clusters_full.json (MBs of embedded traces).

  1. Digest. One screen: budget, noise, clusters (with hypothesis status), branch tips (posterior, coverage, P(beat parent/champion)), merge opportunities, pregate warnings, suggestions. Act on it.
  2. Read RAW evidence for the chosen cluster's exemplar trials: full tool-call args and the full conversation, never clips. Split deterministic tool bugs (fix in code) from policy failures. references/forensics.md has the dump command and subagent hand-off.
  3. Pick a hypothesis covering >= 2 tasks (or headroom >= 0.06), or a deterministic tool bug. Write it to a JSON file (references/clusters.md for the schema).
  4. Make a BIG coherent edit under work/TAG: policy and tools together when the failure needs both. General rules only, never a task id or answer. No single-task edits (their ceiling is below noise). Never hide write calls inside a composite tool. Form by failure type: references/tool-edit-lessons.md.
  5. Propose, probe, decide:
bash
python "$A/act.py" propose cand_1 --run-dir "$R" --project "$P" --parent "$BEST"     # 1st call: creates work/cand_1
python "$A/act.py" propose cand_1 --run-dir "$R" --project "$P" --parent "$BEST" --hypothesis-file "$R/work/h1.json"   # 2nd: rule + pre-gate + record
python "$A/act.py" probe cand_1 --run-dir "$R" --project "$P" --auto --plan          # missing cells, spends nothing
python "$A/act.py" probe cand_1 --run-dir "$R" --project "$P" --auto --n 3 --budget 60
python "$A/act.py" promote cand_1 --run-dir "$R" --project "$P"                      # needs full-val coverage
python "$A/act.py" prune cand_1 --run-dir "$R" --project "$P" --reason "<why>"

Pre-gate failure: fix the edit (the text says what), propose again. Probe runs only cells the ledger lacks, on the hypothesis tasks plus sentinels (--tasks a,b to choose). The digest posterior says promote (P(beat champion) high at full coverage), prune (clearly worse) or continue (probe more). promote that does not accept leaves the node alive; best_id does not move. Full-val probes need --yes. When the budget is EXHAUSTED even propose refuses (--over-budget REASON is recorded). Before each promote/prune append ## Iteration TAG to work/TAG/JOURNAL.md: what changed (file -> cluster), expected effect, what the numbers said, next focus. 6. Merge complementary branches (digest merge_opps):

bash
python "$A/act.py" merge cand_1 cand_2 --run-dir "$R" --project "$P" --tag cand_m

then probe and promote cand_m like any node. references/merge.md. 7. Repeat from the digest until it says stop (budget, goal met, or stop_condition). Then finalize.

Conductor engine (opt-in: ao_engine: conductor)

With ao_engine: conductor in orchestration_mode: agent, cap-evolve run starts scripts/conductor.py supervise instead of handing the loop to a conversational agent. Code runs a tick loop (reap, promote, merge or rebase, rungs, propose, stop); the LLM only runs bounded one-shot jobs (propose, merge-resolve) with a per-job token cap, and never polls or waits. Evaluations are chunked (ao_chunk, default 20 rollouts) in a shared slot pool, with promotion_rule: P2 going through the shared P2 evaluator. State is graph.jsonl plus conductor.json; a killed run resumes and finalize is idempotent. Stopping is structured only (rollouts, tokens, wall deadline_utc, stop_at_reward, plateau with a floor); prose in stop_condition is never parsed into a cap. A cost objective (minimize) adds cost per success: promote on reward with cost per success at most eps (default 0.10) worse, or on cost per success at least eps lower with reward non-inferior. Any other gating objective is refused (exit 2). ao_focus: true judges a candidate only on the champion's failing tasks plus ao_focus_canary passing ones (1-3 trials), with a stratified full-set gain; it promotes directly (no full-val screen or fresh confirm), gives proposers the parent's pass rates and failing traces, merges near misses, and runs one fresh full-val estimate at finalize. With K=1, rungs off and merge off it makes the same decisions as hill-climb. When PR-3 helper checks are importable and helpers.enabled, each proposal gets lint_candidate and run_smoke before any rollout. Without the flag, nothing here runs and the loop below is unchanged.

If the digest says X, do Y

digest saysdo
cluster open, >= 2 tasks or headroom >= 0.06hypothesis + big edit + propose
cluster stuck (2 failed attempts)re-read raw full traces (never test), change the edit FORM, not wording
same tool-error signature across tasksfix it in tool code; no multi-task argument needed
pregate warning (tool fixture fails, policy growth)fix before any probe; it is free
same procedure fails or is redone by hand in >= 2 distinct traces, surface allows scriptscodify it into a helper (references/helpers.md); 1 trace never justifies one
tip at full coverage, P(beat champion) highpromote
tip P(beat parent) low after full probeprune with the numbers
tip partial coverage, undecidedprobe --auto for more cells
gate verdict inconclusive (low coverage / unstable)not a reject: probe more cells (legacy commit.py --decision inconclusive); never prune on it
delta within noise (noise.sd_est)do not re-test; make a bigger or different edit
noise.stalebuy a seed duplicate probe, then re-read noise
merge_opps listedmerge, probe the union of wins, promote
budget EXHAUSTEDstop; finalize (spending verbs refuse; --over-budget REASON is recorded)
infra warningsread them; --strict makes them refusals
objectives / cost constraintsreferences/objectives-cost.md
need to turn a switch off or run legacyreferences/ablation.md

Finalize (once)

bash
python "$A/act.py" finalize --run-dir "$R" --project "$P" --n-confirm 3
python "$S/phases/report/scripts/run.py" --run-dir "$R"

Confirms the champion on full val with fresh seeds, tests it against the seed, seals test ONCE, writes final.json. If the confirm does not accept, finalize refuses to seal (--seal-anyway REASON records "no accepted change"). Report refusals unsoftened: best_id == seed is a null result with a diagnosed cause; an empty split is empty, not 0.0; a no-holdout spec is a FIT metric. No finalize, no result.

Invariants

Core enforces the split seal, val-only gating and the tamper guard. Yours: never hand a subset result to gate_check.py; every round leaves run-dir artifacts (JOURNAL.md entry in work/TAG, DIAGNOSIS.json); report a broken framework file, do not work around it. Wait for finalize to exit or the seal is wasted.

References

One level deep; load only when the digest points there.

  • references/forensics.md — raw-trace dump, subagent diagnosis, composite-tool pitfall. Load before your first edit and when stuck.
  • references/clusters.md — hypothesis schema, per-task rates. Load when picking or writing a hypothesis.
  • references/merge.md — merge flow and conflicts. Load when merge_opps is non-empty.
  • references/objectives-cost.md — cost gating, budget, stop_condition. Load when objectives are set or budget is tight.
  • references/ablation.md — the seven switches. Load before disabling any.
  • references/tool-edit-lessons.md — edit forms, guard closure. Load before editing a surface the first time or after a stuck cluster.
  • references/helpers.md — when to codify a procedure into a deterministic helper, and the lint/smoke it must pass. Load when the surface allows scripts and a procedure recurs.
  • references/stats.md — what the numbers resolve, sign test. Load when a result surprises you.
  • references/legacy.md — all switches off: pointer to the archived round-loop docs. Load only in legacy mode (old SKILL sections live in docs/archive/agent-optimize-legacy/legacy-SKILL.md).

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Agent Optimize AI 技能有什么作用?

适用于智能体编排模式的自由形式优化算法:对话式智能体负责整个搜索过程——读取摘要,根据失败簇假设提出大幅且连贯的能力修改,只探测缺失项,根据后验结果进行晋级或剪枝,合并互补分支,并仅在最后封定测试。仅在 orchestration_mode 为 agent 且 algorithm_skill 为 agent-optimize 时使用。若要使用确定性循环,请改用 hill-climb、gepa 或 skillopt。

为什么在 TypingMind 中使用 Agent Optimize?

因为您只需安装一次,就能搭配任何模型使用。Agent Optimize 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Agent Optimize?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/skillberry-ai/cap-evolve/tree/main/skills/algorithms/agent-optimize。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Agent Optimize?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Agent Optimize 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Agent Optimize 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Agent Optimize AI 技能免费吗?

是的。skillberry-ai 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇