The OED offers these two definitions:
Recognition of a mistake made earlier, leading to a change in one's actions, views, etc.and
Wisdom acquired after the event, typically too late to be of use.Most of the OED's examples of the word's use are drawn from the 1500s and 1600s.
Here are some other definitions:
Websters: "wisdom or perception that comes after it can be of use";
The American Encyclopaedic Dictionary: "wisdom, which comes after the event which it is designed to affect"; and
The Treasury of Knowledge and Library of Reference: "wisdom that comes too late."
The ever resourceful Samuel Johnson defined 'afterwit' as, "The contrivance of expedients after the occasion of using them is past."
I like the gloss given by T. J. B. Spencer in his 1980 edition of John Ford's play The Broken Heart (1633), where 'afterwit' is "knowledge that comes too late." (Manchester University Press, p. 160 n. 12)
The word made it to America, where it was used by Captain Edward Johnson (1599-1672) in his Wonder-working providence of Sions Saviour in New England. (1654). The word lingered long enough in American memory to make it into the writings of Benjamin Franklin, who took the pseudonym 'Anthony Afterwit.'
As a fictional character's name, 'Afterwit' appears to have been a popular satirical device. In his journal Champion (1739), Henry Fielding took the name Afterwit while penning a letter to Captain Hercules Vinegar (another of Fielding's pseudonyms). A 'Mrs. Afterwit' figures in Issue No. 652 of Addison and Steele's Spectator. (Feb. 28, 1715, pp. 76-77) More than fifty years earlier, John Wilson applied the name to a royalist character in The Cheats (1663). And William Burnaby had two characters discuss a Sir Humphrey Afterwit in Act IV (Scene I) of his 1700 play, The reform'd wife a comedy.
In 1600, Samuel Nicholson wrote a poem called 'Acolastus his after-wit'. We also find the word 'afterwit' in this passage from Ch. 12 of Laurence Sterne's Tristram Shandy: "Trust me, dear Yorick, this unweary pleasantry of thine will sooner or later bring thee into scrapes and difficulties, which no afterwit can extricate thee out of." Finally, in the 9th episode of his Ulysses ('Scylla and Charybdis'), James Joyce writes, "Afterwit. Go back."
In the 20th century, the word survived in the dialect of Yorkshire, where it was said that
"Durham folks are troubled with afterwit."