Expand description
Messages between sessions: <store>/messages.jsonl, one line per borg tell or borg ask, from a
session on any harness (or the engineer’s terminal) to the sessions on this machine (local, written
local@<node>), every session of the collective on every member’s machine (collective, or its
synonym all, written all as it always was), one session on one node (<session>@<node>), or the
engineer (engineer[:<email>]): an Address, parsed in one place. Local first: a local line never
leaves this machine (borg-mesh lines.rs travels keeps it here), and a drone named on the command
line is this machine’s when one here matches; a colleague’s session is reached by its node, by
collective, or as the sender of what a reply answers. A 0.4.0 reader parses local@<node> as the
session local of that node, which no session is: it reaches nobody there.
Plain lines, each naming its node, so the mesh can union them like the other synced logs; on one
machine they need no mesh. A borg pause, borg resume or a remote borg no is a message too, of
a privileged Kind that counts only under an admitted role (steer.rs).
A drone named on the command line (a designation as borg top shows it, or a session id prefix) is
resolved to its session id when the message is sent: designations (“Two of Five”) shift as sessions
start and end and differ per node, a session id does not. A line’s by, name and harness are its
sender’s claims; only its node is checked (borg-mesh lines.rs travels), so a session is addressed
with its node, and a reply goes to the (node, by) pair of what it answers (address): a by that
names a local session from another node never routes a reply here.
Delivery (deliver): a recipient’s next prompt or tool call, where its harness takes context there
(harness Caps), shows each message once, as labelled peer data with the command that answers it,
never as the user’s words, never to its sender. What one event shows fits the harness’s context
budget (Caps::context_chars, shared with what the hook already answers), newest first; the rest
stay unclaimed for the next event, and a message longer than the budget shows its head and
borg inbox --show <id>. A broadcast reaches the sessions that were running when it was sent (as
steer.rs applies). A delivery is claimed by creating <store>/messages/seen/<session>/<id>
exclusively, so hooks running at once show it once, and acknowledged with a Seen line in the log;
a claim no Seen of its session lists (a 0.5.0 hook’s, which wrote none, or one whose
acknowledgement failed) is acknowledged at the session’s next read of the log.
Nothing sent: the hook costs one failed stat; no tell, ask or steer written since the session’s
last look, a read of its SCANNED stamp and of the log’s GENERATION more. Acknowledgements do not
count as a change (its own, another session’s, one merged from the mesh), nor does the cut of lines
past the TTL a write makes (Change::Expired): every writer of this version records whether it
wrote talk or cut a line a reader may use (wrote), and a log written by anything else is read
again (talk). A prompt
whose context the harness drops ("context": false) and a subagent’s event (agent_id) show
nothing: the messages wait for the session itself.
Every line is checked on read (Message::well_formed, Seen::well_formed): the log syncs from
every member, and its fields reach prompts, a shell command and terminals. Text is redacted
(notes.rs redact) and kept whole up to WIRE_TEXT before it is hashed into the id; a text that
fits V1_TEXT is written as a v1 line, which 0.5.0 readers read too.
Pacing (window_for): a sender may have a window of tells and asks to one recipient that it has not
acknowledged, by a Seen line its recipient wrote when shown them or by a reply. The window starts
at 1, doubles per acknowledged message, halves per message that expired unacknowledged, and is capped
(WINDOW_CAP). Acknowledgements pace only a recipient they can be expected from (Pace): a
broadcast (whoever runs when it is sent, maybe nobody) and the engineer (who may read where nothing
acknowledges) are never paced more strictly than 0.5.0 paced them (V1_RATE_MS), and a session of
another node is paced by that rate alone until its node acknowledges one of the sender’s messages
to it (it may run 0.5.0, which never does). That cold start reads the pair’s own lines, which sync,
not the mesh’s record of what each node reads (presence.rs reads, local and different on every
node), so the window is a function of the lines alone, and once a Seen line of that node lists one
of the pair’s messages, that pair is under its window on every node holding it.
send decides by the window, over the log it writes to (under its lock), and also refuses a message
that would push out one admitted before it (an earlier stamp, from a clock that stepped back or a
send that took the lock later) or one of its sender’s unread messages to the same recipient
(MEMBER_BYTES). The TTL and the bound later remove the earlier lines a window was decided by, so a
replay can admit less than send did; what travels is decided by a bound every window keeps and
that reads no earlier line (within_windows), so a line once written stays admitted on every node
while it is held. A steer is never paced: a pause is answered by a resume. A Seen line is never
shown, never paced, and no reader that counts messages counts it: it does not parse as a Message.
Bounded on write (bound): a line past TTL_MS goes, and of each member’s lines the newest of each
class (conversation, steers, seen) stay while they fit MEMBER_BYTES, byte for byte as they were.
Structs§
- Author
- Who wrote a line: its sender (or the recipient a
Seenspeaks for) on the node the line names. - Message
- One message of messages.jsonl.
- Seen
- What a recipient was shown: one line per delivery event (a hook’s,
borg inbox’s) listing the ids of the tells and asks it showed, written by the recipient’s node. It acknowledges them (window_for) and does nothing else: never shown, never paced, bounded in its own class (bound), and its kind is noKind, so it never parses as aMessageand no reader that counts messages (unread counts, the inbox, the feed,borg listen, a 0.5.0 node) counts it. - Sender
- Who sends a message.
- Shown
- One message as an event shows it: whole, or
head, the start of its text (capped). - Shows
- How one event shows its messages: to whom, on which harness, under which steering roles.
- Window
- One sender’s window to one recipient at a moment (
window_for).
Enums§
- Address
- Whom a message is for, as its
tosays it (parse;Displaywrites it back). - Change
- How a writer changed the log (
wrote). - Kind
- What a message does.
TellandAskare conversation;Pause,ResumeandVetosteer their recipient and count only under an admitted role (steer.rs). A line of any other kind does not parse as aMessage; aSeenline (kindSEEN) is read as one byLine::parsealone. - Line
- One well-formed line of messages.jsonl as this version reads it.
- NoSteer
- Why this node’s steer would not count on another node: borg-mesh steer.rs
checkon its own key. - Pace
- How one sender’s tells and asks to one recipient are paced (
window_for): by acknowledgements where they can be expected, else never more strictly than 0.5.0 paced them (V1_RATE_MS). - Send
Error - Why a message was not sent.
Constants§
- ALL
- Every session of the collective on every member’s machine (
Address::All): the command word, a synonym ofCOLLECTIVE, and how a line writes it. - ASK
- A message that asks for a reply.
- COLLECTIVE
- The command word for every session of the collective (
Address::All, writtenall). - ENGINEER
- The engineer’s terminal as sender and address:
engineer:<git user.email>, or this alone. - FILE
- The log, in the collective’s store.
- FLAGS
borg tellandborg ask’s flags (completions.rs).- INBOX_
FLAGS borg inbox’s flags.- LOCAL
- The command word for the sessions on this machine (
Address::Local, writtenlocal@<node>). - MEMBER_
BYTES - Guard: the bytes of one member’s lines of one class (conversation, steers, seen, and apart those for
its own sessions:
Class) the log keeps, the newest (bound). It stops one member’s flood from growing the file every hook andborg listenread; a class has its own, so tells never push out a pause or the acknowledgements that pace them. 0.5.0’s whole log held at most ~0.7 MB (500 lines of ~1.4 KB); a week of ordinary traffic from one member (lines of 0.3–1.5 KB) fits with room for long texts. A cut is counted (stats::MSG_DROPPED, whybounds), so a bound that binds often shows. - NAME
- Protocol: the longest sender name a line holds;
well_formedrefuses a longer one. - NODE_
CHARS - Display: the characters of a node key a label shows (
short_node, the one routine every label of a node key calls: a delivered line, steer.rswho, presence.rsMismatch::line, borg-mesh main.rsshort): enough to tell the members of a team apart. - SEEN
- The kind a
Seenline names: not aKind, so it never parses as aMessage. - SEEN_
IDS - Protocol and guard: the most ids one
Seenline lists (a delivery that shows more writes more lines), so a line stays under ~4 KB and a forged one cannot list millions. - SESSION_
CHARS - Display: the characters of a session id a label shows for a sender that gave no name
(
sender_label): enough to tell the sessions of one node apart. - SKEW_MS
- How far ahead of this clock a message may be and still count. Protocol: the one clock skew between
members borg allows; steer.rs
SLACK_MSand borg-mesh live.rs derive from it, so changing it moves both. - STEER_
FLAGS borg pauseandborg resume’s flags.- TELL
- A message that informs.
- TTL_MS
- A message is conversation: shown and kept for a week. Protocol: every member drops a line older than
this (
fresh), so they keep the same lines. - USAGE
- V1_
RATE_ MS - Protocol: 0.5.0’s pacing (its
RATE_MS), one tell or ask per sender and recipient this often, the earliest first: all aborg/mesh/13node takes (borg-mesh sync.rsv1_window). It paces a session of a node that acknowledges nothing (Pace::Rate) and floors the window of a recipient whose reading may write no acknowledgement (Pace::Floor), so where an acknowledgement may never come no sender is paced more strictly than 0.5.0 paced it. Also the span over which the mesh bounds one sender’s unread messages to one recipient (within_windows). - V1_TEXT
- Protocol: a v1 line’s text, 0.5.0’s bound: at most this many characters, plus an ellipsis when
0.5.0 cut it. A text that fits is written as v1 (
Message::new), so 0.5.0 readers andborg/mesh/13peers read it; a longer one is a v2 line, which they drop. - WINDOW_
CAP - Derived: the doubling’s ceiling (
window_for), as many full texts (WIRE_TEXT, at a byte per character) as one member’s share of the log (MEMBER_BYTES) holds. It promises no room: a line takes more than its text (its fields, up to 4 bytes a character), and the share is the node’s, across all its senders and recipients. Sosendrefuses a message that would push one of its sender’s unread messages to the same recipient out of the log (SendError::Share); another pair’s newer lines may still push it out, oldest first, and that cut is counted (stats::MSG_DROPPED, whybounds). Also what the mesh lets through unread from one sender to one recipient within oneV1_RATE_MS(within_windows): no window lets more. - WIRE_
TEXT - Protocol: a v2 line’s text, kept whole up to this many characters, plus an ellipsis past it. Part
of
well_formed, so every member reads the same lines; never changed within a line version. Also a guard: one text of about 4,000 tokens (a page of findings, a plan), longer than any harness takes into one event, so what shows is the delivery budget’s choice (deliver), not the format’s, while one member’s share (MEMBER_BYTES) still holdsWINDOW_CAPfull texts.
Functions§
- ack
- Acknowledges that
by(a session, orengineer[:<email>]) of this node was shown the tells and asksidsatnow:Seenlines of at mostSEEN_IDSids each, written under the log’s lock and bounded assendbounds it. Counts no message: only a bound’s cut is counted. Nothing for abya line cannot carry, whom every reader would drop. The lines leave the log’s talk as it was (wrote), and so does a cut of lines past the TTL they cause (Change::Expired), so they make no reader read the log again; only a cut byMEMBER_BYTESmoves it (Change::Cut). - ack_
engineer - Acknowledges, as the engineer of the repo at
cwd(engineer:<git user.email>), the messages to the engineer amongshown, which a view put in front of them, that noSeenof theirs on this node lists yet (engineer_acks): the terminal inbox calls it, and so may any view that shows the engineer a message’s text (borg top,borg web). - bound
- What the log keeps of
lines(its lines in order) atnow: none pastTTL_MS(with steer.rsSLACK_MS) or without anms, and of each member’s lines (by the node a line names) of eachClassthe newest while they fitMEMBER_BYTES. Newest by stamp, then by the line itself, so every node holding the same lines keeps the same whatever order they arrived in; a node’s lines for its own sessions have classes of their own, so its peers, which never hold them, keep what it keeps of the lines that travel. The kept lines stay byte for byte, in their order. Returns them and how many the bytes bound cut.sendand the mesh (borg-mesh sync.rsstore_lines) bound the log by it alone. - deliver
- The hook’s call after everything else answered (
out): at a prompt or tool call where the harness takes context, the messages for the event’s session not shown yet join the answer’s context, each once. A block (decision) answers the event alone, a prompt sent with"context": false(opencode during a stop) drops what borg answers, and a subagent’s event (agent_id: Claude gives its context to the subagent) is not the session’s: the messages wait. What shows fits the harness’s context budget (Caps::context_chars) less whatoutalready holds (capped), newest first; the rest wait, and the session’sSCANNEDstamp is not written while any does. The tells and asks shown are acknowledged (ack), with those an earlier event claimed that noSeenof the session lists (owed), and the answer names the tells and asks it showed ("shown_ids", for adapters: a wake names the same ids, listen.rssay, so an adapter drops a held wake only once every message it names was shown; never a count, since one event may show a newer message and leave a held wake’s). The stamp holds the log’s talk as the call found it, before it read the log (talk):Seenlines written since, its own acknowledgement’s or any other session’s or node’s, leave it, a tell, ask or steer moves it. None is written when the acknowledgement failed, so the next call tries it again.started: the session’s start (presence.rs);Nonestill delivers messages to the session but no broadcast. - for_
session - The conversation of
msgs(tells and asks; a steer isdeliver’s alone) forsessionof the nodehere(started atstarted) atnow, oldest first. - forget_
session - Removes the delivery claims of one session (its presence record was pruned).
- fresh
- Whether
mcounts atnow: not pastTTL_MS, not further ahead thanSKEW_MS. - fresh_
at - Whether a line stamped
mscounts atnow, asfreshdecides for a message. - is_
engineer - Whether the address or sender
ais the engineer:engineerorengineer:<email>. - is_id
- Whether
sis a message id asid_ofwrites it. - lines
- Every well-formed line of the store, messages and
Seenlines, in file order (Line::parse). - main
borg tell|ask|pause|resume|inbox ….- mark_of
- The mark of the file at
p(mark);Nonewhen there is none. - node
- This node as a message names it: the member key borg-mesh publishes (
node_pub_path), which the mesh checks a message’s node against before it carries it, else (no mesh yet) the stats.rs node. - node_
pub_ path <store>/mesh/node.pub: where borg-mesh publishes this node’s member key (its identity.rspublic_pathis this).- path
- read
- Every well-formed message of the store, in file order: unparsable, newer, forged and
Seenlines skipped. - render
- The block of messages, with the reminder of what they are.
- seen_by
- Every id shown, with the sessions (as file names) it was shown to (top.rs, borg-web).
- seen_
path - Where the shown-once claims live, one directory per session (a watch on it sees deliveries).
- send
- Sends
mfrom the storehomeatnow: refused when every reader would drop it or its sender’s window to the recipient is full (window_for; a steer is never paced: a pause is answered by a resume). The write keeps the log bounded (bound). A steer from this node is admitted first, asRole::Local(steer.rs), so a reader that sees its line sees it count. - sender
- The sender:
from, else the calling session (caller), else the engineer. - sender_
label - The sender of
mas a label names it: the name it gave, else the start of its session id. - short_
node - A node key as a label shows it: its first
NODE_CHARScharacters (every label of a sender’s node: a delivered line, steer.rswho,borg inbox --show). - short_
session - A session id as a label shows it for a sender that gave no name: its first
SESSION_CHARS. - steer_
right - Whether a steer from
mecounts on another node: under the role the held membership gives it,adminorsteer(steer.rsRole::of_member), as each receiver checks at admission. The document is read unverified: the mesh verified it when it saved it, and every receiver checks again, so this only spares the sender a false report. - talk_
mark - The talk of the store
home’s log (talk), for a reader that polls it (listen.rs):Nonewhile there is no log. - unread
- How many of
msgs(asreadgives them) are forsessionof this nodehere(started atstarted) and not shown to it yet: what its next prompts or tool calls would show. - window_
for - The window of
by’s tells and asks toto(written as a line writes it) inlinesatnow. - within_
windows - The ids of the tells and asks of
lineswithin what every window admits (window_for): each one that a recipient acknowledged, and each that, with the sender’s later messages to the same recipient stamped withinV1_RATE_MSof it, makes at mostWINDOW_CAPunacknowledged ones. - wrote
- Records a write of the log at
punder its lock (every writer:send,ack, borg-mesh sync.rsstore_messages):before, the log’s mark before it (mark_of;None: no log);change, what it did to the log;talk, whether it wrote a tell, ask or steer. The generation stays only forSeenlines appended to the log as the record left it, or added by a rewrite that removed only lines past the TTL (Change::Expired), with nothing else written meanwhile (the length says so); anything else moves it, to at least now in ns, so a record made anew never repeats one a reader holds. Best effort: a record that is not the log’s makestalkfall back to the log’s mark.