Since the Enlightenment, there have been advocates for the rationalizing efficiency of enlightened sovereigns, bureaucrats, and technocrats. Today these enthusiasms are joined by calls for replacing or augmenting government with algorithms and artificial intelligence, a process already substantially under way. Bureaucracies are in effect algorithms created by technocrats that systematize governance, and their automation simply removes bureaucrats and paper. The growth of algorithmic governance can already be seen in the automation of social services, regulatory oversight, policing, the justice system, and the military. However, there have also always been justified democratic and economic criticisms of autocracy, bureaucracy, technocracy, and algorithmic governance. Bureaucrats, technocrats, and algorithms embody biases that tend to serve the interests of elites, and all require transparency and democratic accountability, oversight individual citizens are ill equipped to exercise. As state apparatuses are increasingly automated, mechanisms for collective action and democratic oversight also need to be automated. Algorithms and cyborg citizenry will enable a posthuman democracy. Democratically accountable algorithmic governance, enabled by artificial intelligence and human enhancement, can automate bottom-up citizen surveillance, inform debate, aggregate decision making, and ensure the efficient working of the gradually withering state. As paid work disappears and we transition to a postcapitalist economy with a universal basic income, market mechanisms can be replaced with democratic planning. Indeed, only algorithmic governance can secure our future against accelerating threats from technological innovation.