lab Python CLI LLM Prompt Engineering Version Control SQLite DevOps
PromptGit (pvcs)
PromptGit (pgit / pvcs) 🚀
Version Control for LLM Prompts > Treat your prompts like code. Track history, measure costs, and catch regressions.
PromptGit (command: pvcs) is a local-first CLI tool designed to bring Git-like version control semantics to Prompt Engineering. It helps you manage prompt templates, track changes, and record execution metrics (latency, cost, tokens) in a local SQLite database.
✨ Features
- Git-like Workflow: Familiar commands like
init,add,commit,log,diff,checkoutadapted for prompts. - Execution Tracking: Run prompts against LLM providers (Mock, OpenAI, Anthropic) and log every result.
- Cost Analysis: Track exactly how much your prompt engineering is costing you per model.
- Jinja2 Templating: Support for dynamic prompts using standard
{{ variable }}syntax. - CI/CD Ready: Export analytics to JSON for integration with build pipelines.
- Local-First: All data is stored in
.pvcs/db.sqlite- you own your data completely.
📖 User Guide
1. Initialization
Start by creating a new folder for your prompt project and initializing pvcs.
mkdir my-prompts
cd my-prompts
pvcs init
2. Creating a Prompt Template
Create a text file using Jinja2 syntax for dynamic variables.
sentiment_analyzer.txt:
You are a helpful AI. Analyze the sentiment of the following text:
"{{ text }}"
Return JSON: {"sentiment": "positive|neutral|negative", "score": 0.0-1.0}
3. Tracking Changes
Add the file to the staging area and commit it.
pvcs add sentiment_analyzer.txt
pvcs commit -m "Initial draft of sentiment analyzer"
4. Running a Prompt & Analytics
Run prompts with data inputs and track the costs immediately.
pvcs run sentiment_analyzer.txt --data input.json --model gpt-4
pvcs analytics # Shows total runs, costs, and breakdown by model
🏗 Architecture
- Repo:
.pvcs/directory containsdb.sqliteandindex.json. - Database: SQLite stores
commits,tracked_files, andruns. - Content: Files are hashed (SHA-256) and stored in
file_blobsfor efficient deduplication.
🛠️ Tech Stack
- Core: Python 3.12+
- CLI Framework: Typer & Rich for a beautiful terminal experience.
- Storage: SQLite for robust local data management.
- Templating: Jinja2 for flexible prompt construction.