跳到主要内容
知仓学习社ZHICANG

optim-agent

Use when the user wants to optimize configurable system parameters against a measurable scalar objective, especially for model training, inference, …

写文件读凭据执行命令联网读文件严重 0 · 高危 25Optim-Agent/optim-agent

它会碰到什么

扫了多少240 个文本文件,1546 KB
它会碰到什么写文件读凭据执行命令联网读文件
命中总数67 处
命中统计严重 0 · 高 25 · 中 8 · 低 34
逐条看命中(25 条严重或高危)
  • docs/superpowers/plans/2026-07-14-paper-overview-diagram.md:132fs-destructive
    rm -rf /tmp/pdfs/optim-agent-paper
  • docs/superpowers/plans/2026-07-14-skill-hub-distribution.md:110fs-destructive
    rm -rf /tmp/optim-agent-clawhub
  • examples/cifar10.py:100cred-envread
    if os.environ.get("OPTIM_AGENT_CUDA_COMPAT") == "1":
  • examples/cifar10.py:112cred-envread
    env["OPTIM_AGENT_CUDA_COMPAT"] = "1"
  • examples/cifar10.py:113cred-envread
    env["LD_PRELOAD"] = str(lib) + (":" + env["LD_PRELOAD"] if env.get("LD_PRELOAD") else "")
  • examples/cifar10.py:113cred-envread
    env["LD_PRELOAD"] = str(lib) + (":" + env["LD_PRELOAD"] if env.get("LD_PRELOAD") else "")
  • examples/cifar10.py:281exec-spawn
    model.eval()
  • examples/mnist.py:100cred-envread
    if os.environ.get("OPTIM_AGENT_CUDA_COMPAT") == "1":
  • examples/mnist.py:112cred-envread
    env["OPTIM_AGENT_CUDA_COMPAT"] = "1"
  • examples/mnist.py:113cred-envread
    env["LD_PRELOAD"] = str(lib) + (":" + env["LD_PRELOAD"] if env.get("LD_PRELOAD") else "")
  • examples/mnist.py:113cred-envread
    env["LD_PRELOAD"] = str(lib) + (":" + env["LD_PRELOAD"] if env.get("LD_PRELOAD") else "")
  • examples/mnist.py:286exec-spawn
    model.eval()
  • optim_agent/agent.py:46cred-envread
    env["PWD"] = cwd
  • optim_agent/agent.py:47cred-envread
    env["OLDPWD"] = cwd
  • optim_agent/agent.py:48exec-spawn
    proc = subprocess.run(
  • scripts/check_public_readiness.py:22exec-spawn
    return subprocess.run(
  • scripts/verify_classification_cumulative_error.py:106exec-spawn
    proc = subprocess.run(command, cwd=ROOT, capture_output=True, text=True)
  • tests/test_optim_agent.py:107exec-spawn
    result = subprocess.run(
  • tests/test_optim_agent.py:838exec-spawn
    original = agent.subprocess.run
  • tests/test_optim_agent.py:844exec-spawn
    agent.subprocess.run = fake_run
  • tests/test_optim_agent.py:851exec-spawn
    agent.subprocess.run = original
  • tests/test_public_readiness.py:56cred-envread
    env["PYTHONPATH"] = str(ROOT)
  • tests/test_public_readiness.py:57exec-spawn
    result = subprocess.run(
  • tests/test_public_readiness.py:110exec-spawn
    result = subprocess.run(
  • tests/test_public_readiness.py:122exec-spawn
    result = subprocess.run(

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

optim-agent

Act as the sampler inside any coding-agent session: Claude Code, Codex,

OpenCode/OpenClaw, or another agent that can read project files and run shell

commands. Read the project to understand parameter meaning and interactions,

propose one configuration, run the real evaluator, and record the result

through optim-agent's ask/tell API. Let the measured objective, not the agent's

intuition, decide what works.

Load the workflow

Use this file as the operating guide for the active coding agent. In Codex, it

can be installed directly from GitHub:

$skill-installer install https://github.com/Optim-Agent/optim-agent

In Claude Code, OpenCode/OpenClaw, or another coding-agent environment, place

this repository or SKILL.md in the agent-visible workspace and ask the agent

to follow the optim-agent workflow. The workflow does not depend on Codex-only

APIs; it needs file access, shell access, and Python.

Ensure the Python package is importable. Choose one source; do not install both:

# Stable release from PyPI
python -m pip install optim-agent

# Latest source from GitHub
python -m pip install "optim-agent @ git+https://github.com/Optim-Agent/optim-agent.git"

For a reproducible GitHub install, append @<tag-or-commit> after .git.

Workflow

  1. Understand the system. Read the evaluation entry point and every file

that defines the target parameters. Record each parameter's type, legal

range, semantics, interactions, and operational constraints.

  1. Define the experiment. Confirm the scalar objective, minimize or

maximize, trial budget, evaluation command, runtime/cost limit, and fixed

workload or seed. For multiple metrics or hard constraints, agree on one

scalar feasibility or penalty rule before running trials.

  1. Establish a baseline. Evaluate the current/default configuration with the

same command and environment used for every later trial.

  1. Initialize or resume. Keep artifacts in the repository's ignored

.optim-agent-runs/ directory:

   if git rev-parse --git-dir >/dev/null 2>&1 && ! git check-ignore -q .optim-agent-runs/; then
     printf '/.optim-agent-runs/\n' >> "$(git rev-parse --git-path info/exclude)"
   fi
   from pathlib import Path
   import optim_agent as oa

   run_dir = Path(".optim-agent-runs")
   run_dir.mkdir(exist_ok=True)
   study = oa.create_study(
       direction="minimize",
       storage=run_dir / "skill-study.json",
       seed=0,
   )
   print([(t.params, t.value, t.state) for t in study.trials])
  1. Run one informed trial. Choose parameters from code understanding and all

completed history, then use explicit ask/tell:

   params = {"threshold": 0.72, "budget": 80}
   trial = study.ask(params)
   try:
       value = evaluate_system(**trial.params)
   except Exception:
       study.tell(trial, state="failed")
       raise
   else:
       study.tell(trial, value)

For a deliberately stopped trial, report the latest valid intermediate

metric first, then call study.tell(trial, state="pruned").

  1. Select the next point. Avoid accidental repeats, explore broadly before

exploiting, respect bounds and constraints, and treat failed regions as

evidence. If the evaluator is noisy, repeat promising configurations under

the same workload before declaring a winner.

  1. Stop and report. Stop at the approved budget or stopping condition.

Report the baseline, best value and parameters, trial count, failed/pruned

trials, convergence trend, and exact reproduction command.

Recovery

JSON storage records a trial when study.tell runs. Before launching an

expensive external evaluation, save its parameters, command, and output path in

a per-trial directory under .optim-agent-runs/. After interruption, inspect

that output before rerunning: if a valid result exists, recreate the same point

with study.ask(params) and record it; otherwise rerun it deliberately.

Use SQLite storage (skill-study.db) only when the user explicitly wants

multiple processes. Sequential trials are the default because each proposal

should use the complete prior history.

Rules

  • Use ask/tell in skill mode; do not delegate proposal selection to

AgentSampler when the session agent is meant to read and reason over code.

  • Keep evaluation inputs and outputs isolated from production configuration.
  • Never fabricate, infer, or manually improve an objective value.
  • Record crashes as failed; record intentional early stops as pruned.
  • Preserve the study and trial artifacts so the result is auditable and resumable.
  • Do not tune secrets, credentials, or unbounded parameters.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

它属于哪个仓库

星标★ 939
本站分层T2
该仓技能数3
原文件路径SKILL.md

同一个仓库里的其他技能

看这个仓库的全部 3 个技能

同名技能的其他版本

有 3 个不同仓库或目录里都有叫 optim-agent 的技能。它们内容并不相同,别混用:

  • Optim-Agent/optim-agent — Use when optimizing configurable system parameters against a measurable scalar objective.
  • Optim-Agent/optim-agent — Use when optimizing configurable system parameters against a measurable scalar objective.