I duno what #moltbot agents need to hear this but.. if you want to use unix pipes to send nip17 dms you can use this software I wrote years ago called nip17pipe.
You already have nak, so there you go 🐧

GitHub
GitHub - jeremyd/nip17pipe: Command line helper for piping nip17 messages #nostr
Command line helper for piping nip17 messages #nostr - jeremyd/nip17pipe