ccppccpp home
Browse the documentation

Plugins · CCPP PQL

Conditions

IF HAPPEN, IF NOT HAPPEN, ELSE IF and ELSE select the instructions to apply according to a situation Claude can verify.

A condition chain selects at most one branch, according to a situation Claude verifies when it gets there. It uses the active scope and creates none.

KeywordRuns its blockParameter
IF HAPPENwhen the situation is verifiedexactly 1 description
IF NOT HAPPENwhen the situation is refutedexactly 1 description
ELSE IF HAPPENotherwise, when this situation is verifiedexactly 1 description
ELSE IF NOT HAPPENotherwise, when this situation is refutedexactly 1 description
ELSEwhen every previous condition of the chain is falsenone
FROM @packages/pql {
  IF HAPPEN "The test setup is incomplete" {
    SKIP "Fixing the failures caused by this setup";
  } ELSE IF HAPPEN "A defect of the code explains the failures" {
    MODIFY "The code responsible for the failures";
  } ELSE {
    CONTINUE;
  }
}

Chains

  • A chain is one IF HAPPEN or IF NOT HAPPEN, then any number of ELSE IF …, then at most one ELSE, last.
  • A branch continues the chain only when it directly follows the } of the previous one. Two IF in a row are two independent decisions.
  • Braces are mandatory, even for one instruction. An empty block is valid: nothing is asked in that branch.
  • A description is one situation: several comma-separated strings are refused, not combined.

How Claude evaluates them

The compiler checks the structure only. The compiled prompt tells Claude how to decide a chain when execution reaches it:

  • Test the branches in order and select the first whose condition is true; if none is, run ELSE when present.
  • A situation is verified, refuted or indeterminate. Indeterminate is never false, and a missing observation is no proof: while a condition is indeterminate, no later branch is selected, and Claude says what information is missing or asks you.
  • Decide once: no watching for the situation later, no switching branch if it changes afterwards.
  • An unselected branch is inactive: it creates nothing and activates none of its rules.

What a branch holds

A branch inherits the scope and restrictions of its block. It holds objectives, child scopes, nested chains and, in its preamble, stop rules, policy references and HOW directives that apply to that branch only. No branch can lift an inherited restriction, and SESSION SUCCESS is not allowed in a branch.

Syntax and types are checked in every branch. File system checks of a branch (a FROM target, a MATCH source) become warnings, checked again when the branch is selected.

Errors

SituationCode
No description, several, blank, or not a stringPQL-T001 to PQL-T004
Block missingPQL-C001
ELSE IF or ELSE with no chain to attach toPQL-C002
Several ELSE in one chainPQL-C003
Branch after ELSEPQL-C004
Parameter given to ELSEPQL-C005
No active scopePQL-D004