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

# Processes and the log

> A process folds the log of one subject into a status, and says which acts are open now and for whom.

A **process** reads the log of one subject, such as a submission, and gives its status.
The status says which acts are open now, and which role may take each one.
A new-business submission, a cancellation and a claim each fit this shape.

## Append-only log

The log holds what people and tools said and did about the subject, in order.
Each statement adds one entry at the end. A correction is a new entry too.
The process computes the status from the entries and the program each time someone asks.

```mermaid theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': 'whitesmoke', 'primaryTextColor': 'black', 'primaryBorderColor': 'gray', 'lineColor': 'silver', 'edgeLabelBackground': 'whitesmoke', 'tertiaryColor': 'whitesmoke', 'clusterBkg': 'white', 'clusterBorder': 'gray'}}}%%
flowchart TD
    E["<b>The log</b><br/>entry 1 · entry 2 · … · entry n"]
    P["<b>The process</b><br/>rules and grants decide; acts move the state"]
    S["<b>The status</b><br/>open questions and acts, and the outcomes"]
    E --> P --> S
    class E,P,S box;
    classDef box fill:whitesmoke,stroke:gray,color:black,stroke-width:1px;
    linkStyle default stroke:silver,stroke-width:1px,color:black;
```

So these hold for every log:

* The same log and the same program give the same status.
* The status after any earlier entry is still there to read.
* The `open` entry records a hash of the program. The log gives a status only under that program.

In programming terms, a process is an event-sourced decider. Acts move the subject from state to state.
Rules and grants decide which acts are open.

## Entry kinds

| Kind | Records |
| - | - |
| `open` | The start of the log, and the program it runs |
| `answer` | A value for an input, by a role, with an optional cite of a document |
| `tool` | A value that a host tool gave, with the call |
| `decide` | A role's decision on a rule, with the values that the rule read |
| `attach` | A document, under a name and a hash of its bytes |
| `retract` | A taken-back answer or decision, or a withdrawn offer |
| `note` | A new name or a receipt for an offer |
| `act` | An act of the program, such as an offer, a bind or a decline |

Each entry names its writer as a role and a person: `uw:alice`.
A process waits on three kinds of outside value: an answer from a role, a result from a host tool, and a decision by a role.

## RSL 0.5 intake contract

In an RSL 0.5 record, a field margin can give the intake screen a short label (`@short`), a section (`@group`), a description (`@description`), source documents (`@found_on`) and an answer format (`@format`). Each tag takes quoted text; `@found_on` may name several documents. A quoted margin on an enum member becomes its answer label. These values appear in the process log contract's `questions` schema.

Write `as note` on a record field or on an `ask` line to keep the answer in the log without making it a required question. Group calculations in a process with `step name { … }`; the contract lists each step and its values. An interval field's `or refuse CODE "message"` appears in `rules` at that field's path. Referral rule names may be lower case, such as `floor`, or upper case.

For a keyed list of records, `for l in layers { … }` gives each item its own `ask`, `let`, `show`, and `rule` lines. The binder `l` names the current record in expressions. An item rule is evaluated and decided for each key: a referral for `layers[number=1]` does not refer `layers[number=2]`. The contract marks item outcomes and referrals with their list grain. Give every published outcome a unique name across the process, including its root and all item lists.

## Acts and states

A process names its acts, the states each one leaves and enters, and the role that takes it.
This excerpt comes from the staffing example:

```rsl theme={"languages":{"custom":["languages/rsl.tmLanguage.json"]}}
Acts = {
    quote: offer live -> live by @Role.uw,
    bind: accept live -> bound by @Role.uw,
    decline: refuse live -> declined by @Role.uw,
    withdraw: end live -> closed by @Role.assistant,
}
```

| Kind | What the act does |
| - | - |
| `offer` | Saves the present outcomes as an offer under a new name |
| `accept` | Takes one offer that stands, and makes the log final |
| `refuse` | Declines the subject while a rule or a decision declines it |
| `end` | Ends the log before a decision, such as a withdrawal |
| A step | Moves the log to another live state |

An `end` act leaves each live state, so every log can reach a final status.
The check proves it for each program.

## Related

* [Rules, grants and decisions](https://docs.canary.effectiveai.app/rsl/concepts/rules-and-decisions.md) explains what holds an act and who may take it.
* [Submission log](https://docs.canary.effectiveai.app/rsl/reference/submission-log.md) lists every entry field, status and refusal code.
* [Run a submission](https://docs.canary.effectiveai.app/rsl/how-to/run-a-submission.md) plays one submission from open to bind.


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