Contract flexibility can be expedient for economic exchange in environments with high ambiguity and risk, but may also encourage opportunistic behavior. We run a modified investment game, including the choice between two different contract designs and asymmetric information about the realized surplus (i.e., hidden knowledge). We examine if Nairobi slum dwellers choose flexible over rigid contracts when interacting in risky environments and whether preferences for contract flexibility are sensitive to the exogenous probability of experiencing a negative shock. We find that most interaction is realized through flexible agreements. Principals offer a higher level of flexibility if the likelihood of a shock is high, relative to the low-risk environment. Agents are somewhat more reluctant to sign rigid agreements when facing the threat of a bad state. While agents and the overall efficiency benefit from higher flexibility, principals always do better by opting for a rigid contract.