Using what we have learned about signal processing in various pathways of the brain, we have developed a range of approaches to “write” signals into the brain. In earlier work, we paired stimulation with simultaneous measurement of ongoing neural activity across brain structures, enabling us to optimize stimulation parameters (Millard et al., 2015). Using a combination of genetic tools and real-time hardware interfacing, we have developed a framework for closed-loop, feedback control of neural circuits using optogenetics (Newman et al., 2015; Bolus et al., 2018). This framework most recently has been advanced to multi-channel control problems, where we apply strategies from optimal control theory (Bolus et al., 2021). In ongoing work, we are also developing a corresponding toolbox for real-time estimation of cortical states, for guiding behavioral cues and stimulation in closed-loop experiments (Borsa, Weiss, et al., 2022).