Symptom

Near-identical code in multiple files; each copy the agent reads adds to the without adding new information, and copies the agent doesn't read stay unverified. The same structural pattern appears N times, but the agent's reasoning depends on knowing which copy is canonical and which copies have drifted — none of which is structurally signaled.

Goal

One canonical version the agent reads once; edits go in one place, every caller picks them up through the shared reference, and the of N copies disappears. Subsequent reasoning passes load one definition instead of N; the agent's per-edit verification surface shrinks to the single canonical site plus its callers.

Smellier version

function totalUSD(items) {
return items.reduce((s, i) => s + i.price * i.qty, 0);
}
function totalEUR(items) {
return items.reduce((s, i) => s + i.price * i.qty, 0);
}

Fresher version

function lineTotal(items) {
return items.reduce((s, i) => s + i.price * i.qty, 0);
}
Example source: Illustrative example written for this site; the smell itself is catalogued in Martin Fowler's Refactoring (Addison-Wesley, 2018), see the chapter on Bad Smells in Code.
Pressure

The agent edits only the copy currently in its context window; copies outside the window stay unread, so the agent's spans the full duplicate population while only the edited copy gets verified. The user receives correct behavior on the path the edit covered and stale behavior everywhere else — a silent partial fix shipped as complete.

Tradeoff

Replaces N copies of the same code with one shared definition the agent reads once; if the abstraction is wrong, every exception ships as a branch the agent has to load — extra token cost at every call site. Wrong abstractions inflate the per-call count and reintroduce the partial-fix risk the deduplication was meant to remove.

Relief

Bug fixes and new features land in one place; the agent loads one definition per edit instead of N, paying token cost once instead of N times. The verification surface contracts to one function and its callers, dropping completeness-check cost to the size of one dispatch graph rather than the entire family of duplicate sites.

Trap

Merging superficially-similar code forces a flag or type tag into the shared body; later divergences ship as branches the agent loads at every call site, and edits land on the wrong branch when the flag isn't visible from the caller. The agent pays full on every edit; the merge produced a structural promise the implementation cannot keep.