No sooner had Republicans passed much needed tax reform than they agreed to an awful budget deal that will undermine it.

Government spending is the true long-term tax burden of government activity. So, to sustain a new, more competitive tax code, which cuts rates, Republicans should have made spending cuts. This was the perfect opportunity to balance the budget and lock in reform. Instead, Republicans did the opposite: trading their favored huge defense spending increases for Democrats’ desired hikes in other areas. As a result, a deficit already forecast to widen substantially will blow up much sooner, putting the gains from tax reform in jeopardy.

Annual borrowing is now expected to bust $1.2 trillion by 2019. If tax cuts and the budget deal are both made permanent, the Committee for a Responsible Federal Budget estimates that number will rise to $2.1 trillion by 2027, pushing the debt-to-GDP ratio to well over 100 percent of GDP. This is the opposite of what we should be doing after a sustained period of growth.

What can be done? A prerequisite for reversing this mistake requires Republicans and Democrats concerned with the nation’s fiscal health to make the case for near-term fiscal restraint and long-term entitlement reform. But evidence from around the world shows that effective balanced budget rules can be part of a solution too, helping politicians overcome their inherent “deficit bias”.

The case for overall restraint should be obvious. At 77 percent of GDP, federal debt held by the public in 2016 was at its highest level since just after World War II, and way above its 40 percent post-war average. Unlike that post-war period — when military spending cuts, sustained growth, and high inflation eroded the debt burden — projections now show debt ballooning to over 150 percent of GDP over the next three decades. The cause? Ever-rising Social Security and Medicare spending.

Such rising debt levels are not sustainable. They would leave the federal finances dangerously exposed to negative shocks and slow economic growth. Moreover, every year this fiscal reality is ignored, doing something about it gets harder. Last year, the Congressional Budget Office estimated that getting the debt-to-GDP ratio back to its historic average of 40 percent of GDP over three decades would require permanent spending cuts equal to 3.1 percent of GDP. Doing nothing until 2028 would make the needed cuts much steeper at 4.6 percent of GDP.

So, we need to act sooner rather than later — and that change surely requires changing the budget process. Rather than asking politicians to vote to finance spending commitments they have already made, as the debt ceiling does, we need a rule that binds their hands in the first place and explicitly shows the trade-offs associated with new spending before they vote for it.

In a new Cato Institute paper, “Budget Restraints That Work,” I review evidence from around the world on budget rules to ascertain which work best to achieve the goal of reducing the debt-to-GDP ratio. The news is somewhat heartening. Well-designed rules can help entrench fiscal restraint, provided that there is: first, a political commitment to them; second, enough flexibility built in to deal with downturns; and third, limited opportunities for creative accounting by politicians to circumvent them.

An effective rule that fulfils these criteria for the U.S. would be set a cap each year for annual spending, since this is the variable that government has most control over. To achieve the same results as a balanced budget over time, this cap should be set at an estimate of revenues for this year based on the trend in revenues seen across the previous seven years.

The result would be spending that tracks a smoothed revenue trend. Its formulaic nature (relying on calculations from past trends rather than forecasts) would mean the federal finances would not be left hostage to the possibility of overoptimistic forecasting blowing a sustained hole in the budget. A falling debt-to-GDP ratio would be all but certain by design.

A rule like this should be appealing to both conservatives and liberals. It ensures fiscal discipline by tying spending to revenues. But it does so in a way that allows borrowing to fluctuate with the economic cycle. When revenues fall relative to expected trends, it allows deficits. When revenues are above trend, it would enforce surpluses. It would not prejudice what the overall size of the state should be.

Of course, there would need to be added details, such as an escape clause for genuine emergencies. If spending or revenues proved to be way different at the end of the year than expected, then there would also need to be a mechanism to adjust future spending plans over a number of years. And we would still need to achieve structural balance in the near term so that this rule could be implemented from a healthy baseline.

But as part of the long-term answer to today’s federal fiscal challenge, this rule would be a clear and transparent way of setting spending limits, and an important step toward getting debt-to-GDP back on a sustainable, downward path.

Such fiscal conservatism is shockingly absent in Congress right now. But what can’t go on, won’t go on. As the old saying goes, it’s always darkest before dawn.