I was between clients for a few weeks and I wrote some apps for practicing musical scale patterns in different keys, and something to automate voice leading from chord to chord. Best three or four weeks in the last few years.
It's very simple. First reduce the requirements: ignore the melody. Then iterate through the inversions of a chord in closed position, and pick the one with the smallest "distance" from the previous chord.
Using that strategy, you can pick different chord voicing templates, like drop-2 or quartal. An even better method would be to move the "hands" up the keyboard after a tonic chord, that way you don't end up in the low registers too quickly, since jazz harmony tends to go down in 4ths a good bit.