King David chooses to pardon Shimei, offering him a clear guarantee of safety. The king assures Shimei that he will not face execution for the specific offense he had previously committed [מצודת דוד].
To give this promise absolute authority, David takes a formal oath. Through this action, the king officially commits himself to spare Shimei's life [ביאור שטיינזלץ].