I'll take a look at the code to give you the most accurate answer I can give (the answer depends on which CPU AI player is selected as each level has different priorities). I'll edit this post as i discover answers.
UPDATED:
In general the AI processes rules in the following order:
AiRuleWorkerHarvest
(called every 2 seconds)
What this rule does: Finds an idle harvester unit and tells it to harvest a resource
AiRuleRefreshHarvester
(called every 20 seconds)
What this rule does: Finds a harvester that is harvesting and re-assigns it to harvest a resource based on new priorities
AiRuleScoutPatrol
(called every 10 seconds)
What this rule does: If there are a minimum of 8 fighting units, send a unit out to scout the map (one of the other players start location)
AiRuleUnBlock
(called every 3 seconds)
What this rule does: If there are blocked units (units that are surrounded by other units) then tell units surrounded the blocked unit(s) to move away.
AiRuleReturnBase
(called every 5 seconds)
What this rule does: If there are idle units send them back to the base
AiRuleMassiveAttack
(called every 1 second)
What this rule does: a) If there are enemies in the sight of the AI player and b) the AI players base has at least 8 fighting units (then attack enemies anywhere on the map) OR if the AI players base has less than 8 fighting units, attack enemies within 25 cells of the base first.
AiRuleAddTasks
(called every 5 seconds)
What this rule does: if there are no existing tasks queued or there are less than 4 worker units try to add one of the following tasks (in priority order shown below):
1. if there are less than 4 worker units, produce more workers
2. For CPU Mega:
Workers:
- If worker units < 5 produce workers
- If worker units < 10 produce more workers
- If worker units ratio to all units < 20% produce more workers
- If worker units ratio to all units < 30% produce more workers
Fighters:
- If fighter units < 10 produce fighters
- If fighter units ratio to all units < 20% produce more fighters
- If fighter units ratio to all units < 30% produce more fighters
- If worker units >= 10 produce more fighters
- If worker units >= 15 produce more fighters
- If fighter units < 8 produce more fighters (also if > 9 buildings produce more fighters, also if > 12 buildings produce even more fighters)
Buildings:
- if building count < 6 or building ratio to all units < 20%, build a new building
- if building count < 10 and worker count > 12, build a new building
Upgrades:
- if upgrade count == 0 and worker count > 5, start an upgrade
- if upgrade count == 1 and worker count > 10, start an upgrade
- if upgrade count == 2 and worker count > 15, start an upgrade
- If fighter units >= 8, start an upgrade
For CPU Easy:
Workers:
- If worker units < building count + 2 produce workers
- If worker units > 5 and worker ratio to all units < 20% produce more workers
Fighters:
- If fighter units < 10 produce fighters
- If fighter units ratio to all units < 20% produce more fighters
- If fighter units ratio to all units < 30% produce more fighters
- If worker units >= 10 produce more fighters
- If worker units >= 15 produce more fighters
Buildings:
- if building count < 6 or building ratio to all units < 20%, build a new building
- if building count < 10 and fighter count >= 8, build a new building
Upgrades:
- if upgrade count == 0 and worker count > 6, start an upgrade
- if upgrade count == 1 and worker count > 7, start an upgrade
- if upgrade count == 2 and worker count > 9, start an upgrade
For CPU all others:
Workers:
- If worker units < 5 produce workers
- If worker units < 10 produce more workers
- If worker units ratio to all units < 20% produce more workers
- If worker units ratio to all units < 30% produce more workers
Fighters:
- If fighter units < 10 produce fighters
- If fighter units ratio to all units < 20% produce more fighters
- If fighter units ratio to all units < 30% produce more fighters
- If worker units >= 10 produce more fighters
- If worker units >= 15 produce more fighters
Buildings:
- if building count < 6 or building ratio to all units < 20%, build a new building
- if building count < 10 and worker count > 12, build a new building
Upgrades:
- if upgrade count == 0 and worker count > 5, start an upgrade
- if upgrade count == 1 and worker count > 10, start an upgrade
- if upgrade count == 2 and worker count > 15, start an upgrade
- If fighter units >= 8, start an upgrade
AiRuleProduceResourceProducer
(called every 5 and 60 seconds)
What this rule does: If the faction uses a resource on the map and it is consumable and we have < 0 produce a harvester for that resource.
If the faction uses a resource on the map and it is static and we have < 20 produce a harvester for that resource.
AiRuleBuildOneFarm
(called every 10 seconds)
What this rule does: Find a unit that can produce a unit which has resource cost for a consumable resource if we have none of them (need at least 1 farm)
AiRuleProduce
(called every 2 seconds)
What this rule does: If we have a queued task to produce something, then this command will decide exactly what should be produced
<this command has tons of logic and will be documented later>
AiRuleBuild
(called every 2 seconds)
What this rule does: If we have a queued task to build something, then this command will decide exactly what should be built
<this command has tons of logic and will be documented later>
AiRuleUpgrade
(called every 2 seconds)
What this rule does: If we have a queued task to upgrade something, then this command will decide exactly what should be upgraded
<this command has tons of logic and will be documented later>
AiRuleExpand
(called every 30 seconds)
What this rule does: If there are resources on the map used by the faction and we have 'sighted' that resource, expand close to that resource, otherwise send scout to look for resources
AiRuleRepair
(called every 10 seconds)
What this rule does: If we have a damaged 'base', and we have units that can repair it, then send them to repair the base. Otherwise just look for the first damaged unit and try to repair it.