ARLINGTON, Va. — The rise of Donald J. Trump, with his hostility toward free trade and vow to protect entitlements, is a sharp rebuke to the free-market principles long championed by the billionaire brothers Charles G. and David H. Koch.

But if the Koch brothers have lost the battle for conservative values in 2016, they are also quietly preparing for a long war.

Their secret weapon is the Grassroots Leadership Academy: a training program dreamed up by the Americans for Prosperity Foundation, the political education arm of the Koch network, and intended to groom the next generation of conservative activists to shape the future of the Republican Party.

Taking inspiration from icons of the left like Saul Alinsky, the Marxist-inspired Frankfurt School, and even President Obama’s Organizing for Action, the academy offers classes like “Messaging to the Middle” (about reaching not just the conservative base but also persuadable voters), community organizing and how to wage a successful public protest, complete with costumes.