Skip to content

Manifests

One YAML file per intent type, intents/<domain>.<name>.yaml, named after the intent it declares. A manifest says what an agent may ask for, what a decision needs to know, how Sefra does it, and how it is undone. It holds no logic: every value is either a constant or one lookup. Rules belong in policies. The three manifests of the starter procurement bundle are commented examples.

Key Required Meaning
intent yes <domain>.<name>, two segments of [a-z0-9_], at most 64 characters. The tool name replaces the dot with a hyphen: procurement-create_purchase_order. Domain sefra is reserved
version yes Integer from 1. Raise it when the meaning of the input changes; it is part of the approved execution hash
description yes What the agent reads in the MCP tool list. Say what it does and what it refuses, in one or two sentences
effect yes read or write
irreversible no true for a write that cannot be undone. It then has no compensate; in a plan it must be the last step, and the starter policy requires an approval for it
tags no Keywords. Search over them is Planned

input_schema and output_schema are JSON Schema 2020-12 documents of type: object. Write the input schema tight: additionalProperties: false, every field typed, strings with a maxLength and a pattern or enum where you can, numbers with bounds. Every violation is returned to the agent with its path, so that it can correct itself.

  • Money is an integer in minor units with a separate currency code. Mark it x-sefra-money: true; a non-integer type is refused.
  • Sensitive fields are marked x-sefra-sensitive: true. Sefra replaces their value by a keyed hash in the policy input document, the audit payloads, the hashes, and the approval summary, which shows [redacted]. The working copy of a step’s input keeps the real value until timings.operational_retention after the final status (7 days by default), and an approval’s detail shows it to a person eligible to read it. The system of record still gets the real value. A marker is honoured only where redaction reaches it, from the root through properties and items; anywhere else is an error. Mark everything that identifies a person or is secret: tax ids of sole traders, bank accounts, personal names, email addresses, phone numbers. Nothing detects an unmarked field.
  • The output schema lists exactly what the agent gets back. Only the fields the output mapping names are kept from the system’s answer.

A string value may contain ${root.path} lookups into input, principal (id, type, roles, on_behalf_of), response.body (in output mappings and probes) or output (in compensate, the step’s own output). A lookup that is the whole value keeps its JSON type; inside a longer string it is written as text. A value in a URL path is percent-encoded, / included, so that it can never select another endpoint. There are no functions, arithmetic or conditionals: a system that needs a transformation gets a facade API of your own in front of it.

A fact is a read whose answer the policy needs, placed at input.facts.<name>. It is fetched at pre-flight and again just before the step runs, never cached.

facts:
  vendor:
    connector: erp
    method: GET                       # facts are reads
    path: "/vendors/${input.vendor_id}"
    timeout_ms: 2000                  # default 2000
    response_schema:                  # the shape of a 2xx answer
      type: object
      additionalProperties: false
      required: [id, status]
      properties:
        id:     { type: string }
        status: { type: string }
        tax_id: { type: string, x-sefra-sensitive: true }
    # sensitive: ["/bank/iban"]       # JSON pointers, an older form of the same marking
  • A 404 makes the fact null, so that a policy can deny on “does not exist”. Any other error or a timeout makes it unavailable: FACT_UNAVAILABLE, and the execution is rejected at pre-flight or the step fails at step time.
  • Give every fact a response_schema. It declares every field the policy can read, and it is where sensitive fields of the answer are marked. The system returns the whole record, not only what your rules read, and all of it is stored with the decision. Every 2xx answer is validated against the schema; one that does not conform makes the fact unavailable, so that an answer of another shape cannot reach the policy; with additionalProperties: false, neither can a field nobody declared. sefra bundle test warns about every fact without a response schema.
  • Declare every field the answer carries, also those no rule reads, and close the schema with additionalProperties: false at every level. An open schema lets a field the system adds later through to the policy, and into the stored decision, in clear and unreviewed. Closed, a new field makes the fact unavailable until the bundle declares it, marked or not: the intent stops rather than leaks.
  • sensitive is a list of JSON pointers into the answer, redacted as well. Prefer markers in the response schema, which a reviewer reads next to the field.
