  For a compact oriented surface $\Sigma$ of genus $g$ with $n+1$ boundary
components, the space $\mathfrak{g}(\Sigma)$ spanned by free homotopy classes
of loops in $\Sigma$ carries the structure of a Lie bialgebra equipped with a
natural decreasing filtration, whose structure morphisms are called the Goldman
bracket and the (framed) Turaev cobracket.
  We address the following Goldman-Turaev (GT) formality problem: construct a
Lie bialgebra homomorphism $\theta$ from $\mathfrak{g}(\Sigma)$ to its
associated graded ${\rm gr}\, \mathfrak{g}(\Sigma)$ such that ${\rm gr} \,
\theta = {\rm id}$. In order to solve it, we define a family of higher genus
Kashiwara-Vergne (KV) problems for an element $F\in {\rm Aut}(L)$, where $L$ is
a free Lie algebra. In the case of $g=0$ and $n=2$, it is the classical KV
problem from Lie theory. For $g>0$, these KV problems are new.
  We show that an element $F$ induces a GT formality map if and only if it is a
solution of the KV problem. A crucial step in solving the higher genus KV
problem is to construct solutions for the case of $g=1$ and $n=1$ in terms of
certain elliptic associators following Enriquez. By solving the KV problem, we
establish the GT formality for every $g$ and $n$, with the exception of some
framings for $g=1$ in which case the GT formality actually does not hold.
Furthermore, we introduce pro-unipotent groups ${\rm KV}$ and ${\rm KRV}$ which
act on the space of solutions of the KV problem freely and transitively. There
are injective maps ${\rm GT}_1\to {\rm KV}, {\rm GRT}_1\to {\rm KRV}$ from
Grothendieck-Teichm\"uller groups.
  As an application, we show that the Johnson obstruction given by the Turaev
cobracket coincides with the one given by the Enomoto-Satoh trace. As part of
our study, we prove a uniqueness theorem for non-commutative divergence
cocycles on the group algebra of a free group which is of independent value.
