Prompt
need prompt version control for llm app
Latest observation
Nov 24, 2026
OpenAI APIWeb search: off
Here’s a practical way to do prompt version control for an LLM app.
What you want
Treat prompts like code:
- stored in git
- versioned with semantic tags
- change-reviewed
- tested before release
- traceable in production
Recommended setup
1) Store prompts as files in repo
Example structure:
prompts/
summarizer/
v1.0.0.txt
v1.1.0.txt
v2.0.0.txt
classifier/
v1.0.0.txt
Or use YAML/JSON if you want metadata:
name: summarizer
version: 1.1.0
model: gpt-4.1
temperature: 0.2
system: |
You are a helpful assistant...
user_template: |
Summarize the following text:
2) Use semantic versioning
A simple rule:
- patch: wording tweaks, no expected behavior change
- minor: improved instructions, same goal
- major: behavior changes, output format changes, task redesign
Example:
1.0.0= initial prompt1.0.1= typo fix1.1.0= better formatting guidance2.0.0= new output schema
3) Add prompt metadata
Track:
- prompt name
- version
- model
- temperature/top_p
- owner
- intended use
- evaluation status
- changelog
Example:
name: support_reply
version: 1.2.0
model: gpt-4.1
temperature: 0.3
owner: ai-platform
status: approved
changelog: |
- Added instruction to avoid speculation
- Added JSON output field for confidence
4) Reference prompts by version in code
Don’t hardcode prompt text inline in application code.
Example:
prompt = load_prompt("support_reply", version="1.2.0")
Or use aliases:
lateststablecanary
Example:
prompt = load_prompt("support_reply", alias="stable")
5) Add prompt tests
Create regression tests for:
- expected output format
- edge cases
- safety constraints
- golden examples
Example test cases:
- input → expected JSON fields
- input → forbidden phrases not present
- input → summary length under limit
Tools you can use:
pytest- snapshot tests
- eval harnesses
- human review checklists
6) Track prompt changes in git + changelog
Every prompt change should have:
- commit message
- pull request review
- changelog entry
- linked eval results
Example changelog:
## 1.2.0
- Added stricter tone guidance
- Reduced hallucination by requiring “I don’t know” when unsure
- Passed eval set v3
7) Deploy with staged rollout
Suggested flow:
- dev
- staging
- canary
- production
Example:
devuses latest promptstaginguses candidate versionproduses stable version- canary routes 5–10% traffic to new prompt
8) Log prompt version in every request
In production logs, store:
- prompt name/version
- model version
- request id
- input hash
- output hash
- latency
- user feedback
This is critical for debugging.
Good architecture pattern
Prompt registry
Create a small service or config layer:
- stores prompt definitions
- resolves aliases to versions
- supports rollback
- tracks approval status
Example:
{
"support_reply": {
"stable": "1.2.0",
"latest": "1.3.0",
"versions": ["1.0.0", "1.1.0", "1.2.0", "1.3.0"]
}
}
Simple implementation options
Option A: Git-only
Best for small teams.
- prompts in repo
- version tags
- release branches
- code review
Option B: Git + prompt registry
Best for medium/large teams.
- git for source control
- registry for runtime version resolution
- UI for approvals and rollout
Option C: Full prompt management platform
Useful if you need:
- experiment tracking
- A/B testing
- eval dashboards
- approvals
- audit logs
Minimum viable process
If you want something lightweight, do this:
- Put prompts in
/prompts - Version them semantically
- Review changes in PRs
- Run eval tests before merge
- Deploy using
stablealias - Log prompt version in production
Example prompt version workflow
- Edit
prompts/classifier/v1.1.0.txt - Run tests/evals
- Open PR
- Review and approve
- Merge to main
- Update
stable -> 1.1.0 - Monitor production metrics
- Roll back if needed
If you want, I can also give you:
- a folder structure template
- a Python prompt registry example
- a GitHub Actions workflow for prompt tests
- a JSON/YAML schema for prompt metadata
- a full prompt version control design for your app
If you want, I can generate a ready-to-use prompt versioning system for Python/Node.