Nodes/Remembering utils/Remember Last Seed
ComfyUI Node

Remember Last Seed

The node that tells you what seed you were on before

By bombless·Created 2 years ago·Updated 2 years ago· 0
Remember Last Seed
    • INT
    seed

    Remember Last Seed is one step behind on purpose. You feed it a seed, and it hands back the seed you gave it last time - not the one you just typed. That's the entire trick, and once you're iterating on a prompt it's a surprisingly handy thing to have on a wire.

    What it's actually for

    You know the ritual: lock the seed, change one variable, compare, repeat. That discipline is the closest thing this community has to a universal law, because it's the only way to tell which change did what. The problem is that after fifteen rounds of "hmm, was it seed 512313 that made the good one, or 512314?" the numbers blur together. ComfyUI does store the seed in the output PNG's metadata, but that means stopping mid-flow to open the image and dig through the sidebar.

    This node keeps the previous value live in the graph instead. Wire a KSampler's seed into Remember Last Seed, and its INT output carries the seed that ran before the current one - route it into a second sampler for an A/B comparison, into a seed-logging node, or just to a text display so you can see what you're leaving behind.

    The honest take: if you mainly want a nicer seed control, the KSampler already has control_after_generate (fixed, randomize, increment, decrement), and rgthree's Seed node remembers what it just ran with a friendlier UI. Remember Last Seed fills the narrower niche where you want the actual previous number as a graph value you can wire anywhere, not a display.

    How it works

    The whole mechanism is a class-level variable:

    last_seed = None
    def read_seed(self, seed):
        ret = self.last_seed
        self.last_seed = seed
        return (ret,)
    

    It returns the stored value, then stores the incoming one. That's a latch, not a logger - there's no history, just the single most recent value, and the memory lives on the class itself, so it persists across queue runs for your whole ComfyUI session.

    Inputs and outputs

    Only one input you ever touch:

    • seed (INT) - the current seed, usually straight from a KSampler's seed input.

    And one output: INT, the previous seed. That's it. There's no randomization, no control-after-generate, no options. It's OUTPUT_NODE = True, so ComfyUI treats it as a leaf and always executes it.

    Installing it

    This is the easy part. Open ComfyUI Manager, search for "Remembering utils" (it's published to the Comfy Registry as v1.0.2) and install, or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/bombless/comfyUI-RememberingUtils
    

    Then restart ComfyUI. There are no Python dependencies, no requirements.txt, no model files - the whole backend is about thirty lines of standard library. Nothing to download, nothing to configure.

    Where people get burned

    Two gotchas, and they're both straight from the code:

    • The first run returns None. There's no previous seed on a fresh session, so the class variable is None, and that's what comes out. Wire that into a downstream node expecting a real integer and the first run can choke or misbehave. Prime it: queue a throwaway run before you rely on the output.
    • Every Remember Last Seed node in your workflow shares one memory. Because the state lives on the class, not on the instance, two of these in one graph stomp on each other - each one sees the other's writes. In practice, keep at most one per workflow.

    Also worth knowing: this node draws nothing on the canvas. If you want to actually see the value it latched, chain its output into the pack's Show Last Seed node, which renders text on its body after a run.

    The pack ships with no README at all - there's literally an open GitHub issue titled "Some info maybe?" asking the author for a single word of explanation. So trust the source here: it's a tiny, dependency-free, easy-to-eyeball project. That's both the appeal and the catch. If it does what you need, it's free and safe-ish; if it doesn't, don't fight it - it's not trying to be a general-purpose seed manager.

    Categoryutils

    Inputs (1)

    NameTypeDefaultDescription
    seedINT

    Outputs (1)

    NameTypeDescription
    INTINT