MODULE 05 · INCLUDED IN FOUNDATIONS

The brain: Claude

What this module is

The model choice, the system prompt, the call itself, three layers of memory, and cost control. This is where the character's personality actually lives.

What you'll build

  • A Claude Haiku call that returns a one-line, in-character reply with an emotion tag
  • A cached system prompt so input cost drops 80–90%
  • Working, session and long-term memory
  • Hard spend limits and per-hour token caps

Lessons

  1. 01Model choice
  2. 02The system prompt
  3. 03The call
  4. 04Memory
  5. 05Cost control

Checkpoint

reply() returns an in-character, correctly formatted [emotion] answer in under 1.5 seconds, and the Anthropic console shows cache hits.

The system prompt template, annotated

Locked

Included in Foundations

Unlock with Foundations — $847

The call code (src/brain.py) with prompt caching

Locked

Included in Foundations

Unlock with Foundations — $847

The three memory layers and what never gets stored

Locked

Included in Foundations

Unlock with Foundations — $847

Cost control: limits, caps and what a streamed hour actually costs

Locked

Included in Foundations

Unlock with Foundations — $847