Let $M$ be a compact manifold with boundary. If we have two vector bundles $E, F \to M$ with inner products and a differential operator $D: C^{\infty}(E) \to C^{\infty}(F)$ then $D$ admits a formal adjoint $D^*: C^{\infty}(F) \to C^{\infty}(E)$.

This satisfies, for smooth sections with compact support in the interior $\phi \in C^{\infty}_c(E)$, $\psi \in C^{\infty}_c(F)$ the identity $$\int_M \langle D\phi, \psi \rangle_F \text{dvol} = \int_M \langle \phi, D^*\psi \rangle_E \text{dvol}.$$

My question is, when can we understand the value of $$\int_M (\langle D\phi, \psi \rangle_F - \langle \phi, D^*\psi \rangle_E)\text{dvol}$$ when $\phi, \psi$ are not compactly supported in the interior? There should be some boundary term, but I can't figure out exactly what it should be.

My motivating example is the following "integration by parts" for the spin Dirac operator on the positive spinor bundle over a spin$^c$ manifold with boundary: $$\int_M \langle D_A^+\phi, \psi \rangle = \int_M \langle \phi, D_A^-\psi \rangle - \int_{\partial M}\langle \phi, \rho(\nu)\psi \rangle.$$

Here $\rho(\nu)$ is Clifford multiplication by the unit normal vector to the boundary.

There is a similar identity for the Levi-Civita connection, etc.