discover Modules
Discovers optimizable modules in an agent: the strategy-level system prompt, when present and non-empty, plus any subgraphs created via optimizableSubgraphWithTask.
Non-optimizable subgraphs — those created via plain subgraph { } or subgraphWithTask — are filtered out, since their runtime does not consume an OptimizationArtifact and any candidate the optimizer produces for them would be a no-op.
Each subgraph module is seeded with the user's optimizableInstruction. Lookup is identity-keyed via OptimizableSubgraphDelegate.lookupBaseline, populated at strategy-construction time by OptimizableSubgraphDelegate.getValue.
The system message read below is the agent-level one, and it is the only one that exists at discovery time. Since koog 1.1.1 fresh subgraphs inherit it, so __strategy__ and the subgraph modules are no longer independent: optimizing the strategy instruction changes the context every optimizable subgraph runs in, and per-module scores are not separable.
Return
The strategy-level module first when the agent has a non-empty system prompt, followed by one module per optimizable subgraph in graph-traversal order.