archetypos.dev

Archetypes are the recurring patterns that shape systems, cultures, and codebases. They are the invisible scaffolding beneath the surface of every design decision, every architectural choice, every narrative structure. This field guide maps their anatomy -- not to catalog them as curiosities, but to reveal the deep grammar that makes complex systems legible. When you learn to see archetypes, you learn to see the bones of the world.

 1  class Archetype {
 2    constructor(name, pattern) {
 3      this.name = name;
 4      this.pattern = pattern;
 5      this.instances = [];
 6    }
 7
 8    // Recognize pattern in context
 9    match(context) {
10      return this.pattern
11        .test(context.structure);
12    }
13  }

Pattern Recognition

Every archetype begins as an observation: a structure that appears once, then twice, then everywhere. The Archetype class encodes this recognition -- a named pattern with the ability to test itself against new contexts. When a pattern matches, it doesn't merely identify similarity; it reveals the underlying grammar that produced both the original and the new instance. Recognition is the first step toward understanding.

The match method is deliberately simple. Archetypes don't need complex heuristics -- they need clarity. A pattern either resonates with a structure or it doesn't. The power lies not in the matching algorithm but in the quality of the pattern definition itself.

1  const observer = new Archetype(
2    "Observer",
3    /one-to-many.*notify/
4  );
5
6  // Test against a system
7  observer.match(eventBus);
8  // => true

On the Observer

The Observer archetype is perhaps the most pervasive pattern in software -- and in nature. Every publish-subscribe system, every event emitter, every neural synapse firing across a network embodies the same ancient grammar: one entity changes state, and many others respond. To see the Observer is to see the connective tissue of reactive systems everywhere.

Archetypal Network

Creator Observer Strategy Mediator Iterator Facade

Synthesis

Archetypes do not exist in isolation. They form networks -- constellations of interdependent patterns that reinforce and constrain one another. The Creator needs the Observer to propagate change. The Strategy requires the Facade to present a coherent interface. The Mediator sits at the center, coordinating flows between patterns that would otherwise create circular dependencies.

Understanding these relationships transforms pattern recognition from taxonomy into architecture. You stop collecting patterns and start composing systems.

archetypos repl

$

Scanning... found 14 archetypal patterns.

$

Observer: 7 instances across 3 modules.

$ _

Coda

The field guide does not end here. Archetypes are living patterns -- they evolve with the systems that embody them, and new archetypes emerge as new domains of complexity are explored. What you have seen in these three modules is a beginning: the grammar of recognition, the vocabulary of composition, the syntax of systemic thought. The rest is practice.

Go look at your own systems. The archetypes are already there, waiting to be named.