Artificial intelligence is shaping our social lives. It is also affecting the process of law-making and the application of law—coined by the term ‘legal tech’. Accordingly, law-as-we-know-it is about to change beyond recognition. Basic tenets of the law, such as accountability, fairness, non-discrimination, autonomy, due process and—above all—the rule of law are at risk. However, so far, little has been said about regulating legal tech, for which there is obviously considerable demand. In this article, it is suggested that we reinvent the rule of law and graft it onto technology by developing the right standards, setting the right defaults and translating fundamental legal principles into hardware and software. In short, ‘legal protection by design’ is needed and its implementation must be required by law—attributing liability where necessary. This would reconcile legal tech with the rule of law.