English | 简体中文
pm is a local, pipe-friendly command-line prompt manager that uses SQLite to store and search reusable prompts.
# Save a prompt; / is the optional group separator
pm add work/code-review
# Create a prompt from piped content
generate-prompt | pm add generated
pm add from-file < prompt-body.md
# List saved prompts
pm list
# Print a saved prompt, and pipe it to an agent
pm get code-review
pm get code-review | codex exec -
pm get code-review | claude -p
codex "$(pm get code-review)"
pi "$(pm get code-review)"
pm get code-review | pbcopy # copy to clipboard on macOS
# If an execution command is configured (like systemd's ExecStart), run it directly
pm exec code-review
# Edit / remove a prompt
pm edit code-review
pm rm code-reviewA prompt is Markdown with YAML front matter:
---
name: code-review
description: Review source code
tags:
- coding
- review
exec: codex exec -
---
Review the following code:
{{input}}namemust be unique, but can be changed at any timedescription,tags, andexecare optional settings
pm --help
pm <COMMAND> --helpPrompts support variables: names must match [a-zA-Z_][a-zA-Z0-9_-]*, variables are wrapped in double braces, and default values are supported
---
name: system-check
---
SSH to the {{hostname=us-east-1}} host and check the following:
1. System load over the past {{time=15min}}
2. Disk usageAssign values to variables with -v:
pm get system-check \
-v hostname=us-west-2 \
-v time=1hUse -i to fill in missing variables interactively, one at a time. Values may span multiple lines; after entering each value, enter a line with EOF to finish it, or press -D. Prompts are written to stderr, and the rendered result is written to stdout:
pm get system-check -i
pm get system-check -i -v time=1h | codex exec -Prompts can also reference other prompts:
{{prompt:senior-engineer}}
{{prompt:security-guidelines}}
{{input}}
A literal default value can be defined after the first =:
Language: {{ language=rust }}
Endpoint: {{ endpoint=https://example.com?a=1&b=2 }}
Set exec in a prompt's front matter to define its default execution command:
---
name: code-review
exec: codex exec -
---
Review the following code:
{{input}}pm exec code-reviewArguments after -- are appended to the configured command:
pm exec code-review -- --model gpt-5.4pm list
# List only prompts under this prefix
pm list work/
pm list --tag coding
pm list --full
pm list --quiet
pm list --sort updated
pm list --sort updated -r
pm list --sort used
pm search mongoCreating a prompt and editing its content or metadata each create a version
pm history code-review
pm history code-review diff 1 3pm export code-review > code-review.md
pm import code-review.md
pm export --all ./prompts/Generate static completion scripts for Bash, Zsh, or Fish:
pm completions zsh > _pmDynamic completion reads prompt names from SQLite:
pm completions zsh --dynamic > _pm
pm get f # if a prompt named foo exists, Tab completes itpm update
pm update --checkThe database is stored at $HOME/.local/share/pm/pm.db by default. When XDG_DATA_HOME is set, $XDG_DATA_HOME/pm/pm.db is used instead.
make install # Install to /usr/local/bin by default
make install INSTALL_DIR="$HOME/.local/bin" # Install to a user directory
cargo install --path . # Install to ~/.cargo/binmake fmt
make check
make build-release