Skip to main content

NoteSink

Trait NoteSink 

Source
pub trait NoteSink: Send {
    // Required methods
    fn add(&mut self, fact: &str) -> Result<()>;
    fn replace(&mut self, old_substring: &str, new_text: &str) -> Result<()>;
    fn remove(&mut self, substring: &str) -> Result<()>;
    fn usage_line(&self) -> String;
}
Expand description

Model-writable note store behind the save_note tool.

Object-safe by design (the loop holds &mut dyn NoteSink). All write paths behind an implementation MUST share the store the human-facing /remember command writes (one store, one write-time security scan, one char budget). Errors are surfaced to the model verbatim — the over-budget curator error and the scan rejection are coaching text, not failures to hide.

Required Methods§

Source

fn add(&mut self, fact: &str) -> Result<()>

Append a new note. Over-budget adds must fail with the full current entry list (“the cap is the curator”).

Source

fn replace(&mut self, old_substring: &str, new_text: &str) -> Result<()>

Replace the single existing entry containing old_substring with new_text. Zero or multiple matches are errors.

Source

fn remove(&mut self, substring: &str) -> Result<()>

Remove the single existing entry containing substring.

Source

fn usage_line(&self) -> String

One-line usage summary appended to successful results, e.g. notes: 145/2200 chars (6%) — the model sees how full memory is after every write (hermes’s usage-header pattern).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§