  Let $\widetilde{G}$ be a split connected reductive group with connected
center $Z$ over a local non-Archimedean field $F$ of residue characteristic
$p$, let $\widetilde{K}$ be a hyperspecial maximal compact open subgroup in
$\widetilde{G}$. Let $R$ be a commutative ring, let $V$ be a finitely generated
$R$-free $R[\widetilde{K}]$-module. For an $R$-algebra $B$ and a character
$\chi:{\mathfrak H}_V(\widetilde{G},\widetilde{K})\to B$ of the spherical Hecke
algebra ${\mathfrak H}_V(\widetilde{G},\widetilde{K})={\rm
End}_{R[\widetilde{G}]}{\rm ind}_{\widetilde{K}}^{\widetilde{G}}(V)$ we
consider the specialization $$M_{\chi}(V)={\rm
ind}_{\widetilde{K}}^{\widetilde{G}}V\otimes_{{\mathfrak
H}_V(\widetilde{G},\widetilde{K}),\chi}B$$ of the universal ${\mathfrak
H}_V(\widetilde{G},\widetilde{K})$-module ${\rm
ind}_{\widetilde{K}}^{\widetilde{G}}(V)$. For large classes of $R$ (including
${\mathcal O}_F$ and $\overline{\mathbb F}_p$), $V$, $B$ and $\chi$, arguing
geometrically on the Bruhat Tits building we give a sufficient criterion for
$M_{\chi}(V)$ to be $B$-free and to admit a $\widetilde{G}$-equivariant
resolution by a Koszul complex built from finitely many copies of ${\rm
ind}_{\widetilde{K}Z}^{\widetilde{G}}(V)$. This criterion is the exactness of
certain fairly small and explicit ${\mathfrak N}$-equivariant $R$-module
complexes, where ${\mathfrak N}$ is the group of ${\mathcal O}_F$-valued points
of the unipotent radical of a Borel subgroup in $\widetilde{G}$. We verify it
if $F={\mathbb Q}_p$ and if $V$ is an irreducible $\overline{\mathbb
F}_p[\widetilde{K}]$-representation with highest weight in the (closed) bottom
$p$-alcove, or a lift of it to ${\mathcal O}_F$. We use this to construct
$p$-adic integral structures in certain locally algebraic representations of
$\widetilde{G}$.
