The description of the Armor of Agathys spell says (PHB 215, emphasis mine):
A protective magical force surrounds you, manifesting as a spectral frost that covers you and your gear. You gain 5 temporary hit points for the duration. If a creature hits you with a melee attack while you have these hit points, the creature takes 5 cold damage.
The Grappling rule states (PHB 195, emphasis mine):
When you want to grab a creature or wrestle with it, you can use the Attack action to make a special melee attack, a grapple. If you're able to make multiple attacks with the Attack action, this attack replaces one of them.
The target of your grapple must be no more than one size larger than you and must be within your reach. Using at least one free hand, you try to seize the target by making a grapple check instead of an attack roll: a Strength (Athletics) check contested by the target's Strength (Athletics) or Dexterity (Acrobatics) check (the target chooses the ability to use). You succeed automatically if the target is incapacitated. If you succeed, you subject the target to the grappled condition. The condition specifies the things that end it, and you can release the target whenever you like (no action required).
I believe that grapple counts as a melee attack that activates Armor of Agathys. Is this assumption correct?
If so, what happens on consecutive rounds of grappling? Assuming the attempt to escape has failed, and Armor of Agathys can still cause damage to opponents who hit it with melee attacks, does Armor of Agathys inflict more damage to the grappler on consecutive rounds of being grappled? Or is it just the initial grapple attempt that activates the spell and causes damage?