Analogy — mapping the structure of a familiar situation onto a novel one — is how human experts actually reason, and it is quietly becoming an engineering pattern: retrieve a structurally similar solved case, map its solution, adapt what the mapping gets wrong.

The cognitive-science lineage runs through Dedre Gentner's structure-mapping theory: analogy is not similarity of surface features but alignment of relations. A boilerplate CRUD app and a payment-reconciliation pipeline share no vocabulary, yet both are "ingest, validate, transform, commit, reconcile on failure" — and an engineer who sees the second through the first is never starting from zero. Case-based reasoning formalized the loop decades ago: retrieve the most relevant past case, reuse its solution, revise what does not fit, retain the new case.

LLM systems implement the loop with embeddings plus judgment. Retrieval surfaces candidate cases by dense similarity; the model then performs the part classical CBR never automated well — judging structural correspondence and adapting the solution. The pattern shows up everywhere once named: few-shot examples are retrieved analogies; RAG over internal runbooks is organizational case-based reasoning; agents that store and replay traces of solved tasks are retaining cases. The quality lever is the same in all of them — retrieving by surface similarity is easy and mediocre; retrieving by structural correspondence is the actual product.

Operating the Loop

  • Index for structure: annotate cases with goals, constraints, and failure modes — not just text — so retrieval can match on relations.
  • Adapt explicitly: prompt the model to enumerate what differs between the retrieved case and the target before porting the solution; unmapped differences are where adaptations fail.
  • Curate the case base: negative cases — failures with diagnoses — are worth more than successes; a library of solved problems without failure forensics teaches luck, not judgment.
  • Guard against fixation: a confident wrong analogy is worse than no analogy; require the model to justify why the mapping holds, and allow it to reject the retrieved case.

The frontier-model pattern of "thinking from precedent" is this discipline at scale. What retrieval-augmented generation did for facts — replacing parametric guesswork with cited evidence — analogy engineering is starting to do for strategy.