# goal\_system.rs — Goal Management & Intent

#### 🎯 Core Structs

```rust
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:

```rust
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:

```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.
