> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Ask the host's clock to start work nobody will be present for

> Records a schedule: a repository, a prompt, a rule saying when it fires, and what one fire may spend. The host's own clock fires it into a new session that runs unattended — every fire opens its own session and nothing is ever appended to an earlier one.
Everything this host could not honour is refused HERE, because creation is the only moment somebody is present to answer. A rule under the five-minute floor, an instant already behind the clock, and a repository nobody has vouched for are all 422: a schedule accepted into an untrusted directory would wake at three in the morning, be refused at everything it tried, and leave an empty morning behind.
The clock itself is not on this surface. Due-ness, the sweep's cadence and how a ceiling is spent are the host's own facts; a client asks for a schedule and reads what the host decided.



## OpenAPI

````yaml /es/openapi/v3-current/narya.yaml post /v1/schedules
openapi: 3.1.0
info:
  title: Narya Host API
  version: 1.0.0
  description: >-
    The contract between the Narya host and every client. One long-lived host
    serves this API over a Unix socket in your Narya home. The terminal client
    and the one-shot command that Lerian ships drive this API, and a client you
    write drives the same one.


    Requests authenticate with a bearer token issued by the identity provider
    the host is configured with. An operation that declares another security
    scheme also accepts that credential. A request without a valid credential
    gets 401 with NRY-0011. A caller whose role lacks the permission an
    operation needs gets 403 with NRY-0028.


    Submitting a message returns 202 with a turn id. Everything the turn
    produces streams over GET /v1/events as server-sent events with a typed
    envelope, and a stream resumes from a Last-Event-ID header.


    One error envelope: code, title and message. Codes are NRY- followed by four
    digits. Cursors are opaque.
servers: []
security:
  - bearerAuth: []
tags:
  - name: host
    description: The host process itself — version, uptime, mode, store.
  - name: sessions
    description: Durable conversation containers. Archive, never destroy.
  - name: messages
    description: Submitting work into a session and interrupting it.
  - name: events
    description: The server-sent event stream every client consumes.
  - name: lanes
    description: Parallel tracks inside a session — main, subagent, side.
  - name: agents
    description: Named recipes — instructions, tools, model, policy. Read-only in v1.
  - name: ladder
    description: >-
      What a person can type: the skills and command files in force for one
      repository, and expanding one into text. Five origins merged, nearest
      winning a name, the repository's own rungs gated on trust.
  - name: permissions
    description: Pending permission asks, decisions, and the decision audit.
  - name: intercom
    description: Sessions on one machine finding and messaging each other.
  - name: packages
    description: The one thing a user installs — resources, Go code, or both.
  - name: extensions
    description: >-
      Host-side extensions and the operations each exposes over the wire. This
      is the generic lane a host extension uses to serve its own client half (a
      TUI component, a web panel) or any API-only consumer, without adding
      routes to this contract.
  - name: workflows
    description: Deterministic multi-agent orchestration runs.
  - name: providers
    description: Model suppliers, their auth state, and the model catalogue.
  - name: monitors
    description: >-
      Long-running watchers a session keeps beside its conversation — a test
      runner in watch mode, a build, a log being followed. Started by the model
      or by the person, always listed, always killable.
  - name: records
    description: The queryable local record of everything that happened.
  - name: environments
    description: >-
      Where a session's code lives and its commands run — this machine, or a
      container narya operates. A session that names none runs here.
  - name: schedules
    description: >-
      Work the host's own clock starts with nobody present — a repository, a
      prompt, a rule and what one fire may spend. Cancel, never destroy.
  - name: sharing
    description: >-
      Publishing a session from a developer's own home to the organisation's,
      and what is held back before a byte leaves the machine.
  - name: refinements
    description: >-
      What this owner has taught narya and allowed it to keep — distilled facts,
      and the skills, agents and commands the model wrote for itself. Propose,
      read, consent, roll back. Nothing here fires until a person answers.
  - name: platform
    description: >-
      Calls Lerian's control plane made to a home it hosts, as this home
      recorded them.
