Alembic-inspired migration control for production AI prompts and agent configurations
pip install promptmigrate-cli==0.1.0 Copy PIP instructions
Alembic-style migrations for LLM prompts and AI agent configuration. Keep prompts and agent configs as Git-tracked JSON, generate ordered, reviewable revisions, apply them to environments, roll them back, and fail CI when an environment drifts from history.
Langfuse, MLflow, Agenta and promptctl already version and manage prompts. PromptMigrate focuses on something narrower: an ordered migration protocol for configuration, the way Alembic does it for database schemas.
It's designed to sit alongside prompt registries, not replace them.
Python 3.10 or newer. The PyPI distribution is named promptmigrate-cli (the name promptmigrate was already taken); the command and the import are both promptmigrate:
python -m pip install promptmigrate-cli promptmigrate --version To work on PromptMigrate itself, install from a clone instead:
git clone https://github.com/himanshu231204/prompt-migrate.git cd prompt-migrate python -m pip install -e . Five-minute example In a separate, empty project directory, run the example with the starter draft that init creates. You can edit the draft before generating the first revision.
promptmigrate init promptmigrate env list promptmigrate env add qa # Optional: edit .promptmigrate/drafts/assistant.json with the desired system prompt, # model, temperature, tool specs, response schema, etc. promptmigrate revision -m "initial assistant prompt" promptmigrate history promptmigrate plan --env dev --target head promptmigrate upgrade head --env dev promptmigrate check --env dev --require-head promptmigrate get assistant --env dev Then edit .promptmigrate/drafts/assistant.json and run:
promptmigrate diff promptmigrate revision -m "strengthen refusal instructions" promptmigrate upgrade head --env staging promptmigrate current --env staging promptmigrate downgrade -1 --env staging A revision describes the change from the previous Git-tracked revision, not from your local dev database, so pull your team's latest revisions before generating one. For multi-agent systems, add more drafts such as planner.json or reviewer.json. Deleting a draft and generating a revision deletes that config in the target environment, reversibly.
A runnable two-agent walkthrough is in examples/multi-agent-basic/.
{ "format_version": 1, "revision": "0123456789ab", "down_revision": null, "message": "initial assistant", "created_at": "2026-10-29T00:00:00+00:00", "changes": { "assistant": { "before": null, "after": { "messages": [{"role": "system", "content": "You are helpful."}], "model": "provider/model-id", "parameters": {"temperature": 0} } } } } before and after are full JSON snapshots, and null means the config is absent. One revision can change several configs in a single atomic transaction. Snapshots make reversal deterministic, at the cost of larger files and keeping old values in Git history.
flowchart LR D["drafts/*.json
desired config"] -- "revision -m" --> V["versions/*.json
ordered revisions (Git)"] V -- "upgrade / downgrade" --> S[("states/#lt;env#gt;.sqlite3
config + applied ledger")] V -. "check: ledger and config
must match history" .-> S upgrade and downgrade verify the environment against history, then change the configs and the applied-revision ledger together in one SQLite transaction. If anything doesn't match, the command fails without writing.
Global flags: --project targets another project directory, and --output json prints machine-readable results. Exit codes are documented in docs/CLI_SPEC.md.
project/ .promptmigrate/ drafts/ # desired JSON configs (Git tracked) versions/ # revisions with before/after snapshots (Git tracked) environments.json # declared environments (Git tracked) states/ # local SQLite state per environment (gitignored) Use in CI In your project's workflow, install PromptMigrate from its repository, then replay every revision into a throwaway environment and verify it:
- run: python -m pip install "git+https://github.com/himanshu231204/prompt-migrate.git" - run: promptmigrate validate --strict --drafts-clean - run: promptmigrate upgrade head --env dev - run: promptmigrate check --env dev --require-head states/ is gitignored, so a fresh CI checkout starts every environment at the empty base. This job proves the revision history loads, applies cleanly in order from scratch, and verifies. It can't check a long-lived environment such as staging, because that state lives only on the machine that owns it; shared remote state is planned for Phase 3.
validate checks only the files in Git (history, drafts, manifests, secret allowlist) and exits 3 on any finding under --strict; --drafts-clean also fails when a draft edit has no revision yet. check exits non-zero on drift, an edited applied revision, or (with --require-head) pending revisions. It verifies integrity, not prompt quality: it doesn't measure answer quality or prompt-injection resistance.
Not guaranteed yet: transactions across model providers, locks across hosts, remote state, signed revisions, authentication, evaluation gates, canary releases or an append-only audit history. Don't use v0.1 to manage live production prompts or secrets.
The plan is in docs/ROADMAP.md and tracked as GitHub milestones:
Contributions are welcome. Every issue is a single task with acceptance criteria.
python -m pip install -e ".[dev]" python -m pytest -q Design docs start at docs/HANDOFF.md.
I share free visual notes, agent skills and guides on AI agents, Google ADK, RAG and LLMs.
Both files in this release have provenance metadata.
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2026.
Both files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




