Local variables of completed tasks with compensation boundary events

Hi everyone.

I am using Camunda platform 7. I have a model with compensation tasks on it. When compensation happens, I would like to know the local variables of each of the completed tasks that I am compensating for. These variables will be different for each task.

My question is, how do I pass variables from a task that I am compensating for to the task that handles the compensations? In this model, how does Comp1 know the variables that were local to Task 1, and how does Comp 2 know Task 2’s local variables? Thanks for your help