Map: exarch / builtins
exarch’s builtins are one HostSurface: Rust atoms that read and edit below
the redirect frame, and harness verbs that enquire of the agent’s desk.
builtins::host_surface() carries EXARCH_BUILTINS and HARNESS_BUILTINS;
boot::engine_runtime installs it on either carrier, and INSTALLER_TAG
("exarch-agent") names it in the wire EngineSpec. The prompt’s builtin index
reads the same surface. Core never inspects these entries
(builtins-registry,
repl-builtins-stay-in-repl).
Line witnesses
A witness names a line by its neighbourhood, not its number (hash-addressed-editing).
line_hash:hplus six hex of a Blake3 digest of the line, trailing whitespace stripped. Thehkeeps a witness from lexing as anInt(a-numeral-denotes-its-number).window_hashes: each line’s witness hashes the smallest symmetric window, at least ±MIN_RADIUS(5), that no other line shares, folding in the radius and the line’s offset in the clamped window. Partition refinement grows only still-colliding classes. Past ±MAX_RADIUS(64) a line is named by its index.view-hashandedit-hashboth callwindow_hashesover the whole file, so a read and the edit after it agree. The model copies witnesses; it never computes them.
Rust atoms: shell_eval/builtins.rs
Each atom is one logical operation with one surface
(io-surface). Reads go through Shell::locate::<Reading>;
writes through Shell::atomic_write, under the run’s grant
(surface-reads-writes-execs).
Bodies take &[ValClos] and return Settled<ValClos>.
- Line endings (
Eol): a file is CRLF iff every\nfollows a\r; it is read as\ntext and re-encoded on write. Any other file is taken raw, so an unedited round trip is byte-exact. view-text : Str → Int → Int → F [[line: Int, text: Str]]— the half-open range[start, end), 1-based, text verbatim. OneObserved::Read.view-hash : Str → Int → Int → F [[line: Int, hash: Str, text: Str]]— the same range with witnesses.grep-files : Str → Str → F [[file: Str, line: Int, text: Str]]— Rust regex over a file or a recursive walk (search_tree). Beneathpaththe walk skips hidden and ignored entries and stays onpath’s filesystem. CRLF-aware, so a hit’stextis the rowview-textshows. Binary detection quits at NUL. Each file is streamed and every read polls the shell’s scope; a line pastLONGEST_LINE(16 MiB) or a failed read skips the file with a stderr note. OneObserved::Grepfor the whole search.grep-hidden—grep-fileswhose walk enters hidden and ignored entries, except.git.edit-hash : Str → [[hash: Str, line: Str]] → F Unit— resolves every witness against one read before writing. An empty batch, an absent or ambiguous witness, or two records on one line fails with the file untouched. Replacement text is verbatim: an empty line deletes, a real newline splits.edit-replace : Str → Str → Str → F Unit— replaces the one literal occurrence offrom, counted overlap-aware by core’soccurrence_starts. Several matches name their lines; a miss names a provable mangling (a\n-style escape, or a line matching but for indentation). An emptyfromis refused; it never creates a file.- Both editors read silently, surface one whole-file diff card, or nothing if no line changed (cards), and note the replaced lines on stderr.
explore-dir : Int → Str → F [Str]— entries beneathpathto depthn, ignore-aware, the root excluded.find-files : Str → Str → F [Str]— files underpath, ranked by core’stext::rank, cut toFIND_LIMIT(50). The grant filters before the cut.exarch-surface— core’sbuiltin_surfaceunder exarch’s name: puts a card or event on the rail.
Every walk is core’s: Shell::walk_beneath over Walk::search (ignore-aware,
or all but .git for grep-hidden, on one file system), which refuses a
denied root, makes a missing one an error, admits each entry by its own path
and skips denied or unreadable ones. exarch owns only the matching and the
ranking. grep-files opens each file through
locate_if_admitted (capabilities).
Skills: skill.rs
skill-list : F Str—name: descriptionper valid skill, then one line per skipped skill with its place and cause. Fresh scan each call, filtered by the grant.skill : Str → F Str— one skill’sSKILL.mdbody. The name is validated first, which keeps the path inside its root.skill::roots(cwd), first name wins:<cwd>/.exarch/skills,.agents/skillsfrom cwd up to the working-tree root,$XDG_CONFIG_HOME/exarch/skills,~/.agents/skills, thenskill::BUILTIN(exarch-sandbox, compiled in).- Boot’s prompt section (
discover_metadata) and both builtins share these roots, computed from the engine’s own cwd, and judge reads by the same grant stack, so the prompt lists nothingskillcannot load. A guest’s prompt listsBUILTINalone (builtin_metadata): no host root is in the guest.
The agent.ral kit
library::install_agent_library sources data/agent.ral through
extend_session from boot::engine_root; agent_library_docs gives help
its entries.
view-text-around/view-hash-around path line peek— the2*peek + 1lines centred online, clamped at the top.exarch-tasks— a task list stored as a card on thetaskspin, read bytasks-listand written bytasks-sync. No Rust knows what a task is.exarch-goal`set/`clear— thegoalpin.
Harness verbs: shell_eval/builtins/harness.rs
A harness verb decodes the model’s argument into a Request, enquires, and
admits the answer only in the shape the request owes.
first_orderrefuses a block or handle at any depth of the argument, so argument rows are deep and type variablesKind::DATA(argument_row; operators-are-kinded).askchecks the answer withRequest::owed.exarch-agents,exarch-pinsandexarch-transcriptare boundary builtins: theirα:dataanswer is admitted against the script’s use (a-boundary-is-checked-against-its-type).- Outer tag rows are open, so an unknown tag reaches the decoder, which names
the legal tags. Record payloads are closed, so a missing or misspelled field
is a static error. Variant fields inside them (
type,grant,model,trigger) stay open for the same reason.
The vocabulary: enquiry.rs
One Datum codec serves both sides. Request has five classes, each a
Family with CLASS and TAGS: agents, schedules, pins, context,
transcript. Records decode strictly by key (record!). The builtin decodes
so the model sees the decoder’s message; the desk decodes again because a guest
may send anything. A cron expression is parsed in that decode
(CronSchedule::parse), so on both sides.
The desk: agent/desk.rs, agent/desk/
Agent::ralbuildsRunHost { desk, apply }per call.ExarchDeskreaches the owner’sBodyonly throughArc<Loan<Body>>; after dispatch returns,Loan::getfails and enquiries answerno_desk(). Workers and stages have no desk, so every harness verb fails insidespawn.ExarchDesk::handledecodes, dispatches exhaustively, then syncs the record before answering.Callholds per-call values and the committedDeskActs.commit_actemits aDisplay::HarnessCallrow for every attempt and keeps committed acts forCall::audit, which tells the model after a failed dispatch what already happened (harness-calls-are-acts).DeskActisSpawn,Stop,Dismiss,Message,Schedule,Unschedule,Reply,ContextEvict. Listings and reads commit none.
exarch-agents
<list | start […] | message [to: Str, text: Str] | stop Str | dismiss Str | reply β | read Str | ρ> → F α (agents,
an-agent-is-a-thread).
`list— the roster[[name, spawner, state, idle-s, elapsed-s, log-dir]], over agents sharing the reader’sfounder.- Acting tags answer
[live: Int, replied: Int]: other live agents in the tree, and own helpers holding a reply. `start [prompt, name, type, grant, model]— asynchronous; a report notice arrives through the mailbox.- The builtin decodes a
Launch, which splitsgrantfrom theSpec. It refuses withno_desk()unlessMooring::has_desk, then callsShell::marshal(&grant)and asksAgents::Start(Start { spec, parent }). The grant crosses inside theMarshalledparent; handles cross withheld (transport). name:check_name(1–24 ASCII alphanumerics,-,_) at decode;Registry::namereserves it at the desk.type:`amnemon(blank context) or`mnemon(inherits the parent’s context).grant:`inherit, apolicy::spawn_basesname (confined,read-only,edit-only,reasonable), or`restrict R.Grant::decodenames all six shapes.SpawnGrant::layerdecodesRwith the grant vocabulary when the child is built (policy, a-spawn-is-one-layer).model:`inheritshares the parent’sArc<Provider>;`role <Str>takes the provider bound at launch, refused if unknown (provider, optionality-via-variants).- The desk refuses at zero
fuel, builds the engine withchild_engine(IdentityTransport::childin process,make_engineover the wire), callsAgent::born, launches with anInput::Taskand adopts the thread (agent).
- The builtin decodes a
`message— any other live agent; a resting helper takes only its parent or the human. Self-messages are refused.`stop— descendants only; cancels the current exchange, leaving the target’s helpers running.`dismiss— own helpers only; ends and joins it, keeping failures.`reply v— returning agents only (Mail::returns). A bare`replyis(). Last write in a call wins; the loop takes it after the batch.`read name—[name, reply]from the newest own helper of that name, live or ended. Refused whileStatus::reply_pending, or for a failed, stopped or silent helper. Reading consumes nothing.
exarch-schedules
<list | add [trigger, label: Str, prompt: Str] | remove Str | ρ> → F [[label: Str, trigger: Str, next-s: Int, fires: Int]].
- Every tag answers the live table. Every tag requires
--allow-schedule; the refusal names the tag the model wrote. triggeris`cron Stror`after Str.next-sis zero once overdue.`removeof an absent label succeeds; its table lacks the label.
exarch-pins
<set [key: Str, body: card] | clear Str | read Str | list | ρ> → F α over the
caller’s Body.pins (pins,
register-is-read-write).
`set/`clearanswerUnitand record a pin surface.`readanswers`some card(re-encoded) or`none.`listanswers the occupied keys in order.- Pins outlive exchanges, are emptied by
/clear, and are not restored on resume.
exarch-context and exarch-transcript
exarch-context is what the provider is sent; exarch-transcript is
everything the lineage recorded. Both address turns by id; every ral
result ends TURN: <id>
(context-rollover,
the-turn-is-the-atom,
an-eviction-is-a-set-of-turns).
exarch-context : <survey | evict [from: Int, to: Int, note: Str] | ρ> → F [rows: [[from, to, role, kind, label, bytes]], total-bytes: Int]. Both tags answer the survey, the state the next edit is written against.`survey— one row per resident turn (from == to;kindown,importorinherited) or eviction (kindeviction, note aslabel).total-bytesis the serialized request, not a sum of rows (context-is-a-projection).`evict— replaces one contiguous, inclusive run of turns and evictions with one eviction carrying the note (an-eviction-is-a-span). A run must cover any eviction it touches whole; the same span rewrites a note. Refused: unrecorded or withdrawn ends, a run holding the turn being written.Notemust be nonempty, one line, at mostNote::CAP(240) bytes. RecordsTranscript::EvictedunderDeskAct::ContextEvict.
exarch-transcript : <index | read [turns: [Int]] | grep [pattern: Str, turns: <all | only [Int]>] | ρ> → F α. Read-only.`index— survey rows over every turn and eviction ever recorded, pluslocation(`resident,`evicted [from, to]for the innermost eviction,`withdrawn), an eviction before what it covers.`read—[[turn: Int, role: Str, messages: [Message]]], untruncated, wherever the turn lies. The unclosed turn is unreadable.`grep—[hits: [[from, to, kind, role, line, text]], total: Int]. The pattern compiles inGrep::decode. Searches message text, programs, results, reasoning and eviction notes (line: 1);`onlyreaches a note only when it names every id the eviction covers. At mostGREP_HITS(100) hits, text clipped to 200 bytes;totalcounts all.
- A
Partis one arm pergenai::chat::ContentPart(`text,`program,`result,`reasoning,`binarymetadata,`custom), matched exhaustively inrecord/context/transcript.rs;ThoughtSignatureis dropped (the-transcript-is-a-value).
Also
workersis core’s (core builtins); exarch adds none.ralis the only model-facing tool that carries these calls (tools).- No builtin reaches the network; a guest does, policed host-side (egress, synod).