paths:
  /v1/schedules:
    post:
      tags:
        - schedules
      summary: Ask the host's clock to start work nobody will be present for
      description: >-
        Records a schedule: a repository, a prompt, a rule saying when it fires,
        and what one fire may spend. The host's own clock fires it into a new
        session that runs unattended — every fire opens its own session and
        nothing is ever appended to an earlier one.

        Everything this host could not honour is refused HERE, because creation
        is the only moment somebody is present to answer. A rule under the
        five-minute floor, an instant already behind the clock, and a repository
        nobody has vouched for are all 422: a schedule accepted into an
        untrusted directory would wake at three in the morning, be refused at
        everything it tried, and leave an empty morning behind.

        The clock itself is not on this surface. Due-ness, the sweep's cadence
        and how a ceiling is spent are the host's own facts; a client asks for a
        schedule and reads what the host decided.
      operationId: createSchedule
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScheduleCreate'
      responses:
        '201':
          description: The schedule as stored, with the first instant it is owed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Schedule'
        '400':
          $ref: '#/components/responses/BadRequest'
        '413':
          $ref: '#/components/responses/RequestBodyTooLarge'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    ScheduleCreate:
      type: object
      description: >-
        A schedule being asked for, in the words the caller has: the rule
        arrives as the strings a person typed and one parser reads them, so
        every surface refuses `--every whenever` in the same sentence.

        There is no owner field and its absence is the rule rather than an
        omission — the host writes the owner from its own identity.
      required:
        - repository
        - prompt
      properties:
        repository:
          type: string
          maxLength: 4096
          description: >-
            Absolute path of the directory a fire runs in. Somebody must have
            vouched for it already; one nobody has is refused with the sentence
            that names the gesture.
        prompt:
          type: string
          description: >-
            What the fired session is asked to do. Required: a schedule with
            nothing to do starts a session at three in the morning and does
            nothing in it.
        agent:
          type: string
          description: The agent recipe a fire runs under. Empty runs the host's default.
        every:
          type: string
          description: >-
            An interval — "15m", "2h", "24h", "7d". Exactly one of every and at
            is given. The shortest a schedule may fire on is five minutes, and
            anything under it is refused naming the floor: an agent turn takes
            minutes and spends money, so a schedule measured in seconds is an
            incident rather than an aggressive setting. An interval's first fire
            is one interval away, never immediately.
        at:
          type: string
          description: >-
            One absolute RFC3339 instant, fired once, after which the schedule
            is completed. An instant already behind the clock is refused rather
            than fired late.
        ceilingUsd:
          type: number
          format: double
          minimum: 0
          description: >-
            What one fire may spend. Absent takes the operator's configured
            default, which is why the spend ceiling is on whether or not anybody
            thought about it. Zero is not absent and is never promoted: it is a
            schedule that does not fire, which is how one is parked until
            somebody prices it.
      examples:
        - repository: /Users/dana/repos/midaz
          prompt: read yesterday's failed builds and write the summary
          every: 24h
    Schedule:
      type: object
      description: >-
        Work the host's own clock starts, with nobody present.

        A schedule is durable configuration, never swept: what a fire produces
        is a session, governed by the rules sessions already have, while the
        schedule itself stays until somebody cancels it. The owner is never
        something a caller names — a fire has to be attributable to somebody who
        is not there, and an attribution the reader cannot check reads exactly
        like a true one.
      required:
        - id
        - owner
        - repository
        - prompt
        - rule
        - status
        - ceilingUsd
        - createdAt
        - runCount
      properties:
        id:
          type: string
          format: uuid
        owner:
          type: string
          description: >-
            Who this schedule's fires are billed to and attributed to: the
            person who created it, as the host authenticated them. A fire runs
            with nobody present, so this is read from the row rather than from
            whoever is signed in at the time — which is what lets a schedule
            outlive its author being away.
        repository:
          type: string
          description: >-
            The directory a fired session runs in. Somebody has vouched for it —
            creation refuses one nobody has — and the host reads that answer
            again at every fire, because trust is revocable.
        prompt:
          type: string
          description: What the fired session is asked to do.
        agent:
          type: string
          description: The agent recipe a fire runs under. Absent runs the host's default.
        rule:
          $ref: '#/components/schemas/ScheduleRule'
        status:
          type: string
          description: >-
            active fires; completed is what a single-instant schedule becomes
            once that instant is spent; cancelled is what a person does to one,
            and it stops the fires without removing the record; paused keeps the
            row and stops the fires, which is the difference between changing
            your mind and changing it back.
          enum:
            - active
            - paused
            - completed
            - cancelled
        ceilingUsd:
          type: number
          format: double
          minimum: 0
          description: >-
            What ONE fire may spend. A hard stop on the turn rather than a price
            — see setScheduleBudget for what it does and does not bound. Zero
            means this schedule does not fire.
        createdAt:
          type: string
          format: date-time
        nextRunAt:
          type: string
          format: date-time
          description: >-
            The instant a fire is owed at. Absent once a single instant has been
            spent. A cancelled schedule KEEPS the instant it was going to run at
            — its status is what stops the fire, and the instant is what
            somebody reads when they wonder whether they stopped the right one.
            It is advanced from the moment of the fire rather than from the
            instant that was missed, which is why a host that was off for three
            days fires once rather than three times.
        lastRunAt:
          type: string
          format: date-time
          description: >-
            When this schedule last CLAIMED an instant. Absent until it has. It
            is stamped at the claim, before the fire's session exists, so it
            says when the host last acted on this schedule rather than when work
            last started: a fire refused for a missing repository or an
            unpriceable model moves it too, and lastError says which.
        lastFiredSessionId:
          type: string
          format: uuid
          description: >-
            The session the last fire created, which is where the morning's
            reading starts. It may name a session that has since been purged.
        lastSkippedAt:
          type: string
          format: date-time
          description: >-
            When a due fire was refused, with lastSkipReason saying which
            refusal it was. Recorded rather than silent: a skip nobody can read
            is indistinguishable from a scheduler that stopped working. Written
            once while the refusal lasts, so it answers "since when", and
            cleared by any fire that gets through.
        lastSkipReason:
          type: string
        lastError:
          type: string
          description: >-
            How a fire that had already claimed its instant failed to reach a
            session. The instant stays spent, so this is what the morning reads
            instead of an unexplained gap.
        runCount:
          type: integer
          minimum: 0
          description: >-
            How many instants this schedule has CLAIMED, including fires that
            never reached a session. The count is incremented inside the same
            transaction that spends the instant, which is what makes a fire
            unrepeatable across a crash — so a fire refused after the claim, or
            a host that died in the gap before the session existed, is counted
            here and explained in lastError. A consumer counting SESSIONS wants
            the sessions themselves, not this.
      examples:
        - id: 8f2c1a4e-6b0d-4e2f-9a3c-5d7e1f0b2a4c
          owner: user_01HZX3Q8N4KDPYV2A7C9M5T6RB
          repository: /Users/dana/repos/midaz
          prompt: read yesterday's failed builds and write the summary
          rule:
            kind: every
            everySeconds: 86400
          status: active
          ceilingUsd: 5
          createdAt: '2026-09-03T09:00:00.000Z'
          nextRunAt: '2026-09-04T09:00:00.000Z'
          runCount: 0
    ScheduleRule:
      type: object
      description: >-
        When a schedule fires: a kind and the one parameter that kind takes.
        Exactly one parameter is ever set.

        There is no cron expression here and the absence is a decision, not a
        gap: a cron expression drags a timezone, a daylight-saving policy and a
        no-match semantics behind it, and an agent turn costs money and takes
        minutes, so the units that matter are hours and days.
      required:
        - kind
      properties:
        kind:
          type: string
          enum:
            - every
            - at
          x-enum-varnames:
            - ScheduleRuleKindEvery
            - ScheduleRuleKindAt
        everySeconds:
          type: integer
          minimum: 1
          description: >-
            The gap between fires, present only when kind is every. Seconds
            rather than the duration a person typed, because the only arithmetic
            anybody does with it is addition.
        at:
          type: string
          format: date-time
          description: >-
            The single instant, present only when kind is at. It is what the
            person asked for and stays put after the fire, while nextRunAt is
            what the clock did.
    Error:
      type: object
      description: >-
        The single error envelope every operation returns. Codes are NRY-
        followed by four digits and are catalogued in the top-level
        x-error-catalog extension.
      required:
        - code
        - title
        - message
      properties:
        code:
          type: string
          pattern: ^NRY-[0-9]{4}$
          description: Machine-readable error code from the NRY catalogue.
        title:
          type: string
          maxLength: 256
          description: Short human-readable summary of the error class.
        message:
          type: string
          maxLength: 4096
          description: Specific, actionable description of what went wrong.
        fields:
          type: object
          description: Per-field validation problems.
          additionalProperties:
            type: string
      examples:
        - code: NRY-0002
          title: Session not found
          message: >-
            No session with id 6b9f6d2e-1c3a-4f5b-9d7e-2a8c4e6f0b1d exists on
            this host.
  responses:
    BadRequest:
      description: Malformed request — invalid parameter, cursor, or JSON body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RequestBodyTooLarge:
      description: >-
        The request body weighs more than this operation accepts (NRY-0024). The
        host holds one ceiling per operation and refuses at the door, in front
        of every handler: a body whose declared Content-Length is past the
        ceiling is refused before a byte of it is read, and a body that declares
        no length is read only as far as the ceiling and refused there. Nothing
        was read past that point and nothing was written.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnprocessableEntity:
      description: The request was well-formed but failed validation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: The host failed — including a store that refuses writes (NRY-0012).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Enforced on every transport, with no exempt operation. A person's
        request — over the default local unix socket exactly as over a TCP
        listener — must carry a JWT issued by the configured identity provider,
        which the host verifies itself against that issuer's key set: signature,
        issuer, expiry, and the person and organisation it names. Requests
        without a valid one receive 401 NRY-0011. The socket's file permissions
        are transport and are not an authorisation.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.