ccppccpp home
Browse the documentation

Plugins · CCPP PQL

Stop rules

SESSION SUCCESS, STOP WHEN and ASK WHEN set the success criteria, the blocking situations and the decisions that belong to you.

Stop rules say when the work is done, when it must stop and when Claude must ask you. They create no scope and never close Claude Code.

KeywordPurposeParameters
SESSION SUCCESSVerifiable criteria to declare the work done.1 to N descriptions
STOP WHENSuspend and report when this blocking situation is verified.exactly 1 description
ASK WHENSuspend and ask you when this decision is yours.exactly 1 description
FROM @packages/pql {
  SESSION SUCCESS "The PQL keywords are colored in the prompt box", "A valid PQL prompt is compiled before it reaches Claude";
  STOP WHEN "A secret needed by the next action is missing from the expected environment";
  ASK WHEN "The requirements cannot decide between two incompatible public behaviors";
  ADD "The syntax highlighting of PQL keywords";
}

Semantics

  • Each SESSION SUCCESS description is a distinct criterion; all must hold. Several declarations add criteria. Claude may declare success only when every objective is done and every criterion is verified, and never presents an unverified criterion as met.
  • When several rules apply at once, STOP WHEN comes first, then ASK WHEN, then SESSION SUCCESS.
  • Write criteria that can be checked: "bun test passes in packages/pql" rather than "the code works".

Placement

Stop rules sit in the preamble of their block, before its objectives, child scopes, condition chains and fragment calls. They apply to the block and its descendants, and a child cannot disable an inherited rule.

KeywordRoot scopeChild scopeCondition branchFragment function
SESSION SUCCESSyesnonono
STOP WHEN, ASK WHENyesyesyesyes, inside it only

A program function may declare SESSION SUCCESS in its own root scopes.

Errors

SituationCode
No description, several (STOP WHEN, ASK WHEN), blank, or not a stringPQL-T001 to PQL-T004
A block after a stop rulePQL-D005
No active scopePQL-D004
SESSION SUCCESS outside a root scopePQL-P002
Stop rule after an objective, scope or chain of the same blockPQL-P001