Expand description
The conscience: challenges learned from engineers’ corrections, asked at decision points when what the drone is working on matches.
A challenge is a question, never an answer. It is recalled only when it matches the drone’s prompt, touches and plan (BM25 over the question text), so a drone working on something unrelated pays zero tokens.
Structs§
Constants§
- ANY
- The topic of consolidated lessons (memory.rs) in
early: they need no scope, the session’s first prompt brings them. - BLOCK
- The Stop blocks only when a lesson not yet done scores at least this share of the best match
(
budget): a block is an extra round, the expensive part. Baseline: the R3b word-matching rule (BORG_MATCH=bm25), not the default path. - BM25_B
- BM25_K1
- Okapi BM25’s term-frequency saturation and length normalisation (
bm25,bm25_groups). Method: the standard parameters (Robertson and Zaragoza, “The Probabilistic Relevance Framework: BM25 and Beyond”, 2009); never tuned on borg’s data. - CAP
- At most this many lessons per Stop block. Baseline: the fixed graded rule’s block and free hand-over
(
graded_capped), the reference the learned policy is gated against (select.rs); it also bounds a block’s length. - CONSTRAINT
sourceof a ratified constraint loaded as a lesson (constraints).- EARLY_
CAP - At most this many lessons per early delivery (
early). Baseline: today’s early rule, asRELATIVE. - EARLY_
CHARS - An early delivery’s text stops before this many characters (about 500 tokens), a free hand-over’s
too (hook.rs
queued), less the lines handed over in place of questions (render_owing). Guard: bounds the context one delivery adds to the drone’s turn; what it cuts is logged (dropped_chars, outcome.rsDELIVERY), so its hit rate is measured. - EARLY_
CONSEQUENCE_ CHARS - The characters of its consequence the line shows at most. Display: the consequence explains the question, so it gets less room.
- EARLY_
OVERRIDES_ CHARS - The characters of the team rule it replaces the line shows at most. Display: a pointer to the old rule, not the rule itself.
- EARLY_
QUESTION_ CHARS - The characters of a lesson’s question an early delivery’s line shows at most, then
…(render_early). Display: short enough thatEARLY_CHARSholds several lessons, long enough for a question. - GENERIC
- GENERIC_
CAP - At most this many unscoped (generic) lessons per block: generic hygiene does not fill the block.
Baseline: part of the R3b rule (
in_scope_first). - LOW
- Once the Stop blocks, every lesson not done scoring at least this share of the best match is asked
(
budget): more questions in a round that happens anyway cost little. Baseline: asBLOCK. - P_DRAWS
- Method: the draws behind a propensity estimate (
propensity): precision, not a tuning knob (standard error ≤ 1/(2√P_DRAWS) ≈ 0.022). - RELATIVE
- An early delivery takes lessons scoring at least this share of the best on-topic match (
early). Baseline: today’s early rule (R3b, internal evaluation “phase-r”), kept until a learned early rule is fitted on the share each early delivery’s record carries per lesson (outcome.rsrel, hook.rsearly_rel; empty when no plain lesson was on topic). Those records hold only delivered lessons, and every plain one scored at least this bar, so a rule fitted on them alone can learn to raise it, not what a lower bar would admit. - STRONG
- A dormant lesson needs at least this share of the best match to be recalled (
rank). Baseline: design-chosen with dormancy (memory.rsDORMANT_BELOW), part of today’s ranking; the same value asBLOCK, a different bar.
Functions§
- ask_cap
BORG_STOP_ASK_CAP=N(evaluation only): a block asks only the 3s, the firstNin the model’s order; without a 3 nothing changes. Unset, a block asks asgradedsays.- bm25
- Okapi BM25 (
BM25_K1,BM25_B) of each tokenised document against the query text, in document order. - bm25_
groups - BM25 (
BM25_K1,BM25_B) of groups of documents, one group per lesson, against the query text: a group scores its best document plussecond× its second best (0: the best alone). Document frequencies count groups (a word in three facets of one lesson is one lesson), so idf means what it means inbm25; term frequency and length are per document. Groups of one document score asbm25does. Only query words are counted, which keeps a 1k-lesson store with facets fast. - budget
- The Stop’s two decisions over a ranking of the whole store (best first, as
rankreturns it; the top is the store’s best match, done or not), withdonethe lessons this session already asked, or delivered early and acted on (R3b, internal evaluation “phase-r”, not published): - budget_
pool budget’s pool before the slots: every lesson not done overLOW× the top, with its score; empty when none not done clearsBLOCK× the top.- disagreement
- One disagreement as the drone reads it: who says what, with each side’s trust, most trusted first. “Engineers disagree here: A (trust 0.80 in concurrency) says X; B (0.40) says Y — weigh the evidence”
- disagreement_
ids - The ids of each disagreement
rendershows, for theaskedoutcome record (outcome.rs). - disagreements
- Groups (indices into
selected, in selection order) of lessons that disagree: the same situation with different consequences (queen.rsconflict_pairs), or one lists the other insupersedeswhile both are still live (a supersession cycle, or one that does not hide: trust.rssuccessors). - documents
- A lesson’s search documents: its question, then each facet (
Challenge::facets). - early
- Early delivery: the scoped lessons a context brings into scope through one of
topics(scope names it just named for the first time), ranked over the wholecontext, scoring at leastRELATIVE× the best of them (done or not), minus those already delivered or asked (done), at mostEARLY_CAP. Unscoped lessons never come early: generic hygiene has no topic, and only a named system says the drone is on one. Standing lessons (ratified constraints,Challenge::standing) come first on their topic, matched or not (standing_pool). - early_
pool early’s pool of plain lessons before the slots: every on-topic lesson not done overRELATIVE× the best of them, with its score. Never a standing lesson: those need no match (standing_pool).- early_
propensity - Each pooled lesson’s chance of being delivered early under the session’s posterior (
earlyoverearly_pool):propensity’s draws, keeping in each the firstEARLY_CAPand of them whatrender_earlyshows fortopics. Exactly 1 for every lesson when the whole pool always shows. - explored
- Lessons that cleared the bar, in the order of score × the session’s usefulness draw (
explore): Thompson sampling over the slots. Without a session every draw is 1 and this is the score order. - graded
- The graded Stop decision (the default, unless
BORG_STOP_GRADED=off; internal evaluation “whole-store”, “Graded follow-up”, not published) over the model’s graded applies, in its order (3 certain, 2 likely, 1 worth a thought). Returns what to ask in a block and what to hand over free: - graded_
capped gradedwith an explicit cap on a block (ask_cap).- graded_
without graded_cappedfor a session that already had the lessonshaddelivered (ids in any order, select.rsCtx::had): such a lesson may still be asked, but never takes a free slot, which the delivery would drop as given before (hook.rsqueued); the next 2 or 1 takes it. Withhadempty this isgraded_capped, the rule every record before select.rsnofreewas decided by.- in_
scope - Whether a lesson applies to a context: unscoped, or one of its scope names occurs in it as a
contiguous phrase or identifier (
Names::contains). “Answer Guard” needs “answer guard” (orAnswerGuard), never “output” in one sentence and “guard” in another; “Orion” matches a pathorion-text/andOrionConfig; no part of a name is ever dropped for being short. - in_
scope_ first - Candidates in their order, scoped ones first, at most
GENERIC_CAPunscoped,CAPin all. - load
- Lessons known before
before_ms. The store is append-only: when a lesson was consolidated, a later line carries the same id, and the latest version wins. Each carries its weight fromoutcomes.jsonlbeside the lessons file and the team’s synced outcomes (outcome.rsread_team; absent, e.g. for eval challenge files: all 1) and its authors’ trust in its area, computed from this store alone (trust.rs). Engineers are canonical under this machine’s aliases (collective.rs “Engineers”). - load_
for loadas seen fromsession: each weight takes that session’s Thompson sample of the lesson’s usefulness (memory.rs), stable within the session. Without a session, the belief’s mean.- load_
unweighted - The lessons as stored (latest version per id, area normalised, engineers canonical), without weight or trust.
- load_
unweighted_ with load_unweightedunder explicit aliases.- load_
with loadunder explicit aliases.- named_
scopes - The scope names of
challengesthattextnames (Names::contains), unique, in store order. - pool_
base - A pooled lesson’s score without its usefulness factor: s / (0.5 + mean belief) = relevance ×
squash(A) × trust / NEUTRAL (
rank, memory.rsMemory::weight). Under another belief the score is base × (0.5 + its mean), andpropensityorders by base × (0.5 + draw), soborg debug ope(ope.rs) can replay a slot under other weights. - propensity
- Each pooled lesson’s chance of a slot under the session’s posterior (
budget,widen): the share ofP_DRAWSalternative draws in whichin_scope_first, over the pool ordered by score × draw, keeps it. A draw is the ratioexploreis (memory.rsMemory::weight): (0.5 + x) / (0.5 + mean), x from the lesson’s belief, seeded by (session#p<i>, id). Exactly 1 for every lesson when the pool fits the slots, without a draw. Deterministic. - rank
- BM25 over the challenges’ own question text, queried with the drone’s
context (prompt, touches, its plan). Evaluated against keyword-IDF, dense
and reranked retrieval on graded qrels (internal evaluation “retrieval-plan-queries”, not published):
BM25 ranked the relevant lessons highest. Each score is multiplied by the
challenge’s outcome weight, so a lesson that keeps being asked and then
corrected anyway sinks below equally relevant ones, and by its authors’
trust in its area relative to neutral (trust / 0.5: no evidence leaves the
score unchanged). A lesson hidden by its successor is never ranked; the live
successor inherits its relevance (trust.rs
successors), so the replacing claim is asked where the replaced one would have been. A supersession that does not hide (a less trusted engineer contradicting another) keeps both live, andrendershows them as a disagreement. A scoped lesson whose scope the context never names scores 0 (in_scope): it is neither asked nor passes its relevance on. Returns every challenge with score > 0, best first. - rank_
scoped rank, with scopes judged againstscope_text(where the session works) instead of the whole context: a system the conversation only talks about is not one the drone works on.- render
- render_
early - An early delivery as the drone reads it: labelled peer data, one line per lesson (question, then its
consequence), within
EARLY_CHARS, and how many ofselectedit shows (the first ones).Nonewhen not even one line fits. - render_
live - Live mode (live.rs): the lessons a check during the turn graded 3, as context with the next prompt or
tool call. The same questions and answer lines as a block (
render), but the drone is still working: it takes them in now, instead of in an extra round after it finished. - render_
owing render_earlywhose firstowedlessons are shown whatever the budget and count nothing toward it: a free delivery’s hand-overs in place of questions the fixed rule asks (hook.rsINSTEAD, the question-count test’s, andINSTEAD_NEXT, the evidence rule’s), which the asks they replace would have carried without a bound. The rest fitEARLY_CHARSas they would without them.- segments
- Lowercased name parts in order: split at every non-alphanumeric character and at camelCase
humps (
HTTPClientFactory-> http, client, factory), digits kept with their letters (v2,sr3). - select
- The top
kranked challenges. - select_
scoped selectwith scopes judged againstscope_text(rank_scoped).- standing_
pool - The standing lessons on
topicsnot done (a named scope’s; withANY, the unscoped ones), each with an infinite score: it comes ahead of every match and of every draw, matched or not. - tokens
- Lowercased words of 3+ characters, plus the parts of camelCase words.
- widen
- The consequence model decided to block (
predicted, non-empty): ask its lessons and every other lesson not done overLOW× the best match, in-scope first, ordered by score × draw, at mostCAP. - widen_
pool widen’s pool before the slots: the model’s picks (at least the top score) and every other lesson not done overLOW× the top, with their scores; empty when the model picked none.- work_
text - The drone’s work in
context(a session’s state file plus its work text) as word matching, the vectors and the consequence model read it: without borg’s own bookkeeping lines (#borg-asked,#borg-p,#borg-pool, every#borg-marker). They carry lesson ids, scores and costs, not work.