From a8b4fa64104a4d834c51396eef5c62518b7691c9 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Mon, 31 Aug 2026 16:09:43 -0700 Subject: [PATCH] Add how to cache model stuff to AGENTS.md (#16003) --- AGENTS.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index b63b7a1d4..51dd6dd65 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -297,6 +297,12 @@ - Avoid caches that persist across different executions as much as possible. Persistent caches are acceptable only when they use a very minimal amount of memory and have a clear ownership and invalidation story. +- When condition-dependent model work would otherwise repeat on every denoising + step and preprocessing it once materially improves performance, expose a + model preprocessing method and call it from `BaseModel.extra_conds`, following + patterns such as LTXAV and Anima. Pass the result through normal conditioning; + do not add model-owned caches, sampler-option caches, or cache-management + wrappers for this work. - When optimizing, favor small measurable changes: fewer allocations, fewer device transfers, less peak memory, better batching, or use of a faster existing backend op.