ccppccpp home
Browse the documentation

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.

PartContent
Provenancelayer, profile and version, file, hash, claudeCanEdit: false when set
Applicabilityon events, scope, paths, exclude, agents
Triggeringwhen with its builtins and their effective parameters, where, let
Consequenceseach effect with its real meaning, in order
Instructionthe body, only when an effect shows it to Claude
Runtime valuesthe 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

CodeSeveritySituation
PQL-X001errorpolicy not found
PQL-X002errorthe selected definition is disabled
PQL-X003errorthe selected definition is invalid
PQL-X004errora built-in CPO protection is referenced
PQL-X005errornothing exposable to Claude
PQL-X006warningpolicy out of the perimeter
PQL-X007infoconditions evaluated by CPO, only quoted
PQL-X008infoduplicate reference merged
PQL-X009warningHOW limit more permissive than a CPO policy

References sit in a block's preamble and never inside HOW { } (PQL-P003).