Confining molecules and materials within structurally defined environments affords precise control over their interactions and reaction pathways. The pore environment in metal–organic frameworks, a class of materials composed of metal ions bridged by organic linkers, can be tailored to bind a variety of chemical species—ranging from gases to metal ions—with high specificity. In particular, a metal–organic framework furnished with coordinating bipyridine sites facilitates the nucleation, growth, and confinement of atomically-defined metal(ii) halide sheets, which exhibit magnetic properties distinct from the bulk metal halides. For molecular complexes, the secondary coordination sphere can be tuned to influence the chemistry of highly reactive intermediates. Specifically, photochemical generation of chorine radicals within the secondary coordination sphere of a series of iron(iii) pyridinediimine complexes enables observation and control of chlorine radical-mediated C–H activation. These results demonstrate that confinement can be leveraged as a powerful tool to dictate both structure and reactivity.