arXiv:2610.27693cs.SEOct 2026

Manuscript Offprint

arXiv:2610.27693

Knowledge as Code

Martin Monperrus

Abstract

For millennia, knowledge has been carried by language, and large language models still put language at the center. Yet the coding agents built on these models mostly write code. This paper is a contribution to epistemology, which asks what kind of knowledge code is and how it is obtained. We define knowledge as code as knowledge written in a programming language or in a machine-parsable data format, whose validity can be checked by executing it. We define thirteen epistemic properties of knowledge media and show that code is the first medium to have all of them. We distinguish two ways in which knowledge enters code, encoding and learning by execution, where code is both the experiment and the record of its result. Agents make learning by execution observable, since their trajectories record every probe, observation and line of code they keep. Code is thus not only a tool of knowledge work but a knowledge medium in its own right, the first that can check what it holds.

1 Introduction

For millennia, knowledge has been carried by language, first in living memory and then in writing (Ong, 1982). Large language models continue this tradition, and their name says it: they learn from language and answer in language, and the facts they hold can be queried in language (Petroni et al., 2019).

Philosophy has studied knowledge carried by speech and by texts (Goody & Watt, 1963; Ong, 1982), and machine learning research studies the knowledge held in the weights of language models (Petroni et al., 2019). Neither has an account of code as a carrier of knowledge, although a growing part of what is known about the digital world is written in code.

When an agent queries an API, reads the response, and writes a parser for it, something has been learned about the world and kept. The parser is knowledge of the API, justified by the response that the agent observed, and checked every time the parser runs, which is not true of the same fact written in prose or held in weights.

We propose knowledge as code, defined as knowledge written in a programming language or in a machine-parsable data format, whose validity can be automatically checked. We define thirteen epistemic properties of knowledge media: persistence, transmissibility, precision, expressiveness, inspectability, editability, provenance, composability, executability, verifiability, reproducibility, generativity and scalability. We apply them to oral tradition, written language, LLM weights and code. Code meets all thirteen; code is the first knowledge medium that keeps what writing brought millennia ago and adds to it. When knowledge is code, knowledge can act, be checked by a machine, be checked again later, and produce new knowledge.

We distinguish two ways in which knowledge enters code, encoding, which moves existing knowledge into code, and learning by execution, which obtains new knowledge by executing code against the world. We describe the executable knowledge lifecycle that produces, checks and revises the latter.

We measure these concepts on the work of coding agents. Agents make knowledge as code observable, since their trajectories record every probe, every observation and every line of persisted code. Our corpus holds 29,260 trajectories and our instruments are fully automated. We measure how much of what agents write is knowledge as code, how much of the code they keep was learned by execution, how much of it is knowledge verification, and whether what they learned still holds months later.

This paper is a contribution to epistemology, which asks what kind of knowledge code is and how it is obtained. No prior work gives an epistemic account of code, one that compares it with other media by their properties and explains how knowledge enters it by execution.

This paper makes the following contributions.

• Code is shown to be the first knowledge medium that has all thirteen epistemic properties (sections 3 and 6).

• In learning by execution, code is both the experimental means and the experimental outcome (section 4).

• Empirical statistics about knowledge-as-code. Four lines out of five that coding agents write are knowledge as code, and one line of code in four is a probe.

References (40)