Skip to content
GitHub

Compilation Pipeline

The prompd compilation system implements a two-stage approach to maximize context preservation for LLMs while maintaining absolute security:

  1. Package-Time Conversion: All potentially executable or binary files are converted to safe .ext.txt formats
  2. Compile-Time Integration: Original formats are detected and content is wrapped in appropriate markdown code blocks

This strategy provides maximum context (LLMs see full source code) with zero execution risk (no executable files exist in packages).

When creating packages, all potentially dangerous or binary files are automatically converted:

# Original files in source directory:
src/
├── auth.js # JavaScript file
├── styles.css # CSS stylesheet
├── config.html # HTML template
├── report.pdf # PDF document
└── analysis.cpp # C++ source
# After package creation (.pdpkg contents):
src/
├── auth.js.txt # Safe text version
├── styles.css.txt # Safe text version
├── config.html.txt # Safe text version
├── report.pdf.txt # Extracted text content
└── analysis.cpp.txt # Safe text version
document.pdf → document.pdf.txt # Text extracted from PDF
presentation.pptx → presentation.pptx.txt # Text extracted from slides
spreadsheet.xlsx → spreadsheet-sheet1.csv # First sheet as CSV
→ spreadsheet-sheet2.csv # Second sheet as CSV
# Images kept as-is (safe for documentation)
diagram.png → diagram.png # No conversion needed
logo.jpg → logo.jpg # No conversion needed

If conflicts exist between original files and converted names:

# Source has both:
report.txt # Original text file
report.pdf # PDF document
# Package creates:
report.txt # Original kept as-is (already safe)
report-pdf.txt # PDF converted with disambiguated name

During compilation, the system detects original formats from filenames and wraps content in appropriate markdown code blocks:

Filename PatternDetected FormatCode Block Language
*.js.txtJavaScriptjavascript
*.ts.txtTypeScripttypescript
*.py.txtPythonpython
*.go.txtGogo
*.cs.txtC#csharp
*.cpp.txtC++cpp
*.java.txtJavajava
*.rb.txtRubyruby
*.rs.txtRustrust
*.html.txtHTMLhtml
*.css.txtCSScss
*.json.txtJSONjson
*.yaml.txtYAMLyaml

A file named auth.js.txt containing:

function authenticate(user, password) {
return jwt.sign({ id: user.id }, secret);
}

Gets compiled into a properly fenced code block with javascript syntax highlighting, preserving full context for LLM analysis.

malicious-package.pdpkg/
├── legitimate.prmd # Safe prompt file
├── exploit.js # Executable JavaScript
├── backdoor.php # Executable PHP
└── virus.exe # Executable binary
malicious-package.pdpkg/
├── legitimate.prmd # Safe prompt file
├── exploit.js.txt # Safe text - cannot execute
├── backdoor.php.txt # Safe text - cannot execute
└── virus.exe.txt # Safe text - cannot execute

LLMs still receive full context through code blocks, but no executable files can ever exist inside a package. This approach combines maximum context preservation with zero security risk through intelligent file conversion and compile-time integration.

web-app/
├── frontend/
│ ├── app.js
│ ├── styles.css
│ └── index.html
├── backend/
│ ├── server.py
│ └── config.yaml
├── docs/
│ ├── api.md
│ └── architecture.pdf
└── README.md
web-app.pdpkg/
├── frontend/
│ ├── app.js.txt # Converted JavaScript
│ ├── styles.css.txt # Converted CSS
│ └── index.html.txt # Converted HTML
├── backend/
│ ├── server.py.txt # Converted Python
│ └── config.yaml # Safe (kept as-is)
├── docs/
│ ├── api.md # Safe (kept as-is)
│ └── architecture.pdf.txt # Extracted text
├── README.md # Safe (kept as-is)
└── manifest.json # Package metadata

During compilation, each converted file is automatically wrapped in the correct code block format, giving LLMs complete context about the codebase structure and implementation details.