Hello, AFAICT, there is no way to determine which ungrafted package a grafted package comes from without the derivation of the grafted package (where the ungrafted package is referenced). Therefore, I think adding a reference to the ungrafted package in the package itself (your second suggestion) would be the simplest way: https://issues.guix.gnu.org/66824
Presently, it is inconvenient to globally run guix gc at all for me, as many (dependent) packages are deleted and substituted again when rebuilding several profiles built with grafts. Cheers, David