Logo Agent Optimize

Agent Optimize

Tổ chức
skillberry-ai
agent-optimize

Thuật toán tối ưu hóa tự do cho chế độ điều phối tác nhân: tác nhân hội thoại phụ trách toàn bộ quá trình tìm kiếm — đọc bản tóm tắt, đề xuất các chỉnh sửa năng lực lớn và nhất quán dựa trên giả thuyết về các cụm lỗi, chỉ kiểm tra những ô còn thiếu, quyết định giữ hoặc loại bỏ dựa trên hậu nghiệm, kết hợp các nhánh bổ trợ cho nhau và chỉ chốt kiểm thử một lần. Dùng khi orchestration_mode là agent và algorithm_skill là agent-optimize. Để dùng vòng lặp xác định, hãy chọn hill-climb, gepa hoặc skillopt.

Add to TypingMind

Tổng quan

Nhà phát hànhskillberry-ai
Kho mãcap-evolve
Tên kỹ năngagent-optimize
Sao
67
Bản fork
18
Tệp đi kèm
49
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 49 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được skillberry-ai công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Agent Optimize trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/skillberry-ai/cap-evolve/tree/main/skills/algorithms/agent-optimize
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

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
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Agent Optimize trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Agent Optimize ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Agent Optimize với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

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).

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Agent Optimize làm được gì?

Thuật toán tối ưu hóa tự do cho chế độ điều phối tác nhân: tác nhân hội thoại phụ trách toàn bộ quá trình tìm kiếm — đọc bản tóm tắt, đề xuất các chỉnh sửa năng lực lớn và nhất quán dựa trên giả thuyết về các cụm lỗi, chỉ kiểm tra những ô còn thiếu, quyết định giữ hoặc loại bỏ dựa trên hậu nghiệm, kết hợp các nhánh bổ trợ cho nhau và chỉ chốt kiểm thử một lần. Dùng khi orchestration_mode là agent và algorithm_skill là agent-optimize. Để dùng vòng lặp xác định, hãy chọn hill-climb, gepa hoặc skillopt.

Vì sao nên dùng Agent Optimize trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Agent Optimize là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Agent Optimize trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/skillberry-ai/cap-evolve/tree/main/skills/algorithms/agent-optimize. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Agent Optimize?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Agent Optimize với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Agent Optimize với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Agent Optimize có miễn phí không?

Có. Kỹ năng này được skillberry-ai phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