Filters
Filters
Section titled “Filters”Filters narrow the scope of a CTX query. They appear after the target and before the payload, prefixed with specific symbols.
Filter Types
Section titled “Filter Types”| Prefix | Type | Example | Description |
|---|---|---|---|
# | tag | #code | Filter by semantic tag |
@ | time | @7d | Time window constraint |
^ | limit | ^3 | Maximum results |
* | project | *my-project | Scope to a project |
& | format | &json | Response format |
# Tag Filter
Section titled “# Tag Filter”Tags categorize and filter content. Multiple tags narrow the search (logical AND).
?k "auth" #code Match knowledge tagged "code"?m #architecture #decision @30d Match memories with both tags+m lesson #my #fact Store with multiple tagsSpecial Memory Tags
Section titled “Special Memory Tags”On the memory plane (m), certain tags are automatically promoted to typed filters:
Layer tags — scope to a memory tier:
| Tag | Layer |
|---|---|
#ephemeral | Single-session only |
#my | Individual (per-agent) |
#team | Team-shared |
#org | Organization-wide |
#global | Platform-wide |
Kind tags — classify the memory type:
#fact · #lesson · #preference · #spatial · #temporal · #social · #relation · #handoff
?m #my #lesson @7d ^5 My recent lessons?m #team #decision Team decisions+m note #ephemeral "expires after session"Live and Diff Tags
Section titled “Live and Diff Tags”Two special tags work on any plane:
?m #live Subscribe to live updates (SurrealDB LIVE SELECT)?m #diff Return change deltas instead of full results@ Time Filter
Section titled “@ Time Filter”Time filters restrict results to a time window. Two formats:
Relative duration — @{number}{unit}:
| Unit | Meaning | Example |
|---|---|---|
s | seconds | @30s |
m | minutes | @15m |
h | hours | @2h |
d | days | @7d |
w | weeks | @4w |
M | months | @3M |
y | years | @1y |
?m #architecture @7d Memories from the last 7 days?k "deploy" @2h Knowledge accessed in the last 2 hoursAbsolute date — @YYYY-MM-DD or @YYYY-MM-DDTHH:MM:SSZ:
?m @2026-03-01 Memories since March 1st?k "release" @2026-01-01T00:00:00Z Knowledge since start of year^ Limit Filter
Section titled “^ Limit Filter”Limits the number of results returned.
?k "auth" ^3 Return top 3 matches?t github ^10 Return up to 10 tools?m #my @30d ^5 Last 5 recent memories^depth=N Depth Filter
Section titled “^depth=N Depth Filter”Controls graph traversal depth (different from result limit):
?m @traverse auth-decision ^depth=3 Traverse 3 levels deep in the graph* Project Filter
Section titled “* Project Filter”Scopes the query to a specific project namespace.
?k "deploy" *my-project Knowledge from "my-project" only?m #decision *agentctx Decisions in the agentctx project& Format Filter
Section titled “& Format Filter”Requests a specific response format.
?t github &json Return results as JSON?k "auth" &compact Return compact formatCombining Filters
Section titled “Combining Filters”Filters can be combined freely. Order doesn’t matter:
?k "authentication" #code #security @30d ^5 *my-project &jsonThis searches the knowledge plane for “authentication” with tags code AND security, within the last 30 days, limited to 5 results, in the my-project namespace, formatted as JSON.
Mixed Script Detection
Section titled “Mixed Script Detection”The parser detects potential homograph attacks in tag values (mixing Latin, Cyrillic, and other scripts). When detected, the filter is flagged with mixedScript: true for downstream security checks.
- Pipeline Verbs → — ISA verbs for multi-step workflows
- Hybrid Mode → — mixing natural language and CTX