Skip to main content
                                  _   ____  _     _
  _ __  _ __ ___  _ __ ___  _ __ | |_|___ \| |__ (_)_ __
 | '_ \| '__/ _ \| '_ ` _ \| '_ \| __| __) | '_ \| | '_ \
 | |_) | | | (_) | | | | | | |_) | |_ / __/| |_) | | | | |
 | .__/|_|  \___/|_| |_| |_| .__/ \__|_____|_.__/|_|_| |_|
 |_|                        |_|

Natural language in, verified machine code out.

Python 3.11+ License: MIT Version


Describe what you need in plain English. A formal verification engine (Z3) proves safety properties. An LLM generates the C implementation. A test harness validates correctness. GCC compiles it to a binary.

"I need a lock-free audio ring buffer"
     ↓
  formal spec → Z3 proves 7/7 safety properties
     ↓
  LLM generates C → test harness validates
     ↓
  GCC → x86-64 assembly + machine code
     ↓
  audio_ringbuf.h  audio_ringbuf.s  audio_ringbuf.o

Install

pip install prompt2bin

Requires GCC and at least one LLM backend:

Backend Setup API key?
Claude CLI (default) Install Claude CLI No — uses subscription
Codex CLI Install Codex CLI No — uses subscription
Anthropic API pip install prompt2bin[anthropic] + set ANTHROPIC_API_KEY Yes
OpenAI API pip install prompt2bin[openai] + set OPENAI_API_KEY Yes

Auto-detects in priority order: CLI > API key. Set P2B_BACKEND to override.

Quick start

p2b is the short alias for prompt2bin.

# one-shot: describe what you need, get a binary
p2b "I need a memory pool for allocating small objects"

# scaffold a new project
p2b init my_project

# build all components + generate main.c + compile
p2b build my_project

# build and run
p2b run my_project

# interactive mode
p2b --interactive

Project builds

A project is a directory with a build.toml, component .prompt files, and an app.prompt:

my_project/
├── build.toml
├── app.prompt                # what the app does, how components wire together
├── specs/
│   ├── memory_pool.prompt    # "I need a memory pool for allocating small objects..."
│   └── message_queue.prompt  # "I need a queue for passing messages between two threads..."
└── build/                    # generated: .h .s .o for each component + main.c
[project]
name = "my_project"
target = "x86-64-linux"

[model]                         # optional: per-project LLM configuration
backend = "anthropic-api"       # claude, codex, anthropic-api, openai-api
name = "claude-sonnet-4-6"
reasoning = "high"              # low, medium, high
temperature = 0.2

[components.memory_pool]
prompt = "specs/memory_pool.prompt"

[components.message_queue]
prompt = "specs/message_queue.prompt"

Templates:

p2b init my_project --template starter     # memory pool + message queue demo
p2b init my_project --template grok-cli    # interactive xAI Grok API client

Build features: incremental caching (SHA-256), parallel builds (up to 4 workers), per-project model config.

Supported domains

Domain What Z3 proves
Arena allocators Overflow safety, alignment correctness, memory bounds
Ring buffers Capacity invariants, index bounds, data loss prevention
Process spawners Buffer bounds, timeouts, static memory bounds
String tables Table sizing, index masking safety, storage bounds
Terminal I/O Cursor/index bounds, input overflow prevention

Each domain has 7 verified safety properties. See examples/ for generated outputs including C code, assembly, and terminal transcripts.

Examples

"I want a fast game frame allocator for temporary per-frame scratch memory, maybe 64KB"
→ 7/7 properties verified → game_frame.h + .s + .o

"Handle crypto key material in memory — must be wiped when done, no traces left"
→ 7/7 properties verified → crypto_secure.h + .s + .o

page_size=100, min_align=3  (bad spec)
→ [FAIL] power_of_two → Code generation blocked.

License

MIT

Metadata

Release files for prompt2bin 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prompt2bin 0.3.3
File Size Uploaded Provenance
prompt2bin-0.3.3.tar.gz 53.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for prompt2bin 0.3.3
File Interpreter ABI Platform
prompt2bin-0.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 126.2 kB

Release files / prompt2bin-0.3.3.tar.gz

Download URL prompt2bin-0.3.3.tar.gz
Size 53.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f83719b99913072c91428e9fdc323f29debcfd622ce515f8d8e6ce012dd5431a
BLAKE2b-256 checksum
How to use checksums
3da26c18e3608a6bfc12791d64642e5c948f534bd00aaf9177e167b601fcb830
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 20, 2026.

Transparency log

Release files / prompt2bin-0.3.3-py3-none-any.whl

Download URL prompt2bin-0.3.3-py3-none-any.whl
Size 72.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cf71258ee0af02d20d2f05e5c8ab441a1a310d6c3ad971e48d51139afe3857b
BLAKE2b-256 checksum
How to use checksums
27921f81fbc621b5f922397932c9642183e48983b1202a134d3704726af6a3d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 20, 2026.

Transparency log

Security for prompt2bin 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for prompt2bin-0.3.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page