rules.provenance
LiveQuery provenance metadata for a Cortex rule.
Description
Returns the rule's origin: which episode(s) it was synthesized from, how it was created (user explicit vs. system inferred), and how often it has fired. This is the audit primitive — every rule must justify itself.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
rule_id | string | yes | Rule ID to inspect. |
Output shape
typescript
{
ok: boolean;
provenance?: {
source_episode_ids: string[];
created_via: string;
fired_count: number;
};
error?: string;
}Example call
JSON-RPC tools/call request body (omit the JSON-RPC envelope when using an SDK; the SDK adds it for you):
jsontools/call params
{
"name": "rules.provenance",
"arguments": { "rule_id": "rule_01HXP" }
}Example response
Tool results are always wrapped as content[0].text with a stringified JSON body. The shape below is what you get back from JSON.parse(result.content[0].text):
jsonparsed result body
{
"ok": true,
"provenance": {
"source_episode_ids": ["ep_01HXR"],
"created_via": "user_explicit",
"fired_count": 12
}
}Errors this tool can return
| Code | Meaning |
|---|---|
invalid_arguments | Tool input failed Zod validation. |
unauthorized | Missing or invalid bearer token. |
See the full error catalog for resolution steps on each code, plus the standard transport-layer responses (401, 429).