How to set up a command-based communication using I2C

Instead of having both boards alternate between being Master/Slave, have one board as the master and the other as the slave. The master can then request data from the slave, which can either return the results of the processing, or a code indicating that the results are not yet ready. I would also not mess with variable-length payloads, instead use the first byte to indicate the type of payload, and the remaining bytes are the actual payload data, padded to fill the maximum payload length.