by Martin Monperrus Tags:

TLDR: my coding agents wrote 1.36 million lines of code in eight months, 75% of it Python. 25% of it is ephemeral programs.

An ephemeral program is a program that is written once, executed once, and thrown away.

[ data ]

I spend real time and effort in keeping the trajectory of every coding agent session. This does not come for free since all agents delete your old sessions by default.

The first trajectory dates from 18 February 2026, I lost everything before. So “Lifetime” means “since I started archiving”.

[ what is counted ]

A line counts if an agent authored it through a tool call and it is code:

Excluded:

I report the gross number: rewriting a function ten times counts ten times, which is how agents actually work, they actually generated this code ten times.

[ result ]

In 8 months, we wrote 1,362,883 lines of code (1,213,861 non-blank) in 61,787 tool calls.

Claude Code: 77%. My own harness: 19%. Copilot CLI: 3.5%. OpenCode and Codex: the rest. So long for harness diversity.

[ by language ]

Python               1,022,669  75.0%  ████████████████████████████████████████
Go                     137,619  10.1%  █████
Solidity                79,596   5.8%  ███
HTML+JS                 31,103   2.3%  █
Shell                   29,343   2.2%  █
C                       27,603   2.0%  █
TypeScript               8,614   0.6%  █
Lean                     6,656   0.5%  █
Java                     4,596   0.3%  █
Kotlin                   4,518   0.3%  █
Other (15 languages)    10,566   0.8%  █

Python is three lines out of four. Go is a distant second. This reflects first my own preferences and instructions, and also the agent natural choices (Agent often use Python even if I don’t ask for it). Solidity comes from my smart-contract security work.

[ by location ]

Where does the code land?

project folder (cwd)         799,977  58.7%  ████████████████████████████████████████
inline programs              350,614  25.7%  ██████████████████
other paths outside the cwd  123,175   9.0%  ██████
scratchpad (/tmp, …)          89,117   6.5%  ████

What is the scratchpad? A temporary directory under /tmp that Claude Code creates for each session (/tmp/claude-<uid>/<project>/<session>/scratchpad). The agent is told to put its throwaway files there (test inputs, one-off scripts, intermediate results) to keep the project folder clean. I count any write under /tmp as scratchpad.

The scratchpad + inline is what agents throw away.

The second row is the surprise. One line in four is never written to disk. Those are pure ephemeral programs, see next section.

[ ephemeral programs ]

An ephemeral program is a program that is written once, executed once, and thrown away. This happens when the agent pipes the program to an interpreter and reads the output:

python3 - <<'EOF'
from jmap_eas.app import create_app
from starlette.testclient import TestClient
app = create_app()
with TestClient(app) as c:
    r = c.get('/healthz')
    print(r.status_code, r.json())
EOF

That is a real one, six lines. It answers one question (“does the health endpoint respond?”). Then it is gone. It is never in the project folder, never in git, never in /tmp. The only trace is the trajectory.

Why do they exist? A shell command answers a question you can phrase in one line. An ephemeral program answers a question that needs a loop, a parser, an import of the project’s own code. It is the agent’s powerful REPL.

An ephemeral program is the cheapest form of software: no name, no tests, no maintenance. Writing code has become so cheap that throwing it away after one use is the normal case.

[ numbers about ephemeral programs ]

Size distribution (lines per program, share of programs, share of ephemeral lines), median length: 7 lines, the longest has 547:

lines     programs  % progs  % lines
1            6,872    22.9%     2.0%  ███████████████████████
2-5          5,569    18.6%     6.3%  ███████████████████
6-10         7,134    23.8%    15.7%  ████████████████████████
11-20        5,591    18.6%    23.3%  ███████████████████
21-50        4,013    13.4%    34.7%  █████████████
51-100         691     2.3%    13.2%  ██
101+           109     0.4%     4.8%  

The bars show the share of programs. Most ephemeral programs are tiny: 42% have 5 lines or fewer, and 23% are one-liners (a python3 -c equivalent). The 109 programs of 100+ lines are no longer a REPL query, they are real scripts that the agent still chose not to save.

Is it a quirk of one tool? No. Claude Code 24.8% ephemeral, Copilot CLI 20.8% ephemeral, Codex 23.9% ephemeral.

wc -l or cloc on the project folder misses a quarter of what the agent wrote. If you measure agent productivity by commits or by lines in the repository, you undercount.

[ humans would write ephemeral? ]

A human writes a program of a few lines, runs it, and deletes it? Almost never, because of:

What humans do instead is the one-liner: a shell pipeline, a python -c with one expression, a REPL session. These are ephemeral in spirit, but they are small. 58% of the ephemeral programs of my agents have more than 5 lines, and 16% more than 20.

[ we need empirical studies ]

I found no empirical study of ephemeral programs. The adjacent literature is about exploratory programming, studied for tools and workflows, not as code that is never kept: a literature study of 212 publications.

Many cool research questions are open:

[ validation ]

I checked the line counter against an independent jq count of Claude Code’s Write calls: 5,127 calls, zero mismatches.

[ compute on your own trajectories! ]

The counter is part of reproducible-trajectories. It reads the trajectories of Claude Code, Copilot CLI, Codex and OpenCode on your machine. Nothing leaves it.

pipx run reproducible-trajectories count-loc

or with uv:

uvx reproducible-trajectories count-loc

Add --json for machine-readable output.

[ cite ]

@misc{monperrus2026ephemeral,
  author       = {Martin Monperrus},
  title        = {Ephemeral programs: a quarter of the code my coding agents write is never saved},
  year         = {2026},
  month        = oct,
  howpublished = {\url{https://www.monperrus.net/martin/my-agents-wrote-1m-loc}}
}