  Using first-principles calculations we demonstrate sizable exchange coupling
between a magnetic molecule and a magnetic substrate via a graphene layer. As a
model system we consider cobaltocene (CoCp$_2$) adsorbed on graphene deposited
on Ni(111). We find that the magnetic coupling between the molecule and the
substrate is antiferromagnetic and varies considerably depending on the
molecule structure, the adsorption geometry, and the stacking of graphene on
Ni(111). We show how this coupling can be tuned by intercalating a magnetic
monolayer, e.g. Fe or Co, between graphene and Ni(111). We identify the leading
mechanism responsible for the coupling to be the spatial and energy matching of
the frontier orbitals of CoCp$_2$ and graphene close to the Fermi level, and we
demonstrate the role of graphene as an electronic decoupling layer, yet
allowing spin communication between molecule and substrate.
