goal_system.rs — Goal Management & Intent

Oxyde agents pursue goals that guide their behavior, dialogue tone, and memory weighting. The goal system enables emergent, purposeful interactions beyond reactive chat.

🎯 Core Structs

pub struct Goal {
    pub description: String,
    pub priority: f32,
    pub is_active: bool,
    pub conditions: Vec<String>,
}

pub struct GoalManager {
    pub goals: Vec<Goal>,
}
  • priority: dynamic value recalculated at runtime

  • is_active: indicates the current dominant goal

  • conditions: used to activate/deactivate goals automatically


🔁 Goal Evaluation

The method that runs each cycle:

fn evaluate_goals(&mut self)
  • Scores each goal based on:

    • Emotional state

    • Recent memories

    • External input triggers

  • Selects the highest priority one to activate


➕ Defining New Goals

You can define goals manually in Rust:

Goal {
    description: "Explore the ruined temple",
    priority: 0.9,
    is_active: false,
    conditions: vec!["has_map", "not_scared"]
}

Or load them dynamically via config.


🔄 Adaptive Behavior

Goals are reevaluated over time:

  • “Find the player” rises when alone

  • “Defend ally” activates under threat

  • “Flee” if emotion vector trends toward fear/panic


📤 In Prompt Construction

The active goal is included in LLM context:

You are focused on exploring the ruins.

This steers LLM output toward goal-relevant behavior.