{"id":31741221,"url":"https://github.com/terraprompt/promptel","last_synced_at":"2025-10-09T10:50:03.016Z","repository":{"id":294551283,"uuid":"858814839","full_name":"terraprompt/promptel","owner":"terraprompt","description":"A declarative language for crafting sophisticated prompts for Large Language Models","archived":false,"fork":false,"pushed_at":"2025-09-25T12:36:43.000Z","size":255,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-26T06:59:34.873Z","etag":null,"topics":["declarative-programming","generative-ai","language","large-language-models","prompt-engineering"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/promptel","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terraprompt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-17T15:24:31.000Z","updated_at":"2025-09-25T12:36:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f4f97a8-f040-44cc-8e38-f99b0bd85bf5","html_url":"https://github.com/terraprompt/promptel","commit_stats":null,"previous_names":["nudgelang/nudgelang0","skelf-research/promptel"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/terraprompt/promptel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraprompt%2Fpromptel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraprompt%2Fpromptel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraprompt%2Fpromptel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraprompt%2Fpromptel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terraprompt","download_url":"https://codeload.github.com/terraprompt/promptel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terraprompt%2Fpromptel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001275,"owners_count":26083040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["declarative-programming","generative-ai","language","large-language-models","prompt-engineering"],"created_at":"2025-10-09T10:49:59.640Z","updated_at":"2025-10-09T10:50:03.006Z","avatar_url":"https://github.com/terraprompt.png","language":"JavaScript","readme":"# Promptel\n\n**The first Node.js framework with native Harmony Protocol support for advanced prompt engineering. Supports both .prompt and .yml formats.**\n\n[![GitHub license](https://img.shields.io/github/license/terraprompt/promptel.svg)](https://github.com/terraprompt/promptel/blob/main/LICENSE)\n[![npm version](https://badge.fury.io/js/promptel.svg)](https://www.npmjs.com/package/promptel)\n[![Node.js CI](https://github.com/terraprompt/promptel/workflows/Node.js%20CI/badge.svg)](https://github.com/terraprompt/promptel/actions)\n\n## Why Promptel?\n\nModern 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.**\n\n### Key Problems Solved\n\n- **Harmony Protocol Complexity**: Only Node.js framework with native gpt-oss support\n- **Advanced Reasoning Techniques**: Built-in Chain-of-Thought, Tree-of-Thoughts, ReAct\n- **Multi-Channel Responses**: Automatic parsing of analysis, commentary, and final outputs\n- **Provider Lock-in**: Abstract across OpenAI, Anthropic, Groq with consistent APIs\n\n## Quick Start\n\n### Installation\n\n```bash\nnpm install promptel\n```\n\n### Basic Example (.prompt format)\n\n```javascript\nimport { parsePrompt, executePrompt } from 'promptel';\n\nconst prompt = parsePrompt(`\nprompt MathSolver {\n  params {\n    problem: string\n  }\n\n  body {\n    text\\`Solve: \\${params.problem}\\`\n  }\n\n  technique {\n    chainOfThought {\n      step(\"Analysis\") { text\\`Break down the problem\\` }\n      step(\"Solution\") { text\\`Calculate step by step\\` }\n      step(\"Verification\") { text\\`Verify the answer\\` }\n    }\n  }\n}\n`);\n\nconst result = await executePrompt(prompt, {\n  problem: \"What is 25% of 240?\"\n}, {\n  provider: 'openai',\n  apiKey: process.env.OPENAI_API_KEY\n});\n\nconsole.log(result);\n```\n\n### Harmony Protocol Example (gpt-oss)\n\n```javascript\nconst harmonyPrompt = parsePrompt(`\nprompt HarmonyReasoning {\n  harmony {\n    reasoning: \"high\"\n    channels: [\"final\", \"analysis\", \"commentary\"]\n  }\n\n  params {\n    question: string\n  }\n\n  body {\n    text\\`\\${params.question}\\`\n  }\n}\n`);\n\nconst result = await executePrompt(harmonyPrompt, {\n  question: \"Optimize database query performance for large datasets\"\n});\n\n// Multi-channel outputs automatically parsed\nconsole.log(result.channels.final);      // Clean answer for users\nconsole.log(result.channels.analysis);   // Detailed reasoning process\nconsole.log(result.channels.commentary); // Verification and alternatives\n```\n\n### YAML Format Example\n\nThe same prompts can be written in YAML format for those who prefer structured configuration:\n\n```yaml\nname: MathSolver\n\nparams:\n  problem:\n    type: string\n    required: true\n\nbody:\n  text: \"Solve: ${params.problem}\"\n\ntechnique:\n  chainOfThought:\n    steps:\n      - name: \"Analysis\"\n        text: \"Break down the problem\"\n      - name: \"Solution\"\n        text: \"Calculate step by step\"\n      - name: \"Verification\"\n        text: \"Verify the answer\"\n```\n\n```javascript\n// Works with both formats automatically\nconst yamlPrompt = fs.readFileSync('math_solver.yml', 'utf-8');\nconst result = await executePrompt(yamlPrompt, { problem: \"What is 25% of 240?\" });\n```\n\n## Format Conversion\n\nConvert between .prompt and .yml formats:\n\n```bash\n# Convert .prompt to YAML\npromptel --convert yaml -f solver.prompt -o solver.yml\n\n# Convert YAML to .prompt\npromptel --convert prompt -f solver.yml -o solver.prompt\n```\n\n```javascript\n// Programmatic conversion\nimport { FormatConverter } from 'promptel';\n\nconst converter = new FormatConverter();\nconst yamlVersion = converter.promptToYaml(promptContent);\nconst promptVersion = converter.yamlToPrompt(yamlContent);\n```\n\n## Architecture\n\n```\n┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐\n│  Parser Module  │    │ Executor Module │    │Provider Adapter │\n│                 │    │                 │    │                 │\n│ • Lexer/Parser  │◄──►│ • Harmony Integ │◄──►│ • OpenAI        │\n│ • AST Builder   │    │ • Technique Eng │    │ • Anthropic     │\n│ • Validation    │    │ • Output Format │    │ • Groq          │\n└─────────────────┘    └─────────────────┘    └─────────────────┘\n```\n\n**Flow**: `.prompt/.yml file` → `Parser` → `AST` → `Executor` → `Provider` → `LLM` → `Response Parser` → `Structured Output`\n\n## Advanced Features\n\n### Multi-Provider Support\n```javascript\n// Same prompt, different optimizations per provider\nconst executor = new PromptelExecutor(process.env.LLM_PROVIDER);\nconst result = await executor.execute(prompt, params);\n\n// Harmony channels for OpenAI gpt-oss\n// Thinking tags for Anthropic Claude\n// Custom reasoning for Groq models\n```\n\n### Built-in Techniques\n- **Chain of Thought**: Step-by-step reasoning\n- **Tree of Thoughts**: Multiple solution paths\n- **ReAct**: Reasoning + Action planning\n- **Self-Consistency**: Multi-solution consensus\n\n### Type-Safe Parameters\n```typescript\nparams {\n  temperature: number = 0.7\n  max_tokens?: number\n  difficulty: \"easy\" | \"medium\" | \"hard\"\n}\n```\n\n## CLI Usage\n\n```bash\n# Execute prompt file (.prompt format)\npromptel -f solver.prompt -p openai -k $OPENAI_API_KEY --params '{\"problem\":\"2+2\"}'\n\n# Execute YAML format\npromptel -f solver.yml -p openai -k $OPENAI_API_KEY --params '{\"problem\":\"2+2\"}'\n\n# With output file\npromptel -f prompt.prompt -p anthropic -k $ANTHROPIC_KEY -o result.json\n\n# Convert formats\npromptel --convert yaml -f solver.prompt -o solver.yml\npromptel --convert prompt -f solver.yml -o solver.prompt\n```\n\n## Requirements\n\n- Node.js 18+ (LTS recommended)\n- Supported provider API key (OpenAI, Anthropic, or Groq)\n\n## Documentation\n\n- **[Technical Overview](docs/TECHNICAL_OVERVIEW.md)** - Architecture and implementation details\n- **[Harmony Design](docs/HARMONY_DESIGN.md)** - OpenAI Harmony Protocol integration\n- **[Grammar Reference](docs/GRAMMAR.md)** - Complete language specification\n- **[Dual Format Guide](docs/DUAL_FORMAT_GUIDE.md)** - Complete .prompt ↔ .yml format guide\n- **[Development Tasks](docs/TODO.md)** - Project roadmap and tasks\n\n## Contributing\n\nWe welcome contributions! Please see our development setup:\n\n```bash\ngit clone https://github.com/terraprompt/promptel.git\ncd promptel\nnpm install\nnpm test\nnpm run lint\n```\n\n## Performance\n\n| Operation | Time (ms) | Memory (MB) |\n|-----------|-----------|-------------|\n| Parse prompt | 5-15 | 2-5 |\n| Execute simple | 200-800 | 5-10 |\n| Execute complex | 1000-3000 | 10-20 |\n| Harmony parsing | 50-150 | 8-15 |\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Support\n\n- **Documentation**: [Technical docs](docs/)\n- **Issues**: [GitHub Issues](https://github.com/terraprompt/promptel/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/terraprompt/promptel/discussions)\n\n---\n\n**Promptel makes advanced prompt engineering accessible, maintainable, and scalable for production AI applications.**","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraprompt%2Fpromptel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterraprompt%2Fpromptel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterraprompt%2Fpromptel/lists"}