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: boolWhether 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: u32How many times the verify command has been run.
max_attempts: u32Maximum 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: boolWhether 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: StringBean 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
impl Bean
Sourcepub fn try_new(id: impl Into<String>, title: impl Into<String>) -> Result<Self>
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.
Sourcepub fn new(id: impl Into<String>, title: impl Into<String>) -> Self
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.
Sourcepub fn effective_max_loops(&self, config_max: u32) -> u32
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.
Sourcepub fn effective_verify_timeout(
&self,
config_timeout: Option<u64>,
) -> Option<u64>
pub fn effective_verify_timeout( &self, config_timeout: Option<u64>, ) -> Option<u64>
Get effective verify_timeout: bean-level override, then config default, then None.
Sourcepub fn from_string(content: &str) -> Result<Self>
pub fn from_string(content: &str) -> Result<Self>
Parse a bean from a string (either YAML or Markdown with YAML frontmatter).
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self>
Read a bean from a file (supports both YAML and Markdown with YAML frontmatter).
Sourcepub fn to_file(&self, path: impl AsRef<Path>) -> Result<()>
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.
Sourcepub fn hash(&self) -> String
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.
Sourcepub fn from_file_with_hash(path: impl AsRef<Path>) -> Result<(Self, String)>
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.
Sourcepub fn apply_value(&mut self, field: &str, json_value: &str) -> Result<()>
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 updatejson_value- JSON-serialized value to apply
§Returns
Ok(())on successErrif field is unknown or value cannot be deserialized