Skip to content

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) and probability(name) are queryable fields, but not defined by SignalQL core.

Canonical output format

Ask the AI to emit:

  1. SignalQL query in canonical clause order.
  2. Brief rationale for retrieval intent only.
  3. Expected structured output fields.
  4. 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, count
FROM entity(repo)
TREND DOWN OVER 5d
RETURN entity_id, count
FIND sequence
WHERE pr_opened -> no_activity -> stale
WITHIN 3d

Canonical invalid examples

Bad snippetWhy
ASSIGN owner = "sam"Action/mutation is out of scope
FROM entity(work_item) WHERE sprint = "Q2"Domain-specific nouns are not core
WHERE blocked = trueBuilt-in business interpretation is not core
Raw SQL SELECTNot SignalQL surface

Intent → shape

User intentShape
Dependency blast radiusFROM entity(x) TRAVERSE relation DEPTH <= N
Risky work itemsWHERE signal(risk_score) > X
Delay likelihoodWHERE probability(delay) > X
Activity declineTREND DOWN OVER Nd
Pattern detectionFIND sequence WHERE a -> b -> c WITHIN Nd

Copy this file into Cursor rules, Claude project knowledge, or MCP resources as needed.