execute:
  connector: erp
  method: POST
  path: /purchase-orders
  body: { vendor_id: "${input.vendor_id}", quantity: "${input.quantity}" }
  idempotency: { mode: header, header: Idempotency-Key }
  success: [201]
  output: { po_id: "${response.body.id}" }

success lists the statuses that mean the effect exists. Anything else is classified as refused (4xx except 408 and 429), transient (connection failed before sending, 429, 503) or ambiguous (timeouts, other 5xx, a 2xx not in success, a mapped output field missing). Every required output field must be mapped.

Every write declares how a repeated call is made safe. Read intents declare none.

Mode Use when Sefra after an ambiguous attempt
header The system deduplicates by a key in a header (Stripe’s Idempotency-Key, many ERPs) Repeats with the same key
natural Repeating is harmless by nature: “set status to cancelled” Repeats
none Neither Never repeats; runs the probe, or stops in needs_intervention

none without a probe is a warning: an ambiguous outcome then always needs an operator.

Every write has a compensate block or irreversible: true; one without either is refused and can never appear in a tool list. Compensation runs when a later step of a plan fails, in reverse order.

compensate:
  connector: erp
  method: POST
  path: "/purchase-orders/${output.po_id}/cancel"
  idempotency: { mode: natural }      # header or natural; none is refused
  success: [200]
  already_undone: [404, 409]          # statuses that mean nothing is left to undo

Compensation is retried for 24 hours with backoff; a refusal, or the deadline, ends in compensation_failed, and the execution waits in needs_intervention for an operator. Pick already_undone statuses that really mean undone: an order already cancelled (409) is; an order that cannot be cancelled because it shipped is not.

If the system can answer success before the undo has finished, declare what a finished answer looks like. Every value must hold; anything else is ambiguous, is repeated, and ends with an operator:

compensate:
  success: [200]
  success_when: { "/status": succeeded }   # JSON pointer into the body: a string, integer or boolean

A probe tells whether the effect of an ambiguous attempt exists, typically a lookup by a natural key of the input.

probe:
  connector: erp
  method: GET
  path: "/vendors/by-tax-id/${input.tax_id}"
  applied_when: [200]
  absent_when: [404]
  output: { vendor_id: "${response.body.id}" }

The key must identify the effect uniquely: if an older record can have the same key, the probe reports an effect that is not this attempt’s. The starter policy refuses a new vendor whose tax id exists for this reason.

summary_template is required for writes: approvers read it on the page and on the CLI, and it is in the approval.requested webhook. Lookups into input only; sensitive fields show as [redacted]. Write it so that an approver who reads nothing else knows what they approve, with amounts and units.

connectors.yaml names each system of record: type: http, base_url, auth (bearer, basic, api_key with header, or oauth_client_credentials with token_url, client_id and optional scope), timeout_ms (per attempt) and max_concurrency. secret is a name that sefra.yaml maps to where the value lives; a bundle never holds one (configuration, credential scoping). Sefra calls no host outside a connector’s base URL.

Three optional keys for APIs like Stripe’s. A Stripe bundle uses all three:

  • body_encoding: form writes request bodies as application/x-www-form-urlencoded in the bracket convention (a[b]=1, a[0]=x) instead of JSON (json, the default). A body template stays the same; a null in it fails the call before anything is sent. Answers are still read as JSON.
  • auth.secret_prefixes: [sk_test_, rk_test_]: a secret starting with none of them is never sent; the step ends with DOWNSTREAM_UNAVAILABLE. Use it to keep a connector to test credentials.
  • fail_closed_on: { "/livemode": true }: a JSON pointer into the answer and a value that makes the answer untrusted. A write is then ambiguous (repeated with its key, then an operator), a fact unavailable.

A step’s output is checked against output_schema; a success answer whose mapped output does not match is ambiguous. Use it to say what success means where the status code does not: a Stripe bundle requires status: { const: succeeded }, so a 200 for a payment that still needs the customer reaches an operator instead of passing as paid.

grants.yaml maps a role or a principal to intent patterns (an exact type or <domain>.*). An intent no grant names is invisible to that caller: not listed, and an unknown tool when called. A pattern that matches no intent is a warning.

limits.yaml sets default, optional principals overrides and optional per-intents limits, each { per_minute, burst }, counted per principal.