
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
A declarative language for crafting sophisticated prompts for Large Language Models
The first Node.js framework with native Harmony Protocol support for advanced prompt engineering. Supports both .prompt and .yml formats.
Modern AI applications need sophisticated prompt engineering, but implementing advanced techniques like Chain-of-Thought or handling multi-channel responses is complex and error-prone. Promptel solves this with a declarative approach and native support for OpenAI's Harmony Protocol.
npm install promptel
import { parsePrompt, executePrompt } from 'promptel';
const prompt = parsePrompt(`
prompt MathSolver {
params {
problem: string
}
body {
text\`Solve: \${params.problem}\`
}
technique {
chainOfThought {
step("Analysis") { text\`Break down the problem\` }
step("Solution") { text\`Calculate step by step\` }
step("Verification") { text\`Verify the answer\` }
}
}
}
`);
const result = await executePrompt(prompt, {
problem: "What is 25% of 240?"
}, {
provider: 'openai',
apiKey: process.env.OPENAI_API_KEY
});
console.log(result);
const harmonyPrompt = parsePrompt(`
prompt HarmonyReasoning {
harmony {
reasoning: "high"
channels: ["final", "analysis", "commentary"]
}
params {
question: string
}
body {
text\`\${params.question}\`
}
}
`);
const result = await executePrompt(harmonyPrompt, {
question: "Optimize database query performance for large datasets"
});
// Multi-channel outputs automatically parsed
console.log(result.channels.final); // Clean answer for users
console.log(result.channels.analysis); // Detailed reasoning process
console.log(result.channels.commentary); // Verification and alternatives
The same prompts can be written in YAML format for those who prefer structured configuration:
name: MathSolver
params:
problem:
type: string
required: true
body:
text: "Solve: ${params.problem}"
technique:
chainOfThought:
steps:
- name: "Analysis"
text: "Break down the problem"
- name: "Solution"
text: "Calculate step by step"
- name: "Verification"
text: "Verify the answer"
// Works with both formats automatically
const yamlPrompt = fs.readFileSync('math_solver.yml', 'utf-8');
const result = await executePrompt(yamlPrompt, { problem: "What is 25% of 240?" });
Convert between .prompt and .yml formats:
# Convert .prompt to YAML
promptel --convert yaml -f solver.prompt -o solver.yml
# Convert YAML to .prompt
promptel --convert prompt -f solver.yml -o solver.prompt
// Programmatic conversion
import { FormatConverter } from 'promptel';
const converter = new FormatConverter();
const yamlVersion = converter.promptToYaml(promptContent);
const promptVersion = converter.yamlToPrompt(yamlContent);
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Parser Module │ │ Executor Module │ │Provider Adapter │
│ │ │ │ │ │
│ • Lexer/Parser │◄──►│ • Harmony Integ │◄──►│ • OpenAI │
│ • AST Builder │ │ • Technique Eng │ │ • Anthropic │
│ • Validation │ │ • Output Format │ │ • Groq │
└─────────────────┘ └─────────────────┘ └─────────────────┘
Flow: .prompt/.yml file → Parser → AST → Executor → Provider → LLM → Response Parser → Structured Output
// Same prompt, different optimizations per provider
const executor = new PromptelExecutor(process.env.LLM_PROVIDER);
const result = await executor.execute(prompt, params);
// Harmony channels for OpenAI gpt-oss
// Thinking tags for Anthropic Claude
// Custom reasoning for Groq models
params {
temperature: number = 0.7
max_tokens?: number
difficulty: "easy" | "medium" | "hard"
}
# Execute prompt file (.prompt format)
promptel -f solver.prompt -p openai -k $OPENAI_API_KEY --params '{"problem":"2+2"}'
# Execute YAML format
promptel -f solver.yml -p openai -k $OPENAI_API_KEY --params '{"problem":"2+2"}'
# With output file
promptel -f prompt.prompt -p anthropic -k $ANTHROPIC_KEY -o result.json
# Convert formats
promptel --convert yaml -f solver.prompt -o solver.yml
promptel --convert prompt -f solver.yml -o solver.prompt
We welcome contributions! Please see our development setup:
git clone https://github.com/terraprompt/promptel.git
cd promptel
npm install
npm test
npm run lint
| Operation | Time (ms) | Memory (MB) |
|---|---|---|
| Parse prompt | 5-15 | 2-5 |
| Execute simple | 200-800 | 5-10 |
| Execute complex | 1000-3000 | 10-20 |
| Harmony parsing | 50-150 | 8-15 |
MIT License - see LICENSE file for details.
Promptel makes advanced prompt engineering accessible, maintainable, and scalable for production AI applications.
FAQs
A declarative language for crafting sophisticated prompts for Large Language Models
The npm package promptel receives a total of 3 weekly downloads. As such, promptel popularity was classified as not popular.
We found that promptel demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.