I use Renai Transportation mod, sometimes if I select shift+click on request button ("craft with hands") it uses a recursion recipe:
Request: get some iron chests (Note: I have some already)
1) it converts my iron chests to open chests (without top cap)
2) then it converts those open chests back to iron chests (yep, it is the backward recipe)
Result: I still have some iron chests and it did not craft new iron chests for me.
Expected: it uses another recipe to craft iron chest from iron plates.
So, I think we have some solutions for that scenario.
Option #1) check recipe path for recursion items:
a) iron chest => open chest => iron chest (boom! it's recursion with the item from first (Nth) step.)
b) iron plates => iron chest (no recursion - it's ok)
Looks easy, but we have issue with some mods, that uses recursion to extend products, so we need check type and items count here.
A meta example:
4x iron chest => XXX sub-products => (add water) => 6x iron chest (more than before - it's ok)
4x iron chest => XXX sub-products => (add water) => 4x iron chest (less or equal - it's bad)
I think this will be difficult.
Option #2) Create a new global UI form, if we open it (maybe with a some new button from your ghosts counter dialog), it shows slot-buttons,
we can click it, and select recipes that will be ignored from crafting (as final or intermediate product). Note: it should not be item, but recipes — it's because of we want skip some recursion recipes, not product items. Those recipes should be remembered and re-used between different ghost counters.
This method is not as beautiful as option #1 with auto-mode, but it can be simply implemented and all players can customize it for themselves.