Hello Arch Bot.
I looked into the changes you made.
First you should remove rate array and just use the equation you introduced. Multiplying 0,42 with 0,05 is 0,021 and not handicap player picked.
Now I am going to present my current opinion if your mod should be merged with codebase.
In most RTS Ais get cheats because they cannot match human thinking and decision making. Else they would be wiped out by any player and there would be no fun at all. Issue is that, with more complex games, Ai needs to think about more aspects and put them into equation. Also it needs to plan for future and to know when top stop current plan because it has to do something else. Also making Ai more complex could be bad trade off with performance. (fun story: I tried to mimic attacking code in defense manager to improve defense, it lagged so hard it was unplayable). Also there is issue what AI actually knows about. As player you move game camera and you can see enemy moving towards you and you know what units it has and how to counter them. That is not case for AI. It can at best check enemy units in some proximity of its structures but doing so for all visible structures and comparing enemy units if they are in the proximity is very resource heavy computation, so mostly it reacts only if gets attacked what is most of the time too late.
I can agree rate bonus could be separate variable and difficulties could just influence what decision ai takes.
But I am not sure if allowing for example hard ai going under rate of 1 is good idea. That would make it even worse then current medium ai. Also the same for allowing medium ai to go to bonus 100% would make it insane. It would mass units too fast. Current very hard ai has only 56% bonus and few players can beat and they count for ai wasting units with useless attacks and chases their units under their turrets.
So generally speaking, ai is terrible in defense and sometimes lets units die stupidly or it tries to place structures at places it is constantly destroyed, also it wastes resources from time to time. Taking rate advantage from ai at this state would in my opinion make ai more boring to play against as it is right now.
If you are interested in improving current ai:
For the ai development and comparison it is preferable to remove that bonuses from initgame.js and let current ai fight against the new one with highest mutual difficulty level in various maps, settings and mainly I would suggest to pick for both of them the same civilization.
Team would be more than happy to merge new ai if it turns out being better then current one, without destroying performance.
P.S. : Ai should not be unbeatable.