While running (always a great time to think things through) I've figured out a quite neat solution for peculiar rename challenges like this (and many others).
The key was, as I had guessed, to leverage the power of IMatch variables and create some new variables for the Renamer content.
I've already added the variable
{Renamer.TargetFileName} for the next release. This variable holds the 'current' target file name at the time the step using it is executed. This allows to create Renamer presets which check the file name produced so far and then act accordingly. Not often needed but when you need it can be a real time-saver.
So, the new "Group By" step has to keep track of its current state (e.g. which files it has already seen, when its time to create a new group etc.). I used this existing data for two new variables only available when a "Group By" step is running:
{Renamer.Group.Index} This is the one-based index of the current file in the current group. If you group files by 3, this variable goes 1,2,3, 1,2,3 ...
{Renamer.Group.FileNames} This variable contains the file names produced for the current group so far. It changes over time, while the "Group by" step is accumulating new files into the current group.
To get the name of the first file in the current group, we can use the neat
index: variable function:
{Renamer.Group.FileNames|index:first}.
To make all this usable with the new "Group by" step I've just added a generic text parameter which supports a free mix of literal text and variables. Basically the same that the "Text and Variables" step does.
All this combined in the new "Group By" step allows us to
a) group files by a fixed number or a variable expression
b) Append a sequential number to each file in the group, starting at 1
c) Append a token from a list of tokens (e.g. for custom postfixes, latin nubers, characters, ...)
d) Append an arbitrary text produced from variables, including the first or any file name in the current group.
e) Combine all that freely.
I'm quite sure that not many users will ever use this step - because most users have fairly simple file naming conventions (good!).
But sometimes you need something like this, and then it's great to have it.
It also solves the "How to append a sequential number to all duplicate file names, including the first one", which came up quite a number of times in the past.
I've implemented all this roughly and, as a test, tried to implement the naming convention the OP requested (when I understood it correctly). These are my results (only one step needed in the Renamer):
