Why do people add H(core)+F in Hartree-Fock? I'm trying to implement my own HF code, and it seem usual that, after building the Fock matrix $F$, they add that to the pre-existing $H_{core}$, from the two-point interactions, when computing final energy.

As one example, https://github.com/ipudu/SCFpy/blob/master/SCFpy/scf.py . In lines 135-138, they include Hcore in F. Then in line 156, when they actually return the energy, they add Hcore[i,j]+F[i,j], apparently double-counting Hcore.

As another example, in http://sirius.chem.vt.edu/wiki/doku.php?id=crawdad:programming:project3 , when they compute the energy (see Step #9), they use $$E_{elec}^i = \sum_{\mu\nu}^{AO} D_{\mu\nu}(H^{core}_{\mu\nu} + F_{\mu\nu})$$

again apparently double-counting $H_{core}$. Why? What gives?

My best guess is that this is somehow related to the fact that these are double-filled orbitals, containing both spins. But then, shouldn't $F$ need a factor as well, for all it particles occurring twice as well?

In particular, I have an HF code that agrees with the 'crawdad' link above by copying their steps pretty much verbatim. I'm now trying to extend it into a generalized Hartree-Fock code, but I'm having difficulties, and in trying to understand the problem I became confused by this expression.
Actually, $F$ is double-counting the electron-electron interaction when evaluating the total energey. By adding $H^{\text{core}}$ and using a factor of $\frac{1}{2}$, which I suspect is implicit in $D$, one can obtain the correct energy. This is basically an occurence of the HF energy not being the sum of orbital energies (which are a result of $F$).