Take a look at the example: https://github.com/romkatv/gitstatus#gitstatusd. Even though this example uses ZSH, it's just for exposition. It launches gitstatusd, writes a request to its stdin, reads the request from stdout and prints it. You can discern from it the format it uses for requests and responses.