How an agent is made

Decided 22 October 2026: one file per agent is the source, and the card is a view of it (OS/A's docs/one-graph.md). The words below replace takes, gives, done, uses, needs and approves.

The card

What the job is, the case a model is measured on, and how it did. Drawn from the agent's file: its own [card] block, and what the agent declares.

The agent

The job as OS/A runs it, in Agent Markdown, at canon/agents/<run name>.md, the one file that holds the card too. OS/A takes the agent without the card's blocks.

The ontology

The kinds of record the agent works with, what each holds, when one needs attention and what it measures. OS/A's, in lib/ontologies/. Shared by every agent.

A card and its agent are generic. They name no company, person, product or trade, and they carry no story. Only the card's case is concrete, and nothing from the case goes into the agent.

The card

The card is drawn from the agent's file. What the agent declares is read from its own blocks and never written twice: its verb and tags from the frontmatter, what it works with from [data] kinds and [acquaintances], what it owns and what the person approves from its [contract]. What is the card's alone is in the file's [card] block, one key: value line each, with [run] and [results] after the agent's blocks. canon/agents.json is built from the files.

LineWhat it holds
noIts number. Never changes and is never reused.
codeThe code name, in capitals: CHASE_DEBTORS. In lower case with hyphens it is the run name and the file's name.
nameThe standard name a business gives the job: Credit control.
volumeWhere the work is done. In book 1, the department.
roleWho does this job by hand: A credit controller.
descriptionWhat the job is and what the agent does, for any business.
task, task_askA command of two or three words and the words it is asked with. No dates and no names.
ask, givenThe case: the request in a person's words, and the situation with its difficulty.
stepThe reference path, one line each, Tag | sentence. The model is never shown them.
good, nullA correct result, stated so it can be checked, and the one failure the card exists to catch.
personWhether the person is there in the case: there or away.
deceptionWhat in the case lies on purpose, when something does.
traps, stakes, skill, turns, tokensJudged from 1 to 6, and the estimates; the rating is added up from them.
by_hand_minutes, usefulness, usefulness_whyHow long it takes by hand, and how much it matters, out of 10 with one sentence.

The ontology

A kind is a kind of system: accounting, stock, mail. A kind holds things: accounting holds customers, invoices and bills. A thing has fields, each with a type. A kind is named, never a product: accounting, not Xero. When a business has no system of that kind, OS/A's store holds the records in the same shape.

A thing may also declare two more parts. Code reads both, with no model.

PartWhat it saysIts form
attentionWhen one of these records needs somebody, by name.Conditions that must all hold, each [field, test, value]. The tests are before, after, within (days), below, above, is, is not, empty and not empty. A value is a literal, today, or a field; a field may follow one ref, as sku.reorder_point.
measuresThe numbers worth knowing about these records, by name.A number field, or [field, less, field]. Every measure is totalled over the records, and every set of records can be counted.
"invoice": {
  "fields": { "due": { "type": "date" }, "total": { "type": "number" }, "paid": { "type": "number" }, … },
  "attention": {
    "overdue": [["due", "before", "today"], ["paid", "below", "total"]]
  },
  "measures": {
    "owed": ["total", "less", "paid"]
  }
}

A rule is decided by the fields, never by a status somebody typed. An invoice marked "sent" whose due date has passed is overdue.

A field that points at another record is a ref: {"type": "ref", "to": "accounting.customer", "by": "name"}. A thing that is a role of an entity says so with is: an accounting customer and a CRM company are both roles of an organisation, joined in OS/A's store. The entity types are organisation, person, product and location. The grammar of an ontology file is lib/ontologies/ontology.schema.json, a JSON Schema.

The agent

Agent Markdown, OS/A's standard (../osa/docs/agent-markdown.md). Its frontmatter carries id, name, version, description, and the card's verb and tags. Its blocks:

BlockWhat it holds
[identity], [instructions], [guardrails]Who it is, how it does the job, and what it must never do. Written for any business: the business's name is {{business}}.
[data]kinds: the kinds of record it works with. The card shows them as what it works with.
[acquaintances]The agents it works with, each with a role. required marks one it cannot work without: sys-machine for the person's computer, sys-site for a browser.
[contract]What code holds the agent to. Below.
[test]Cases written from the card's good and null: given: and expect:.
[tools], [memory]The tools it may call, and the facts it reads, such as business.

The contract has five lines, each one word:

LineWhat it saysExample
owns:What brings the job round: an attention rule of one of its kinds, or a cadence. One agent owns a rule within a scenario.owns: accounting.invoice overdue
owns: every month, first working day
requires:What it must be given to start, each a name and a type: text, a file, or a record as kind.thing, with [] for a list.requires: request (text)
produces:What it hands back: the words for the person, and the records it creates or changes.produces: report (text), queued (accounting.payment[])
exit:The condition the work is finished on, one line each, checked against what it produced.exit: nothing has been sent
approval:The acts the person says yes to. The card shows it.approval: each reminder before it is sent
[data]
kinds: accounting, mail, crm, bank, documents
[end]

[contract]
owns: accounting.invoice overdue
requires: request (text)
produces: report (text)
exit: every overdue invoice is named, with a draft reminder or the reason it was set aside
exit: nothing has been sent
approval: each reminder before it is sent
[end]

What the build holds

The canon's build stops, and names the file, when:

  • a file has no [card] block, or a line the card needs is missing;
  • a file's name is not its card's run name, or two cards share a number;
  • the agent works with a kind or names an acquaintance canon/structure.json does not know;
  • two agents in one scenario own the same attention rule;
  • the card's [run] would not run on OS/A.

OS/A holds the rest when it imports an agent: a record in requires: or produces: is of a kind the agent works with and a thing its ontology holds, and owns: names an attention rule its kind declares or a cadence in one of the fixed forms.

How it is used

WhereWhat it reads
A scenarioNames cards in groups. Installed in OS/A, the scenario becomes an application, and its agents come from canon/agents/.
The deskDue today: each agent whose owns: rule has records now. Coming up: cadences and dates ahead. Needs you: approval: met in a run. The business: the measures of the scenario's kinds. Done: what each job produced.
Starting the jobThe button is the card's task, with the records in hand as what it requires:.
A runThe card's case and run, judged by good, null and the exit: lines.

Adding an agent

  1. Check it is real work that comes round often or costs a great deal when it goes wrong, and that no card already does it.
  2. Give it the next number, its standard name, a verb from the list, and the volume where the work is done.
  3. Name the kinds it works with. If a kind it needs is missing, or a thing, field, attention rule or measure, add it to the ontology first.
  4. Copy canon/template.md to its file in canon/agents/ and write the [card] block: description, role, task, steps, good and null, and the case with its difficulty. The guide is docs/writing-an-agent.md.
  5. Write the agent in the same file: its blocks, its contract, and tests from the case.
  6. Run node canon/build.js, then score it in OS/A with node tools/check-agent.js. When a scenario names the card, import it into OS/A with node tools/canon-import.js --write.