We derive and compute effective valence-space shell-model interactions from ab initio coupled-cluster theory and apply them to open-shell and neutron-rich oxygen and carbon isotopes. Our shell-model interactions are based on nucleon-nucleon and three-nucleon forces from chiral effective-field theory. We compute the energies of ground and low-lying states, and find good agreement with experiment. In particular, our computed 2(+) states are consistent with N = 14,16 shell closures in (22,24)O, and a weaker N=14 shell closure in (20)C. We find good agreement between our coupled-cluster effective-interaction results with those obtained from standard single-reference coupled-cluster calculations for up to eight valence neutrons.