image-optimization-requirements

A set of rules for optimizing webpage images according to a staged loading plan and a limited amount of data allowed before the main content appears.

In plain words
What is it for?
Use it to configure first-section images for early loading, suitable dimensions, high priority, and responsive delivery within the defined loading budget.
Why use it?
It helps prevent large or late-loading images from delaying the first visible section and its Largest Contentful Paint measurement.

Cursor rule for Cursor

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 rules/adobecom/da-express-milo/image-optimization-requirements
Clone the repo
git clone --depth 1 https://github.com/adobecom/da-express-milo

Made for: Cursor.

Per session 2,985 This file is loaded in full into every session.
When invoked 2,985 The same file — it is already loaded in full.
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.02985 $0.02985
Opus 5 $0.01492 $0.01492
Sonnet 5 $0.00597 $0.00597
Haiku 4.5 $0.00298 $0.00298

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

Security

Grade A, and why

image-optimization-requirements 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 3d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/image-optimization-requirements.mdc · 370 lines

How it starts

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

Image Optimization Performance Rules - Three-Phase Strategy

APPLY: EVERY QUERY - CRITICAL PERFORMANCE RULE

AEM Bandwidth Budget Management (CRITICAL)

Based on AEM's performance guidelines:

  • 100kb total payload before LCP including all images, CSS, JS
  • Single origin only before LCP (no CDN/external image connections)
  • LCP target: 1560ms on mobile for Lighthouse 100 score

Phase E (Eager) - LCP Image Optimization (REQUIRED)

For first section hero/marquee images that are LCP candidates:

// ✅ REQUIRED for LCP candidate images (Phase E)
const optimizeLCPImage = (img, block) => {
  const isFirstSection = block.closest('.section') === document.querySelector('.section');
  const isFirstImage = img === block.querySelector('img');

  if (isFirstSection && isFirstImage) {
    // Phase E: Critical LCP optimization
    img.removeAttribute('loading');
    img.setAttribute('loading', 'eager');
    img.setAttribute('fetchpriority', 'high');

    // Calculate optimal size for bandwidth budget
    const optimalWidth = getOptimalImageSize();
    const aspectRatio = getImageAspectRatio(img);

    img.setAttribute('width', optimalWidth);
    img.setAttribute('height', Math.round(optimalWidth * aspectRatio));

    // Preload only if within bandwidth budget
    const estimatedSize = estimateImagePayload(img.src, optimalWidth);
    if (payloadTracker.canLoadResource(estimatedSize)) {
      preloadLCPImage(img.src, optimalWidth);
    } else {
      console.warn('LCP image exceeds bandwidth budget, consider optimization');
    }
  }
};

// ✅ REQUIRED - Bandwidth-aware image preloading
const preloadLCPImage = (src, width) => {
  const link = document.createElement('link');
  link.rel = 'preload';
  link.as = 'image';
  link.href = `${src}?width=${width}&format=webply&optimize=medium`;
  link.fetchPriority = 'high';
  document.head.appendChild(link);
};

Bandwidth Budget Calculation (REQUIRED)

Read the full file on GitHub · 370 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. 3d ago First seen · 370 lines · 2,985 tokens per session scan A f1b0e9cfc893

Subscribe to this mod's changes

image-optimization-requirements is a cursor rule published in the GitHub repository adobecom/da-express-milo (6 stars, last pushed 3d ago), licensed Apache-2.0. It adds 2,985 tokens to every session, about $0.0149 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.