03 · What You Need to Know
When AI Prompt Records Matter for Research Code Transparency
What Is the Difference Between a Prompt Record and a Code Record?
A prompt record documents an instruction, question, or other input submitted to an AI system. Depending on the interaction, it may also include the model's response, follow-up instructions, attached context, and information about the model used.
A code record preserves the actual source code incorporated into the research project, including subsequent human edits and corrections.
These records answer different questions.
Prompt history
Helps explain what the researcher requested, what the AI suggested, and how particular development decisions arose.
Executable code history
Shows which code revisions were preserved and, when appropriately linked to data and environment records, which implementation produced the research results.
Neither record is a complete substitute for the other. A prompt may not reveal the final implementation, while executable code may not explain why the researcher chose a particular analytical approach.
Why Might Researchers Want to Preserve AI Coding Prompts?
Research documentation is not limited to preserving final outputs. It can also explain decisions that shaped those outputs.
The Turing Way emphasizes the value of provenance information in reproducible research, including records of how files and analytical workflows change. AI-assisted programming introduces another potential source of development decisions that researchers may need to reconstruct.
For example, an AI-generated function might implement a particular missing-data strategy because the researcher explicitly requested it. Alternatively, the model may have introduced that strategy without being instructed to do so.
These situations have different methodological implications. A preserved interaction can help distinguish an intentional research decision from an unexamined model-generated assumption.
Prompt documentation may therefore support an audit of the development process, particularly when an analytical choice is consequential or subsequently questioned.
Which AI Prompts Are Worth Preserving?
The most useful prompt records are those that explain substantive aspects of the research workflow rather than routine interactions with little evidentiary value.
| AI interaction |
Why it may matter |
Suggested treatment |
| Request to implement a statistical method |
May document assumptions and analytical instructions |
Preserve the prompt, relevant response, and accepted implementation. |
| Request to clean or exclude observations |
May affect the analytical sample |
Preserve the decision and its methodological justification. |
| AI suggestion to change an estimator |
May alter results or interpretation |
Record the suggestion, review, and final researcher decision. |
| Correction of a consequential coding error |
May explain why reported results changed |
Preserve the relevant interaction and corrected code revision. |
| Routine syntax explanation |
Usually has limited methodological significance |
Optional unless required by project policy. |
| Rejected cosmetic suggestion |
Usually does not affect the final analysis |
Generally unnecessary unless relevant to an audit. |
These are practical recommendations, not universal retention rules. A project studying how AI systems generate research software may require substantially more comprehensive prompt records than a project using AI only for occasional programming assistance.
Should Researchers Save the AI Response as Well as the Prompt?
Often, yes, when the interaction is consequential.
A prompt alone records what the researcher requested, but not what the model actually produced. The AI response may contain assumptions, warnings, proposed code, or methodological suggestions that were not explicitly included in the original instruction.
For instance, a researcher might ask an AI tool to handle missing questionnaire responses without specifying a particular strategy. The model could recommend complete-case analysis, mean imputation, or another approach. Preserving only the prompt would not establish which recommendation was made.
A useful record may therefore include the prompt, relevant response, accepted code, and a short explanation of the researcher's decision.
Researchers should distinguish between what the AI proposed and what was ultimately executed. An AI response is not evidence that its proposed method was accepted, implemented correctly, or scientifically justified.
Do Prompt Records Make AI-Generated Code Reproducible?
Not by themselves.
Computational reproducibility generally depends on whether the original analysis can be rerun using the appropriate code, data, software dependencies, and computational settings.
Preserving prompts may improve understanding of how the code was developed, but asking the same model to regenerate a script is not a reliable substitute for saving the actual implementation.
Model outputs can vary across interactions. Changes in model versions, settings, hidden system instructions, and service implementations may further complicate attempts to reconstruct earlier responses.
Consequently, making AI-generated research code reproducible should begin with preserving and testing the executable workflow. Prompt history is supplementary unless the generation process itself forms part of the research method.
Should Prompts Be Stored in the Same Git Repository as the Code?
They can be, but there is no universal requirement to do so.
For projects where prompt records are appropriate for inclusion, researchers might maintain a dedicated documentation directory containing selected prompts, relevant model responses, and links to associated code revisions.
For example, a project could use the following structure:
research-project/
README.md
src/
clean_data.py
analyze_data.py
tests/
test_clean_data.py
environment.yml
docs/
ai-assistance-log.md
prompts/
scoring-function.md
missing-data-review.md
This is an illustrative organization, not a required repository standard.
Each prompt record can identify the code file or commit to which it relates. Such links are more informative than storing a collection of disconnected AI conversations.
Researchers should apply appropriate version-control practices for AI-assisted code changes so that prompt documentation remains associated with identifiable implementations.
Where interactions contain confidential data or restricted information, a separate access-controlled research record may be preferable to storing them in a repository intended for public release.
What Information Should an AI Prompt Record Contain?
The level of detail should reflect the importance of the interaction. For consequential AI-assisted coding decisions, a structured record may include the following information:
-
Date and purpose: When the interaction occurred and what programming task it supported.
-
AI tool and model: The provider, model identifier, and version or snapshot information when available.
-
Relevant prompt: The instructions and context necessary to understand the request.
-
Relevant AI response: The proposed code, explanation, or recommendation that influenced the workflow.
-
Researcher decision: Whether the suggestion was accepted, modified, rejected, or independently replaced.
-
Verification: The tests, calculations, or methodological checks used to evaluate the accepted code.
-
Code reference: The associated file, commit identifier, or release.
Researchers should avoid claiming to have recorded a complete AI interaction if the record includes only selected messages. A curated log can be useful, but it should be identified as such.
For greater transparency, documenting the AI model involved in code generation may also help establish the development context. Model names alone, however, may not identify an exact deployed configuration.
What If a Prompt Contains Research Participant Data?
Prompt preservation introduces an important confidentiality problem.
Researchers may have included participant responses, unpublished datasets, personal identifiers, institutional information, or confidential manuscript content in an AI interaction. Saving or sharing the transcript could expose those materials again.
Even when an AI service permits conversation exports, that capability does not establish that the content may lawfully or ethically be disclosed.
Watch Out
Do not commit unreviewed AI conversation exports to a public repository. Prompt histories may contain identifiable research data, API credentials, confidential material, or information subject to contractual restrictions. Git history can retain previously committed content even after it is deleted from the latest version.
Researchers should assess whether the material was appropriate to submit to the AI service in the first place, then determine how any retained record must be protected.
Where permitted, a redacted prompt record may preserve the methodological instructions without disclosing sensitive content. Redaction should be documented when it removes context relevant to interpreting the interaction.
GitHub's official documentation explains both how to exclude files from tracking and the difficulties of removing sensitive information after it has entered repository history.
When Is a Complete AI Conversation History More Important?
There are research situations in which selective prompt documentation may be insufficient.
Suppose the research question concerns whether different AI models can generate correct statistical analysis code from identical instructions. In that case, the prompts, responses, model configurations, sampling settings, and generation procedures may be part of the experimental evidence.
Researchers would need to define the relevant units of observation, preserve the outputs under study, and document the conditions under which they were generated.
Likewise, a study evaluating how iterative prompting changes code quality may need to preserve the sequence of interactions rather than only the final successful prompt.
In these circumstances, the AI generation process is part of the research methodology itself. Its reproducibility requirements are therefore more extensive than those of a study that simply uses AI to assist with developing an otherwise conventional analytical script.
Can Researchers Rely on the AI Platform to Preserve Their Prompt History?
That is not always a reliable long-term preservation strategy.
Conversation histories may be deleted, become inaccessible after account changes, or depend on service features and retention policies that change over time.
Researchers should not assume that a conversation link will remain accessible throughout the research record's required retention period.
For interactions that warrant preservation, an authorized export or independently maintained record is generally more dependable. The retained material should be stored in accordance with institutional data-management and information-security requirements.
Researchers should also consider whether the exported conversation is complete and whether attached files, system-level instructions, or other contextual information remain unavailable.
Does Saving Prompts Establish Who Is Responsible for the Code?
No. Prompt records can clarify how an implementation was developed, but they do not transfer scientific responsibility to the AI system.
A researcher who accepts AI-generated code remains responsible for evaluating whether it performs the intended analysis. A preserved prompt showing that the researcher requested an incorrect calculation does not make the calculation scientifically acceptable.
Likewise, documenting that AI proposed a methodological choice does not establish that the choice was appropriate.
The distinction between human and AI contributions to research code may be relevant to transparency, but verification must address the actual computational behavior of the accepted implementation.