session
The session plugin: the coordinator’s one long conversation, compacted during the day, at set times, once it uses a share of its context window, or both, so it never overflows its context (roadmap entry 35), started fresh at night once no job and no merge runs, and restarted on /restart (entry 36). Before each, the coordinator writes its handoff, and the next conversation reads it first. Its restart guard holds new jobs once a commit changed the code arthur run loaded, until arthur run starts again, which under its service it does by itself once no job and no merge runs (entry 37). At every start of arthur run it asks the coordinator’s model for one word and tells the owner whether the coordinator is up, after what arthur doctor found missing, and it tells each coordinator turn that fails before any text (entry 38). Each project agent has the same in its own session and its own chat, one compaction at a time across sessions (entry 88, “Project agents” below). It gives arthur doctor the user service and linger (entry 80). It needs orchestration, which runs the coordinator.
A running merge holds every restart as a job does (AR0691): the fresh start’s try, /restart and the restart due. A merge runs, for session, while the delivery plugin names it through delivery.merging: while the process its merge.lock names lives, from the merge’s first look at main through its checks on main and the ticket’s spec: commit, arthur merge --auto included. The lock goes before the merge pushes main and prunes the ticket’s jobs, so a restart may still end those two steps; main is merged and checked by then, and nothing rolls it back. A merge whose process is gone (killed) holds nothing. Without the delivery plugin no merge holds a restart.
Options
Section titled “Options”In session({ ... }) in arthur.config.ts; every key optional:
| Option | Meaning |
|---|---|
compactAt |
The times of day the coordinator’s conversation is compacted, each "HH:MM" (00:00 to 23:59) in core.timeZone. Default ["08:00", "13:00", "18:00"]; [] never compacts. Not used with compactOn: "context". |
compactOn |
What compacts the coordinator’s conversation: "schedule", each compactAt time; "context", a turn that ends with the conversation at compactAtPercent of its context window or more; "both", whichever comes first. Default "schedule". Jobs compact as before under each. |
compactAtPercent |
With compactOn "context" or "both", the share of the context window, in percent, at which a compaction is asked for; a whole number from 1 to 99. Default 80. |
compactWaitSeconds |
How long a compaction waits for the coordinator to be idle, a whole number of seconds of at least 1. Default 1800. |
freshAt |
The time of day, "HH:MM" in core.timeZone, of the first try of the fresh start: a new conversation, without --continue, only once no job and no merge runs. Default "23:00". |
freshRetryMinutes |
While a job or a merge runs, the fresh start is tried again this often, counted from freshAt; a whole number of minutes of at least 1. A try also waits this long for the handoff. Default 15. |
freshUntil |
The time of the last try, "HH:MM"; earlier than freshAt it is the next day, equal to it a single try. Default "03:00". |
restartGuard |
true or false: once a commit changed the code arthur run loaded, refuse every spawn and continue until it starts again, and say so in the coordinator’s context (below). Default true; false turns the guard off. |
probeLlm |
true or false: at every start of arthur run, ask the coordinator’s model for one word before the start notice (below). Default true; false skips the probe, and the start notice says coordinator up without asking. |
Refused at load (and by arthur config check), naming the option: a compactAt that is not a list, an entry, freshAt or freshUntil that is not "HH:MM" (compactAt[<index>]: expected a time "HH:MM" from 00:00 to 23:59, got <value>, freshUntil: ...), a compactOn other than these three (compactOn: expected "schedule", "context" or "both", got <value>), a compactAtPercent that is not a whole number from 1 to 99 (compactAtPercent: expected a whole number from 1 to 99, got <value>), a compactWaitSeconds or freshRetryMinutes that is not a whole number of at least 1 (freshRetryMinutes: expected a whole number of minutes of at least 1, got <value>), a restartGuard or probeLlm that is not true or false (probeLlm: expected true or false, got <value>), and any other option.
The handoff
Section titled “The handoff”arthur run asks the coordinator for a compaction or a restart in <home>/session/request.json, one request at a time. The handoff extension, packages/session/src/handoff-extension.ts, which orchestration loads into the coordinator’s agent (arthur coordinator --help, coordinator.extension), takes it and:
- Waits until the agent is idle with nothing queued: no turn running and no message waiting in omp, for 2 s in a row, longer than the coordinator’s inbox takes to hand over what it queued. Running jobs do not hold it back.
- Asks the coordinator, as a message from Arthur, to write its handoff to
<home>/session/handoff.md, replacing what it holds: the work in progress, the next steps, and every question to the owner still unanswered, with when it was asked. Its reply goes to nobody, unless an owner’s message joins that turn. The request’s words are the procedurepackages/session/roles/coordinator/handoff-<compact|restart|fresh>.mdfor a compaction, a restart or a fresh start, read as it is sent,{handoff}filled in with the path. - When that turn has ended and the agent is idle, and the handoff is new (its modification time changed since step 2), the handoff is written. A compaction then compacts the conversation with omp’s own compaction, as
/compactdoes, and gives the compacted conversation the handoff, as a message from Arthur that holds its text, each line quoted; a restart sayshandoff writtenin the request, andarthur runrestarts the coordinator.
At every start of the coordinator’s agent, the extension notes its pid in <home>/session/agent, and, when the handoff is newer than the last one a conversation read, gives it to the new conversation as its first message: [Arthur] The coordinator just started again. Before that you wrote this handoff (<path>); go on from it: and its text, each line quoted (> before it), so no line of it reads as a message’s mark. So the handoff carries the work in progress and the unanswered questions across every way a conversation ends: a compaction, a fresh start, a /restart, a crash. A handoff of only blanks is never read back, and one read (its modification time is noted in <home>/session/handoff-read) is not read again. A read that fails to reach the agent stays unread, for the next start.
The handoff read back, after a compaction as after a start, never makes omp read a file: omp reads into the turn each file a message names as @<path>, @"<path>" or @'<path>' at the start of a line or after whitespace or one of (, [, {, <, ", ' and `, so each such @ of the handoff gets a word joiner (U+2060) before it, as the coordinator’s inbox does (arthur coordinator --help).
A request.json that is not a request (edited by hand) is dropped: session: <home>/session/request.json is not a request, so it is dropped: <its first 200 characters>. A request is replaced by a restart while a compaction is still asked for: the extension drops the compaction, which then prints nothing.
The extension acts only in its agent’s own session, one with a UI, never in a task subagent. Each project agent has the same, on its own folder (below, “Project agents”).
Compaction during the day
Section titled “Compaction during the day”arthur run looks at the clock every 500 ms. At each compactAt time it asks for a compaction (with compactOn "schedule" or "both"), and prints the outcome, one line:
session: compact: done; the compacted conversation starts by reading the handoff, orsession: compact: done; the handoff is empty, so nothing is read back.session: compact: skipped, session busy for <n> s: the agent was not idle with nothing queued withincompactWaitSecondsof the slot. The handoff is not asked for.session: compact: skipped, handoff not written: <reason>: the conversation is left as it was, not compacted. Reasons:no new handoff when the coordinator's turn ended, with omp’s error in brackets when the turn ended in one;no turn started within 30 safter the request was handed over;the request did not reach the agent: <error>.session: compact: failed: <omp's error, first line>: omp’s compaction threw; nothing is read back.
When it happens:
- No coordinator running at a slot: nothing happens and nothing is printed. The request is dropped once
compactWaitSecondshave passed without an agent taking it, so a coordinator that starts later does not compact late; one that starts within that time does compact. - A slot that passed while
arthur runwas down is skipped, not run late: the next slot is counted from the start, and a request left by the previous run is dropped at the start. - Two slots close together never queue two compactions: a slot that comes while a compaction or a restart is still asked for or running is dropped, and slots passed together (a clock that jumped, a machine that slept) ask once.
- Daylight saving days: a time the spring gap skips (02:30 in Warsaw) comes at the first minute after the jump (03:00); a time the autumn repeat shows twice compacts at its first pass only.
- The coordinator restarting during a compaction: its request is dropped without a word once the agent that took it is gone.
By context use (compactOn "context" or "both"): at each real end of a coordinator turn (aborted and failed turns included, not one omp goes on from), the turn extension, packages/session/src/turn-extension.ts, leaves in <home>/session/context-use the share of its context window the conversation uses, as omp’s ctx.getContextUsage() gives it (omp 18.3.0; nothing when omp gives none or knows no context window). At its next 500 ms look arthur run reads that report once and removes it; one at compactAtPercent or more asks for the same compaction a compactAt time asks for, as slot context <percent>%: the handoff first, withdrawn when it is not written, waiting up to compactWaitSeconds for an idle session, with the same outcome lines. It then asks again only after a compaction whose outcome is compact: done (by either trigger), or after a report below compactAtPercent (a fresh start, omp’s own compaction, a /compact typed): a repeated crossing asks once, and one skipped or withdrawn is not asked again until then. A report left before arthur run started is dropped. With "both", a slot or a report asks, whichever comes first, and neither queues one while a compaction or a restart is asked for; the two stay independent, so a slot soon after a compaction by context use compacts again. Set compactAtPercent below the point omp’s own auto-compaction starts near the limit, which compacts without a handoff.
The fresh start at night
Section titled “The fresh start at night”Every night from freshAt to freshUntil (across midnight when freshUntil is the earlier time), arthur run tries to give the coordinator a new conversation:
- A try at
freshAt, then everyfreshRetryMinutesafter it, and the last atfreshUntilitself, also when it falls between two of those. - A try made while any job runs, of any kind (worker, review, plan, audit, …: every job in a run, as
arthur stopallcounts them), or a merge (above), waits for the next try, without a line. After the last try:session: fresh: skipped, <n> job(s) running at <freshUntil>,..., <n> merge(s) running at <freshUntil>or both,<n> job(s) running, <n> merge(s) running, and that night is over; a job or merge that ends later starts nothing until the next night’sfreshAt. - With no job and no merge running, it asks the coordinator for its handoff (above), waiting up to
freshRetryMinutesfor it. A handoff that is not written withdraws that try with one line, and the next try asks again:session: fresh: try withdrawn, handoff not written: <reason>; next try at <HH:MM>, or after the last trysession: fresh: skipped, handoff not written: <reason> at <freshUntil>. Reasons: those of a compaction above,session busy for <n> s,handoff not written within <n> s, orthe coordinator ended. - Once the handoff is written, the jobs and merges are counted again: one started during the wait makes it a try that waits for the next one, as in step 2. With none, the coordinator’s session is ended through orchestration’s
coordinator.restartwithfresh: true, and orchestration starts it again without--continue(arthur coordinator --help):session: fresh: done; the coordinator restarts in a fresh conversation, which starts by reading the handoff. The next try is the next night’sfreshAt. - With no coordinator running, no handoff is asked: the restart is made at once, so its next start is a fresh conversation (
..., with no handoff: no coordinator was running).
A night whose freshAt passed while arthur run was down is skipped, not run late: the first try is counted from the start. A window that passed unseen (a clock that jumped, a machine that slept) is not tried late either. Times the spring gap skips and the autumn repeat shows twice are taken as for compactAt.
Once the next coordinator is up, one Restarted. notice goes to every channel, Restarted. (fresh session) after a fresh start: arthur restart --help, which also covers /restart and /restart fresh.
The restart guard
Section titled “The restart guard”arthur run loads Arthur’s code once, at its start, so a merge after that runs only once arthur run starts again. The guard holds new jobs meanwhile, so that the jobs running can end and the restart can be made, and nobody runs on code older than main without knowing it:
- At its start,
arthur runnotes in<home>/session/loaded.jsonthe time, the checkout that holds the core (Arthur’s own:git rev-parse --show-toplevelof the core’s package folder), itsHEADcommit, and the code it loaded: thesrc/folder of the core and of each enabled plugin in that checkout, the host’scode(the package folder around the module each plugin names as its own, itsimport.meta.url, whatever the package’s name or place). A disabled plugin is not loaded, so its code is not watched; neither is a plugin that names no module (one written in the config), nor one whose package lies outside that checkout. With the core outside a Git checkout there is nothing to note and the guard does nothing. - At every spawn and every
arthur continue, throughbeforeSpawn, of any kind, for any project, the checkout’sHEADis compared with the commit noted, only in those folders. A merge of docs, tests, roles or any other file does not count, and neither does one in another project’s repository. A change that a later commit undid does not count either: the code atHEADis the code loaded. - When it differs, a restart is due, and the spawn is refused, exit code 1:
refused by session: restart due: AR0153, 1a2b3c4 changed Arthur's code since arthur run started 2026-10-18 08:41 at 0a41782; restart arthur run once no job and no merge runs, or pass --ignore-restart. Each commit onHEAD’s first-parent line since the one noted that changed that code is named by the ticket of itsMerge <id>: ...subject, else by its short hash, oldest first; aHEADmoved back past the commit noted names the commit it is at. arthur spawn --ignore-restartandarthur continue --ignore-restartstart that one job all the same.- A restart of
arthur runclears it: the service’ssystemctl --user restart arthur(docs/deploy.md, “Updating”),/restartunder the service, which then endsarthur runso the service starts it again (arthur restart --help, step 6), orarthur runstarted again by hand. Its start notes the code anew. The fresh start, and/restartin anarthur runstarted by hand, restart only the coordinator’s agent, so they do not clear it. - Under the service,
arthur runmakes that restart itself. At its 500 ms look, once a restart is due, no job runs, no merge runs (above: a restart would end a merge that put Arthur’s code on main during its checks, and the nextarthur runwould roll it back, so that no merge of Arthur’s code could end) and no request is pending (a compaction, a fresh start’s try,/restart), it asks for the restart/restartasks for, as slotdue: the coordinator’s handoff first, for at most 120 s, then the coordinator’s restart, thenarthur runends and its service starts it again;Restarted. (arthur run restarted)follows. A job or a merge started during the wait stops that restart without a notice, and it is asked again once no job and no merge runs; one that throws is only logged,session: restart failed: <first line>, and asked again. Anarthur runstarted by hand never asks it.
The coordinator’s context gets one line on every turn (arthur coordinator --help, under ## session): Restart: none due; no commit changed Arthur's code since arthur run started 2026-10-18 08:41 at 0a41782., or Restart: due, AR0153 changed Arthur's code since ... and what that holds. Nothing while no note exists.
A loaded.json that is not what arthur run notes (edited by hand) refuses every spawn, plugin session: beforeSpawn failed: <path> is not what arthur run notes at its start; it is noted again at the next start, and the context gets coordinator.context failed: with the same words; --ignore-restart still starts a job. A Git command that fails (a commit noted that is gone) refuses the spawn the same way, with Git’s first line: git diff in <checkout>: fatal: bad object <commit>.
The start notice
Section titled “The start notice”So that the owner learns Arthur is up, and a model provider that fails (a login expired, a key revoked, a model gone) is found at the start instead of at the coordinator’s first real turn:
- At every start of
arthur run(the service starting it again counts), the coordinator’s model is asked for one word first:<agent> -p --no-session --no-title --no-tools --no-extensions --no-skills --no-rules --mode json --model <coordinator.model> "Answer with one word: ready.", the agentcore.agent.command, the model the one orchestration answers for the rolecoordinator(arthur roles), the agent’s own default when none is set. It runs beside the coordinator’s own start and holds nothing back. - Answered with text, every channel gets one notice:
coordinator up on <host>,<host>the machine’s name. - Otherwise the notice is
no LLM access on <host>: <reason>; run omp login. The reason is the first line of the model’s error (401 {"type":"error","error":{"type":"authentication_error",...}}), else omp’serror: ...line (No API key found for anthropic.), else its first line on stderr (Model "<model>" not found), elseno answer within 60 swhen the probe is cut after 60 s (the agent is killed),the model's turn ended with aborted,no answer, orexit code <n>. - With
probeLlm: falsenothing is asked, and the notice iscoordinator up on <host>at once.
Two starts in a row send two notices, one each: nothing is merged or held back. An arthur run stopped while its probe runs kills the probe and sends no notice. The notice tells about the model; that the coordinator’s tmux session started is in arthur run’s output (arthur coordinator --help).
The notice opens with the lines arthur doctor found missing that this start sends, one per line, before coordinator up on <host> or no LLM access ...: the core’s doctor event, { lines }, which arthur run emits before any plugin’s start. A line is sent at most once a day (arthur doctor --help); with none to send, the notice is as above.
A coordinator turn that fails before any text (its last message an error, and none of its replies since the message that started it holds text) sends the notice turn failed on <host>: <reason>, the first line of omp’s error, once per reason: while a provider is down the inbox hands its messages over again, and a turn that fails with the same first line as the failure told last is not told again; one with another reason is. The next turn that ends without an error after one told sends turns work again on <host> once, and the reason told before may be told again after it; an aborted turn is neither. The session’s second extension in the coordinator’s agent, packages/session/src/turn-extension.ts, leaves each in <home>/session/turn-failed/, and arthur run sends them within 500 ms, oldest first; one left before this arthur run started is dropped, not told late. A turn the owner aborted, one that replied before it failed, and one omp says goes on, are not told.
A credential is never repeated in either notice: in the reason, every value of the env file under whatever name and every enabled plugin’s ...Env value from the shell (host.secrets), the value of every environment variable whose name holds KEY, TOKEN, SECRET, PASSWORD, CREDENTIAL or AUTH (either 8 characters or more), a Bearer token, a key with a vendor’s prefix (sk-, xoxb-, ghp_, …), and any run of 20 or more letters, digits, _ and - that mixes letters and digits become [redacted]. The reasons are cut at 300 characters. The turn extension leaves omp’s error in turn-failed/ as it is, in the home folder, which is its user’s alone (0700), and arthur run redacts it in one pass and removes the file as it sends the notice, so a value of the env file goes whole, never a part of it.
Project agents
Section titled “Project agents”Each project agent orchestration runs (arthur coordinator --help, “Project agents”; roadmap entry 88) has all of the above as the coordinator has it, in its own session. The plugin reads the list once at setup, collect("orchestration.sessions"); without orchestration’s answer, or with no project agent, only the coordinator’s session is there and everything is as above.
- Its folder is
<home>/session/agents/<project>/, made at setup: itsrequest.json,handoff.md,handoff-read,agent,context-use,turn-failed/,restarted.jsonandafter-restart.md, as the coordinator’s in<home>/session/. The plugin answerscoordinator.extensionfor the sessionagent:<project>with its two extensions on that folder (ARTHUR_SESSION_FOLDER), and none for a session orchestration does not list. The handoff’s words are the coordinator’s procedures. - Compaction runs one session at a time: a request for one session (its
compactAtslot, or its turn’s report atcompactAtPercent) while another session’s compaction is asked for waits, and is made, with its first slot, once no session’s compaction is asked for; the sessions are looked at in the list’s order, the coordinator’s first. A waiting request is dropped when a restart is asked in its own session. A handoff that is not written withdraws only that session’s compaction. Its lines inarthur run’s output readsession: agent:<project>: compact: .... - Its fresh start at night waits only for the jobs and merges of its project; the coordinator’s still waits for every job and merge. Its lines read
session: agent:<project>: fresh: ..., and namethe project agent of <project>forthe coordinator. /restartrestarts the session of the chat it was sent from: the agent whose chat is that channel, bot and place (a chat that names no bot being its channel’s main one,channel.main), else the coordinator;arthur restartrestarts the agent of the project--projectnames, by default its own in an agent’s session, else the coordinator (arthur restart --help). An agent’s restart waits only for its project’s jobs and merges, and never endsarthur run: the restart guard’s restart is the coordinator’s alone, and a restart ofarthur runrestarts every session.- Its start notice,
project agent of <project> up on <host>orno LLM access on <host>: ..., probes the model orchestration answers for the roleproject(roles.project), after the coordinator’s: the probes run one after another. The linesarthur doctorfound missing open only the coordinator’s notice. Its start notice, itsRestarted.,restart: not done, ...andturn failed on <host>: ...notices carry its chat’schannel,instanceandplace, so that channel sends them to its chat, every other channel at its main place.
arthur doctor
Section titled “arthur doctor”The plugin gives arthur doctor (arthur doctor --help) two requirements, neither critical, so arthur run starts without them:
session service: the systemd user servicearthur.serviceis installed (LoadState=loaded), enabled (UnitFileState=enabled) and hasRestart=always, assystemctl --user show arthur.servicesays. Missing:arthur.service is not installed,arthur.service is disabled, not enabled,arthur.service has Restart=on-failure, not always; without it nothing startsarthur runat boot, or again after it ends; the fix is step 9 ofdocs/setup.md.session linger:loginctl show-user <user> -p Linger --valuesaysyes. Missing:linger is off for <user>, so the user manager, andarthur runwith it, starts only once the user logs in; the fix issudo loginctl enable-linger <user>.
Without a systemd user manager (macOS, a container: systemctl --user show-environment fails) the plugin has no line; the core’s core controllers line says so, once.
In <home>/session/: request.json (the request of the moment), handoff.md (the coordinator’s handoff), handoff-read (the modification time of the last handoff read), agent (the pid of the coordinator’s agent), context-use (the share of its context window the coordinator’s conversation used at its last turn’s end, until arthur run reads it), restarted.json (a restart made, until the next coordinator is up; one that is not a restart’s mark is dropped, named), after-restart.md (the steps for the human after a restart, sent once with Restarted.), loaded.json (what arthur run loaded at its start, for the restart guard), service (the pid of an arthur run that is the service’s, from its start until it stops, for /restart), and turn-failed/ (the coordinator turns that failed before any text, until arthur run sends them).
A file here that cannot be read, written or removed (a disk full, the folder made read-only) never ends arthur run: the 500 ms look that failed prints session: <compaction|restart|turn notice> failed: <the error's first line>, once per distinct error, and the next look tries again. A fresh start’s try whose request could not be written is made at the first look that can write it; a night’s restart that threw ends that night, and the next night tries again.
arthur restart
Section titled “arthur restart”Usage: arthur restart [fresh], and on a channel the phone commands /restart and /restart fresh, answered without the model. Comes with the session plugin; the restart itself is arthur run’s, so it needs arthur run running.
/restart ends the coordinator’s conversation and starts it again with --continue; /restart fresh starts a fresh conversation, without --continue. While a restart is due (the restart guard, packages/session/docs/session.md), it ends arthur run too, once the coordinator’s restart is asked, so its service starts it again on the new code and the restart due is cleared (step 6). Both first ask the coordinator for its handoff, <home>/session/handoff.md, and the next conversation starts by reading it (arthur restart and the fresh start at night: packages/session/docs/session.md):
- Refused while any job runs, of any kind:
error: <n> job(s) running: <short ids>; run /stopall first, exit code 1. Refused too while a merge runs, as thedeliveryplugin names it (delivery.merging: a merge’smerge.lockheld by a live process,arthur merge --autoincluded, from its first look at main through its checks and itsspec:commit, not its push and prune after them;packages/session/docs/session.md):error: <n> merge(s) running: <project> (<short job id>); run /restart again once no merge runs, the job left out before the merge named it; with a job running too, both,error: <n> job(s) running: <short ids>, <n> merge(s) running: ...; run /stopall first. Nothing is asked and nothing restarts. - Refused while a restart is already on its way (another
/restart, the fresh start’s try, or a restart due):error: a restart is already on its way, asked by /restart,..., asked by freshAt <time>or..., asked by the restart guard(the restart due thatarthur runasks under its service,packages/session/docs/session.md), exit code 1. A compaction still asked for gives way to the restart. - With no coordinator running (no agent with the session’s extension alive), no handoff is asked: the restart is made at once,
no coordinator is running, so no handoff is asked; its next start is a fresh conversation(orgoes on with --continue). - Otherwise the reply is
restarting[ in a fresh conversation]: the coordinator writes its handoff first, for at most 120 s; Restarted. follows, andarthur runasks the coordinator for the handoff once it is idle with nothing queued, as before a compaction. Once that turn has ended, or 120 s after the command, the coordinator’s session is ended through orchestration (coordinator.restart,arthur coordinator --help) and started again. A handoff not written in time does not stop the restart. - A job or a merge started meanwhile stops it: the restart is not made, and the channels get the notice
restart: not done, <n> job(s) running: <short ids>; run /stopall first, orrestart: not done, <n> merge(s) running: <project> (<short job id>); run /restart again once no merge runs. A restart that throws inarthur run’s tick (its markrestarted.jsoncannot be written, orcoordinator.restartthrows) sends the noticerestart: not done: <the error's first line>at each/restartthat fails, and printssession: restart failed: <first line>once per distinct error;Restarted.does not follow. The fresh start at night is only printed, and the next night tries again. - While a restart is due (
restart due: ...: a commit changed the codearthur runloaded, or its note is broken), andarthur runis the service’s (at its start,systemctl --user show arthur.servicenamed it asMainPID, withRestart=always;docs/setup.md, step 9), the reply adds; then arthur run ends, a restart being due (<AR0153, 1a2b3c4> changed Arthur's code), and its service starts it again on the new code. With no coordinator running that restart waits forarthur run’s next look, within a second, instead of being made at once. Once the coordinator’s restart is asked,arthur runsends itself SIGTERM, as the service’s stop does: it stops every plugin and ends, and the service starts it again 5 s later. Anarthur runstarted by hand, or a service withoutRestart=always, is not ended: the reply adds; a restart is due (<reason>), but arthur run runs without its service, so only the coordinator restarts and the restart stays due. WithrestartGuard: falsenothing is due. The fresh start at night never endsarthur run.
arthur run prints session: restart: done; the coordinator restarts[ in a fresh conversation], which starts by reading the handoff, or ..., with no handoff (<reason>), or ..., with no handoff: no coordinator was running; when it ends too, followed by ; arthur run ends, and its service starts it again on the new code.
Once the next coordinator is up, one notice goes to every channel:
Restarted. (fresh session; handoff not written)
After the restart:<the steps in <home>/session/after-restart.md>
Health:- <each line another plugin answers to collect("health")>(arthur run restarted) after a restart that ended arthur run (step 6), (fresh session) after a fresh conversation, (handoff not written) when no new handoff was written, joined by ; ; plain Restarted. otherwise. after-restart.md holds the steps for the human after a restart (not the handoff), written by the coordinator, or by a project agent in its own folder (below); it is sent once and then removed, and a file of only blanks is not sent. A health answer is a line or a list of lines; a plugin whose answer throws gives <plugin>: health failed: <first line>.
The command’s message is answered here and never reaches the coordinator’s inbox, so the next conversation does not read it again.
With project agents (arthur coordinator --help, “Project agents”), /restart restarts the session of the chat it was sent from: sent in a project agent’s chat (its channel, bot and place), it restarts that agent alone, else the coordinator alone. arthur restart restarts the agent of the project --project names, by default its own when run in an agent’s session (ARTHUR_PROJECT), else the coordinator. An agent’s restart is the same as above with project agent of <project> for coordinator (no project agent of shop is running, ..., restarting: the project agent of shop writes its handoff first, ...), in its own folder <home>/session/agents/<project>/, with these differences: only its project’s jobs and merges refuse or stop it (step 1 and 5); it never ends arthur run (step 6 is the coordinator’s); arthur run prints session: agent:<project>: restart: done; the project agent of <project> restarts, ...; and its Restarted. and restart: not done notices go to its chat (packages/session/docs/session.md, “Project agents”).
arthur restart prints the same lines, a refusal on stderr; more than one argument, or one that is not fresh, prints usage: arthur restart [fresh] (usage: /restart [fresh] on a channel) and exits 2.