[guided]Assume that $\mathcal W[g(t),f(t),\tau(t)]$ is constant on $J$. The point of the monotonicity formula is that it does not merely say $\mathcal W$ is nondecreasing; it identifies its derivative as an integral of a square. For every interior time $t \in J^\circ$, constancy gives
\begin{align*}
\frac{d}{dt}\mathcal W[g(t),f(t),\tau(t)] = 0.
\end{align*}
Perelman's $\mathcal W$-entropy monotonicity formula in the theorem setting applies by the hypotheses of the theorem and gives
\begin{align*}
0
=
2\tau(t)\int_M
\left|
\operatorname{Ric}_{g(t)}
+
\operatorname{Hess}_{g(t)} f(t)
-
\frac{1}{2\tau(t)}g(t)
\right|_{g(t)}^2
\, d\mu_t.
\end{align*}
Using the definition of $A(t)$, this is
\begin{align*}
0
=
2\tau(t)\int_M |A(t)|_{g(t)}^2\, d\mu_t.
\end{align*}
Since $\tau(t)>0$, division by $2\tau(t)$ is valid and yields
\begin{align*}
\int_M |A(t)|_{g(t)}^2\, d\mu_t=0.
\end{align*}
Now we use the positivity built into the weighted measure. The function
\begin{align*}
p \mapsto |A(t)(p)|_{g(t)}^2
\end{align*}
is continuous because $g$, $f$, and $\tau$ are smooth, and it is nonnegative because it is a squared norm. The measure $\mu_t$ is given by
\begin{align*}
d\mu_t
=
(4\pi\tau(t))^{-n/2}e^{-f(\cdot,t)}\, d\operatorname{vol}_{g(t)},
\end{align*}
and this density is strictly positive at every point of $M$. If the continuous nonnegative function $|A(t)|_{g(t)}^2$ were positive at some point $p \in M$, then by continuity it would be positive on some open neighbourhood of $p$, and that neighbourhood would have positive $\mu_t$-measure. The integral would then be strictly positive, contradicting the identity above. Hence
\begin{align*}
|A(t)(p)|_{g(t)}^2=0
\end{align*}
for every $p \in M$. Since $g(t)$ is a Riemannian metric, the squared norm of a tensor is zero exactly when the tensor itself is zero. Thus $A(t)=0$ on $M$ for every $t \in J^\circ$.
Finally, the tensor $A$ is a smooth time-dependent section of $S^2T^*M$, so it depends continuously on $t$. Because $J$ is nondegenerate, if $s \in J$ is an endpoint of $J$, then there is a sequence $(t_k)_{k=1}^{\infty}$ in $J^\circ$ with $t_k \to s$. Passing to the limit in $A(t_k)=0$ gives $A(s)=0$ on $M$. Consequently, for every $t \in J$ and every $p \in M$,
\begin{align*}
\operatorname{Ric}_{g(t)}(p)+\operatorname{Hess}_{g(t)} f(t)(p)
=
\frac{1}{2\tau(t)}g(t)(p).
\end{align*}[/guided]