1 Kings 2:40
And Shimei arose, and saddled his ass, and went to Gath to Achish to seek his servants: and Shimei went, and brought his servants from Gath. And Shimei arose, and saddled his ass, and went to Gath to Achish to seek his servants: and Shimei went, and brought his servants from Gath.
The verse belongs to the history of Solomon's reign, within the account of the undivided kingdom under Solomon and the broader history of Israel's kings from Solomon's accession to the Babylonian captivity. It stands in 1 Kings 2, which gives the whole account of Solomon's dealing with Adonijah, Joab, and Abiathar after coming to the throne and is to be read entire. It belongs to the closing history in 1 Kings 1-2 which with 2 Samuel 11-24 shows how the judgments that came upon David completely accomplished the prophet Nathan's denunciation after David's wickedness in the case of Uriah, a transgression that is neither covered up nor excused.
After agreeing to remain in Jerusalem under Solomon's command, Shimei left for Gath to Achish to seek two servants who had fled there, and then returned with them from Gath. That departure violated the oath, command, restriction, boundary, and conditions for his life imposed by Solomon, and shows disregard for a solemn oath even over this matter. The episode is also described as defiance of David's order, with David requiring Shimei to answer for breaking the boundary set for him and Solomon sentencing him to death.
Shimei was the man who had cursed David and shown hostility toward David; though he thought David was falling, he was the one who ultimately went down, and for his disobedience he was put to death as a just reward. The verse illustrates that the warning of death on the day of disobedience meant that a sentence of death was then made certain, not that death had to occur physically that same day, so Shimei's death sentence became certain on the day he broke the command although its execution came later.