Barcode (BAyesian Reconstruction of COsmic DEnsity fields) samples the primordial density fields compatible with a set of dark matter density tracers after cosmic evolution observed in redshift space. It uses a redshift space model based on the analytic solution of coherent flows within a Hamiltonian Monte Carlo posterior sampling of the primordial density field; this method is applicable to analytically derivable structure formation models, such as the Zel'dovich approximation, but also higher order schemes such as augmented Lagrangian perturbation theory or even particle mesh models. The algorithm is well-suited for analysis of the dark matter cosmic web implied by the observed spatial distribution of galaxy clusters, such as obtained from X-ray, SZ or weak lensing surveys, as well as that of the intergalactic medium sampled by the Lyman alpha forest. In these cases, virialized motions are negligible and the tracers cannot be modeled as point-like objects. Barcode can be used in all of these contexts as a baryon acoustic oscillation reconstruction algorithm.