Behind the scenes there have been all sorts of power struggles. For a start I learn that the row over outsiders in Whitehall is not confined to defence secretary Liam Fox and his former flatmate Adam Werritty. No, it goes right to the top. I am told that inside Downing Street “plenty of people” have been urging prime minister David Cameron to appoint a top businessman from the private sector to take over as head of the Home Civil Service when Sir Gus steps down at the end of the year.

Sir Gus has fought them off and his victory is being claimed as a vote of confidence in the civil service. Yet while Sir Gus has won that battle, he seems to have lost another, more significant one. His role is being split – as it used to be more than 30 years ago. The change marks the triumph of that consummate Downing Street operator, Jeremy Heywood, currently the top official in Number 10. He will take over as cabinet secretary and will be chief policy adviser to the PM while Ian Watmore will head a new expanded cabinet office, where he is already based. “Jeremy will be an extremely powerful figure, in effect heading a combined department of the PM and the cabinet office,” says one insider. So why isn’t the new Whitehall supremo becoming head of the civil service as well? Simple. He didn’t want both jobs.

So the new head of the civil service will a part-timer. The existing permanent secretaries will be invited to apply but whoever is appointed will continue to run a major government department as well. Some senior figures complain that the role of head of the civil service is being “downgraded”. Says one: “Being a permanent secretary is a full-time job – no department wants their boss heading the civil service on the side.” Worse, it is happening at a time of cuts, pay freezes and strike threats.

Sir Gus – who will go to the Lords – may himself share these concerns. I’m told that back in 2009, when he and Mr Heywood appeared before a Lords committee, he said he was a “strong believer” in keeping his various roles together. Whether or not he has changed his mind, the new arrangements are clearly designed to suit Mr Heywood.

Sir Gus will probably be best remembered as the mandarin who smoothed the path of the first coalition government in 80 years – and without involving the Queen. Yet despite his brilliant people skills, the likeable Sir Gus has been viewed with suspicion by some Tories because he managed to get on so well with Labour’s Tony Blair and Gordon Brown. He and Ed Balls, now shadow chancellor, even jointly edited a book, with a foreword by Mr Brown, on reforming Britain’s economic policy. Sir Gus, who is interested in developing countries and may work in that field, could be glad to leave Whitehall behind.

Code breaker

Meanwhile the unfolding Fox saga has shown that the much-vaunted ministerial code is not worth the paper it is written on. It was rewritten last year to say it was “not the role of the cabinet secretary or other officials to enforce the code”. Allegations about breaching the code would be referred to the independent adviser on ministers’ interests, currently Sir Philip Mawer.

The change was backed by Sir Gus. The mandarins hate being asked to sit in judgment on a minister. Usually they either have to accuse the minister of lying or they clear him and everyone says it’s a whitewash. Former cabinet secretary Sir Robin (now Lord) Butler, was attacked when he cleared Tory minister Jonathan Aitken, later jailed for perjury.

Yet right now Sir Philip is nowhere to be seen. Instead Ursula Brennan, a top defence official, helped by Sir Gus, is investigating whether Mr Fox broke the code. In other words, the PM has decided to break the very code that he introduced with such a flourish last year. And no one can stop him. Is this another blow for Sir Gus?

Not necessarily. Sir Gus has been heard to murmur that managing these things is “one of the joys of the job”. The PM clearly wants to keep the abrasive Fox, who is said to be getting a grip on his ministry’s finances. Says one insider: “Sir Philip might decide that Mr Fox had indeed broken the code. Ursula and Sir Gus will be more ... subtle and mandarin-like.”