cql) or a structured filter (filter), preview
what it matches, then compile it into context your agents consume. The same scope
grammar drives ad-hoc preview, slice authoring, and compilation.
Scope: CQL or a structured filter
Both express the same thing with names, not UUIDs.cql is canonical if you
pass both. New to CQL? Start with the CQL page.
type: (entity type names, union), shape: (one shape per
scope), source: (source file names), source-shape:"file"->"shape", and
after: / before: (created-at bounds). Same-kind tokens union; different-kind
intersect.
Relative dates
after: / before: accept absolute ISO (YYYY-MM-DD) or relative
expressions, resolved to absolute time server-side (UTC):
| Form | Meaning |
|---|---|
last-week, last-month, last-year | a week / month / year ago |
today, yesterday, now | start of today / yesterday / this instant |
7d, -7d, 2w, 12h, 3mo, 1y | N units ago (sign ignored; past-only) |
Honest warnings, never silent drops
Anything a scope can’t express comes back inscope_warnings instead of being
dropped silently:
edge:,agent:,sort:, and free text are query/ranking concerns, not membership. They are ignored with a warning.- A second
shape:, an unresolved shape/source name, or a malformed date each produce a warning. - Property predicates and
gt/ltoperators are available only on the structuredfilter, not in the CQL string.
Preview a scope
Preview resolves a scope to amatched count plus warnings, without saving. It is
fast author-time feedback.
Compile a scope or slice
Compile turns a scope, or a saved slice, into aCompiledContext
payload your agents consume.
project_id (or the X-Penumbra-Project header).
Method reference
| Method | REST | Description |
|---|---|---|
pb.context.preview(scope) | POST /v1/context/preview | Resolve a scope to a matched count + warnings. |
pb.context.compile(scope) | POST /v1/context/compile | Compile a scope (or slice_id) into context. |
pb.context.discover(input) | GET /v1/context/discover | Find candidate types/sources/slices to scope from. |
Related
Slices
Save a scope under a name and reuse it.
CQL
The full scope-string grammar.