-
Notifications
You must be signed in to change notification settings - Fork 2
Goal Engine en
The goal engine is what makes AIBot "figure things out". It back-chains a declarative goal into a dependency-correct execution plan — no manual step list required.
Goal (what you want) → GoalPlanner (how to get it) → GoalExecutor (run step by step + re-plan on failure)
Goal is a sealed set of types expressing a desired end state, not concrete steps:
| Goal | Meaning |
|---|---|
HaveItem |
Own N of an item (e.g. 3 diamonds) |
HavePickaxeTier |
Own a pickaxe of a given tier |
MineOre |
Mine N of an ore |
HarvestCrop |
Harvest N of a crop |
Armor |
Wear a given armor set |
Workstation |
Have / place a workstation |
Stockpile |
Stock a resource to a target amount |
GoalPlanner.plan is pure-functional backward-chaining. The core is the ensureItem recursion:
To obtain an item, check the inventory → if missing, figure out how to acquire it (craft / mine / smelt / gather / hunt / farm) → recurse
ensureItemon each prerequisite material, down to directly obtainable base items.
It emits ordered GoalSteps:
GoalStep.Kind |
Action |
|---|---|
GATHER |
gather (logs…) |
MINE |
mine exposed blocks (stone…) |
MINE_ORE |
targeted ore mining |
CRAFT |
craft |
SMELT |
smelt |
MOVE |
move to a workstation |
FARM / HUNT
|
farm / hunt (food chain) |
DESCEND_TO_Y |
descend to an ore layer |
PLACE_STATIONS |
place workstations |
STOCKPILE |
stockpile |
Planning also handles: tool-tier back-chaining (diamonds need an iron pickaxe → ensure it first), deep-ore prerequisites (descend + sword/shield/armor before diamonds), merging like gathers, food / armor resupply, and more. Depth is bounded by goal.maxPlanDepth (see Configuration).
craft(crafting_table)
craft(wooden_pickaxe) ← needs planks/sticks ← needs logs → gather(oak_log)
mine(stone) ×3 ← needs wooden pickaxe (ensured above)
craft(stone_pickaxe)
descend_to_y(16)
mine_ore(iron_ore) ×3
craft(furnace) ← needs cobblestone
smelt(raw_iron → iron_ingot) ×3
craft(iron_pickaxe)
You only said "I want an iron pickaxe" — everything else is derived.
-
submit / plan — receive the goal, build the step queue via
GoalPlanner. -
assignNext — instantiate the current step as a Task System, hand it to
TaskManager. - tick — task done → advance; all done → goal achieved.
-
handleStepFailure — a step fails → re-plan (per
goal.replanOnFailure) instead of hanging. - userGoal protection — a player-issued goal is locked so it can't be silently "downgraded" into a prerequisite sub-goal (e.g. quitting after "mine iron" when the real goal was "mine diamonds").
Without it, the LLM either micromanages (slow, error-prone, token-hungry) or skips prerequisites (mining with no pickaxe). The goal engine makes "one sentence → a complete, reliable plan" a deterministic process; the model only states intent.
Further reading: Task System · Brain & Tools · Architecture
AIBot · GitHub · MIT License · LLM plans · Tasks execute · Bob survives
新手上路
理解原理
参与开发
- Home
- Getting Started
- Commands
- Configuration
- Client Panel
- Architecture
- Goal Engine
- Task System
- Brain & Tools
- Safety Net
- Developer Guide
- FAQ
主仓库 · MIT