Skip to main content

Module conscience

Module conscience 

Source
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§

Challenge
Names
A text as its name parts, indexed for contiguous lookups.

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
source of a ratified constraint loaded as a lesson (constraints).
EARLY_CAP
At most this many lessons per early delivery (early). Baseline: today’s early rule, as RELATIVE.
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.rs DELIVERY), 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 that EARLY_CHARS holds 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: as BLOCK.
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.rs rel, hook.rs early_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.rs DORMANT_BELOW), part of today’s ranking; the same value as BLOCK, a different bar.

Functions§

ask_cap
BORG_STOP_ASK_CAP=N (evaluation only): a block asks only the 3s, the first N in the model’s order; without a 3 nothing changes. Unset, a block asks as graded says.
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 plus second × 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 in bm25; term frequency and length are per document. Groups of one document score as bm25 does. 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 rank returns it; the top is the store’s best match, done or not), with done the 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 over LOW × the top, with its score; empty when none not done clears BLOCK × 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 render shows, for the asked outcome record (outcome.rs).
disagreements
Groups (indices into selected, in selection order) of lessons that disagree: the same situation with different consequences (queen.rs conflict_pairs), or one lists the other in supersedes while both are still live (a supersession cycle, or one that does not hide: trust.rs successors).
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 whole context, scoring at least RELATIVE × the best of them (done or not), minus those already delivered or asked (done), at most EARLY_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 over RELATIVE × 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 (early over early_pool): propensity’s draws, keeping in each the first EARLY_CAP and of them what render_early shows for topics. 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
graded with an explicit cap on a block (ask_cap).
graded_without
graded_capped for a session that already had the lessons had delivered (ids in any order, select.rs Ctx::had): such a lesson may still be asked, but never takes a free slot, which the delivery would drop as given before (hook.rs queued); the next 2 or 1 takes it. With had empty this is graded_capped, the rule every record before select.rs nofree was 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” (or AnswerGuard), never “output” in one sentence and “guard” in another; “Orion” matches a path orion-text/ and OrionConfig; no part of a name is ever dropped for being short.
in_scope_first
Candidates in their order, scoped ones first, at most GENERIC_CAP unscoped, CAP in 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 from outcomes.jsonl beside the lessons file and the team’s synced outcomes (outcome.rs read_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
load as seen from session: 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_unweighted under explicit aliases.
load_with
load under explicit aliases.
named_scopes
The scope names of challenges that text names (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.rs Memory::weight). Under another belief the score is base × (0.5 + its mean), and propensity orders by base × (0.5 + draw), so borg 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 of P_DRAWS alternative draws in which in_scope_first, over the pool ordered by score × draw, keeps it. A draw is the ratio explore is (memory.rs Memory::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, and render shows 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 against scope_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 of selected it shows (the first ones). None when 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_early whose first owed lessons 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.rs INSTEAD, the question-count test’s, and INSTEAD_NEXT, the evidence rule’s), which the asks they replace would have carried without a bound. The rest fit EARLY_CHARS as 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 k ranked challenges.
select_scoped
select with scopes judged against scope_text (rank_scoped).
standing_pool
The standing lessons on topics not done (a named scope’s; with ANY, 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 over LOW × the best match, in-scope first, ordered by score × draw, at most CAP.
widen_pool
widen’s pool before the slots: the model’s picks (at least the top score) and every other lesson not done over LOW × 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.