# notdone

Measure finished work, not lines.

`notdone` turns engineering events into a team-by-month panel, estimates what a tool rollout did to each measure with an event study, shows where finished work waits, and simulates a production line to find the station that limits output. One JavaScript file, no dependencies, Node 18+ and browsers.

```
npm test                         # 14 checks, about 2 seconds
node bin/notdone.js help
```

## Why it exists

In October 2026 two Harvard economists, using engineering data from more than 700 software firms (about 300 million work events, 2021 to March 2026), reported what happened after firms adopted AI coding agents: lines of code per worker rose about 30%, commits 20% and pull requests 23%, but finished issues and epics did not rise significantly. Pull requests took 49% longer to merge, drew 35% more review comments, and were sent back for changes nearly twice as often. More code went in; no more software came out. The extra work piled up in review.

Most teams can see their own lines and pull requests go up. Far fewer can see whether anything got finished faster. `notdone` gives a team or a company the same measures and the same kind of estimate the study used, on its own data.

## Use

```js
const notdone = require("./src/notdone.js");           // or <script src="notdone.js"> -> window.notdone

const rows = notdone.panel(events);                       // events: [{ unit, at, type, lines, pr, author, reviewer, days }]
const adoption = { payments: "2025-10", search: "2025-11" };   // when each team started using agents; others never did

notdone.eventStudy(rows, { measure: "issues", adoption })
// { att: { pct: -0.013, pctLo: -0.032, pctHi: 0.006, p: 0.17 }, coef: [ { k: -6, ... }, ..., { k: 6, ... } ], ... }

notdone.study(rows, { adoption, robust: true })          // every measure, with a second estimator alongside
notdone.line({ agentsFrom: 120 })                         // a simulated line: before and after
```

## What each step does

| Step | Function | What happens |
|---|---|---|
| Panel | `panel(events)` | Commits (with lines), pull requests opened and merged (with days to merge), review comments, change requests, reviewers, finished issues and epics, active workers: counted per unit and month. |
| Measures | `MEASURES` | Lines, commits and pull requests per worker; issues finished per worker; days to merge; comments per pull request; share sent back for changes; share of workers who review; issues finished per 1,000 lines (the done ratio). |
| Event study | `eventStudy(rows, {measure, adoption, window})` | Two-way fixed effects (unit and month) with an indicator for each month relative to adoption (the month before is the baseline; the ends are binned), log outcomes for counts, errors clustered by unit. Also a pooled before/after estimate. |
| Robust | `robust(rows, {...})` | Each adoption cohort compared with units not yet treated at that month, relative to the month before adoption, then averaged by month (Callaway & Sant'Anna 2021 style). Unit bootstrap for errors. Use it when early and late adopters may differ. |
| Study | `study(rows, {adoption, robust})` | All measures at once. |
| Flow | `flow(prs)` | Median days in each stage, the share spent waiting for a first review, merges per week, and work in progress by Little's law. |
| Line | `line({...})`, `createLine({...})` | A daily simulation of a team (`createLine` steps it one day at a time, so agents can be switched on mid-run): issues split into pull requests, written, picked up after a delay, reviewed with limited hours, sometimes sent back, merged; an issue is finished when all its pull requests are merged. |
| Synth | `synth({units, months, seed})` | A staggered-adoption panel with the study's effects planted, ramping in over three months. |

## On the simulated panel

`node examples/replicate-the-table.js` runs the design on `synth({ seed: 11 })` (160 teams, 36 months, 113 adopting at different times):

| Measure | Planted | Estimated (pooled after adoption) |
|---|---|---|
| Lines per worker | +30% | +26.0% |
| Commits per worker | +20% | +17.2% |
| Pull requests per worker | +23% | +18.9% |
| Issues finished per worker | 0% | −1.3% (not significant) |
| Days to merge | +49% | +44.4% |
| Comments per pull request | +35% | +30.5% |
| Share sent back for changes | +0.12 | +0.106 |
| Issues finished per 1,000 lines | — | −21.7% |

The pooled numbers sit a little below the planted ones because the effects ramp in over the first three months and the pooled estimate averages those months in; from the third month on, the month-by-month estimates match the planted effects. That is a property of the simulation and of pooling, worth keeping in mind when reading anyone's pooled number.

## The line

`node examples/the-line.js`, 240 days, agents from day 120 (seed 5):

| Per day | Before | After | Change |
|---|---|---|---|
| Pull requests opened | 3.49 | 4.20 | +20% |
| Merged | 3.54 | 4.11 | +16% |
| Issues finished | 1.17 | 1.09 | −7% |
| Waiting for review | 10.4 | 22.8 | +118% |
| Days to merge | 4.05 | 6.65 | +64% |

The agent settings (coding 1.42x, 1.23x more pull requests per issue, twice the send-back rate, 1.1x review hours per pull request, 1.36x review hours available, 1.45x pickup delay) are a model tuned to show the pattern the study reports. They are not estimates; change them and see which station limits output. With these settings the faster coding is spent on rework (more pull requests per issue, more send-backs): fewer send-backs lift finished work, while extra review hours change little unless review hours are short enough to make review the slowest station.

## Command line

```
node bin/notdone.js synth --out panel.csv --adoption adoption.csv
node bin/notdone.js study panel.csv --adoption adoption.csv --robust
node bin/notdone.js event panel.csv --adoption adoption.csv --measure mergeDays
node bin/notdone.js panel events.csv > panel.csv
node bin/notdone.js flow prs.csv
node bin/notdone.js line --days 240 --agents-from 120
```

## Limits

- An event study shows what changed around adoption, not why. If teams adopted because they were about to grow, the estimate absorbs that; check that the months before adoption are flat.
- Two-way fixed effects can be biased when effects differ across adoption cohorts and over time; compare with `robust`.
- "Issues finished" is only as good as the issue tracker. Teams that split work into more, smaller issues after adoption will look faster.
- The line simulation is a model of one team, for intuition about bottlenecks; it is not fitted to anyone's data.

## References

- Chen, F. & Stratton, J. 2026, "Artificial Intelligence in the Firm: Bottlenecks in Software Production", working paper, Harvard University (version of 4 August 2026).
- Callaway, B. & Sant'Anna, P. H. C. 2021, Journal of Econometrics 225(2), 200–230 — difference-in-differences with multiple time periods.
- Goodman-Bacon, A. 2021, Journal of Econometrics 225(2), 254–277 — difference-in-differences with variation in treatment timing.
- Little, J. D. C. 1961, Operations Research 9(3), 383–387 — a proof for the queuing formula L = λW.
- Goldratt, E. M. & Cox, J. 1984, The Goal — the theory of constraints.

MIT licence.
