# Prompt Versioning

> Treat prompts as immutable, hashed, semver'd artifacts in a registry — deploy and roll back like code, tie eval results to specific versions.

- **Category**: Agentic AI
- **Subcategory**: Governance & Observability
- **Canonical URL**: https://designpattern.fyi/patterns/prompt_versioning/

---

## Description
**Intent**: Treat prompts as immutable, hashed, semver'd artifacts in a registry — deploy and roll back like code.
**Context**: Multiple engineers edit prompts, sometimes inline in code, sometimes through a management tool. Without versioning, you can't answer "what exact prompt was live when this bad output was generated?" and rolling back a prompt requires a code redeploy.
**Solution**: Prompts live in a registry as immutable, hashed, version-tagged artifacts. Code references prompts by name + version (semver). Deployments pin specific versions; rollback is a version change. The eval harness ties metric outcomes to prompt versions. Optionally sign artifacts for provenance.



## Use Cases
- Prompts are edited often and audit, rollback, or A/B comparison is required.
- Eval outcomes need to be tied to specific prompt versions.
- A registry can hold immutable, hashed, semver-tagged artifacts.






## Trade-offs


### Advantages

- Prompt rollback without a code redeploy — just pin the previous version.

- Eval results map to specific, reproducible prompt versions.




### Considerations & Drawbacks

- Registry infrastructure adds setup and maintenance overhead.

- Version-pinning means prompts stop tracking model upgrades automatically — requires intentional bumps.







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/prompt-versioning/)

