docs/StrategyEngine/03-MatchingSystem.md
When a user activates the Assistant, the Strategy Engine enters its matching and evaluation loop. This happens instantly, gathering the OS snapshot and assessing which Strategies apply.
The StrategyContext comprises the current computing state, including:
chrome.exe, devenv.exe).The matching process follows several distinct phases:
The engine requests GetStrategies() from all activated Providers, gathering an initial pool of all available Strategies from the OS, builtin defaults, and user directories.
Because Strategies are flat, they are identified by a globally unique Id (often prefixed by their namespace like user.summarize-arxiv or builtin.explain).
If the engine encounters multiple Strategies with the exact same Id across different providers, it resolves conflicts based on the Priority integer field.
builtin.summarize-arxiv with a priority of 100 implicitly overwrites the system default (priority 10).This acts as an elegant hot-swapping/overriding mechanism, removing the need for hardcoded patches.
After deduplication, the engine runs .Evaluate(Context) on the individual Condition tree defined by each Strategy.
Conditions can be simple text regex matches, process name checks ("chrome"), deep OS attachment inspections, or complex generic UI queries.
Evaluate() returns true -> Keep.Evaluate() returns false -> Drop.The final filtered list of Strategies is sorted by Priority descending. The UI then binds to this list, displaying the correct icons, names, and descriptions to the user.
Conditions support composite logic (AND, OR, NOT). Since they are declarative (most defined in YAML), non-programmers can author complex visual matching rules.
Example condition scenarios:
idea.exe OR rider.exe AND text is selected.{AutomationId: 'AddressBar'} (typically browsers).