SAMMO is a general framework for efficiently optimizing the structure and content of metaprompt programs to improve their performance on downstream tasks.