Page 1 of 1

'Add to freshest stack' inserter option

Posted: Fri Aug 14, 2026 11:58 pm
by macdjord
TL;DR
Inserters have an option that lets you control which stack in their source they take from based on freshness values; give us an option that lets us control which stack in the destination they add to.

What?
By default, when an inserter is inserting into a chest or other container, it adds the items it is holding to the first non-full stack of that item in the container; if there are no existing partial stacks, it instead creates a new stack.

This proposal would add a new tick-box to the inserter configuration screen named 'Add to freshest stack'. When this option is enabled, if the inserter is holding a spoilable item, then instead of adding the item to the first partial stack in the container, it instead tries to make a new stack if possible, and if there are no empty slots, it adds to whichever partial stack has the highest freshness value. (This parallels the way the existing 'Spoiled priority' option works: by default, when taking items, inserters take from the last non-empty stack; selecting the option instead causes them to scan all stacks and find the one with the lowest or highest freshness value, as desired, and take from that.)

(I suppose, for completeness, you might want to allow this new option to select between adding to the freshest stack and adding to the least-fresh one, though I honestly can't think of a use-case for adding to the least-fresh stack.)
Why?
One of the primary use-cases for the existing 'Spoiled priority' option is for maintaining a buffer of items, e.g. to be launched by rocket when requested: you add items to a chest as they are produced, and if you exceed your target buffer amount, you use an inserter set to 'spoiled first' to remove the oldest ones to be disposed of in some way.

However, this creates a problem: every time the disposal inserter activates, it removes a few items from the most-spoiled stack. This means that stack is now a partial stack, which means the input inserter will dutifully start adding new items to. Since these new items are very fresh, they raise the average freshness level of that stack. Since this is, or at least was, the least-fresh stack in the buffer, this means that the next time the disposal inserter activates, the items it discards will be fresher than they really should be, meaning more total freshness is lost, and the average freshness of the buffer as a whole is lower than it should be. Instead of the buffer being an orderly queue of items of decreasing freshness, with fresh new stuff being added at the start and old spoiled stuff being removed at the end, it trends towards a bunch of equally semi-spoiled stacks.

Currently, the only way I know of to avoid this is to use circuit logic to make insertion and removal modal: fill the buffer to one full stack above your target without removing anything, then stop adding stuff while you remove the oldest stack in its entirety, then start filling again. This requires complicated circuit logic (you need to fill and empty the chest in increments of exactly one complete stack, so you need to not just enable or disable the inserters but dynamically adjust their hand sizes) and, depending on your input rate, might require using two buffer chests, so that one can be filling while the other empties.

However, if we had the option to control which partial stack the input inserter added to, then this whole issue becomes much simpler: set the input inserter to add to the freshest stack, and set the disposal inserter to take from the oldest stack any time the total number of items exceeds the target amount. Old items will be removed from old stacks, new items will be added to new stacks, and never from the same stack at the same time.