Skip to main content

Playbook

Struct Playbook 

Source
pub struct Playbook { /* private fields */ }
Expand description

Structured context store for accumulated strategies and insights.

The Playbook replaces traditional message history with a curated collection of strategy entries (bullets) that evolve based on execution feedback.

Implementations§

Source§

impl Playbook

Source

pub fn new() -> Self

Create a new empty playbook.

Source

pub fn add_bullet( &mut self, section: &str, content: &str, bullet_id: Option<&str>, metadata: Option<&HashMap<String, i64>>, ) -> &Bullet

Add a new bullet to the playbook.

Source

pub fn update_bullet( &mut self, bullet_id: &str, content: Option<&str>, metadata: Option<&HashMap<String, i64>>, ) -> Option<&Bullet>

Update an existing bullet.

Source

pub fn tag_bullet( &mut self, bullet_id: &str, tag: &str, increment: i64, ) -> Option<&Bullet>

Tag a bullet to update its counters.

Source

pub fn remove_bullet(&mut self, bullet_id: &str)

Remove a bullet from the playbook.

Source

pub fn get_bullet(&self, bullet_id: &str) -> Option<&Bullet>

Get a bullet by ID.

Source

pub fn bullets(&self) -> Vec<&Bullet>

Get all bullets.

Source

pub fn bullet_count(&self) -> usize

Get number of bullets.

Source

pub fn section_names(&self) -> Vec<&str>

Get section names.

Source

pub fn to_dict(&self) -> Value

Convert to serializable dictionary.

Source

pub fn from_dict(payload: &Value) -> Self

Load from dictionary.

Source

pub fn dumps(&self) -> String

Serialize to JSON string.

Source

pub fn loads(data: &str) -> Result<Self, Error>

Deserialize from JSON string.

Source

pub fn save_to_file(&self, path: &Path) -> Result<()>

Save playbook to JSON file.

Source

pub fn load_from_file(path: &Path) -> Result<Self, Box<dyn Error>>

Load playbook from JSON file.

Source

pub fn apply_delta(&mut self, delta: &DeltaBatch)

Apply a batch of delta operations.

Source

pub fn as_prompt(&self) -> String

Return playbook as formatted string for LLM prompting.

Source

pub fn stats(&self) -> PlaybookStats

Get playbook statistics.

Trait Implementations§

Source§

impl Clone for Playbook

Source§

fn clone(&self) -> Playbook

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Playbook

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Playbook

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.