# Goodhart's law

> When a measure becomes a target, it stops being a good measure, because people optimize the number, not the goal.

Concept · Laws of software engineering · https://levelcode.org/concepts/goodharts-law

**Goodhart's law** is usually stated as "when a measure becomes a target, it ceases to be a good measure." The economist Charles Goodhart described it in 1975 for monetary policy; the anthropologist Marilyn Strathern gave it the short form everyone quotes. It applies to any number people are rewarded for moving.

## How it works

A metric is useful because it correlates with something you care about but can't see directly. Code coverage correlates with how well code is tested. Closed tickets correlate with work done. Once people are judged on the number, they find the cheapest way to move it, and the cheapest way is usually not the thing it stood for:

| Target | What it was meant to show | How it gets gamed |
| --- | --- | --- |
| 90% code coverage | The code is well tested | Tests that run code but assert nothing |
| Story points per sprint | The team is getting faster | Estimates inflate |
| Mean time to resolve incidents | Outages are fixed quickly | Incidents closed early, then reopened as new ones |
| Benchmark score for a model | The model is good at the task | Prompts and models tuned to the benchmark's quirks |

Nobody has to be dishonest for this to happen. Teams simply follow the incentive they were given.

## Using metrics without breaking them

- **Measure, don't reward.** Use a number to start a conversation, not to rank people.
- **Pair metrics that pull against each other.** Deploy frequency with change failure rate; speed with quality.
- **Look underneath the number.** Read a sample of the tests, the tickets or the model outputs. A metric that rises while the samples get worse is being gamed.
- **Prefer measures close to the user.** An [SLO](https://levelcode.org/concepts/sli-slo-sla) on what users experience is harder to game than an internal activity count.
- **Refresh your test sets.** In [AI evaluations](https://levelcode.org/roadmaps/ai-engineer/evals), a fixed eval set becomes a target as soon as you tune prompts against it; keep a held-out set and add new real cases.

When a number improves suddenly and nothing else seems different, suspect Goodhart before you celebrate.
