Plugins · CCPP PQL
Policy references
!policy-id; gives Claude the context of a CPO policy: when it applies, what triggers it and what happens then.
A reference !policy-id; adds to the compiled prompt what Claude needs to respect a
CPO policy. It never creates, installs, enables or changes a policy, and CPO keeps
enforcing its policies whether a program mentions them or not: a reference only saves Claude a refusal.
FROM @packages {
!ts-no-any;
!file-size;
ADD "The PQL lexer";
}Resolution
The id is looked up with CPO's own discovery, in the project where Claude Code runs (a FROM never changes it),
highest priority first: .claude/policies/, .claude/policies/profile/, ~/.ccpp/policies/,
~/.ccpp/policies/profile/. The definition CPO selects is the one used; an overridden one is never a fallback.
A policy from a renamed profile keeps its prefixed id. Press ! in the prompt box to list the active ones.
What Claude receives
A Markdown block, never PQL: the policy text is quoted and never parsed again.
| Part | Content |
|---|---|
| Provenance | layer, profile and version, file, hash, claudeCanEdit: false when set |
| Applicability | on events, scope, paths, exclude, agents |
| Triggering | when with its builtins and their effective parameters, where, let |
| Consequences | each effect with its real meaning, in order |
| Instruction | the body, only when an effect shows it to Claude |
| Runtime values | the file.*, facts.*, git.*… the rule reads, described, never filled in |
The compiler reads installed files only. It runs no check, effect or module, and proves nothing about compliance: CEL conditions and modules are marked as evaluated by CPO.
Visibility
A reference never reveals what CPO keeps from Claude. A policy with a deny effect, or with internal effects
only (log, notify, set…), has nothing to expose: the reference is the error PQL-X005, shown to you only,
and its message names nothing.
Perimeter and duplicates
A policy that provably cannot reach the program's scopes (every event is a file event and its paths, exclude
or scope exclude the perimeter) gives the warning PQL-X006 and no context. Shell and session events can run
anywhere, so they keep it. A second reference to the same policy in the block or an enclosing block is merged
(PQL-X008). A LIMIT FILE above the limit of a refusing max-lines or max-bytes policy is PQL-X009.
Diagnostics
| Code | Severity | Situation |
|---|---|---|
PQL-X001 | error | policy not found |
PQL-X002 | error | the selected definition is disabled |
PQL-X003 | error | the selected definition is invalid |
PQL-X004 | error | a built-in CPO protection is referenced |
PQL-X005 | error | nothing exposable to Claude |
PQL-X006 | warning | policy out of the perimeter |
PQL-X007 | info | conditions evaluated by CPO, only quoted |
PQL-X008 | info | duplicate reference merged |
PQL-X009 | warning | HOW limit more permissive than a CPO policy |
References sit in a block's preamble and never inside HOW { } (PQL-P003).