Table of Contents

Prompt bodies (llmcpp)

A prompt body describes the behavior requested from an __llm__ definition. It occupies the function's usual brace-delimited body, while the surrounding declaration supplies the interface and compiler context.

__llm__ int clamp(int value, int low, int high)
{
    Return value constrained to the inclusive interval [low, high].
}

The text describes intent rather than an implementation. Parameters such as value and low are real C++ declarations, so the agent can inspect their types instead of inferring them from prose alone.

Comments inside a prompt body are ignored and are not included in its request text. An empty prompt still triggers generation, allowing the backend to infer conventional behavior from the declaration and context. That inference can be ambiguous, so explicit edge cases are useful when behavior matters.

For example, a clamp request can specify whether reversed bounds are valid. The compiler can reject an invalid expression but cannot decide which interpretation the author intended. Behavioral tests connect the generated implementation with the requested contract.