Skip to content

julio-mcdulio/pmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pmp

Python package

A simple prompt management tool supporting different storage backends.

Table of Contents

Quickstart

Install pmp using uv or pip. The project requires Python 3.10 or higher.

# With uv
$ uv pip install -e .

# Or with regular pip
$ pip install -e .

For development, install with test dependencies:

$ uv pip install -e ".[test]"

Basic Usage

Get started with these essential commands:

$ pmp add hello --content "Hello, world!" --tag "greeting"
prompt "hello" version 1 created

$ pmp get hello
Hello, world!

$ pmp list
hello

$ pmp edit hello --content "Hello, everyone!"
prompt "hello" version 2 created

$ pmp delete hello --force
prompt "hello" deleted versions [1, 2]

Configuration

By default pmp uses the file store backend. You can optionally configure a different backend and storage location. The file backend stores prompts as JSON files, while the sqlite backend uses a SQLite database.

$ pmp config set backend file
backend = file

$ pmp config set backends.file.path ~/.pmp/store
backends.file.path = ~/.pmp/store

Storage Plugins

pmp supports storage plugins that extend the default backends with additional functionality. Storage plugins use the pluggy plugin system and can be installed as optional dependencies.

The following plugins are currrently supported:

Detailed Examples

Adding Prompts

Add a prompt with content, tags, and an associated model:

$ pmp add demo --content "You are a helpful assistant" --tag "chat,general" --model "gpt-4"
prompt "demo" version 1 created

Retrieving Prompts

Retrieve a prompt in different formats:

$ pmp get demo
You are a helpful assistant

$ pmp get demo --format json
{
  "name": "demo",
  "version": 1,
  "content": "You are a helpful assistant",
  "metadata": {
    "tags": [
      "chat",
      "general"
    ],
    "model": "gpt-4"
  },
  "created_at": "2025-11-27T22:03:40+00:00"
}

$ pmp get demo --version 1 --format yaml
name: demo
version: 1
content: You are a helpful assistant
metadata:
  tags:
  - chat
  - general
  model: gpt-4
created_at: '2025-11-27T22:03:40+00:00'

Updating Prompts

Update an existing prompt to create a new version:

$ pmp edit demo --content "You are an expert assistant" --tag "expert,chat"
prompt "demo" version 2 created

Listing Prompts

List all prompts:

$ pmp list
demo

$ pmp list --long
NAME  VERSION  TAGS         MODEL  UPDATED
----  -------  -----------  -----  -------------------------
demo  2        expert,chat  gpt-4  2025-11-27T22:03:49+00:00

$ pmp list --format json
[
  {
    "name": "demo",
    "latest_version": 2,
    "updated_at": "2025-11-27T22:03:49+00:00",
    "metadata": {
      "tags": [
        "expert",
        "chat"
      ],
      "model": "gpt-4"
    }
  }
]

Filter prompts by tag or model:

$ pmp list --tag expert
demo
test2

$ pmp list --model gpt-4
demo

Deleting Prompts

Delete a specific version or all versions of a prompt:

$ pmp delete demo --version 1
prompt "demo" version 1 deleted

$ pmp delete demo --force
prompt "demo" deleted versions [2, 3]

Reading from Files

Read prompt content from a file:

$ pmp add my-prompt --file prompt.txt --tag "production"
prompt "my-prompt" version 1 created

Viewing Configuration

View and modify configuration:

$ pmp config get backend
file

$ pmp config list
backend = "file"
[backends]

[backends.file]
path = "~/.pmp/store"

Command Overrides

Override the backend for a single command:

$ pmp --backend sqlite list
test-sqlite

Use with other tools

pmp prompts can be easily used with other CLI tools. Here are examples using llm:

$ echo "Python is a programming language" | llm "$(pmp get summarize)"
Python is a versatile, high-level programming language known for its easy readability and wide range of applications.
$ echo "def add(a, b): return a+b" | llm "$(pmp get short-review)"
The given code defines a simple function named add that takes two parameters, a and b, and returns their sum. It uses a concise format with a single-line return statement, which is clear and efficient for its intended purpose. However, it lacks type annotations and documentation, which could improve its usability and readability, especially in larger codebases.
$ llm -s "$(pmp get explain-code)" "def square(x): return x*x"
The function square(x) takes an input x and returns its square by multiplying x by itself.

Chain multiple pmp calls together using pipes:

$ PROMPT=$(pmp list --tag code | head -1 | xargs pmp get)
$ echo "def add(a,b): return a+b" | llm -s "$PROMPT"

This uses pipes to find prompts tagged with "code", selects the first one, retrieves it, then uses it as a system prompt with llm.

Generate a prompt using llm and store it back in pmp:

$ pmp get generate-prompt | llm | pmp add python-reviewer --content "$(cat)" --tag "code,review"
prompt "python-reviewer" version 1 created

This retrieves a prompt from pmp, uses it with llm to generate a new prompt, then stores the result back into pmp.

About

A simple prompt management tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages