Restriction factors and pattern recognition receptors make up innate or intrinsic cellular defenses against viral infection. TRIM5 proteins are restriction factors and receptors that recognize the incoming cores of retroviruses by binding to the capsid that surrounds and protects the core. Upon capsid binding, TRIM5 proteins accelerate dissociation of the viral core, inhibit reverse transcription of the viral genome, and activate ubiquitin-dependent interferon signaling. TRIM5 proteins contain the tripartite motif fold (RING, B-box, and coiled-coil domains) and a C-terminal domain (SPRY or CypA) that mediates direct binding to retroviral capsids. Retroviral capsids are fullerene structures composed of about 1,500 copies of the viral CA protein, which are organized on a hexagonal lattice composed of about 250 hexamers and exactly 12 pentamers. TRIM5-mediated capsid recognition is driven by avidity, requiring higher-order assembly of multiple TRIM5 protein molecules on the capsid surface. I will discuss a series of studies, which collectively show that TRIM5 binds a retroviral capsid through a mechanism of hierarchical assembly. A limited number of local interaction modes are successively organized as increasingly higher-order structures that culminate in a TRIM5 cage surrounding the capsid. Cage formation explains the mechanism of restriction and provides the structure/function context that links core recognition to ubiquitin-dependent processes that disable the retrovirus and signal the presence of an invader.