SHE arrived in the presidential palace with a reputation as a no-nonsense manager, but one who had never previously held elected office. Almost eight months into her term as Brazil's president, Dilma Rousseff has found herself sucked into the political swamp that is Brasília. She has reacted firmly to corruption scandals, and is striving to trim budget pork and to fill senior government jobs on merit rather than through political connections. Her reward has been signs of mutiny in her coalition. With the world economy deteriorating, whether Ms Rousseff can impose her authority on her allies matters a lot for Brazil's prospects.

In June the president dawdled before dispensing with Antonio Palocci, her chief of staff, after allegations of past influence-peddling had made his position untenable. Since then she has been quick to nip any scandal in the bud. When Veja, a weekly magazine, published evidence of systematic overbilling on contracts at the transport ministry, the president fired dozens of officials, including the minister. Next Veja reported on similar overpayments and kickbacks at the agriculture ministry. The number two at the ministry was sacked; on August 17th the minister, Wagner Rossi, a sidekick of the vice-president, Michel Temer, resigned. This month police arrested more than 30 officials in the tourism ministry, including the deputy minister, on suspicion of stealing public money intended for training hotel staff ahead of the 2014 football World Cup. In the midst of all this the president sacked the defence minister after he insulted some of her closest aides in an interview.

In all this Ms Rousseff is slowly putting her own stamp on a government that she inherited from her predecessor and political mentor, Luiz Inácio Lula da Silva. But the multiple scandals are straining her ramshackle coalition. This consists of over a dozen parties, ranging from communist to right-wing populist, that between them give her the nominal support of around three-quarters of Congress. The main interest of some of the coalition's smaller members is not ideology but the extraction of jobs and money—for personal gain or party financing—from government. They are annoyed that Ms Rousseff has tried to rewrite the rules of the game.

Many of the 25,000 government jobs in her direct gift remain unfilled. Of those that have been doled out, more have gone to independent technocrats than the parties wanted. To help to cut the fiscal deficit she has eliminated legislators' amendments to the budget involving spending on pet projects of 8 billion reais ($5 billion).

This week the small Party of the Republic, of the former transport minister, left the coalition. More dangerous is discontent in the president's own Workers' Party and its biggest ally, the Party of the Brazilian Democratic Movement, to which Mr Temer belongs. The latter, in particular, fears disruption to business as usual and the spoils system. Both regard Ms Rousseff as dangerously naive. They think that by acting on the corruption claims she may have started something she cannot stop. Politicians under fire have a habit of throwing back counter-claims of wrongdoing by others.

Grandees from both parties are now trying to persuade the president that handing out more jobs and allowing through at least some pork would be a small price to pay for governability. Otherwise, they warn, Congress may retaliate by approving a big-spending constitutional amendment. One that has backbench support would impose a national minimum salary for police and firefighters; another would force the federal government to spend far more on health care. Either would blow a huge hole in next year's budget, already stretched because of a promised inflation-busting hike to the minimum wage and linked social-security spending.

But the biggest legislative test for Ms Rousseff will come in a vote due before the end of the year on extending a provision, in force since 1994, that gives the government discretion over 20% of federal spending. Its approval requires the support of three-fifths of both houses of Congress. Her advisers are working to persuade potential rebels that its rejection would leave Brazil defenceless in the face of global economic turmoil by making any fiscal retrenchment impossible.

If Ms Rousseff does manage to whip Congress back into line using a mix of threats, promises and appeals to self-interest, her reward could be cleaner politics. “She is trying to send a new message to politicians—that they can play the old political game but with new limits,” says Sylvio Costa of Congresso em Foco, a website that acts as a watchdog. A clean-up would be popular with middle-class voters. But more important for Ms Rousseff's overall popularity will be keeping inflation under control and ensuring that a necessary cooling of the economy does not descend into stagnation.

The difficulty of managing Congress seems to have persuaded the president and her advisers to try and do without any big legislative reforms, especially constitutional ones that require three-fifths majorities. Where they are unavoidable, the approach will be to take tiny steps and put off any pain as far as possible into the future.

Drowned out by the scandals, the government has made some such moves in recent weeks. An industrial policy features a cut in payroll taxes but only for a few industries, which will pay a (smaller) tax on turnover instead. A scheme under which small businesses can use a simplified system for filing tax returns has been widened. The government's approach to harmonising the sales taxes levied by state governments is to seek agreement to gradual change. Making Brazil's absurdly generous pensions system slightly less so by raising the retirement age will require congressional approval—but officials working on it hope that by pushing the pain into the future there is a chance it will pass. Rather than trying to reform Brazil's labyrinthine labour laws, many of which are enshrined in the constitution, the government hopes to improve productivity by offering more scholarships and technical training.

Perhaps as great as the risk that Ms Rousseff will stumble in the attempt to clean up Brazil's politics is that, against a darkening world economic background, such a gradualist approach may be overtaken by events.