The bimodal requisite for a genetic program and external stimuli is a key feature of sensory circuit formation. However, the contribution of cell-intrinsic codes to directing sensory-specific circuits remains unknown. Here, we identify the earliest molecular program that preselects projection neuron types in the sensory neocortex. Mechanistically, Foxg1 binds to an H3K4me1-enriched enhancer site to repress COUP-TFI, where ectopic acquisition of Foxg1 in layer 4 cells transforms local projection neurons to callosal projection neurons with pyramidal morphologies. Removal of Foxg1 in long-range projection neurons, in turn, derepresses COUP-TFI and activates a layer 4 neuron-specific program. The earliest segregation of projection subtypes is achieved through repression of Foxg1 in layer 4 precursors by early growth response genes, the major targets of the transforming growth factor-β signaling pathway. These findings describe the earliest cortex-intrinsic program that restricts neuronal connectivity in sensory circuits, a fundamental step towards the acquisition of mammalian perceptual behavior.