Since the endless stack invasion problem is unnerving, I had a look at this in my Hai campaign on hard over 20 years or so. The AS was the enemy, it was at peace or allied with the Ptolemies most of the time. It includes heavy use of auto_win and FD. Many findings were already observed above.
1. It seems the AI only attacks provinces that border their provinces. I have 4 settlements closely together in the Caucasus and the AS only ever attacked those settlements it has a border with, even though their stacks run rampant through my lands and very close to "deeper" settlements. They never even entered the deeper provinces but always skirt around them, even though the cities are only a winter season's march away. The deeper settlements had minimal garrisons.
2. The strength of defending armies dissuades the AI from attacking. My first impression is that it is true combat strength, not numbers or the number of units. They won't attack comparable or stronger armies. If multiple AI stacks exceed the limit, they do attack, ergo the decision is not made on a per stack basis.
3. Defenders do not need to be in the settlement proper to have the defensive effect, hovering somewhere in the province is sufficient. Whether they need to be in a certain maximum radius around the settlement or just anywhere I can't say yet.
4. Forts maybe increase the defensive effect. Again they don't need to be located in mountain passes or approaches, just somewhere in the province.
5. Such dissuaded AI stacks do not necessarily move away, but sometimes stop and stay right where they were when you moved your stack into the province, maybe because they have nothing else to do. I had an AS stack parked right next to a settlement for years without them attacking me. Once you move your dissuasion forces away, or once they are able to bring more troops, they drop any pretenses or ceasefires and attack immediately of course following their true Total War nature.
6. The dissuaders do not need to be in a single stack.
What this means is that it could be possible to "cover" (or at least significantly hamper the assault of) multiple provinces with one strong army, by stationing it on the borders in between. When AI stacks start wandering, move the army into the province in question. Or have medium sized stacks in all border provinces and move another medium sized into the relevant ones.
This is of course already done by many, but I want to stress that these troops do not engage but only threaten, in order to prevent the time wasting stream of stacks. It is possible that the AI will only use the time to build up and move in with even larger stacks later, but this is in the interest of most players anyway (fewer small battles, more decisive battles.)
So what else do we need to find out?
- Reproduce the above findings more repeatably
- Check whether it is sufficient to have dissuasion forces just anywhere in the province, even if it is a huge one
- Find out more about the "decision process" of whether to start moving into a player province while at peace:
Which stacks start moving into your province at all?
Do they cross multiple provinces to get to you?
Or are they somehow "anchored" to a specific AI settlement? Maybe the settlement they were last in? Or the one they were created in?
Will they move into a player province if the player has forces in the AI province or will they rather attack those first? (I have already seen something different though)
Are there differences in movement decision between peace time and war?
[My guess is that they only cross their own provinces when at war with a faction. The normal peacetime roaming attacks of opportunity (those which start the wars) are launched out of AI provinces next to player provinces when said provs are undermanned.]
Bookmarks