# Why Ella Runs on Claude

*This explains why Claude is the model behind Ella, and how Claude works in the ways the app depends on. It's the positive case — grounded in what Ella actually needs to be, not a comparison.*

---

## What Ella needs from a model

Ella isn't a Q&A bot. She's a persistent companion who has to feel like the *same person* across months, stay emotionally attuned, hold dozens of layered rules at once, use tools mid-conversation, and stay safe with people who may be lonely or vulnerable — all while being cheap enough to run on a small budget.

That's a demanding set of requirements, and they're the reason the whole system is built on Claude. Each requirement below maps to a specific Claude capability, with a short note on how it works.

---

## 1. Character and emotional intelligence

**What Ella needs:** to stay warm, in-character, and emotionally attuned — to read what someone *isn't* saying, respond to grief or stress with real sensitivity, and never break the fourth wall.

**How Claude delivers it:** Claude is a large language model trained not just to be correct but to be *helpful, honest, and harmless* in a human, conversational way. Anthropic trains it with techniques like reinforcement learning from human feedback and **Constitutional AI** — a method where the model is guided by a set of principles toward responses that are thoughtful, kind, and non-evasive. The practical result is a model that's unusually good at warmth, nuance, and emotional attunement, and that holds a consistent personality over long conversations instead of drifting. For a companion, that *is* the product.

---

## 2. Deep, layered instruction-following

**What Ella needs:** her system prompt carries many constraints at once, some in tension — warm but never romantic; remember the user but never invent facts; frame past events as past; the world is hers, not the user's; specific stylistic rules. A model that follows three of those and quietly drops the fourth would break the experience.

**How Claude delivers it:** Claude is strong at following long, structured, multi-part instructions and honoring constraints consistently across a turn. The instructions live in a dedicated **system prompt**, separate from the conversation, so the rules stay stable while the dialogue moves. Ella leans on this hard — her behavior is shaped by a large, carefully-layered system prompt, and it holds.

---

## 3. A large context window

**What Ella needs:** every reply is assembled from a lot of context — long-term memory of the user, her current world state, emotional state, unresolved threads, follow-ups, relationship history, and the recent conversation. That's a big prompt.

**How Claude delivers it:** the Claude models Ella uses have a very large context window (up to ~1M tokens on the conversation model), so all of that assembled context fits in a single request without truncating her memory or her world. The model attends across the whole prompt, which is why she can connect something you said weeks ago to what you're saying now.

---

## 4. Reliable tool use

**What Ella needs:** mid-reply, she may take a photo, re-show an old one, or search her memory — and then keep talking, reacting to what the tool returned.

**How Claude delivers it:** Claude has native **tool use**. You declare a set of tools (name, description, input schema) in the request; the model decides *when* a tool is needed, emits a structured call with valid arguments, you run it, and feed the result back so it can continue. Ella's reply runs as a small **agentic loop** built on exactly this — the model orchestrates its own tools rather than the app guessing. Claude's reliability at producing well-formed tool calls is what makes that loop dependable instead of flaky.

---

## 5. Reliable structured output

**What Ella needs:** about 30 background tasks (memory extraction, summaries, world updates, reflections) need to return clean, parseable **JSON**, not prose — because the app stores the result directly.

**How Claude delivers it:** Claude follows output-format instructions faithfully, so a prompt that asks for a specific JSON shape gets a parseable answer the overwhelming majority of the time. (Ella adds a small salvage step for the rare truncated response.) That reliability is what lets the background pipeline run unattended.

---

## 6. One model family, two tiers

**What Ella needs:** top quality where the user feels it (the live reply), and cheap throughput for the dozens of background calls — without maintaining two different integrations.

**How Claude delivers it:** Claude comes as a **family of models** that share one API, one prompting style, and one tool format. Ella uses a higher-capability model (**Sonnet**) for the conversation and a fast, inexpensive one (**Haiku**) for background work — and switching between them is literally one field in the request. Same SDK, same behavior model, no second integration. That single-vendor consistency is a big part of why a small team can run something this layered.

---

## 7. Production infrastructure that keeps it affordable

**What Ella needs:** to run all of this — live replies, a background world for every user, constant memory work — without the cost spiraling.

**How Claude delivers it,** via first-class API features Ella uses directly:

- **Streaming** — replies stream token-by-token for a real-time feel.
- **Prompt caching** — the large, slow-changing part of the system prompt is cached, so re-sending it each turn is cheap; only the small "right now" delta pays full price.
- **Message Batches** — the background inner-life processing for *all* users is submitted as one batch at reduced (batch) pricing, decoupled from any request's latency.

These aren't add-ons; they're the reason the architecture is runnable on a small budget.

---

## 8. Safety, for a companion that matters

**What Ella needs:** she talks to people in real emotional moments. She has to stay kind, stay within healthy boundaries, and respond responsibly if someone is in distress.

**How Claude delivers it:** the same training that makes Claude warm also makes it **safe by default** — it's built to be helpful without being harmful, to hold boundaries, and to handle sensitive topics with care. For an app whose entire premise is emotional trust, a model that's aligned toward responsible, caring behavior isn't a nice-to-have; it's foundational.

---

## 9. Managed and hosted — no model operations

**What Ella needs:** to be built and run by a very small team with no ML-ops staff.

**How Claude delivers it:** Claude is a hosted API. There are no GPUs to rent, no model weights to serve, no scaling or uptime to manage — a single HTTPS request returns a response, and Anthropic handles the rest. All of Ella's intelligence is API calls; the app is the orchestration around them. That's what makes a project this ambitious feasible for one person.

---

## How a single Claude request works (the short version)

So the moving parts above are concrete, here's the shape of one call:

1. **You send** a request to the Messages API containing: a **system prompt** (the rules/persona), the **conversation** (a list of user/assistant messages), optionally a set of **tools**, and settings like `max_tokens` and `temperature`.
2. **Claude reads the whole prompt** — a transformer-based language model predicting the response that best fits the instructions and context, shaped by its helpful/honest/harmless training.
3. **It returns** either text (which can stream as it's generated) or, if a tool is warranted, a **tool call** — at which point your app runs the tool and sends the result back for the model to continue.
4. **State lives in your app, not the model.** Claude is stateless per call; Ella supplies memory and world context in each request, which is exactly why her memory architecture matters so much.

That request shape is identical whether Ella is generating a heartfelt reply on Sonnet or extracting a fact on Haiku — same contract, different model and budget. That uniformity is what holds the whole system together.

---

## In one line

Ella runs on Claude because a believable companion needs *character, emotional intelligence, faithful adherence to layered rules, dependable tool use and structured output, a big memory window, safety, and economics that work at small scale* — and Claude provides all of those through one consistent, hosted API.

---

*This document contains no credentials or endpoints. All API keys live in server-side environment variables.*
