ui-render-cost

ui-render-cost is a cursor rule for Cursor from paperclipai/paperclip. It costs 0 tokens per session (687 once invoked), scanned A, original, MIT.

A coding rule for keeping user-interface rendering work proportional to the size of a collection, keeping memoized inputs stable, and testing large lists at realistic sizes.

In plain words
What is it for?
Use it when changing React-style components and hooks that render, memoize, or select data from potentially large collections.
Why use it?
It helps prevent slow or frozen browser tabs caused by repeated scans, inefficient nested work, or memoization that recalculates every render.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it when changing React-style components and hooks that render, memoize, or select data from potentially large collections.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/paperclipai/paperclip/ui-render-cost
About the project

Paperclip is a Node.js server and React application for coordinating AI agents as a business team, with goals, organizational roles, budgets, governance, and work tracking in one interface. It is used by people managing multiple agents or autonomous agent organizations across tools such as OpenClaw, Claude Code, Codex, and Cursor. The catalogue includes skills, agents, an MCP add-on, and an instruction for working with Paperclip.

paperclipai/paperclip · 118,214 stars · on GitHub · paperclip.ing

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.

Clone the repo
git clone --depth 1 https://github.com/paperclipai/paperclip

Made for: Cursor.

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 ui-render-cost

README.md
[![agentmods](https://agentmods.dev/badge/rules/paperclipai/paperclip/ui-render-cost/github.svg)](https://agentmods.dev/rules/paperclipai/paperclip/ui-render-cost)
Your own site
<a href="https://agentmods.dev/rules/paperclipai/paperclip/ui-render-cost"><img src="https://agentmods.dev/badge/rules/paperclipai/paperclip/ui-render-cost/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ui-render-cost

Your own site · 80×15
<a href="https://agentmods.dev/rules/paperclipai/paperclip/ui-render-cost"><img src="https://agentmods.dev/badge/rules/paperclipai/paperclip/ui-render-cost.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 687 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.00687
Opus 5.5 $0.00000 $0.00275
Sonnet 5.5 $0.00000 $0.00137
Haiku 4.5 $0.00000 $0.00069

Measured 23d ago against content hash c0ba1dfb3f2a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ui-render-cost 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 23d 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.

rules/ui-render-cost.mdc · 61 lines

How it starts

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

Render work must stay proportional to its data

Applies to components (ui/src/**/*.tsx) and hooks (ui/src/**/use*.ts) that iterate over a collection during render, in a useMemo, or in a selector, when the collection can be large. Large means hundreds of items or more. Examples are catalogs shipped with the app and lists that grow with a company's data, such as tasks, runs, agents, connections and activity.

Why

Render code runs on the main thread, often many times per second while queries poll or the user types. Work that is quadratic or worse in collection size looks free with test fixtures of a few items. At real size it can freeze the tab. Two patterns cause most of these problems:

  • A hidden inner scan. A loop over one collection calls a helper that scans another collection with some, find, filter or includes. Each line looks cheap, but the cost is the product of both sizes, and nesting multiplies again.
  • A memo that never hits. A useMemo depends on an object, array or Map that the component body builds again on every render. The memo then recomputes on every render, so expensive work runs on each keystroke and each poll.

Requirements

  • Do not scan a large collection inside a loop over another large collection. Build a Set or Map index once, outside the loop, and look items up in it.
  • Normalize keys (slugs, lowercase names, identities) once per item, not inside comparison callbacks.
  • Keep every useMemo and useCallback dependency referentially stable across renders that change no data. Memoize derived objects, or derive them from query data, which TanStack Query keeps structurally shared. useQueries returns a new array on every render, so do not use it directly as a dependency.
  • When a change adds or reorders work over a large collection, test that path with realistic data size. Load shipped data with vi.importActual instead of a few hand-written items, and turn on every flag or mode that gates the path. Bound the work with a deterministic counter, such as calls to a key normalizer, not with wall-clock time. Make the counter throw above its limit, so a runaway render fails at once instead of stalling the test worker.

Read the full file on GitHub · 61 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. 23d ago First seen · 61 lines · 0 tokens per session scan A c0ba1dfb3f2a

Subscribe to this mod's changes

ui-render-cost is a cursor rule published in the GitHub repository paperclipai/paperclip (118,214 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 687 tokens. 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-11-07.

Related

ui-render-cost compared with cursor rules from other repositories

ui-render-cost next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
ui-render-costpaperclipai/paperclipCursor rule118kyesterdayMITA0Cursor
reacttaberoajorge/loopforgeCursor rule31mo agononeA0Cursor
ponytailDietrichGebert/ponytailCursor rule201k8d agoMITA604Cursor
angular-20angular/angularCursor rule102k4d agoMITA0Cursor
dev-standardapache/supersetCursor rule76ktodayApache-2.0A1,147Cursor
prefer-assertions-over-defensive-checksprisma/ormCursor rule48ktodayApache-2.0A0Cursor
prefer-direct-imports-over-module-mocksprisma/ormCursor rule48ktodayApache-2.0A0Cursor