Brain
Table of Contents
Classes
- AgentBrain
- Turns one {@see AgentObservation} into a single game action by asking an LLM
(via {@see OllamaClient}) and parsing a strict JSON reply.
- AutoPlayer
- Runs one observe → decide → act cycle for an agent: fetch the world, ask the
{@see AgentBrain}, and queue the chosen intent via {@see NHA::intentWithToken()}.
- Ladder
- The deterministic decision ladder — "what would a sensible agent do here?"
computed straight from an observation, no LLM. Two entry points:
- OllamaClient
- Minimal async chat client for a local LLM server, driven by the bot's
ReactPHP event loop.
- Playbook
- The strategy an agent plays by: the verb catalogue plus the system prompt
{@see AgentBrain} sends at the head of every decision request.
- PromptBuilder
- Builds the model's *user* turn — a compact, deterministic digest of one
{@see AgentObservation} plus the carry-over context ({@see AutoPlayer} feeds
last turn's decision, its outcome, the recent-history window, the combine
bookkeeping and any forced loop-break objective).
Enums
- Stance
- The strategic stance an agent is playing right now. It is a soft steer, not a
script: it re-flavours the system prompt {@see Playbook::systemPrompt()} and
lightly reorders the deterministic ladder {@see Ladder::suggestion()}, but
the survive / defend / arm rungs and the anti-patterns always apply.