Solution (source code)

= Solution

Set $U_\mu=\partial_\mu\phi$. Torsion-freeness and commutation of ordinary partial derivatives imply that its covariant Hessian is symmetric:
$$
\nabla_\alpha U_\beta=\nabla_\beta U_\alpha.
$$
Take the cyclic sum of the three commutators acting respectively on $U_\gamma,U_\alpha,U_\beta$. Their left-hand sides cancel pairwise by this Hessian symmetry, leaving
$$
\left(R^\nu{}_{\gamma\alpha\beta}
+R^\nu{}_{\alpha\beta\gamma}
+R^\nu{}_{\beta\gamma\alpha}\right)U_\nu=0.
$$
At a chosen point, a scalar field can be selected whose gradient has any prescribed covector value. The coefficient of $U_\nu$ must therefore vanish. Relabelling indices gives the <first Bianchi identity>
$$
\boxed{
R^\mu{}_{\alpha\beta\gamma}
+R^\mu{}_{\beta\gamma\alpha}
+R^\mu{}_{\gamma\alpha\beta}=0.}
$$