Former White House chief of staff John Kelly introduced himself to staff members with a speech that was “potentially hostile” to Donald Trump, according to a new memoir by a former Trump communications aide.

The aide, Cliff Sims, described being shocked by a speech Kelly made to staff at the Eisenhower executive office building shortly after Kelly replaced outgoing chief of staff Reince Priebus.

Sims writes in his book Team of Vipers, a copy of which was obtained by the Guardian, that Kelly’s speech “hammered” on the theme of service to country coming first, and service to the president second.

“Kelly seemed to be saying that… it might be necessary to subvert the president’s wishes in service of some amorphous higher calling,” Sims writes.

Kelly, a retired four-star Marine general, was credited with bringing a degree of basic functionality to the White House when he took the chief of staff job in July 2017, firing the errant communications director Anthony Scaramucci and pushing out chief strategist Steve Bannon.

The whole thing felt like Game of Thrones, but with the characters from Veep

But from the start, the disciplined Marine was on a collision course with his boss. Trump chafed against Kelly’s attempts to introduce a chain of command, and Kelly committed public stumbles such as mishandling domestic abuse charges against staff secretary Rob Porter.

By last December, Kelly and Trump were reportedly no longer speaking, and Kelly was replaced by acting chief of staff Mick Mulvaney earlier this month.

White House officials have previously expressed frustration with what they described as Kelly’s savior complex. “Kelly portrays himself to Trump administration aides as the lone bulwark against catastrophe, curbing the erratic urges of a president who has a questionable grasp on policy issues and the functions of government,” unnamed officials told NBC News last year.

Sims’ book makes much of infighting among White House staff. “The whole thing felt like Game of Thrones, but with the characters from Veep,” writes Sims, an Alabaman who joined the Trump campaign as co-host of a Facebook live program run by the campaign.

The memoir is the latest entry in the impressively stocked subgenre of tell-all books by former Trump aides and insiders, with previous contributors including Sean Spicer, Scaramucci, Omarosa Manigault Newman, Corey Lewandowski and David Bossie. The bookshelf has been generously padded by entries from journalists including Bob Woodward and Michael Wolff.

If Kelly had reservations about some of Trump’s policy views, the pair shared many views including, crucially, a hardline posture on immigration.

“We’re on the same page,” Sims quotes Bannon as saying when Kelly comes aboard. “He knows the border is f–ed. He dealt with it [in his previous role as secretary of homeland security]. “It’s going to be good.”

Whatever was good about it soon soured, however. In September, Kelly found himself denying an accusation, reported by Woodward, that he had called Trump an “idiot”.

“The idea I ever called the president an idiot is not true,” Kelly said.

Sims does not report such a comment, but he writes that when the retired general smiled, he appeared to be in pain, concluding: “He didn’t seem like the most pleasant guy to be around.”