pub struct LearningLedger { /* private fields */ }Expand description
The durable, append-only ledger of human-approved lessons.
Built by promoting green, approved RepairCases. Entries are kept in
promotion order and the whole ledger serialises to Links Notation with a stable
content id, so it can be committed as an auditable artifact and re-derived.
Implementations§
Source§impl LearningLedger
impl LearningLedger
Sourcepub fn entries(&self) -> &[LedgerEntry]
pub fn entries(&self) -> &[LedgerEntry]
The promoted lessons, in promotion order.
Sourcepub fn promote(
&mut self,
case: &RepairCase,
approval: &HumanApproval,
) -> Result<&LedgerEntry, PromotionRejected>
pub fn promote( &mut self, case: &RepairCase, approval: &HumanApproval, ) -> Result<&LedgerEntry, PromotionRejected>
Promote case into the ledger — the terminal, human-gated step of the loop.
Succeeds only when the case is benchmark-green with an adoptable lesson, its
source round-trips faithfully, and approval is granted. Returns the newly
recorded LedgerEntry, or a PromotionRejected explaining which gate
stopped it. Idempotent per failure prompt: a second promotion of the same
failure is refused as PromotionRejected::AlreadyPromoted.
Sourcepub fn lesson_for(&self, prompt: &str) -> Option<&LedgerEntry>
pub fn lesson_for(&self, prompt: &str) -> Option<&LedgerEntry>
The approved lesson for a repeated failure, if one was promoted.
This is what makes the loop “auto learning”: a failure the system once could not answer, then learned and had approved, is now recognised and answered from the ledger without re-deriving it. Matching is on the normalised prompt (trimmed, case-insensitive) so trivial rephrasings of whitespace/case hit.
Sourcepub fn knows(&self, prompt: &str) -> bool
pub fn knows(&self, prompt: &str) -> bool
Whether the ledger already holds an approved lesson for prompt.
Sourcepub fn links_notation(&self) -> String
pub fn links_notation(&self) -> String
Render the whole ledger as Links Notation — the committable, auditable “mainline history” of approved learning records. Ends trimmed.
Sourcepub fn content_id(&self) -> String
pub fn content_id(&self) -> String
A stable content id over the ledger’s Links Notation — a fingerprint of the whole approved-lesson history.
Trait Implementations§
Source§impl Clone for LearningLedger
impl Clone for LearningLedger
Source§fn clone(&self) -> LearningLedger
fn clone(&self) -> LearningLedger
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LearningLedger
impl Debug for LearningLedger
Source§impl Default for LearningLedger
impl Default for LearningLedger
Source§fn default() -> LearningLedger
fn default() -> LearningLedger
impl Eq for LearningLedger
Source§impl PartialEq for LearningLedger
impl PartialEq for LearningLedger
impl StructuralPartialEq for LearningLedger
Auto Trait Implementations§
impl Freeze for LearningLedger
impl RefUnwindSafe for LearningLedger
impl Send for LearningLedger
impl Sync for LearningLedger
impl Unpin for LearningLedger
impl UnsafeUnpin for LearningLedger
impl UnwindSafe for LearningLedger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.