Skip to content
qianbradyPublic

About

Version prompts like code and gate quality regressions in CI - offline checks catch leaks without calling any LLM.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

promgit · prompt 版本管理与回归门禁

PromGit —— version your prompts like code, and gate regressions before they ship.

PromGit —— 把 prompt 当代码管理:快照、历史、离线体检,分数回退直接拦在 CI 门禁里。

tests license

解决什么问题

团队改 prompt 全凭手感:改完"感觉更顺了",两周后才发现某类 badcase 率翻倍。promgit 给 prompt 库加上版本链 + 分数基线:每次改动跑一遍离线体检,分数比基线退步就退出码 1 拦下合并——不接 LLM 也能拦住 80% 的典型退化(泄密、模板破损、必需小节丢失、无限膨胀)。

30 秒上手

python -m promgit init                       # 生成 .promgit/ 与 prompts/
# 放几个 prompt 进 prompts/*.md(支持 frontmatter: id / model / ...)
python -m promgit snapshot --require 边界与降级,质量标准   # 建立基线
python -m promgit check                   # CI 里跑;分数回退 → exit 1

四类离线体检

检查 默认规则 权重
forbidden 疑似 API key / AWS AKIA / 硬编码 token 正则;--forbidden 追加 40
required --require 小节标题必须存在(如「边界与降级」) 30
vars 未配对花括号(模板变量写坏的高发信号) 15
length 正文超长告警(prompt 膨胀) 15

典型 CI 接入

- name: prompt regression gate
  run: python -m promgit check --threshold 80 --json > gate.json || exit 1

设计取舍

  • 离线优先:不调 LLM 也有确定性的分数(同输入恒同输出),CI 才敢用;
  • frontmatter id 为准:文件改名不断链;重 id 直接报错;
  • 历史即 JSONL:.promgit/history.jsonl 一行一快照,diff/审计都友好。

License

MIT

Install

pip install -e .

Quickstart

  1. git clone https://github.com/qianbrady/promgit
  2. pip install -e .
  3. Run promgit --help - full usage on screen

Usage

$ promgit --help

Contributing

Issues and PRs welcome - run pytest locally before submitting.

About

Version prompts like code and gate quality regressions in CI - offline checks catch leaks without calling any LLM.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages