pub struct CompactionPrompt { /* private fields */ }Expand description
Optional prompt customization for automatic and manual compaction requests.
By default, compaction uses Merry’s built-in handoff summary instructions. Callers can:
- Keep the built-in instructions and attach persistent
Self::with_user_contextguidance applied to both automatic and manual compactions. - Replace the summary instructions with
Self::custom(plain text or Markdown;<summary>tags are optional and never required), optionally adding persistentSelf::with_user_context.
When manual compaction also supplies per-call focus text, the runtime merges it
after any persistent user_context so caller focus is never lost.
Implementations§
Source§impl CompactionPrompt
impl CompactionPrompt
Sourcepub fn custom(instructions: impl Into<String>) -> Result<Self, CompactionError>
pub fn custom(instructions: impl Into<String>) -> Result<Self, CompactionError>
Creates a prompt that replaces the built-in summary instructions with custom text.
Line endings are normalized and disallowed control characters are stripped. Blank text is rejected.
Sourcepub fn with_user_context(
self,
user_context: impl Into<String>,
) -> Result<Self, CompactionError>
pub fn with_user_context( self, user_context: impl Into<String>, ) -> Result<Self, CompactionError>
Attaches persistent user-context guidance applied to every compaction request.
Works with both the built-in default instructions (CompactionPrompt::default())
and custom instructions (CompactionPrompt::custom(...)). Line endings are
normalized and disallowed control characters are stripped; blank text is rejected.
Sourcepub fn instructions(&self) -> Option<&str>
pub fn instructions(&self) -> Option<&str>
Custom summary instructions, if set (None uses the built-in template).
Sourcepub fn user_context(&self) -> Option<&str>
pub fn user_context(&self) -> Option<&str>
Persistent user-context guidance applied to automatic and manual compaction.
Trait Implementations§
Source§impl Clone for CompactionPrompt
impl Clone for CompactionPrompt
Source§impl Debug for CompactionPrompt
impl Debug for CompactionPrompt
Source§impl Default for CompactionPrompt
impl Default for CompactionPrompt
impl Eq for CompactionPrompt
Source§impl PartialEq for CompactionPrompt
impl PartialEq for CompactionPrompt
impl StructuralPartialEq for CompactionPrompt
Auto Trait Implementations§
impl Forget for CompactionPrompt
impl Freeze for CompactionPrompt
impl Move for CompactionPrompt
impl RefUnwindSafe for CompactionPrompt
impl Send for CompactionPromptwhere
RawVecInner: Send,
impl Sync for CompactionPromptwhere
RawVecInner: Sync,
impl Unpin for CompactionPrompt
impl UnsafeUnpin for CompactionPrompt
impl UnwindSafe for CompactionPromptwhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.