In the 1630s, Count Giangirolamo II Acquaviva d'Aragona (known as Il Guercio di Puglia) and his consort Isabella Filomarino commissioned the renovation of the ancient Romanesque church of San Matteo. They dedicated the new complex to the Healing Saints Cosmas and Damian, to whom the counts were particularly devoted, having received a grace from them.