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.
| Keyword | Purpose | Parameters |
|---|---|---|
SESSION SUCCESS | Verifiable criteria to declare the work done. | 1 to N descriptions |
STOP WHEN | Suspend and report when this blocking situation is verified. | exactly 1 description |
ASK WHEN | Suspend 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 SUCCESSdescription 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 WHENcomes first, thenASK WHEN, thenSESSION SUCCESS. - Write criteria that can be checked: "
bun testpasses inpackages/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.
| Keyword | Root scope | Child scope | Condition branch | Fragment function |
|---|---|---|---|---|
SESSION SUCCESS | yes | no | no | no |
STOP WHEN, ASK WHEN | yes | yes | yes | yes, inside it only |
A program function may declare SESSION SUCCESS in its own root scopes.
Errors
| Situation | Code |
|---|---|
No description, several (STOP WHEN, ASK WHEN), blank, or not a string | PQL-T001 to PQL-T004 |
| A block after a stop rule | PQL-D005 |
| No active scope | PQL-D004 |
SESSION SUCCESS outside a root scope | PQL-P002 |
| Stop rule after an objective, scope or chain of the same block | PQL-P001 |