  Quantum error correction has recently emerged as a tool to enhance quantum
sensing under Markovian noise. It works by correcting errors in a sensor while
letting a signal imprint on the logical state. This approach typically requires
a specialized error-correcting code, as most existing codes correct away both
the dominant errors and the signal. To date, however, few such specialized
codes are known, among which most require noiseless, controllable ancillas. We
show here that such ancillas are not needed when the signal Hamiltonian and the
error operators commute; a common limiting type of decoherence in quantum
sensors. We give a semidefinite program for finding optimal ancilla-free
sensing codes in general, as well as closed-form codes for two common sensing
scenarios: qubits undergoing dephasing, and a lossy bosonic mode. Finally, we
analyze the sensitivity enhancement offered by the qubit code under arbitrary
spatial noise correlations, beyond the ideal limit of orthogonal signal and
noise operators.
