  This article constructs the moduli stack of torsionfree $G$-structures in
homotopy type theory with one monadic modality. This yields a construction of
this moduli stack for any $\infty$-topos equipped with any stable factorization
systems.
  In the intended applications of this theory, the factorization systems are
given by the deRham-Stack construction. Homotopy type theory allows a
formulation of this abstract theory with surprising low complexity. This is
witnessed by the accompanying formalization of large parts of this work.
