LLM grammar pack (SignalQL v0.2)
Compact reference for prompts and MCP resources. Pair with the v0.2 specification, scope, and versions index.
Grammar summary
- Retrieve:
FROM entity(type)|events ... - Graph traversal:
TRAVERSE relationship DEPTH <= N - Temporal trend:
TREND UP|DOWN|FLAT OVER Nd|Nh|Nw - Sequence:
FIND sequence WHERE a -> b -> c WITHIN Nd|Nh|Nw - Derived signals:
signal(name)andprobability(name)are queryable fields, but not defined by SignalQL core.
Canonical output format
Ask the AI to emit:
- SignalQL query in canonical clause order.
- Brief rationale for retrieval intent only.
- Expected structured output fields.
- Explicit statement that interpretation is external.
When to ask for schema first
Ask for entity types, relationship names, signal catalog keys, and event names before emitting SignalQL if:
- The source domain is unfamiliar.
- Relationship traversal is requested.
- Derived/probabilistic signals are referenced.
If the user already provided schema/context, proceed without re-asking.
Canonical valid examples
FROM entity(work_item)
WHERE signal(risk_score) > 0.7
RETURN entity_id, signal(risk_score)FROM entity(work_item)
TRAVERSE depends_on DEPTH <= 2
RETURN entity_id, countFROM entity(repo)
TREND DOWN OVER 5d
RETURN entity_id, countFIND sequence
WHERE pr_opened -> no_activity -> stale
WITHIN 3dCanonical invalid examples
| Bad snippet | Why |
|---|---|
ASSIGN owner = "sam" | Action/mutation is out of scope |
FROM entity(work_item) WHERE sprint = "Q2" | Domain-specific nouns are not core |
WHERE blocked = true | Built-in business interpretation is not core |
Raw SQL SELECT | Not SignalQL surface |
Intent → shape
| User intent | Shape |
|---|---|
| Dependency blast radius | FROM entity(x) TRAVERSE relation DEPTH <= N |
| Risky work items | WHERE signal(risk_score) > X |
| Delay likelihood | WHERE probability(delay) > X |
| Activity decline | TREND DOWN OVER Nd |
| Pattern detection | FIND sequence WHERE a -> b -> c WITHIN Nd |
Copy this file into Cursor rules, Claude project knowledge, or MCP resources as needed.