Self-improving agent optimization — generates challenger variants of any agent/command, benchmarks against baseline, promotes winners, logs learnings to instincts. Inspired by Karpathy's autoresearch pattern.
Scanned 5/27/2026
Install via CLI
openskills install ShaheerKhawaja/ProductionOS---
name: productionos-auto-optimize
description: "Self-improving agent optimization — generates challenger variants of any agent/command, benchmarks against baseline, promotes winners, logs learnings to instincts. Inspired by Karpathy's autoresearch pattern."
argument-hint: "[repo path, target, or task context]"
---
# productionos-auto-optimize
Use this alias when you want the same workflow through a top-level Codex-safe name without the `productionos:` namespace.
## Overview
This is the Codex-native workflow wrapper for [.claude/commands/auto-optimize.md](../../.claude/commands/auto-optimize.md).
Use it when the user wants this exact ProductionOS workflow, not just the umbrella `productionos` router.
## Source of Truth
1. Read the source command spec at [.claude/commands/auto-optimize.md](../../.claude/commands/auto-optimize.md).
2. Use [CODEX-PARITY-HANDOFF.md](../../docs/CODEX-PARITY-HANDOFF.md) to confirm runtime support and parity expectations.
3. Preserve the source workflow's guardrails, scope, artifacts, and verification intent.
4. Translate Claude-only slash-command and hook semantics into Codex-native execution instead of copying them literally.
## Codex Behavior
- Summary: Self-improving agent optimization — generates challenger variants of any agent/command, benchmarks against baseline, promotes winners, logs learnings to instincts. Inspired by Karpathy's autoresearch pattern.
- Use the source command as the behavioral spec, then execute the same intent with Codex-native tools and constraints.
## Inputs
- `target` — Agent or command to optimize (e.g., 'code-reviewer', 'security-hardener', '/production-upgrade') Required.
- `challengers` — Number of challenger variants to generate (default: 3) Default: `3` Optional.
- `benchmark` — Benchmark to evaluate against: 'self-eval' (default) | 'test-suite' | 'llm-judge' | path to custom benchmark Default: `self-eval` Optional.
- `hypothesis` — Specific hypothesis to test (e.g., 'add chain-of-thought to security-hardener'). If omitted, auto-generates hypotheses. Optional.
- `max_cost` — Maximum cost in USD for the optimization run (default: 5) Default: `5` Optional.
- `mode` — Optimization mode: prompt (modify agent instructions) | model (test different models) | layers (test prompt composition layers) | params (test convergence parameters) Default: `prompt` Optional.
## Execution Outline
1. Preamble
## Agents And Assets
- Agents: `metaclaw-learner`, `prompt-optimizer`, `rubric-evolver`
- Templates: `PREAMBLE.md`, `PROMPT-COMPOSITION.md`
- Artifacts: `.productionos/AUTO-OPTIMIZE-BASELINE.md`, `.productionos/AUTO-OPTIMIZE-HARVEST.md`, `.productionos/AUTO-OPTIMIZE-HYPOTHESES.md`, `.productionos/AUTO-OPTIMIZE-REPORT.md`, `.productionos/AUTO-OPTIMIZE-RESULTS.md`, `.productionos/analytics/skill-usage.jsonl`, `.productionos/calibration/`, `.productionos/challengers/challenger-{N}.md`, `.productionos/instincts/`, `.productionos/instincts/project/`
## Workflow
1. Load only the agents, templates, prompts, and docs referenced by the source command.
2. Execute the workflow intent with Codex-native tools.
3. If the source command implies parallel agent work, only delegate when the user explicitly wants that overhead.
4. Verify with the smallest relevant checks before concluding.
5. Summarize what changed, what was verified, and what still needs human approval.
## Guardrails
- Do not claim that Claude-only marketplace, hook, or slash-command behavior runs directly in Codex.
- Keep the scope faithful to the source command rather than broadening into a generic repo audit.
- Prefer concrete outputs and validation over describing the workflow abstractly.
- **Cost ceiling:** $ARGUMENTS.max_cost (default $5). Hard halt when exceeded.
- **No regression allowed:** If ALL challengers score lower than baseline, keep baseline.
- **Prompt length limit:** Challenger prompts cannot exceed 2x the baseline length.
- **Model safety:** Model changes require human approval before promotion.
- **Idempotent:** Running auto-optimize twice with the same inputs produces the same baseline measurement.
- **Rollback:** If promoted winner causes test failures in subsequent runs, revert automatically.
No comments yet. Be the first to comment!