In Caosmos, the behavior engine is based on a hierarchy where the Action is the catalyst for all change. A citizen does not simply "be" in a task; they enter it through a validated action.
This "Will Cycle" leverages the non-deterministic nature of AI models (controlled by their temperature). We interpret the unpredictability of these models as Free Will: the capacity of a citizen to react differently to the same stimuli, creating an organic and living simulation.
An Action is the unit of intention that the system (AI or User) sends to the citizen. It is the "Verb" that initiates any interaction with the world.
- Entry Point: All AI decisions are first manifested as an
ActionRequest. - Validation and Gatekeeping: Before any change occurs, an
ActionHandlervalidates if the action is physically possible (e.g., Are you near? Do you have the tool?). - Dual Natures: An action can have two natures depending on its purpose:
- Atomic Action: Executes instantaneously and finishes (e.g.,
PICKUPto collect an object). - Generating Action: If validation is positive, the action "installs" a persistent Task in the citizen (
e.g.,
WORKorEXPLORE).
- Atomic Action: Executes instantaneously and finishes (e.g.,
A Task is the persistent state a citizen enters after a generating action. It represents a flow of logic that stays
alive across multiple server "ticks", implementing the executeOnTick interface.
- State of Being: While a task is active, the citizen changes their cognitive state (e.g.,
MOVING,BUSY). - Direct Modification: Unlike other systems, Tasks do not generate internal Actions. The task manipulates the
citizen's state directly:
- Calculates movement step-by-step (Lerp) and updates position (
setPosition). - Gradually consumes energy and hunger by interacting with the citizen's biology.
- Evaluates when the goal has been reached (e.g., reaching the exploration limit).
- Calculates movement step-by-step (Lerp) and updates position (
- Interruption: Tasks return an
ActiveTaskon each tick and can be interrupted by external events (danger) or replaced by new actions.
- Intention (
ActionRequest): The AI decides: "I want to explore the North". - Handling (
ActionHandler): The engine validates: "Can this citizen start exploring now?". - Activation (
Task): If valid, anExploreTaskis instantiated and assigned. - Physical Simulation: On each tick, the
ExploreTaskmathematically calculates the new position, moves the citizen 0.1 meters, reduces their energy, and checks for collisions, without generating new "Actions". - Completion: The task finishes on its own (goal met) or is replaced by a new action.
Important
Remember: No Action, No Task. The Task is the persistent consequence of a will expressed through an Action.