Too early to break out the champagne, but today's results are best yet. I'm encouraged!
Yesterday I improved the clock software so that it would synchronise closer to the NPT time command. The program on the main computer was changed so that, on receipt on a synchronous command from me, it waits until the next whole second before telling the clock. This eliminates most of the error due to ignoring microseconds at the sender.
In the clock, when a synchronisation time message arrives, I obtain the bob position by reading the pendulum timer/counter. This varies between zero and about 13175309 ticks. As each tick is 62.5nS, how far through a swing the bob is can be calculated accurately. This value is used to adjust the gearTrain so that counter time aligns with pendulum ticks. How good it is varies, but better than 0.1s is typical. More work needed.
I also changed the clock so that it only sends messages immediately after time reports. As these are written immediately after a 'tock', any extra messages have a whole pendulum period in which to send. Previously, clock messages where sent immediately, which meant the microcontroller could be tied up when a 'tock' was received, and delay reporting it. Touch wood, seems to have stopped glitches. The graph is clean, and no bad ticks are in the log:

The graph shows the clock running uncompensated for 45000 beats to establish drift rate, then the spike when drift compensation was loaded and the clock resynchronised to NPT. Thereafter the clock stays close to the green line, showing it's not far off NPT. Actual numbers:
ClockEnd = 2023-02-04 16:32:00.388850
NPTEnd = 2023-02-04 16:32:00.376452
Difference = 0.012s 0.000019% (0.195ppm)
The pendulum is unusually well behaved so far in this run, reporting Q=13883, Hopefully because the impulse is right and needn't be touched again.
It's what happens next that matters. With luck all is now good and the clock will stay close to NPT for months. More likely next time I check, it will have veered off for no apparent reason. I know the temperature and pressure compensation isn't spot on, but earlier runs showed deviations with no obvious cause. I suspect the suspension because it's not well made.
Dave