Expand description
What Borg did, counted: the collective’s usage statistics.
Two files per collective store:
stats/events.jsonl(local, never synced): one line per event, written by the hook or command where it happened (record). It holds session ids and repos, so it stays on this machine.stats.jsonl(synced by the mesh,borg-meshlines.rsSYNCED): one rollup per (node, engineer, UTC day), folded from the local events (rollup). A bucket is a versioned record (id+version), so the mesh’ssettlekeeps its latest version on every machine with no merge logic of its own. Only the node that owns a bucket writes it, so buckets never conflict. A rollup carries counts, cost and lesson ids, never prompts or sessions.
Recording fails open and costs one append: a broken store never disturbs the drone.
Structs§
- Bucket
- One node’s counts for one engineer on one UTC day: a line of
stats.jsonl. - Event
- Said
- One session’s corrections and vetoes (
per_session).
Constants§
- ANSWERED
- The rollup count of the answers to a drone’s own questions (a
CORRECTIONevent whosewhyis learn.rsANSWER;fold). - ASSIMILATED
- One imported chunk of team documents (
n: lessons,usd). - BLOCK
- A block: one extra round of agent work (
n: questions,lessons: the asked ids). - CHANGED
- Outcomes of asked lessons (outcome.rs): used, ignored, corrected anyway, not corrected.
- CHECK
- One turn-end model call (
n: lessons shown,usd,dur_ms;why: "failed"when it gave no answer). - CORRECTED
- CORRECTION
- The engineer corrected the drone (an episode):
whyisrejected_tool,pushback,regretoranswer(learn.rsANSWER: an answer to the drone’s own question),texta snippet. An answer is rolled up underANSWERED, never as a correction: the corrections tiles keep counting rejected tool calls and pushback. - EARLY
- Lessons handed over free at a prompt or touch (
n,lessons). - FEED_
CHARS - Display: the characters of a feed excerpt (
excerpt): one line of borg web’s activity feed. - GATE_
SKIP - The free gate skipped the model call (
why: the score, ornoedit). - IGNORED
- LESSON_
MERGED - LESSON_
NEW - A lesson written (
why: its source, session/import/queen/veto) or merged into an existing one. - LIVE_
ASK - Live mode: grade-3 lessons a live check asked, delivered with the next prompt or tool call (
n,lessons). Never an extra round: the drone answers as it works. - LIVE_
CHECK - Live mode (live.rs): one model call during the turn (
n,usd,dur_ms,why: "failed", ascheck). - MODEL_
CALL - A model call outside the turn end (
why: learn, assimilate, facets, expert;usd,dur_ms). - MSG_
DELIVERED - MSG_
DROPPED - MSG_
SENT - Messages between sessions (msg.rs): one sent (
why: tell/ask), shown to a session (why: its kind), and dropped (why:window, the sender’s window to its recipient was full, msg.rswindow_for; events before 0.6.0 sayrate;bounds,nlines the log’s bound, msg.rsMEMBER_BYTES, cut). - NOT_
A_ LESSON borg learnjudged an episode not to be a lesson.- NOT_
CORRECTED - PAUSE_
REFUSED - QUEEN_
ANSWERED - QUEEN_
DELIVERED - QUEEN_
DISMISSED - QUEEN_
MISSED - QUEEN_
NO - The queen’s attention reward (escalation.rs), once per event: an escalation answered by changing
course, one answered “yes, fine”, and a “no” after merge from a session never escalated (
why: the kind, orveto/regret;textstarts with the question, episode or link id). - QUEEN_
QUEUED - The queen’s queue: a question queued, handed to a drone, answered (
dur_ms: time to answer), skipped, dismissed. - QUEEN_
SKIPPED - QUEEN_
STAMP - QUEUED_
FREE - Grade-2 and grade-1 lessons queued to arrive free at the next prompt (
n,lessons). - REGRETTED
- A later fix, or a review finding, counted against a lesson asked before the decision (outcome.rs
regretted;lessons: the blamed lesson). - REVIEW_
FINDING - A review step’s finding that a fix step fixed before any commit, recorded as an episode
(review_fix.rs;
why: its severity,text: its redacted title, for this machine’s feed only). - STEER_
DELIVERED - STEER_
DROPPED - STEER_
ISSUED - Steering: a directive issued, shown to a drone (
why: say/pause/resume), refused on receipt (why: the reason), and a tool call refused because the drone was paused (why: the tool). - TESTED
borg learncredited a lesson asked before the session’s own tests went green (outcome.rstested;lessons: that lesson).- TURN_
END - A turn end the conscience saw (one per Stop that was not the rework after its own block).
- VETO
- The engineer said no (
borg no, veto.rs):lessonsthe lessons shown so far (creditedvetoed),ntheir number,whycli,promptormesh,textthe reason. - VETO_
REPEAT borg learnmerged a veto into a lesson an earlier veto made: the same “no” said twice, dated when that veto was said (its episode’s ms), so it falls in the week of its ownveto.
Functions§
- backfill
- Derives, once per store, the events that happened before live counting began from the logs Borg kept anyway: corrections (episodes), outcomes, lessons, the queen’s queue, imports, expert and facet calls, steering drops, and the turn ends recorded in the session state (dated by the state file’s time). Only what happened before the first live event counts, so nothing is counted twice. Returns how many events it wrote; 0 when it ran before.
- backfill_
path - count
- Records one event in the store
homenow;filladds the details. The engineer defaults to the one presence.rs recorded for the session, so callers need not ask git again. - current
- Every bucket the page shows: other nodes’ published rollups, and this node’s own counts folded fresh from its local events, so local activity shows before the next rollup.
- day
YYYY-MM-DD(UTC) of an epoch-ms time.- days_
between - Every
YYYY-MM-DDfromfirsttolast(UTC), both included; empty if either is malformed. - events
- Every local event: the history derived once from the older logs (
backfill) and the live ones. - events_
path - excerpt
- The first
maxcharacters oftexton one line (a feed excerpt,FEED_CHARS). - fold
- The local events folded into this node’s buckets, keyed by bucket id (version 0).
- live
- The live events only (stats/events.jsonl), without the derived history.
- live_
since - When live counting began in
home: its first live event (None: none yet). A repeated veto is dated when it was said, earlier than its line, so it never marks the start. Whatbackfillderives is before it; a series backfill cannot derive (merges, repeated vetoes) is unknown there. - node
- This machine’s id in the collective’s statistics, created once (
stats/node). Not the mesh key: stats work in local collectives too, and nothing here should need the member key. - per_
session - Per session, what the engineer said against its work: every correction and veto, whether or not
borg learnmerged it into a lesson (a merge is what outcome.rs sees; most corrections merge into none). The denominator for how often a mistake was seen at all, beside the results. - purpose
- record
- Appends
evto the local event log. Fails open; records nothing with BORG_LEARN=off (eval drones). - rollup
- Publishes this node’s buckets whose counts changed since their last line in
stats.jsonl, each with the next version. Returns how many lines it appended (0 when nothing changed). - rollups
- The latest version of every bucket in
stats.jsonl(every node’s, after the mesh merged them). Two lines of one version (two rollups at once) are ranked as borg-mesh lines.rssettleranks them, by the line’s blake3 hash, so every node shows the same one whatever order the lines arrived in. - rollups_
path - set_
purpose - What this process’s model calls are for (learn, assimilate, facets), set once by the command.
- source
- An episode’s
Event::source: itsharnessandharness_version, joined; empty for the hooks’ (and imports from before 0.7.2).