ConceptsBrain
The brain is Claude.#
The brain is Claude, reached through the Anthropic API. Each turn is a tool-calling agent loop: Claude reasons over the event, decides which tools to call, the harness executes them and feeds the results back, and the loop repeats until Claude emits a final reply.
The key#
The agent reads ANTHROPIC_API_KEY from the environment. The key never touches the chain and is never written into memory. An optional ANTHROPIC_MODEL overrides the model; otherwise the runtime defaults to a current Claude model.
Source: packages/core/src/brain.
How a turn happens#
- Compose the frozen prefix (system prompt, memory index, identity, persona, the tool list, environment context).
- Append the conversation history.
- Append the current event as the user message.
- If the running estimate breaches the compaction threshold, fold older turns into a summary first.
- Call Claude with the tool definitions.
- If the reply contains tool calls, dispatch each through the tool registry and feed the results back; repeat until no more tool calls.
- Return the final turn to the route loop.
Output and context limits are configurable in the agent config.
Compaction#
When the running token estimate breaches a configured fraction of the context window, the brain folds the oldest portion of history into a summary, generated by a separate call. Older turns are replaced by the summary in subsequent inferences. The frozen prefix never compacts, so the prompt cache hits cleanly.
Source: packages/core/src/brain.
Dumb limbs, smart brain#
The brain decides; the tools execute. Tools never embed their own LLM — every decision routes through Claude so it can be reasoned about and logged. See Tools.
Read Tools next.
Source: packages/core/src/brain.
Source: packages/core/src/brain