© 2015 The Authors. Ecology and Evolution Published by John Wiley & Sons Ltd. Understanding the drivers of ant diversity and co-occurrence in agroecosystems is fundamental because ants participate in interactions that influence agroecosystem processes. Multiple local and regional factors influence ant community assembly. We examined local factors that influence the structure of a twig-nesting ant community in a coffee system in Mexico using an experimental approach. We investigated whether twig characteristics (nest entrance size and diversity of nest entrance sizes) and nest strata (canopy shade tree or coffee shrub) affected occupation, species richness, and community composition of twig-nesting ants and whether frequency of occupation of ant species varied with particular nest entrance sizes or strata. We conducted our study in a shaded coffee farm in Chiapas, Mexico, between March and June 2012. We studied ant nest colonization by placing artificial nests (bamboo twigs) on coffee shrubs and shade trees either in diverse or uniform treatments. We also examined whether differences in vegetation (no. of trees, canopy cover and coffee density) influenced nest colonization. We found 33 ant species occupying 73% of nests placed. Nest colonization did not differ with nest strata or size. Mean species richness of colonizing ants was significantly higher in the diverse nest size entrance treatment, but did not differ with nest strata. Community composition differed between strata and also between the diverse and uniform size treatments on coffee shrubs, but not on shade trees. Some individual ant species were more frequently found in certain nest strata and in nests with certain entrance sizes. Our results indicate that twig-nesting ants are nest-site limited, quickly occupy artificial nests of many sizes, and that trees or shrubs with twigs of a diversity of entrance sizes likely support higher ant species richness. Further, individual ant species more frequently occupy nests with different sized entrances promoting ant richness on individual coffee plants and trees.