  We describe a systematic development of kinetic entropy as a diagnostic in
fully kinetic particle-in-cell (PIC) simulations and use it to interpret plasma
physics processes in heliospheric, planetary, and astrophysical systems. First,
we calculate kinetic entropy in two forms -- the ``combinatorial'' form related
to the logarithm of the number of microstates per macrostate and the
``continuous'' form related to $f \ln f$, where $f$ is the particle
distribution function. We discuss the advantages and disadvantages of each and
discuss subtleties about implementing them in PIC codes. Using collisionless
PIC simulations that are two-dimensional in position space and
three-dimensional in velocity space, we verify the implementation of the
kinetic entropy diagnostics and discuss how to optimize numerical parameters to
ensure accurate results. We show the total kinetic entropy is conserved to
three percent in an optimized simulation of anti-parallel magnetic
reconnection. Kinetic entropy can be decomposed into a sum of a position space
entropy and a velocity space entropy, and we use this to investigate the nature
of kinetic entropy transport during collisionless reconnection. We find the
velocity space entropy of both electrons and ions increases in time due to
plasma heating during magnetic reconnection, while the position space entropy
decreases due to plasma compression. This project uses collisionless
simulations, so it cannot address physical dissipation mechanisms; nonetheless,
the infrastructure developed here should be useful for studies of collisional
or weakly collisional heliospheric, planetary, and astrophysical systems.
Beyond reconnection, the diagnostic is expected to be applicable to plasma
turbulence and collisionless shocks.
