MODEP consistently losing MIDI device connections

You may use remote shell client to run commands on the device, see this guide: Raspberry Pi: Remote Control Raspberry Pi via SSH

It must be determined what goes wrong in your case. Just recently another seemingly simillar issue was reported: Upgraded Patchbox, getting system freezes

I wonder if it’s the same issue, may be some updated Raspbian package is causing an issue…