An agent is a thread
An agent owns its conversation and shell on one joined thread. Everything else is its state or a message to it. Hosts gate admission and observe records; they do not drive exchanges.
The laws
-
A1 — One owner. The attending thread owns
Contextand resources (engine, client, nursery and timers); the cell ownsMail,SchedulesandModelunder one lock. Only a foreground shell call borrows the body (A7). -
A2 — Scopes nest. The human’s life is the fleet root, containing its children’s lives; a parent’s life contains its helpers’ lives; each life contains its exchanges. Stop cancels only an exchange with
Interrupted; stronger gestures end lives. Cancellation never resets. -
A3 — A life ends whole. Teardown joins helpers before ending its engine.
Joinedjoins on drop; field order drops the life-ending mailbox before the body’s nursery, then the engine and name. This holds on unwind too.Host::endandHost::dropend and join every child of the human; no thread is detached. -
A4 — Jobs are linear. A job is an agent’s observed busy period, not a cancellation scope. Under the cell lock,
begincommitsControl::JobOpened; its commit number names the job held byMail. Settlement commitsJobSettledand clears the job only with an empty queue and nothing pending. Stop takes that same lock, marks the open job stopped, cancels its latest exchange. Human gestures additionally recall queued text in the same critical section; desk Stop and SIGINT leave it queued. Stale ids do nothing; a job without settlement ended with its life. -
A5 — A parent is owed a reply. The mail derives debt for every returning agent: what it took up and has not answered, or pending posts by its parent. Every agent starts owing nothing. A helper owes from its task’s post and later parent messages; a returning child of the human owes from human posts, before admission. Human input to helpers and peers add none.
Takenkeeps debt;Withdrawntakes unread debt away.Txn::reportcommitsControl::Status, retires schedules and withdraws queued wakeups (all pending posts after life ends), then postsChildiff it owed, under the helper lock. A job settling owing reportsStoppedif stopped, otherwiseFailed. The helper postsDied, thenGone, last. A parent admitsChildonly from an adopted, unjoined helper. -
A6 — Admission. At rest,
Freeadmits any input,Gatedadmits any after a release (releasedis cell plumbing, set only at rest and consumed by job opening; a release while working is ignored), andParentadmits human and parent input. Commands,ChildandGoneare quiet: never held and do not themselves open jobs at rest. Other inputs retain their place. A resting helper refuses peer messages; while working it accepts them. -
A7 — Loans. The body lives in the call’s host during dispatch and returns on return or unwind. Later enquiries answer
no desk.Loan<Body>and call-local acts useAtomicRefCell; neither is a persistent shared agent register. -
A8 — Teardown. Ending life reports
Failedif a report is owed, joins helpers, retires the engine and returns failures to the joiner. Name removal precedesDied;Gonefollows it. Directory emptiness is not producer completion:Host::is_finishedalso requires every retained human child’s thread finished before the TUI’s final drain/frame.Host::endstill joins and collects failures. -
A9 — Helpers’ rest is bounded. Under the mailbox lock,
nextends aParent-admitted life withTimedOutafter its idle interval with no admissible input. A racing post either wins or is refused. Default:HELPER_IDLE, five hours;--helper-idleoverrides it. -
A10 — Rest owes nothing. An unjoined helper is pending exactly while
Mail::owes()is true. Reporting holds its cell across the status commit and parent post, so observing paid debt means the notice was delivered.Rest::pending, read before the parent’s lock, cannot overtake it. A report after life ends withdraws every pending post: an ended reported helper owes nothing by construction, andGonejoins it in or out of a job. -
A11 — Engines end once. An agent holds
Option<Engine>; final teardown takes it before retirement, so repeated teardown cannot retire it again. Clear retires the outgoing engine, or the prepared engine on commit failure.Body::retire_enginerecords an uncertified end once asTeardownFailedand retains it in failures, propagated throughTeardowntoHost::end, never re-recorded by joiners. Unwind drops an unended engine; the panic is the failure. Failed thread creation tears down the unlaunched agent;LaunchErrorreturns both the spawn cause and teardown failures. -
A12 — Reminders. At the end of an exchange, an owing agent is reminded to reply iff no worker runs,
Restis empty, and noHuman,Task,MessageorChildis queued.Restis read before the queue.
Delivery and replacement
The cell is the transaction boundary; the owner keeps the context and resources.
- A popped input receives an exchange lease under life. Only accepted input opens a job; stale-generation or already-claimed batches open nothing. Nudges continue the exchange locally, never through the queue.
- A timer retains
WeakAgentAddress(Weak<Shared>)and only rings its cell, recording nothing. The owner answersNext::Rungand rings before drains, readsSchedules, coalesces queued timer ids and commits the fire before retiming or dropping its timer. The registry is owner-held and unlocked; retiring a booking makes late rings harmless, without epochs. - A conversing agent’s schedules survive jobs and can wake it from rest; a returning agent waits for armed schedules and clears them on reporting.
/clearprepares without mutation, then dismisses and joins helpers, commitsCleared, transfers the life binding to the fresh engine and retires the outgoing one. It resets pins, readings and schedules, advances engine generation, commits queued-report/wakeup/batch withdrawals and booking retirements, then drops their timers; all human text, messages and commands remain. Preparation failure changes nothing; commit failure ends life and retires the prepared engine.- Stop preserves helpers, schedules and loose shell workers. Further input and helper reports may continue the same stopped job. TUI restoration prepends every recalled prompt to the existing draft even during history browsing or non-insert mode; ordinary Up recall remains guarded. Synod’s serialized withdrawals preserve gesture order and attempt identity.
exarch-agents `stoptargets a descendant’s exchange;`dismissends and joins only one’s own helper.
Lock order: descendant cell → ancestor cell → journal → bus channel. The timer registry has no lock; the deadline heap is a leaf. Names are a leaf: clone handles out before notification. Hold at most one mailbox, except reporting from descendant to ancestor. Read helper status without holding the parent’s mailbox.
Supersession
- The one-scope-tree-one-inbox design is superseded: its monotone tree survives as life ⊃ exchange; work scopes, provenance vouching, receipts, shared status cells, census and reply lease do not.
- Exchange-ends-at-fleet-quiescence is superseded: jobs are recorded busy periods for every agent, with helper debts paid before settlement. Synod gates the next job across its folder walk.
- Reply-parks is superseded: a helper rests and times itself out; reporting does not end its helpers.
- The host-holds-a-helm product boundary is amended to Stop < end, including Synod: Stop no longer ends helpers.
- 261029_a-child-is-a-status is amended:
ChildStatushas noWorking; reports are messages posted only while the helper mailbox owes its parent. The mail’s recorded status servesreadand views.
Amendment — 2026-10-29: a frontend holds a port
261029_a-frontend-holds-a-port amends the boundary without changing the
thread and join laws. The immutable client is owned by Body; frontends
read AgentRow.selected from the cell through Port, not the client.
Its P5 replaces A8’s completion criterion: after a drain to empty, every known
tab for a child of the human must have received Died.
Host::is_finished is removed; Host::end still joins and collects failures. The laws above include the
fold amendment below.
Amendment — 2026-10-30: an agent is the fold of its log
agents supplies the cell and F1–F6.
A1, A4–A6, A10 and A12 above state their amended rules: no separate debt
flag, published pick, registry epoch or registry lock. Closure transactions
keep poison; a poisoned cell ends life and its helper still reports failure.
commit_to appends and steps together. The context remains owner-held,
not locked with the shared folds.
Amendment — 2026-10-30: one kind of agent
The human has no model, log or engine. Its life is the fleet root and
Fleet.human: Mutex<Nursery> owns its children’s handles and joins, as an
agent’s nursery owns its helpers. Host::children() lists every adopted
child in birth order, joined or not, including /new and /branch births;
end repeatedly drains the nursery to include racing births. The human is
not sent Gone; frontends already observe Died.
Agent::born and AgentLog::create are the one birth and log opening.
Parent::terms is the one construction case split: the human lends launch
terms; an agent lends search, one less fuel, nested life, Parent admission
and returns: true. The handle holds only fixed parentage; returns is
read from Mail. The helper’s opening task is its parent’s Peer post,
with bare text, and debt begins at that post, not birth. A2 and A5 above
include these rules.
Where
exarch/src/agent.rs,agent/{attend,build,spawn,engine,loan,nursery}.rs: ownership, loop, consumptive retirement, launch and loans.exarch/src/bus/{mailbox,lease}.rs,schedule.rs: admission, observed jobs, Stop, reports and scheduled-firing transactions.exarch/src/{host,port}.rs,agent/fleet.rs,headless.rs,tui/{app,prompt,tabs,tui_loop}.rs: the human’s nursery, registry-backed ports and observed child deaths, including lossless Stop restoration.exarch/src/vm.rs(Guest::end),desktop/src/assistant/{gate,conversation}.rs,desktop/src/window/conversation.rs: gated jobs, folder walks and machine recovery after joins.
agents, cancellation, session-record, agent, frontend, synod, desktop.
The terminal verdict includes recording failure through the final SessionEnded append. A missing terminal completion is a failure, not a successful teardown.
Headless observes helper panic verdicts received before the returning agent’s report; it does not continue consuming the bus after that report. Joined teardown failures still reach the process result.