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."
Such dialect uses preoccupied an anonymous author in the Guardian in 1943. On Sept. 20 and 22, 'afterwit' is the focus of the column headed 'Miscellany'. In the first entry, 'afterwit' is defined as realizing a witty retort too late to be of use and, so, is assimilated to Diderot's l'esprit de l'escalier. The author credits a correspondent from Lancashire with bringing 'afterwit' to his attention. In the second entry, the author reports that (according to some readers) the word occurs more often in Yorkshire than Lancashire. S/he adds that 'afterwit' is sometimes replaced by 'latter-wit', especially when preceded by the phrases 'troubled with ...' and 'plagued by ...'. The author then says, "In the OED version the 'wit' of afterwit has to do with knowledge rather than repartee; the word means after-knowledge as opposed to fore-knowledge." (p. 3)
On March 20, 1931 (p. 6), the Washington Post reprinted a piece from the London Times under the heading 'Afterwit'. The author uses the phrase "the pangs of afterwit" and "troubled by afterwit" and asks "whether afterwit is a blessing or a curse." S/he adds, "Is it preferable to go on in blithe unconsciousness that we might have done so much better, or to become painfully aware of opportunity gone by; to be permanently stupid, or to be wise too late? The choice is hard."