A generalized Kuramoto model of coupled phase oscillators with a slow varying coupling matrix is studied. The dynamics of the coupling coefficients is driven by the phase difference of pairs of oscillators in such a way that the coupling strengthens for synchronized oscillators and weakens for nonsynchronized pairs. The system possesses a family of stable solutions corresponding to synchronized clusters of different sizes. A particular cluster can be formed by applying external driving at a given frequency to a group of oscillators. Once established, the synchronized state is robust against noise and small variations in natural frequencies. The phase differences between oscillators within the synchronized cluster can be used for information storage and retrieval.