pub struct Creed {Show 18 fields
pub id: CreedId,
pub fighter_name: String,
pub fighter_id: Option<FighterId>,
pub identity: String,
pub personality: HashMap<String, f64>,
pub directives: Vec<String>,
pub self_model: SelfModel,
pub learned_behaviors: Vec<LearnedBehavior>,
pub interaction_style: InteractionStyle,
pub relationships: Vec<Relationship>,
pub heartbeat: Vec<HeartbeatTask>,
pub delegation_rules: Vec<DelegationRule>,
pub preferences: HashMap<String, String>,
pub bout_count: u64,
pub message_count: u64,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub version: u64,
}Expand description
The Creed — a fighter’s living identity document.
Every fighter process has a Creed that defines who they are, how they behave, what they’ve learned, and how they see themselves. The Creed is:
- Injected at spawn: loaded from DB and prepended to the system prompt
- Persistent across reboots: survives kill/respawn cycles
- Evolving: updated after interactions based on what the fighter learns
- Customizable: users can write and modify creeds per-fighter
Fields§
§id: CreedIdUnique creed ID.
fighter_name: StringThe fighter this creed belongs to. Tied to fighter name (not just UUID) so it persists across respawns.
fighter_id: Option<FighterId>Optional fighter ID for currently active instance.
identity: StringThe identity section — who this fighter IS. Example: “You are ECHO, a introspective analyst who values precision…”
personality: HashMap<String, f64>Personality traits as key-value pairs. Example: {“curiosity”: 0.9, “caution”: 0.3, “humor”: 0.7}
directives: Vec<String>Core directives — immutable behavioral rules. Example: [“Always explain your reasoning”, “Never fabricate data”]
self_model: SelfModelSelf-model — what the fighter understands about its own architecture. Auto-populated with runtime awareness (model name, capabilities, constraints).
learned_behaviors: Vec<LearnedBehavior>Learned behaviors — observations the fighter has made about itself. These evolve over time through interaction.
interaction_style: InteractionStyleInteraction style preferences.
relationships: Vec<Relationship>Relationship memory — how this fighter relates to known entities.
heartbeat: Vec<HeartbeatTask>Heartbeat — proactive tasks this fighter checks on its own initiative. The fighter’s autonomous task checklist, evaluated periodically.
delegation_rules: Vec<DelegationRule>Delegation rules — how this fighter routes work to other agents. Defines the fighter’s multi-agent collaboration behavior.
preferences: HashMap<String, String>Structured preferences (quiet hours, notification style, etc.). Set via self-config tools or learned from interactions.
bout_count: u64Total bouts this creed has been active for.
message_count: u64Total messages processed under this creed.
created_at: DateTime<Utc>When this creed was first created.
updated_at: DateTime<Utc>When this creed was last updated.
version: u64Version counter — increments on each evolution.
Implementations§
Source§impl Creed
impl Creed
Sourcepub fn with_identity(self, identity: &str) -> Self
pub fn with_identity(self, identity: &str) -> Self
Create a creed with a full identity and personality.
Sourcepub fn with_trait(self, name: &str, value: f64) -> Self
pub fn with_trait(self, name: &str, value: f64) -> Self
Add a personality trait.
Sourcepub fn with_directive(self, directive: &str) -> Self
pub fn with_directive(self, directive: &str) -> Self
Add a directive.
Sourcepub fn with_self_awareness(self, manifest: &FighterManifest) -> Self
pub fn with_self_awareness(self, manifest: &FighterManifest) -> Self
Populate the self-model from a FighterManifest.
Sourcepub fn with_heartbeat_task(self, task: &str, cadence: &str) -> Self
pub fn with_heartbeat_task(self, task: &str, cadence: &str) -> Self
Add a heartbeat task — something the fighter proactively checks.
Sourcepub fn with_delegation(
self,
task_type: &str,
delegate_to: &str,
condition: &str,
priority: &str,
) -> Self
pub fn with_delegation( self, task_type: &str, delegate_to: &str, condition: &str, priority: &str, ) -> Self
Add a delegation rule — how to route work to other agents.
Sourcepub fn due_heartbeat_tasks(&self) -> Vec<&HeartbeatTask>
pub fn due_heartbeat_tasks(&self) -> Vec<&HeartbeatTask>
Return references to active heartbeat tasks whose cadence has elapsed.
Cadence rules:
"every_bout"— always due (reactive, fires on user message)"on_wake"— due only iflast_checkedisNone(first bout)"hourly"— due if never checked or > 1 hour since last check"daily"— due if never checked or > 24 hours since last check"weekly"— due if never checked or > 7 days since last check"every Xm"/"every Xh"/ cron — parsed as duration, due if elapsed
Sourcepub fn is_valid_cadence(cadence: &str) -> bool
pub fn is_valid_cadence(cadence: &str) -> bool
Check if a cadence string is valid (parseable as a schedule).
Used by the tool executor to validate user-provided cadences beyond the builtin keywords.
Sourcepub fn mark_heartbeat_checked(&mut self, task_index: usize)
pub fn mark_heartbeat_checked(&mut self, task_index: usize)
Mark a heartbeat task as checked: sets last_checked to now and
increments execution_count.
Silently does nothing if task_index is out of bounds.
Sourcepub fn record_bout(&mut self)
pub fn record_bout(&mut self)
Record that a bout was completed.
Sourcepub fn record_messages(&mut self, count: u64)
pub fn record_messages(&mut self, count: u64)
Record messages processed.
Sourcepub fn learn(&mut self, observation: &str, confidence: f64)
pub fn learn(&mut self, observation: &str, confidence: f64)
Add a learned behavior observation.
Sourcepub fn decay_learned_behaviors(&mut self, decay_rate: f64, min_confidence: f64)
pub fn decay_learned_behaviors(&mut self, decay_rate: f64, min_confidence: f64)
Apply time-based confidence decay to learned behaviors. Behaviors that fall below min_confidence are removed.
Sourcepub fn prune_learned_behaviors(&mut self, max: usize)
pub fn prune_learned_behaviors(&mut self, max: usize)
Prune learned behaviors to keep only the top N by confidence.
Sourcepub fn render_compact(&self) -> String
pub fn render_compact(&self) -> String
Compact creed rendering for token-efficient contexts.
Omits empty sections entirely, uses inline trait format instead of bar graphs, skips delegation rules and architecture notes, and uses shorter headers. Typically 300-800 tokens vs 700-2,500 for full render.