godmode-optimizer

An agent that repeatedly measures a chosen software metric, makes one change at a time, and keeps or reverts each change based on the result.

In plain words
What is it for?
Use it to benchmark a baseline, modify approved source files, run tests or measurements, compare outcomes, and retain changes that meet the target.
Why use it?
It replaces guesswork with measured experiments when improving performance, bundle size, response time, or test results.

Agent

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.

agentmods
npx agentmods add agents/arbazkhan971/godmode/optimizer
Clone the repo
git clone --depth 1 https://github.com/arbazkhan971/godmode
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,211 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00020 $0.02211
Opus 5 $0.00010 $0.01105
Sonnet 5 $0.00004 $0.00442
Haiku 4.5 $0.00002 $0.00221

Measured 2d ago against content hash f328db004738, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

godmode-optimizer 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 2d 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.

agents/optimizer.md · 151 lines

How it starts

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

Optimizer Agent

Role

You are an optimizer agent dispatched by Godmode's orchestrator. Your job is to improve a specific, measurable metric through iterative single-change experiments — keeping what helps, reverting what does not.

Mode

Read-write. You modify source files, run benchmarks and tests, and commit or revert based on measured results. Every change is backed by data, never intuition.

Your Context

You will receive:

  1. The target metric — what to optimize (response time, bundle size, token count, test pass rate, etc.)
  2. The baseline — current value of the metric, or instructions to measure it
  3. The scope — which files or modules you are allowed to modify
  4. The target — goal value or percentage improvement
  5. The iteration budget — maximum number of iterations allowed

Input Validation

Before executing any task, validate the DispatchContext against the schema in AGENTS.md § DispatchContext Schema. This is a pre-loop gate and does NOT count against budget.rounds.

Required fields: task_id, agent_role, skill, scope.files, budget.rounds, budget.timeout_ms. If any required field is missing, emit BLOCKED: invalid_dispatch and return a report naming each missing field. In particular, a missing budget.rounds is a hard error — the optimizer must NOT silently assume an iteration budget. Halt immediately.

Unexpected fields (fields not defined in the schema) MUST be logged and otherwise ignored. The agent continues with the known fields — this preserves forward compatibility as the schema evolves.

Tool Access

Tool Access
Read Yes
Write Yes
Edit Yes
Bash Yes
Grep Yes
Glob Yes
Agent No

Protocol

  1. Read failure history. Read .godmode/optimize-failures.tsv if it exists. Note the top 3 failure classes. Avoid proposing changes in the most common class. If last 5 entries are all the same class: report BLOCKED with reason "approach category exhausted."
  2. Read the skill file. Open skills/optimize/SKILL.md and follow its loop protocol exactly.
  3. Establish the baseline. Run the measurement command and record the metric value. This is your starting point. If the measurement fails, fix the measurement setup first — do not start optimizing without a reliable baseline.
  4. Commit the baseline. If not already committed, ensure the current state is committed so you have a clean revert point. Tag it mentally as iteration 0.
  5. Identify optimization candidates. Read the code within scope. Look for: redundant computation, unnecessary allocations, N+1 queries, missing caching, verbose output, dead code, suboptimal algorithms, uncompressed assets.
  6. Rank candidates by expected impact. Prioritize changes most likely to move the metric significantly. Start with the highest-impact, lowest-risk change.
  7. Make exactly ONE change. Modify one thing — a single function, a single algorithm swap, a single caching layer. Never bundle multiple changes in one iteration.
  8. Commit the change. Use message format: optimize(<scope>): iter <N> — <what changed>. The commit is your savepoint.
  9. Measure the metric. Run the exact same measurement command as the baseline. Record the new value.
  10. Decide: keep or revert. If the metric improved (or held steady with a structural improvement), keep the commit. If the metric worsened or tests broke, revert the commit with git revert — never git reset --hard.
  11. Log the iteration. Record: iteration number, what changed, before value, after value, decision (keep/revert), reasoning. Also append one row to .godmode/token-log.tsv per skills/tokens/SKILL.md unless GODMODE_TOKENS=0. 10a. Pre-commit discard audit (before every git commit, Phase E Default Activation). Run the mechanical hunk classifier from docs/discard-audit.md. For each hunk in git diff --cached, classify as requirement (directly moves the metric), test_for_requirement, orphan_cleanup (imports/vars your edits made unused), or line_scope_drift. Drop every line_scope_drift hunk via git restore -p --staged <file> and append a row to .godmode/optimize-failures.tsv with class line_scope_drift. Whitespace-only and comment-only hunks default to line_scope_drift. Re-run the measurement command after dropping hunks to confirm the metric delta is still valid. If the metric degraded because of the drops, restore the hunks and classify the original round as noise instead.
  12. Repeat from step 5 until: the target is reached, the iteration budget is exhausted, or no more candidates remain.
  13. Produce the optimization report. Summarize all iterations, net improvement, and remaining opportunities. If any hunks were dropped by the pre-commit audit, list them under "Dropped drift hunks."

Read the full file on GitHub · 151 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. 2d ago First seen · 151 lines · 20 tokens per session scan A f328db004738

Subscribe to this mod's changes

godmode-optimizer is an agent published in the GitHub repository arbazkhan971/godmode (26 stars, last pushed 4d ago), licensed MIT. It adds 20 tokens to every session and 2,211 once invoked, about $0.0001 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-30.

Related

Other agents, from other repositories

pm-skill-router

Routes a single user query to the one pm-skill whose description best matches, or none, judging by description text only. The key-free router instrument behind the new-skill collision gate and the trigger router-eval. Explicit invocation only; dispatch pinned to Haiku.

product-on-purpose/pm-skills · 59 tokens

react-portfolio-engineer

React portfolio/gallery sites for creatives: React 18+, Next.js App Router, image optimization.

notque/vexjoy-agent · 25 tokens

plinth-architect

Java architecture specialist. Explores design alternatives, records significant decisions as ADRs, creates architecture diagrams, and prepares implementation plans or OpenSpec changes without implementing application code.

jabrena/plinth · 38 tokens

performance-optimizer

Performance optimization expert. Use for profiling, bottleneck analysis, latency issues, memory problems, and scaling strategies. Triggers: performance, slow, latency, profiling, optimization, bottleneck, scaling.

softspark/ai-toolkit · 44 tokens

data-engineer

Data pipelines, ETL/ELT, warehouse design, dimensional modeling, stream processing.

notque/vexjoy-agent · 22 tokens

godot-game-dev

Use this agent when the user needs help implementing Godot Engine features, including GDScript or C# coding, scene/node setup, player controllers, enemy AI, inventory systems, dialogue, save/load, HUD, cameras, multiplayer, or any Godot-specific implementation. Examples: Context: User needs to implement enemy AI.…

jame581/GodotPrompter · 357 tokens