Skip to main content

Bean

Struct Bean 

Source
pub struct Bean {
Show 40 fields pub id: String, pub title: String, pub slug: Option<String>, pub status: Status, pub priority: u8, pub created_at: DateTime<Utc>, pub updated_at: DateTime<Utc>, pub description: Option<String>, pub acceptance: Option<String>, pub notes: Option<String>, pub design: Option<String>, pub labels: Vec<String>, pub assignee: Option<String>, pub closed_at: Option<DateTime<Utc>>, pub close_reason: Option<String>, pub parent: Option<String>, pub dependencies: Vec<String>, pub verify: Option<String>, pub fail_first: bool, pub checkpoint: Option<String>, pub attempts: u32, pub max_attempts: u32, pub claimed_by: Option<String>, pub claimed_at: Option<DateTime<Utc>>, pub is_archived: bool, pub produces: Vec<String>, pub requires: Vec<String>, pub tokens: Option<u64>, pub tokens_updated: Option<DateTime<Utc>>, pub on_fail: Option<OnFailAction>, pub on_close: Vec<OnCloseAction>, pub history: Vec<RunRecord>, pub outputs: Option<Value>, pub max_loops: Option<u32>, pub verify_timeout: Option<u64>, pub bean_type: String, pub last_verified: Option<DateTime<Utc>>, pub stale_after: Option<DateTime<Utc>>, pub paths: Vec<String>, pub attempt_log: Vec<AttemptRecord>,
}

Fields§

§id: String§title: String§slug: Option<String>§status: Status§priority: u8§created_at: DateTime<Utc>§updated_at: DateTime<Utc>§description: Option<String>§acceptance: Option<String>§notes: Option<String>§design: Option<String>§labels: Vec<String>§assignee: Option<String>§closed_at: Option<DateTime<Utc>>§close_reason: Option<String>§parent: Option<String>§dependencies: Vec<String>§verify: Option<String>

Shell command that must exit 0 to close the bean.

§fail_first: bool

Whether this bean was created with –fail-first (enforced TDD). Records that the verify command was proven to fail before creation.

§checkpoint: Option<String>

Git commit SHA recorded when verify was proven to fail at claim time. Proves the test was meaningful at the point work began.

§attempts: u32

How many times the verify command has been run.

§max_attempts: u32

Maximum verify attempts before escalation (default 3).

§claimed_by: Option<String>

Agent or user currently holding a claim on this bean.

§claimed_at: Option<DateTime<Utc>>

When the claim was acquired.

§is_archived: bool

Whether this bean has been moved to the archive.

§produces: Vec<String>

Artifacts this bean produces (types, functions, files). Used by decompose skill for dependency inference.

§requires: Vec<String>

Artifacts this bean requires from other beans. Maps to dependencies via sibling produces.

§tokens: Option<u64>

Estimated token count for this bean’s context. Used for sizing decisions (decomposition vs implementation).

§tokens_updated: Option<DateTime<Utc>>

When the token count was last calculated.

§on_fail: Option<OnFailAction>

Declarative action to execute when verify fails.

§on_close: Vec<OnCloseAction>

Declarative actions to execute when this bean is closed. Runs after archive and post-close hook. Failures warn but don’t revert.

§history: Vec<RunRecord>

Structured history of verification runs.

§outputs: Option<Value>

Structured output from verify commands (arbitrary JSON).

§max_loops: Option<u32>

Maximum agent loops for this bean (overrides config default, 0 = unlimited).

§verify_timeout: Option<u64>

Timeout in seconds for the verify command (overrides config default). If the verify command exceeds this limit, it is killed and treated as failure.

§bean_type: String

Bean type: ‘task’ (default) or ‘fact’ (verified knowledge).

§last_verified: Option<DateTime<Utc>>

Unix timestamp of last successful verify (for staleness detection).

§stale_after: Option<DateTime<Utc>>

When this fact becomes stale (created_at + TTL). Only meaningful for facts.

§paths: Vec<String>

File paths this bean is relevant to (for context relevance scoring).

§attempt_log: Vec<AttemptRecord>

Structured attempt tracking: [{num, outcome, notes}]. Tracks claim→close cycles for episodic memory.

Implementations§

Source§

impl Bean

Source

pub fn try_new(id: impl Into<String>, title: impl Into<String>) -> Result<Self>

Create a new bean with sensible defaults. Returns an error if the ID is invalid.

Source

pub fn new(id: impl Into<String>, title: impl Into<String>) -> Self

Create a new bean with sensible defaults. Panics if the ID is invalid. Prefer try_new for fallible construction.

Source

pub fn effective_max_loops(&self, config_max: u32) -> u32

Get effective max_loops (per-bean override or config default). A value of 0 means unlimited.

Source

pub fn effective_verify_timeout( &self, config_timeout: Option<u64>, ) -> Option<u64>

Get effective verify_timeout: bean-level override, then config default, then None.

Source

pub fn from_string(content: &str) -> Result<Self>

Parse a bean from a string (either YAML or Markdown with YAML frontmatter).

Source

pub fn from_file(path: impl AsRef<Path>) -> Result<Self>

Read a bean from a file (supports both YAML and Markdown with YAML frontmatter).

Source

pub fn to_file(&self, path: impl AsRef<Path>) -> Result<()>

Write this bean to a file. For .md files, writes markdown frontmatter format (YAML between --- delimiters with description as the markdown body). For other extensions, writes pure YAML.

Source

pub fn hash(&self) -> String

Calculate SHA256 hash of canonical form.

Used for optimistic locking. The hash is calculated from a canonical JSON representation with transient fields cleared.

Source

pub fn from_file_with_hash(path: impl AsRef<Path>) -> Result<(Self, String)>

Load bean with version hash for optimistic locking.

Returns the bean and its content hash as a tuple. The hash can be compared before saving to detect concurrent modifications.

Source

pub fn apply_value(&mut self, field: &str, json_value: &str) -> Result<()>

Apply a JSON-serialized value to a field by name.

Used by conflict resolution to set a field to a chosen value. The value should be JSON-serialized (e.g., "\"hello\"" for a string).

§Arguments
  • field - The field name to update
  • json_value - JSON-serialized value to apply
§Returns
  • Ok(()) on success
  • Err if field is unknown or value cannot be deserialized

Trait Implementations§

Source§

impl Clone for Bean

Source§

fn clone(&self) -> Bean

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Bean

Source§

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

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

impl<'de> Deserialize<'de> for Bean

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&Bean> for IndexEntry

Source§

fn from(bean: &Bean) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Bean

Source§

fn eq(&self, other: &Bean) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Bean

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Bean

Auto Trait Implementations§

§

impl Freeze for Bean

§

impl RefUnwindSafe for Bean

§

impl Send for Bean

§

impl Sync for Bean

§

impl Unpin for Bean

§

impl UnsafeUnpin for Bean

§

impl UnwindSafe for Bean

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,