A related concept is preregistration. This is a practice in which scientists publish their methods prior to conducting the experiment. Preregistration can either be “embargoed” or not. Embargoed means that the researchers register their planned methods with some independent agency, who agrees to keep the methods private until the research is ready to publish the results. This helps researchers protect from being “scooped”, having others copy their methods and beat them to publication. For example, the Open Science Framework (OSF) is a not-for-profit organization that provides a web platform on which researchers can pre-register methods and choose to have them embargoed. The web site tracks the dates when information was entered as preregistration, and any edits that were made. Thus the researcher is in control of what information is provided, and when, but the entire history of changes provides others with documentation as to whether the end results, and methods used to obtain them, are free from HARKing and p-hacking.
The other option is to publish the methods as a “preregistered report”. Some journals now allow, and even encourage this. Indeed, some journals will guarantee publication of the results of any study whose preregistered methods that journal publishes. Both the preregistered methods, and the results, still need to get through peer review, but this provides a high level of transparency around methods, preventing HARKing and p-hacking, and ensures that publication is not biased by the perceived interest or novelty of the results. Preregistration is also required in some areas of research, such as clinical trials testing the efficacy of a new drug, device, or other intervention.