




Are you ready to revolutionize your command-line experience? Say hello to prompt2, the cutting-edge software that brings the power of AI directly to your terminal. Whether you’re a developer, a sysadmin, or just a tech enthusiast, prompt2 is here to supercharge your productivity and creativity.
{{reads}}
, {{writes}}
, and custom filters to create dynamic, powerful prompts.Ready to dive in? Here’s how to get started:
pip install prompt2
export OPENROUTER_API_KEY=sk_...
prompt2 edit hello
prompt2 send hello
With these simple commands, you’ll be crafting and sending AI-powered prompts in no time. And remember, prompt2 puts you in control of the narrative.
Note: If you’re using LiteLLM, you can use any supported ENV vars instead of OPENROUTER_API_KEY
.
Let’s walk through a quick tutorial to see prompt2 in action:
Create a Prompt: Run prompt2 edit hello
. This opens your $EDITOR
, where you can type something like create a hello world in python
. This creates a prompt in ~/.prompt2/prompts/hello.txt
, which you can view with prompt2 list
.
Send the Prompt: Run prompt2 send hello
. Watch as the AI responds with a tutorial on creating a Python script.
Use a Parser: Run prompt2 send hello wholefile
to use the wholefile parser. You’ll get only the Python source code as output.
Save the Output: Run prompt2 send hello wholefile > hello.py
. Notice how prompt2 caches responses to save costs, making subsequent runs lightning-fast.
Update the Prompt: Run prompt2 edit hello
again, and update the text to:
update this script to also print any sys arg with the hello string {{read('hello.py')}}
This uses Jinja2 to read the content of hello.py
and include it in the prompt. You can even register your own Jinja functions and template paths!
Send the Updated Prompt: Run prompt2 send hello wholefile > hello.py
again to update your script.
Profit: Enjoy your newly enhanced script!
If you run into any issues, you can peek behind the curtain with:
DEBUG=1 prompt2 send hello
prompt2 supports multiple models through environment variables. Set MODEL
to configure your default LLM plugin:
MODEL='openrouter/google/gemini-2.5-pro-exp-03-25:free'
You can also define specific models for different purposes:
MODEL_EDITOR='deepseek/deepseek-chat:free max_tokens=16384'
MODEL_ARCHITECT=xai/grok-2-latest
For those who love scripting, prompt2 offers a Python API:
import prompt2
import asyncio
async def ai_wizard():
model = prompt2.Model.get('architect')
prompt = prompt2.Prompt('hello')
result = await model(prompt, 'wholefile')
with open('hello.py', 'w') as f:
f.write(result)
asyncio.run(ai_wizard())
prompt2’s plugin system is robust and flexible:
Here’s a quick overview of prompt2’s CLI commands:
prompt2 paths
: Return prompt paths.prompt2 list
: List available prompts.prompt2 edit NAME
: Edit a prompt.prompt2 show PROMPT
: Show a prompt.prompt2 render PROMPT CONTEXT=VALUE...
: Render a prompt with a given template context.prompt2 parser NAME
: Show a parser.prompt2 parsers
: List registered parsers.prompt2 messages PROMPT [parser=PARSER] [model=MODEL] [CONTEXT=VALUE]...
: Render prompt messages.prompt2 send PROMPT [parser=PARSER] [model=MODEL] [CONTEXT=VALUE]...
: Send a prompt and get a response.While aider-chat has its merits, prompt2 was built to address specific needs:
cli2.theme
, prompt2 offers extensive theming options.In essence, prompt2 is designed for those who crave simplicity, control, and the ability to tailor their tools to their exact needs. Give it a try and see how it transforms your CLI experience!
With prompt2, the power of AI is at your fingertips, ready to enhance your terminal workflow like never before. Happy prompting!