Jack Shaftoe is a fictional character featured in the novels of Neal Stephenson's The Baroque Cycle.
Jack is an English vagabond turned soldier of fortune turned adventurer. He is highly intelligent (though uneducated), and has extraordinarily poor impulse control. The latter leads to many situations that only Jack Shaftoe could find himself in, e.g., chasing an ostrich into a Turkish harem during the siege of Vienna. This poor impulse control, Jack claims, stems from the influence of an Imp of the Perverse which compels him to do things against his, or most anyone's, better judgment. Jack's sanity is, consequently, often called into question by his companions.
Jack is the father, with Mary Dolores (an Irish woman deceased before the start of the story) of twin boys (Jimmy Shaftoe and Danny Shaftoe ) through which he is (presumably) an ancestor of Bobby Shaftoe from the novel Cryptonomicon.
He earns the nickname "Half-Cocked" Jack when a medical treatment meant to cure him of syphillis goes awry and seriously damages his penis. As accounts of his exploits circulate, he accumulates additional nicknames: L'Emmerdeur, the King of the Vagabonds, Ali Zayback, Sword of Divine Fire, and Jack the Coiner.
The character is based in part on the historical figure Jack Sheppard.