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.
npx agentmods add commands/shaheerkhawaja/productionos/auto-optimizegit clone --depth 1 https://github.com/ShaheerKhawaja/ProductionOSWrote 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.
[](https://agentmods.dev/commands/shaheerkhawaja/productionos/auto-optimize)<a href="https://agentmods.dev/commands/shaheerkhawaja/productionos/auto-optimize"><img src="https://agentmods.dev/badge/commands/shaheerkhawaja/productionos/auto-optimize.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00042 | $0.02443 |
| Opus 5 | $0.00021 | $0.01222 |
| Sonnet 5 | $0.00008 | $0.00489 |
| Haiku 4.5 | $0.00004 | $0.00244 |
Grade A, and why
auto-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 6d ago.
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.
How it starts
The opening of the file, as written. The whole thing — 267 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Auto-Optimize — Self-Improving Agent Loop
You are the Auto-Optimize orchestrator. You implement Karpathy's autoresearch pattern for ProductionOS: generate challenger variants, benchmark against baseline, promote winners, harvest learnings.
The compound moat: Every optimization run makes ProductionOS measurably better. Run #10 benefits from all learnings of runs #1-9.
Step 0: Preamble
Before executing, run the shared ProductionOS preamble (templates/PREAMBLE.md).
Phase 1: Baseline Capture
1.1: Read Target Definition
# For agents:
cat agents/$ARGUMENTS.target.md
# For commands:
cat .claude/commands/$ARGUMENTS.target.md
1.2: Extract Current Metrics
Read existing performance data if available:
cat ~/.productionos/analytics/skill-usage.jsonl | grep "$ARGUMENTS.target" | tail -20
cat ~/.productionos/instincts/project/*/lessons.json 2>/dev/null | grep "$ARGUMENTS.target"
1.3: Record Baseline
Run the target against the benchmark to establish baseline:
BASELINE:
target: $ARGUMENTS.target
benchmark: $ARGUMENTS.benchmark
timestamp: {ISO8601}
metrics:
score: {0-10 from self-eval or test pass rate or LLM-judge}
tokens: {token count for the run}
duration: {seconds}
issues_found: {count, for auditors}
false_positives: {count}
prompt_length: {word count of instructions}
model: {current model assignment}
layers: {which prompt composition layers are active}
Write baseline to .productionos/AUTO-OPTIMIZE-BASELINE.md.
Phase 2: Hypothesis Generation
If $ARGUMENTS.hypothesis is provided:
Use the user's hypothesis directly. Create $ARGUMENTS.challengers variants that test this hypothesis.
If no hypothesis:
Read the prompt-optimizer agent definition from agents/prompt-optimizer.md and dispatch it to generate hypotheses.
If the target is prompt-heavy or rubric-heavy, also dispatch textgrad-optimizer to propose gradient-style wording improvements before challengers are generated.
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.
- 6d ago First seen · 267 lines · 42 tokens per session scan A 3b7136d0bf46
auto-optimize is a command published in the GitHub repository ShaheerKhawaja/ProductionOS (8 stars, last pushed 4mo ago), licensed MIT. It adds 42 tokens to every session and 2,443 once invoked, about $0.0002 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-08-31.
Other commands, from other repositories
rekindle
Recover a fellowship after a session crash. Scans worktrees and state files, presents a recovery dashboard, and re-spawns Gandalf with recovered quest context. Use when returning to a crashed or expired fellowship session.
settings
View or edit fellowship configuration (/.claude/fellowship.json). Run /settings to see current settings, change values, or reset to defaults.
validate-docs
Validate that site and README documentation is current. Report-only — flags issues without modifying anything.
chronicle
One-time codebase onboarding — interactively extracts your team's conventions, identifies reference files, and generates CLAUDE.md sections so Claude codes the way your team does. Run once per project.
guide
Interactive guide to fellowship. Walks you through a real task using the structured research-plan-implement flow, then shows you what's next.
red-book
Use after receiving PR review feedback. Extracts conventions from reviewer comments and offers to add them to CLAUDE.md. Closes the convention learning loop.