ComfyUI Node

Shrug Cache Control

Peek inside (or flush) your server's KV cache

By fblissjr·Created about a year ago·Updated 4 months ago· 25
Shrug Cache Control
  • connection
  • info
actionlist

Your LLM server keeps a KV cache - the internal state that lets it avoid recomputing already-seen tokens. It's why repeated prompts feel fast and why a long chat session doesn't re-process its whole history every turn. Most of the time you never need to think about it. But when a session has been running for hours, the cache is the thing quietly holding gigabytes of memory, and occasionally it's the reason generations start drifting or repeating in ways that make no sense. Shrug Cache Control is the pack's window into that cache: list what's in it, or clear it.

This is a niche node and it knows it. You won't use it every session. But when you're debugging a long-running workflow or about to benchmark something and want a clean slate, having the flush button inside the graph (instead of a curl call) is genuinely handy.

How it works

Two modes, from the action combo:

  • list (default) - calls the server's /v1/cache/list endpoint and returns the cache info as a JSON string in the info output. Handy for seeing how many cached entries there are and roughly what's occupying memory.
  • clear - calls /v1/cache/clear and returns the string "cache cleared".

The asymmetry that matters: listing is public, clearing is admin-gated. The clear call sends the admin_token from your ShrugConnection as an X-Heylook-Admin-Token header, and it has to match the server's HEYLOOK_ADMIN_TOKEN environment variable. Set that up once on the server side, put the same value in the admin_token field of the connection, and clearing works. Miss it and you'll get an auth error on clear while list works fine.

That split is deliberate in the client code - inference endpoints never require auth, admin endpoints do - so don't assume a server that lets you chat freely will let you clear its cache.

Inputs and outputs

  • connection (required) - a SHRUG_CONN from ShrugConnection. The admin_token on that connection is what unlocks clear.
  • action (required) - list or clear, default list.

One output: info - a STRING. It's JSON for list, and a plain "cache cleared" for clear.

How to install

Standard pack install. ComfyUI Manager → search Shrug-Prompter → Install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/fblissjr/shrug-prompter

Dependencies are already present in any modern ComfyUI (httpx, orjson, pillow, torch, numpy) - nothing heavy, no model downloads (the cache being cleared lives on the server). A current ComfyUI build is required (V3 extension API).

Common issues

  • list works, clear errors. The admin token mismatch described above. Check that the connection's admin_token matches the server's HEYLOOK_ADMIN_TOKEN.
  • info is an empty JSON object. A freshly started server has an empty cache. Not a bug.
  • You cleared the cache and generations feel slower. Correct and expected - the server is recomputing context it used to have cached. It'll warm back up.
  • Node won't run at all. Server down or wrong base_url on the connection. Same checklist as every other server-facing node in the pack.
Categoryshrug

Inputs (2)

NameTypeDefaultDescription
connectionSHRUG_CONN
actionCOMBOlist2 options: list, clear

Outputs (1)

NameTypeDescription
infoSTRING