  We define a categorical notion of cybernetic system as a dynamical
realisation of a generalized open game, along with a coherence condition. We
show that this notion captures a wide class of cybernetic systems in
computational neuroscience and statistical machine learning, exposes their
compositional structure, and gives an abstract justification for the
bidirectional structure empirically observed in cortical circuits. Our
construction is built on the observation that Bayesian updates compose
optically, a fact which we prove along the way, via a fibred category of
state-dependent stochastic channels.
