The project I'm working on right now also automatically generates music and I ran into the same problem. Here's what my software automatically generates now to deal with it:
\score {
\new PianoStaff <<
\new Staff = "upper" <<
\new Voice = "first" \with {\remove "Note_heads_engraver" \consists "Completion_heads_engraver" \remove "Rest_engraver" \consists "Completion_rest_engraver"}
\voice_one >>
\new Staff = "lower" <<
\new Voice = "second" \with {\remove "Note_heads_engraver" \consists "Completion_heads_engraver" \remove "Rest_engraver" \consists "Completion_rest_engraver"}
\voice_five >>
>>
\layout{ragged-bottom = ##t ragged-right = ##t }
}
What you're looking for is the stuff starting at "\with {\remove ...\consists "Completion_rest_engraver"}
This is a lifesaver.