pren is a prompt engine focused on reusability and composability.
pren is a powerful prompt management system that allows you to organize, store, and use prompts with advanced template capabilities for dynamic content generation. It provides a command-line interface for managing prompts and integrating them with LLMs for content generation.
- Prompt Storage: File-based storage for organizing and managing prompts
- Template Variables: Support for variable substitution in prompts using
{{variable}}syntax - Prompt Composition: Reference other prompts using
{{prompt:name}}syntax to build complex prompt structures - Dynamic Prompt References: Variable prompt references with
{{prompt_var:name}}for dynamic prompt selection - LLM Integration: Generate content directly with LLMs using your prompts
- CLI Auto-completion: Tab completion for prompt names and arguments
The pren CLI provides several subcommands for managing and using prompts:
pren add -n greeting -d "A simple greeting" -t general,template -c "Hello, {{name}}!"pren listpren show -n greetingpren render -n greeting -a name=Worldpren get -n greeting -a name=Worldpren generate -g greeting -a name=Worldpren delete -n greetingpren supports several template syntaxes for dynamic content generation:
{{variable}}: Replace with the value of the variable passed during rendering{{prompt:name}}: Include the content of another prompt (with variable substitution if applicable){{prompt_var:name}}: Include the content of a prompt specified by the variablename{{{{literal}}}}: Escaped braces render as literal{{literal}}
pren add -n hello -c "Hello, world!"
pren render -n hello
# Output: Hello, world!pren add -n greeting -c "Hello, {{name}}! Welcome to {{place}}."
pren render -n greeting -a name=Alice,place=pren
# Output: Hello, Alice! Welcome to pren.pren add -n greeting -c "Hello, {{name}}!"
pren add -n formal -c "{{prompt:greeting}} Please enjoy your stay."
pren render -n formal -a name=Bob
# Output: Hello, Bob! Please enjoy your stay.pren add -n greeting -c "Hello, {{name}}!"
pren add -n farewell -c "Goodbye, {{name}}!"
pren add -n dynamic -c "Message: {{prompt_var:message_type}}"
pren render -n dynamic -a message_type=greeting,name=Charlie
# Output: Message: Hello, Charlie!add: Add a new prompt with name, description, tags, and contentshow: Display a prompt's detailsrender: Render a prompt with provided argumentsget: Render a prompt and copy output to clipboardlist: List all available promptsdelete: Delete a promptgenerate: Render a prompt and generate content with an LLMinfo: Show information about the prompt storage