{"id":50170350,"url":"https://github.com/boygotflames/promptus-dsl","last_synced_at":"2026-05-24T23:08:44.422Z","repository":{"id":351076968,"uuid":"1209356452","full_name":"boygotflames/promptus-dsl","owner":"boygotflames","description":"A Rust-based compiler for the .llm prompt format. Stop wasting tokens on Markdown and start treating your prompts like code. Features deterministic AST parsing, CI bench regression, and an 8.5% average reduction in token bloat.","archived":false,"fork":false,"pushed_at":"2026-04-14T14:35:25.000Z","size":251,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-14T16:26:04.458Z","etag":null,"topics":["ai-agents","ai-agents-cli","compiler","llm","parser","prompt-engineering","rust","token-optimization"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boygotflames.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-13T10:48:51.000Z","updated_at":"2026-04-14T14:35:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/boygotflames/promptus-dsl","commit_stats":null,"previous_names":["boygotflames/llmc","boygotflames/promptus-dsl"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/boygotflames/promptus-dsl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boygotflames%2Fpromptus-dsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boygotflames%2Fpromptus-dsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boygotflames%2Fpromptus-dsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boygotflames%2Fpromptus-dsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boygotflames","download_url":"https://codeload.github.com/boygotflames/promptus-dsl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boygotflames%2Fpromptus-dsl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33453597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-24T19:21:36.376Z","status":"ssl_error","status_checked_at":"2026-05-24T19:21:10.562Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ai-agents","ai-agents-cli","compiler","llm","parser","prompt-engineering","rust","token-optimization"],"created_at":"2026-05-24T23:08:41.497Z","updated_at":"2026-05-24T23:08:44.416Z","avatar_url":"https://github.com/boygotflames.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/Promptus.svg\" width=\"220\"\n       alt=\"promptus-dsl\" /\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/boygotflames/promptus-dsl/releases\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/boygotflames/promptus-dsl?label=version\u0026color=0057FF\"\n         alt=\"Latest release\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/boygotflames/promptus-dsl/actions\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/boygotflames/promptus-dsl/ci.yml?label=CI\u0026branch=main\"\n         alt=\"CI status\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\n# promptus-dsl\n\n**A prompt compiler for LLM workflows.**\n\nWrite structured prompts in `.llm` files. Validate them\nbefore spending tokens. Compile them to the exact JSON\nformat each provider API expects.\n\n```\nagent: SentimentAnalyzer\nsystem:\n  role: classifier\n  instruction: \"Classify the input as positive, negative, or neutral.\"\nuser: \"{input_text}\"\noutput:\n  sentiment: \"one of: positive, negative, neutral\"\n  confidence: \"float between 0 and 1\"\nvars:\n  input_text: \"The product broke on day one.\"\n```\n\n```powershell\n# Validate before you spend\nllm_format validate sentiment.llm\n\n# Compile to Anthropic's native API format\nllm_format transpile sentiment.llm --target anthropic-messages\n\n# Compile to OpenAI's chat format\nllm_format transpile sentiment.llm --target openai-chat\n```\n\n## The Problem\n\nPrompts live as raw strings scattered across codebases. No validation\nbefore execution. No reuse. No clear separation between what you write\nand what the API receives.\n\npromptus-dsl gives prompts the same discipline as code: structure,\nvalidation, versioning, and composability.\n\n## Getting Started\n\n### Prerequisites\n\n- [Rust](https://rustup.rs/) (stable, 2021 edition or later)\n\n### Build\n\n```powershell\ngit clone https://github.com/boygotflames/promptus-dsl\ncd promptus-dsl\ncargo build --release\ncargo test\n```\n\n### Your first prompt\n\n```powershell\ncargo run -- validate examples/minimal.llm\ncargo run -- transpile examples/minimal.llm --target plain\ncargo run -- transpile examples/minimal.llm --target json-ir\n```\n\n## What the Compiler Does\n\n### validate\n\nCatches problems before you spend tokens:\n\n- Missing required keys (`agent`, `system`)\n- Type mismatches (sequence where scalar expected)\n- Empty required fields\n- Undefined `{var}` references\n- Circular includes\n- Merge conflicts in multi-file prompts\n\n```powershell\ncargo run -- validate myprompt.llm\n# ✓ valid  myprompt.llm\n# OR\n# semantic error at 3:1: [E101] missing required key: `system`\n# ✗ invalid  myprompt.llm  (1 error(s))\n```\n\n### transpile\n\nCompiles to output targets:\n\n```powershell\n# Plain normalized text\ncargo run -- transpile prompt.llm --target plain\n\n# JSON intermediate representation\ncargo run -- transpile prompt.llm --target json-ir\n\n# Shadow compact encoding (stable, backwards compatible)\ncargo run -- transpile prompt.llm --target shadow\ncargo run -- transpile prompt.llm --target shadow --provider anthropic\n\n# Native provider JSON (ready for direct API calls)\ncargo run -- transpile prompt.llm --target openai-chat\ncargo run -- transpile prompt.llm --target anthropic-messages\n```\n\n### run\n\nExecute a prompt against a live API:\n\n```powershell\n# Run against Anthropic (uses ANTHROPIC_API_KEY env var)\ncargo run -- run examples/minimal.llm `\n  --provider anthropic `\n  --model claude-3-5-sonnet-20241022\n\n# Run against OpenAI (uses OPENAI_API_KEY env var)\ncargo run -- run examples/minimal.llm `\n  --provider openai `\n  --model gpt-4o\n\n# Pass the API key explicitly\ncargo run -- run examples/minimal.llm `\n  --provider anthropic `\n  --model claude-3-5-sonnet-20241022 `\n  --key $env:MY_KEY\n\n# Preview the API payload without sending (no key needed)\ncargo run -- run examples/minimal.llm `\n  --provider openai --model gpt-4o --dry-run\n```\n\nThe `run` command validates the file first, then transpiles\nto the provider's native JSON format, injects `model` and\n`max_tokens`, and POSTs to the API. Response is printed as\npretty JSON. If the document declares an `output:` schema\nand the response is JSON, missing fields are reported as\nwarnings.\n\n### fmt\n\nCanonical formatting — normalize any `.llm` file:\n\n```powershell\ncargo run -- fmt myprompt.llm\n```\n\n### lint\n\nStatic analysis of prompt quality before execution:\n\n```powershell\ncargo run -- lint myprompt.llm\n```\n\nChecks:\n- **L001** — Missing `output:` schema declaration\n- **L002** — Missing `user:` turn\n- **L003** — System prompt is very short (\u003c 20 chars)\n- **L004** — System prompt is very long (\u003e 4000 chars)\n- **L005** — Contradictory constraints (concise + verbose)\n- **L006** — Duplicate constraints\n\nWarnings are printed to stderr; the command exits with\ncode 1 when warnings are found. They do not block\n`transpile` or `run`.\n\n### bench\n\nToken count analysis against a Markdown baseline:\n\n```powershell\ncargo run -- bench myprompt.llm --baseline baseline.md\n```\n\n## Format Reference\n\n### Required keys\n\n- `agent` — identity of this prompt/agent\n- `system` — instructions for the model\n\n### Optional keys\n\n- `user` — user turn content\n- `memory` — context items (sequence)\n- `tools` — available tools (sequence)\n- `output` — expected output schema\n- `constraints` — behavioral rules (sequence)\n- `vars` — template variables for `{var_name}` expansion\n\n### Multi-file composition\n\n```\ninclude: shared/base-system.llm\n\nsystem:\n  objective: \"Answer questions about billing.\"\n\nvars:\n  product_name: \"Acme Pro\"\n```\n\n### Variable expansion\n\n```\nsystem: \"You handle {product_name} support for {region}.\"\nvars:\n  product_name: Acme\n  region: EU\n```\n\nVariables expand at transpile time in all output targets.\n\n## VS Code Extension\n\nInstall from `editors/vscode/` for:\n\n- Syntax highlighting\n- Live validation (inline error squiggles as you type)\n- Completion for all keys and `{var}` references\n- Hover documentation\n- Go-to-definition for `{var}` references\n- `{var}` expanded values as ghost text\n- Format on save\n\n## Provider Support\n\n| Provider | Shadow encoding | Tokenizer |\n|---|---|---|\n| `generic` (default) | V0 `@`-marker | cl100k_base |\n| `openai` | V0 `@`-marker | cl100k_base |\n| `anthropic` | V1 XML-tag | o200k_base |\n\nAll three providers are stable. Use `--provider anthropic` for\nAnthropic-optimized shadow output and `o200k_base` token counts.\n\n## Diagnostic Codes\n\nAll errors carry structured codes (`E001`–`E116`).\nSee [SPEC.md](SPEC.md) for the full reference.\n\n## Repository Layout\n\n- [`src/`](src): compiler — lexer, parser, AST, validator, transpile targets, CLI, bench\n- [`tests/`](tests): conformance suite (131 tests)\n- [`examples/`](examples): valid, invalid, and baseline fixtures\n- [`editors/vscode/`](editors/vscode): VS Code extension\n- [`docs/`](docs): compatibility matrix, versioning, roadmaps\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n```powershell\ncargo fmt\ncargo clippy --all-targets --all-features -- -D warnings\ncargo test\n```\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for the full version history (v1–v4).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboygotflames%2Fpromptus-dsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboygotflames%2Fpromptus-dsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboygotflames%2Fpromptus-dsl/lists"}