Ninefox Gambit by

Machineries of Empire ; book 1 …the battle of wits between a disgraced captain and her undead advisor, a brilliant tactician...