npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

promptel

v0.2.0

Published

A declarative language for crafting sophisticated prompts for Large Language Models

Readme

Promptel

The first Node.js framework with native Harmony Protocol support for advanced prompt engineering. Supports both .prompt and .yml formats.

GitHub license npm version Node.js CI

Why Promptel?

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.

Key Problems Solved

  • Harmony Protocol Complexity: Only Node.js framework with native gpt-oss support
  • Advanced Reasoning Techniques: Built-in Chain-of-Thought, Tree-of-Thoughts, ReAct
  • Multi-Channel Responses: Automatic parsing of analysis, commentary, and final outputs
  • Provider Lock-in: Abstract across OpenAI, Anthropic, Groq with consistent APIs

Quick Start

Installation

npm install promptel

Basic Example (.prompt format)

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);

Harmony Protocol Example (gpt-oss)

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

YAML Format Example

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?" });

Format Conversion

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);

Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│  Parser Module  │    │ Executor Module │    │Provider Adapter │
│                 │    │                 │    │                 │
│ • Lexer/Parser  │◄──►│ • Harmony Integ │◄──►│ • OpenAI        │
│ • AST Builder   │    │ • Technique Eng │    │ • Anthropic     │
│ • Validation    │    │ • Output Format │    │ • Groq          │
└─────────────────┘    └─────────────────┘    └─────────────────┘

Flow: .prompt/.yml fileParserASTExecutorProviderLLMResponse ParserStructured Output

Advanced Features

Multi-Provider Support

// 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

Built-in Techniques

  • Chain of Thought: Step-by-step reasoning
  • Tree of Thoughts: Multiple solution paths
  • ReAct: Reasoning + Action planning
  • Self-Consistency: Multi-solution consensus

Type-Safe Parameters

params {
  temperature: number = 0.7
  max_tokens?: number
  difficulty: "easy" | "medium" | "hard"
}

CLI Usage

# 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

Requirements

  • Node.js 18+ (LTS recommended)
  • Supported provider API key (OpenAI, Anthropic, or Groq)

Documentation

Contributing

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

Performance

| 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 |

License

MIT License - see LICENSE file for details.

Support


Promptel makes advanced prompt engineering accessible, maintainable, and scalable for production AI applications.