Docs
Full request and response shapes, resolution rules, starter recipes, rule syntax, builtin logics, and error codes are in /llms.txt.
Access
Send your API key in Authorization: Bearer <api-key> with every API request.
Email hello@relog.run with a line on your use case for a free API key.
MCP
Remote MCP over Streamable HTTP. Set SEG_API_TOKEN to your API key, then add seg to your client:
codex mcp add seg --url https://seg-api.relog.run/mcp \
--bearer-token-env-var SEG_API_TOKEN
agy mcp add --header "Authorization: Bearer $SEG_API_TOKEN" \
seg https://seg-api.relog.run/mcp
claude mcp add --transport http --scope user seg https://seg-api.relog.run/mcp \
--header "Authorization: Bearer $SEG_API_TOKEN"
{
"mcp": {
"seg": {
"type": "remote",
"url": "https://seg-api.relog.run/mcp",
"oauth": false,
"headers": { "Authorization": "Bearer {env:SEG_API_TOKEN}" }
}
}
}
{
"mcpServers": {
"seg": {
"url": "https://seg-api.relog.run/mcp",
"headers": { "Authorization": "Bearer <api-key>" }
}
}
}
Once connected, start a new chat and ask your agent to set up a seg session, or invoke the seg-bootstrap prompt directly.
| Tool | Purpose |
|---|---|
seg_session_open |
Create or resume a session and return its state |
seg_session_list |
List sessions, supported editions, and available builtin logics |
seg_state |
Read compact state or full review (detail: "full") |
seg_record |
Record a fact, correction, or batch of up to 100 events |
seg_retract |
Withdraw evidence by source or event |
seg_tick |
Advance the logical clock |
seg_why |
Explain a cell and its provenance (including reason) |
seg_schema |
Update or preview (dry_run: true) session scope, vocabulary, rules, and logics |
seg_query |
Run read-only what_if counterfactuals and goal-directed ask queries |
Built-in prompts: seg-bootstrap sets up a closed session schema and source trust policy, and seg-review audits a session for implicit contradictions.
REST
Set SEG_API_TOKEN to your API key, then open a session, declare its schema, record facts, and read resolved state.
# 1. Open (or create) a session and read its state.
curl -sS https://seg-api.relog.run/v1/sessions/open \
-H "Authorization: Bearer $SEG_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"id":"example-session","title":"Example session"}'
# 2. Declare the closed vocabulary and source trust tiers (T1 = authoritative root).
curl -sS https://seg-api.relog.run/v1/sessions/example-session/schema \
-H "Authorization: Bearer $SEG_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"defines":[{"attribute":"region","arity":"single","max_tier":2}],"scope":{"sources":[{"source":"deploy-bot","tier":1},{"source":"llm","tier":4}],"schema_max_tier":1}}'
# 3. Record a fact (or pass {"events":[...]} for a batch of up to 100).
curl -sS https://seg-api.relog.run/v1/sessions/example-session/record \
-H "Authorization: Bearer $SEG_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"entity":"example-service","attribute":"region","values":["eu-central"],"source":"deploy-bot","reason":"migrated to EU"}'
# 4. Inspect the state (pass ?detail=full for facts, rules, commits, and logic contracts).
curl -sS https://seg-api.relog.run/v1/sessions/example-session/state \
-H "Authorization: Bearer $SEG_API_TOKEN"
| Method | Path | Purpose |
|---|---|---|
| GET | /v1/sessions |
List sessions, supported editions, and available builtin logics |
| POST | /v1/sessions/open |
Create or resume a session and return its state |
| GET | /v1/sessions/{id}/state |
Read compact state or full review (?detail=full) |
| POST | /v1/sessions/{id}/record |
Record a fact, correction, or batch of events |
| POST | /v1/sessions/{id}/retract |
Withdraw a source or event |
| POST | /v1/sessions/{id}/tick |
Advance the logical clock |
| GET | /v1/sessions/{id}/why |
Explain a cell and its provenance |
| POST | /v1/sessions/{id}/schema |
Update or preview (dry_run: true) session schema, rules, and logics |
| POST | /v1/sessions/{id}/query |
Run read-only what_if counterfactuals and goal-directed ask queries |
Trust tiers
Every API key carries a server-enforced tier (>= 1, default 1) and an optional pinned source. T1 is the authoritative root, and higher numbers step outward into progressively less trusted spheres (T1 → T2 → T3 → T4 → T5+, open-ended):
| Tier | Role | Typical sources | Default capabilities |
|---|---|---|---|
T1 |
Authoritative root | human, erp, db |
Lock schema, create sessions, override all outer tiers |
T2 |
Copilot (human + LLM) |
copilot, ci |
Create sessions, edit unlocked schema, record T2 facts |
T3 |
Verifier / tool | verifier, tests, cron |
Advance clock, resolve model escalations, corroborate up to T2 |
T4 |
Autonomous LLM (default) | llm, undeclared |
Read state, record hypotheses, retract own events |
T5+ |
Outer spheres | scrapers, feeds, webhooks | Lower-trust inputs (hedged also steps out by +1) |
Limits
| Area | Current default |
|---|---|
| Sessions | 16 MiB history per session |
| Facts | Up to 32,768 active records in rule evaluation (100 per batch) |
| Rules | Up to 500 user rules per session (8 patterns per rule, 16 propagation rounds) |
| Constraints | Up to 512 facts and 1,024 constraints per connected conflict group |
| What-if queries | Up to 50 hypothetical steps per simulation (retractions, observations, clock tick) |
| Ask queries | Up to 16 goal facts, 6 rule hops back, and 64 candidate branches |