Skip to content

Repository files navigation

Promptmd

Promptmd is a CLI tool for running, chaining, and looping prompts defined in markdown files with real-time streaming support.

Features

  • 🔗 Chain prompts together with simple syntax
  • 📝 Markdown-based prompt definitions with frontmatter
  • 🔄 Loop execution with exit conditions
  • 🎯 Variable substitution with {{variable}} syntax
  • 📊 Structured output via YAML frontmatter
  • ⚡ Real-time streaming output
  • 🔌 Multiple backends: OpenCode, subprocess, or custom implementations

Quick Start

Install globally:

npm install -g promptmd-cli

Simple prompt

echo "Check the weather in Berlin" > weather.md
promd weather

Chaining prompts

echo "Check the weather in Berlin" > weather.md
echo "Suggest activities in Berlin based on the provided weather forecast: {{input}}" > plan-activities.md
promd weather plan-activities

Use arguments

echo "Check the weather in {{city}}" > weather.md
echo "Suggest activities in {{city}} based on the provided weather forecast: {{input}}" > plan-activities.md
promd weather plan-activities --city Hamburg

Structured output via frontmatter

weather.md

---
output:
  temperature: "the forecasted temperature"
  rain: "will it rain?"
---
Check the weather in Berlin
echo "Suggest activities in Berlin. Temperature: {{input.temperature}} Rain: {{input.rain}}" > plan-activities.md
promd weather plan-activities

Chain all prompts in a directory

promd .

Run in a loop

promd loop --count 10 --exitOn "Complete" ./my-workflow

Backends

OpenCode Backend (Recommended)

Use OpenCode for AI-powered prompt execution with streaming:

# .promd
backend: opencode
opencode:
  model: anthropic/claude-sonnet-4
  thinking: true

See OPENCODE_BACKEND.md for details.

Subprocess Backend

Integrate with external tools/scripts:

# .promd
backend: subprocess
subprocess:
  command: python
  args: ['run_llm.py']

See STREAMING.md for details.

Mock Backend (Default)

For testing and development:

# .promd
backend: mock

Documentation

Configuration

Create ~/.promd or ./.promd:

backend: opencode
opencode:
  model: anthropic/claude-sonnet-4
  format: default

Config files are loaded hierarchically:

  1. ~/.promd (global)
  2. ../../.promd, ../.promd (parent directories)
  3. ./.promd (current directory, highest priority)

Examples

See the examples/ directory for:

  • Basic prompt files
  • Chained workflows
  • Structured output examples
  • Backend integration examples
  • Configuration examples

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages