Page 3 of the supplementary information of High-threshold and low-overhead fault-tolerant quantum memory (Nature, 2024) gives an algorithm for the syndrome measurements of arbitrary BB codes. I'm curious about how to turn this into a STIM circuit.
The main non-obvious thing seems to be regarding logical measurements at the end of the STIM circuit and perhaps the detectors.
Presumably, for each measured syndrome qubit I use a DETECTOR annotation to compare the measurement to the measurement of the same qubit in the previous cycle. I should also have a DETECTOR annotation at the start of the circuit for each syndrome qubit.
At the end of the circuit, how do I implement logical measurements of the multiple logical qubits within the BB code, what are my OBSERVABLE_INCLUDE and what should my DETECTOR annotations look like?
Perhaps, more generally, what must DETECTOR annotations and OBSERVABLE_INCLUDE correspond to at the end of STIM circuits? Looking at the surface code example, OBSERVABLE_INCLUDE seems to correspond to a logical X/Z operator on the surface code and I'm unclear what the final DETECTORs correspond to.