Solution (source code)

= Solution

For a <scalar field>, $\nabla_\mu\phi=\partial_\mu\phi$. Apply the <product rule> to the <stress-energy tensor>, using <metric compatibility> to pass the <covariant derivative> through $g^{\mu\nu}$:
$$
\begin{aligned}
\nabla_\mu T^{\mu\nu}
={}&(\Box\phi)\nabla^\nu\phi
+\nabla^\mu\phi\,\nabla_\mu\nabla^\nu\phi\\
&-\nabla_\sigma\phi\,\nabla^\nu\nabla^\sigma\phi
+m^2\phi\nabla^\nu\phi.
\end{aligned}
$$
The middle terms cancel because the <Levi-Civita connection> gives a <symmetric Hessian of a scalar field>. Thus, with the sign conventions of this question, the <scalar stress-energy divergence identity> becomes
$$
\boxed{\nabla_\mu T^{\mu\nu}=(\Box\phi+m^2\phi)\nabla^\nu\phi=0.}
$$
The last equality is the <Klein-Gordon equation>. This <stress-energy conservation> follows from the field equation and <metric compatibility>; it does not require imposing the <Einstein field equations>.