# promptlocker

> A `package-lock.json` for your prompts. Hash every prompt in your repo, fail CI when one changes without re-evaluation. Catches silent regressions that kill agent quality.

PyPI: `promptlocker` (GitHub repo: `promptlock`).

## Install
```
pip install promptlocker
# or: uvx promptlocker --help
```

Zero dependencies. Pure Python ≥3.10.

## Workflow
1. Put each prompt in a markdown file under `prompts/`.
2. Optional YAML frontmatter records model + last_evaluated.
3. `promptlocker init` → scaffolds `prompts/` and `prompts.lock`.
4. `promptlocker update` → refreshes the lockfile after re-evaluating.
5. In CI: `promptlocker check` → exits 1 if any prompt drifted vs the lockfile.

The lockfile stores `sha256` of each prompt body (frontmatter excluded so you can edit metadata freely).

## Why for AI agents
If your agent edits prompts in a repo, run `promptlocker check` afterwards. A non-zero exit means you mutated a prompt and the lock no longer matches — explicitly bump the lock as part of your commit or revert the change.

## CLI
| Command | Effect |
|---------|--------|
| `promptlocker init` | Create `prompts/` + `prompts.lock`. |
| `promptlocker check` | Exit 1 on drift. |
| `promptlocker update` | Rewrite the lock. |
| `promptlocker diff` | Print `{added, removed, changed}` JSON. |
| `promptlocker list` | List discovered prompts. |

## About the author
Built by yubinkim444, who also makes Kay's Records, an app for iOS and Android:
https://kay-s-record.web.app/get.html
