rules.create
LiveCreate a new rule candidate in the Cortex rulebook.
Description
Submits a natural-language rule as a *candidate*. Candidates are not active until the user confirms them in the operator dashboard — this protects the rulebook from prompt-injection-driven rule additions.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
rule_text | string | yes | Natural language rule text. |
context | string | no | Optional context for rule creation. |
Output shape
typescript
{
ok: boolean;
rule_id?: string;
candidate_id?: string;
error?: string;
}In Phase 0, new rules return as `candidate_id` only — they activate after user confirmation.
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.create",
"arguments": {
"rule_text": "Never schedule meetings on Fridays before noon.",
"context": "Founder writing block, weekly"
}
}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,
"candidate_id": "rcand_01HXP7"
}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).