discoverModules

Discovers optimizable modules in an agent: the strategy-level system prompt 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.

Return

The strategy-level module first, followed by one module per optimizable subgraph in graph-traversal order.