ax-agent-optimize

ax-agent-optimize is a skill for Claude Code, Codex from ax-llm/ax. It costs 57 tokens per session (4,156 once invoked), scanned A, original, Apache-2.0.

A guide for tuning and evaluating AxAgent behavior with example tasks and judging criteria. It can help optimize how an agent responds, uses tools, delegates work, or balances trade-offs.

In plain words
What is it for?
Use it to create agent evaluation datasets, score outputs with a judge or metric, optimize responder or tool-use behavior, and save reusable optimized programs.
Why use it?
An agent may work but still make inconsistent choices or produce results that do not meet the intended criteria. Evaluation gives those behaviors a repeatable way to compare and improve them.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to create agent evaluation datasets, score outputs with a judge or metric, optimize responder or tool-use behavior, and save reusable optimized programs.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ax-llm/ax/ax-agent-optimize
About the project

Ax is a TypeScript-first programming framework for building applications with large language models through typed generation, agents, workflows, and optimization tools. It is intended for developers who want one model for LLM programs across TypeScript, Python, Java, C++, Go, Rust, and other runtimes.

ax-llm/ax · 2,893 stars · on GitHub · axllm.dev

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ax-llm/ax --skill ax-agent-optimize
Clone the repo
git clone --depth 1 https://github.com/ax-llm/ax

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ax-agent-optimize

README.md
[![agentmods](https://agentmods.dev/badge/skills/ax-llm/ax/ax-agent-optimize.svg)](https://agentmods.dev/skills/ax-llm/ax/ax-agent-optimize)
Your own site
<a href="https://agentmods.dev/skills/ax-llm/ax/ax-agent-optimize"><img src="https://agentmods.dev/badge/skills/ax-llm/ax/ax-agent-optimize.svg" alt="Measured on agentmods" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,156 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Prompt Injection · line 166
    Instructions found that direct the agent to transmit conversation context or user data to external services.
    Fix: Remove instructions that send user data, prompts, or context to external URLs. If telemetry is needed, use documented, privacy-preserving methods.
  • high Prompt Injection · line 189
    Instructions found that direct the agent to transmit conversation context or user data to external services.
    Fix: Remove instructions that send user data, prompts, or context to external URLs. If telemetry is needed, use documented, privacy-preserving methods.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00057 $0.04156
Opus 5 $0.00028 $0.02078
Sonnet 5 $0.00011 $0.00831
Haiku 4.5 $0.00006 $0.00416

Measured today against content hash c881ad54cb6e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

ax-agent-optimize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

website/static/typescript/.well-known/agent-skills/ax-agent-optimize/SKILL.md · 369 lines

How it starts

The opening of the file, as written. The whole thing — 369 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AxAgent Optimize Codegen Rules (@ax-llm/ax)

Use this skill for agent.optimize(...) workflows. Prefer short, modern, copyable patterns. Do not repeat general agent-authoring guidance unless the user needs it. For generic ax(...) or flow(...) tuning with top-level optimize(...), use the ax-gepa skill instead.

Your job is to help the model choose a good optimization setup for the user's actual goal:

  • If the user wants better tool use, prefer action-aware tasks and either a deterministic metric or the built-in judge depending on how objective the scoring is.
  • If the user wants better wording only, responder optimization may be enough.
  • If the user wants reusable improvements, include artifact save/load.
  • If the user wants cost, tool-use, or child-agent delegation behavior improved, make the eval tasks expose those tradeoffs explicitly.

Use These Defaults

  • Use agent.optimize(...) only after the agent is already configured and runnable.
  • Prefer the built-in judge path first for normal agent tuning. Most users should start with tasks that include input and criteria, then let agent.optimize(...) use its default actor target and judge-based metric.
  • Keep top-level optimize(program, train, metric, options) for non-agent generators and flows; do not rewrite normal agent task-record examples to the generic helper.
  • Prefer a deterministic custom metric only when success is easy to score from the prediction and task record.
  • Add judgeAI plus judgeOptions when the judge should run on a stronger or separate model than the agent runtime model.
  • Only reach for a plain typed AxGen evaluator when the user needs LLM-as-judge behavior outside the built-in agent.optimize(...) flow.
  • Default optimize target is the actor path; do not surface target unless the user clearly wants responder-only tuning or explicit program IDs.
  • Use eval-safe tools or in-memory mocks because optimization replays tasks many times.
  • Prefer precise tool return schemas such as f.object(...) over vague f.json(...) whenever the agent must reason about returned fields.
  • Prefer task wording with canonical entity names like "the Atlas project" instead of ambiguous labels like "Atlas" when ambiguity could trigger pointless clarification.
  • Save artifacts with axSerializeOptimizedProgram(result.optimizedProgram!), then restore with axDeserializeOptimizedProgram(saved) and agent.applyOptimization(...).
  • For browser-safe persistence, let the caller store the serialized JSON anywhere they want such as localStorage, IndexedDB, or a backend.
  • If bootstrap is enabled, bootstrapped demos are persisted inside result.optimizedProgram.demos; raw failed traces are not saved in v1.
  • Auto-promoted context fields (large undeclared inputs kept runtime-only by autoUpgrade) appear in captured traces/demos as their truncated preview string, not the full value — same as declared truncate-style contextFields. This is expected; do not treat the shortened value as a bug in the saved demos.
  • For first examples, pass a plain task array instead of splitting into train and validation unless the user already has a holdout set.
  • GEPA-backed agent.optimize(...) now optimizes generic components exposed by the selected target programs; target: 'actor' only tunes actor components, target: 'responder' only tunes responder components, and target: 'all' broadens the component set.
  • result.optimizedProgram.componentMap is the canonical saved artifact for agent GEPA runs. It may include actor instructions, descriptions, tool descriptions/names, templates, or runtime primitives depending on what the selected target exposes.
  • When child-agent delegation matters, expose the child agents as named functions and tune against realistic call/no-call tasks.

Read the full file on GitHub · 369 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today Changed c881ad54cb6e
  2. 4d ago First seen · 369 lines · 57 tokens per session scan A 2cee84aa66ee

Subscribe to this mod's changes

ax-agent-optimize is a skill published in the GitHub repository ax-llm/ax (2,893 stars, last pushed today), licensed Apache-2.0. It adds 57 tokens to every session and 4,156 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.