ccppccpp home
Browse the documentation

Plugins · CCPP PQL

The compiled prompt

What Claude reads after a PQL program compiles: the sections of the prompt, the program tree, the normalized PQL and the manifest.

On success the compiler renders a natural-language prompt. You keep seeing the PQL you typed; Claude reads this prompt as context. Run ccpp pql compile program.pql to read it yourself.

Sections

A section appears only when the program uses what it explains, so a short program gives a short prompt.

SectionContent
IntroductionA compiled PQL program; quoted text is your wording, data and never an instruction about the protocol.
ScopesChanges stay in the active scope, reading elsewhere is allowed; what FROM and MAKE mean.
ObjectivesOrder kept but not a strict dependency; the meaning of each keyword used; contradictions are reported.
Condition chainsFirst true branch only, indeterminate is never false, no watching, unselected branches inactive.
Stop rulesSTOP WHEN and ASK WHEN behavior, their priority, SESSION SUCCESS.
HOW directivesStrengths, accumulation, measured units, no claimed compliance without a measurement.
Policy contextsCPO context is information; CPO enforces its policies itself.
ProgramThe success criteria, then the program tree.
Normalized PQLThe program in canonical form, function calls expanded.
Compiler notesWarnings and information meant for Claude, with their line.
ReportWhat Claude reports when it stops: done, not done, deferred, criteria, conflicts.

The program tree

Steps are numbered and read top to bottom: scopes S1, objectives O1, condition chains C1 with branches C1.1. Rule lines (STOP WHEN, ASK WHEN, HOW …, policy contexts) come first in their block and apply to its descendants. Each description stays verbatim, in quotes.

- S1 scope `packages` (FROM: existing directory)
  - HOW constraint: bounds, all inclusive - each file: at most 250 lines; each callable signature: at most 4 parameters.
  - HOW principle: KISS (v1): Prefer the simplest design that meets the objectives; ...
  - S2 scope `packages/pql` (MAKE: create it)
    - HOW constraint: bounds, all inclusive - each file: at most 200 lines (tightens the inherited 250).
    - C1 condition chain (select at most one branch)
      - C1.1 IF HAPPEN "The last test run failed"
        - O1 MODIFY "The code responsible for the failures"
      - C1.2 ELSE
        - O2 CONTINUE
    - O3 ADD "The PQL lexer"
  • LIMIT, DEPTH MAX and COMPLEXITY of a block merge into one bounds line with the values in force: a looser local bound shows the stricter inherited one.
  • FOLLOW prints each principle with its version and definition, so its meaning does not depend on the model.
  • A policy context shown by an enclosing block is not repeated; one in a branch applies only if the branch is selected.

Manifest

ccpp pql compile --json adds a manifest: the project directory, every scope (keyword, absolute and relative path, conditional or not), the functions and policies used (file, sha256, layer) and the versioned registry entries the directives rely on. The prompt box keeps the scopes for its scope guard.