optimize

optimize is a command for coding agents from obiwancenobi/klamben. It costs 23 tokens per session (319 once invoked), scanned A, original, Apache-2.0.

A command for making Flutter apps use less work during drawing and screen updates. Flutter is a toolkit for building app screens from reusable code components.

In plain words
What is it for?
Use it to add constants, build long lists lazily, isolate expensive or animated areas, cache network images, reduce unnecessary rebuilds, and improve fade animations.
Why use it?
It targets common causes of slow scrolling and unnecessary redraws without changing business logic. This can make screens more responsive, especially on less capable devices.

Command

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 commands/obiwancenobi/klamben/optimize
Clone the repo
git clone --depth 1 https://github.com/obiwancenobi/klamben

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 optimize

README.md
[![agentmods](https://agentmods.dev/badge/commands/obiwancenobi/klamben/optimize.svg)](https://agentmods.dev/commands/obiwancenobi/klamben/optimize)
Your own site
<a href="https://agentmods.dev/commands/obiwancenobi/klamben/optimize"><img src="https://agentmods.dev/badge/commands/obiwancenobi/klamben/optimize.svg" alt="Measured on agentmods" height="20"></a>
Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 319 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.00023 $0.00319
Opus 5 $0.00012 $0.00160
Sonnet 5 $0.00005 $0.00064
Haiku 4.5 $0.00002 $0.00032

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

Security

Grade A, and why

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 4d 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.

src/commands/optimize.md · 40 lines

What it actually says

/optimize

Performance cleanup. Mechanical, safe changes only.

When to use

  • Jank on scroll
  • Slow rebuilds
  • Before shipping to low-end devices
  • /audit flags code-quality/missing-const

Actions

  1. Check design context: If .klamben.md exists in the project root, read it first. Apply the project's brand, platform targets, accessibility tier, and existing patterns to your work below.
  2. Add const to every eligible constructor
  3. ListView.builder for lists > 10 items
  4. RepaintBoundary around animated or expensive subtrees
  5. cached_network_image for network images (add to pubspec if needed)
  6. ValueListenableBuilder / AnimatedBuilder instead of setState on animations
  7. Lazy loadingListView.builder with itemCount over ListView(children: map(...).toList())
  8. Avoid Opacity for fade animations — prefer FadeTransition

Do NOT

  • Cache data without understanding invalidation
  • Add profile-mode benchmarks unless user asks
  • Change business logic
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. 4d ago First seen · 40 lines · 23 tokens per session scan A 00ea753a99bc

Subscribe to this mod's changes

optimize is a command published in the GitHub repository obiwancenobi/klamben (2 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 23 tokens to every session and 319 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-31.