Heh, I just wrote something very similar - bash, curl, and jq scripts that wrap local Ollama calls to produce a REPL/agent: https://github.com/cloudkj/llayer
Seems like the core idea is the same, but I took it farther down the Unix philosophy line of thinking and tried to make the individual components small and composable.
Feel free to check it out and compare!