Numbers (1.609, 86400, 0.05) and strings ('admin', 'USD') inline in code where the value carries domain meaning that the literal alone can't express.
The agent encounters a bare number or string whose meaning requires loading the surrounding context to interpret; refactoring the value means finding every occurrence by character match.
Bare numbers and strings that encode domain concepts become named constants whose name says what the value represents.
Each domain value has a named constant at one declaration site; every usage resolves through the constant's name, and the value's meaning loads with the name instead of being inferred from context at every literal occurrence.
Before the refactoring
function trip(distance) {return distance * 1.609;}
After the refactoring
const KM_PER_MILE = 1.609;function trip(distance) {return distance * KM_PER_MILE;}
Searching by domain term ('kilometers per mile') doesn't find the conversion; changing the value means hunting every occurrence; comments accumulate to explain what the constant means.
The agent must trace context to interpret bare literals; changing a value requires text-search across the codebase with no semantic guarantee of completeness.
Naming every literal can drown the file in trivia — only name literals that carry domain meaning the surrounding code can't speak.
Each named constant adds an import the agent loads at every consumer; the cost is one file load per consumer file in exchange for one definition site for the value.
Searches by domain term find every callsite; changing the value is one edit; the constant invites code-side documentation when it's truly load-bearing.
Changing the value happens at one constant declaration; the agent does not grep for every literal occurrence and verify each by hand, and generated code that references the constant by name picks up the new value at the next build.
Naming every literal — including loop indices, array offsets, status code 200 — drowns the file in trivia and breaks the eye's pattern-recognition for genuinely meaningful constants.
Naming every literal — including indices, loop bounds, and obvious status codes — bloats the agent's mental constant table without comprehension gain.