Cooperative behavior emerges in biological systems through coordinated actions among individuals 1, 2. Although widely observed across animal species, the cellular and molecular mechanisms underlying the establishment and maintenance of cooperative behaviors remain largely unknown 3. To characterize the circuit mechanisms serving the needs of independent individuals and social groups, we investigated cooperative digging behavior in Drosophila larvae 4-6. Although chemical and mechanical sensations are important for larval aggregation at specific sites 7-9, an individual larva's ability to participate in a cooperative burrowing cluster relies on direct visual input as well as visual and social experience during development. In addition, vision modulates cluster dynamics by promoting coordinated movements between pairs of larvae 5. To determine the specific pathways within the larval visual circuit underlying cooperative social clustering, we examined larval photoreceptors (PRs) and the downstream local interneurons (lOLPs) using anatomical and functional studies <up>10, 11</up>. Our results indicate that rhodopsin-6-expressing-PRs (Rh6-PRs) and lOLPs are required for both cooperative clustering and movement detection. Remarkably, visual deprivation and social isolation strongly impact the structural and functional connectivity between Rh6-PRs and lOLPs, while at the same time having no effect on the adjacent rhodopsin-5-expressing PRs (Rh5-PRs). Together, our findings demonstrate that a specific larval visual pathway involved in social interactions undergoes experience-dependent modifications during development, suggesting that plasticity in sensory circuits could act as the cellular substrate for social learning, a possible mechanism allowing an animal to integrate into a malleable social environment and engage in complex social behaviors.