Managing complexity and uncertainty in high-risk sociotechnical systems requires people to continuously adapt. Designing resilient systems that support adaptive behavior requires a deepened understanding of the context in which adaptations take place, of conditions and enablers to implement these adaptations, and of their effects on the overall system. Also, it requires a focus on how people actually perform, not how they are presumed to perform according to textbook situations. In this paper, a framework to analyze adaptive behavior in everyday situations in which systems are working near the margins of safety is presented. Further, the variety space diagram has been developed as a means to illustrate how system variability, disturbances, and constraints affect work performance. The examples that underlie the framework and the diagram are derived from nine focus groups with representatives working with safety-related issues in different work domains, including health care, nuclear power, transportation, and emergency services.