Thanks for the fast response! Yes lib_macro.tpa fixed the issue and I'll use that until the next release but it might still worth mentioning to say that without lib_macro.tpa, file the problem persists even without the spells component of TOTLM.
Using a copy of my installation folder with the unaltered initial.tpa, I uninstalled every weidu mod in reverse order up to and including TOTLM-in-BG2. With that, stratagems installation worked fine.
But then I uninstalled stratagems, reinstalled just the main component of TOTLM (without the spells), reinstalled stratagams 1500 & 1510 so that my weidu.log looked like this:
Then the AI component failed again:
As I said, copying over lib_macro.tpa works fine but there might be something else than just an incompatibility with TOTLM's spells component. Maybe this is an issue with the TOTLM mod itself and not with stratagems; I don't know enough to speculate further.
As for why I was trying to install spells from both mods, it's because the developer commented on beamdog forums that SCS' spells would likely complement TOTLM so I missed the part in the readme and assumed I would have a more exhaustive setup by installing both. Looks like this isn't the case then.
I hope this info was helpful. It's exciting that BG mods of this quality are still being developed after two decades. Thanks!