  We propose a scheme for detecting and correcting faults in any Clifford
circuit. The scheme is based on the observation that the set of all possible
outcome bit-strings of a Clifford circuit is a linear code, which we call the
outcome code. From the outcome code we construct a corresponding stabilizer
code, the spacetime code. Our construction extends the circuit-to-code
construction of Bacon, Flammia, Harrow and Shi [2], revisited recently by
Gottesman [16], to include intermediate and multi-qubit measurements. With this
correspondence, we reduce the problem of correcting faults in a circuit to the
well-studied problem of correcting errors in a stabilizer code. More precisely,
a most likely error decoder for the spacetime code can be transformed into a
most likely fault decoder for the circuit. We give efficient algorithms to
construct the outcome and spacetime codes. We also identify conditions under
which these codes are LDPC, and give an algorithm to generate low-weight
checks, which can then be combined with effcient LDPC code decoders.
