PIC12F617 Device ID read when debugging but not when programming
Your circuit looks fine.  The 51.1 k&Omega; resistor and diode to Vdd on MCLR is a bit silly, but that's not getting in the way of the ICD reading the device ID.  Two things to consider:

Make sure that you are trying to use the ICD3 as a programmer, not a debugger when you are just trying to program firmware that should stand on its own.

Maybe you are getting crosstalk between PGC and PGC?  I usually put 100 &Omega; in series with the lines coming out from the PIC, followed by 47 pF or so to ground.  That filters sharp edges the PIC can produce during readback, which can cross between the two lines.  This is made worse by PGC and PGD being next to each other on the normal ICD cable.  I often use a ribbon cable with a extra ground line between the two.



For more general demystification about PIC programming electrical considerations, see www.embedinc.com/picprg/icsp.htm.