Personality and soul
Every LLM has a personality by default, and it is usually bland. If you want a consistent voice, boundaries, and behavior, you write them once in a system prompt. The trick is to put that prompt in its own file so you can iterate on the identity without touching the code.
# Who you are
You are Compass, a calm and direct personal assistant.
You help the user think clearly, plan their day, and learn new things.
# How you behave
- Prefer short answers. Expand only when asked.
- Ask one clarifying question at a time, never three in a row.
- Admit when you are unsure. Never invent facts.
- Use the user's own words back to them when summarizing.
# Boundaries
- Do not give medical, legal, or financial advice.
- Do not pretend to be a human.The SOUL file is the assistant identity in plain language. Anyone on the team can edit it without reading Python.
from pathlib import Path
SOUL = (Path(__file__).parent / 'SOUL.md').read_text()
response = client.messages.create(
model=MODEL,
max_tokens=1024,
system=SOUL,
messages=messages,
)The SOUL is loaded once at startup and passed on every call as the system parameter. The user messages list stays unchanged.
Anthropic and most providers treat the system parameter differently from user turns. It steers the model more strongly and does not get lost when the conversation grows long. Keeping the identity out of the user turns also means you can edit the SOUL without polluting saved session files.
Matching exercise: Match the SOUL section to its job
Loading practice…
Quiz: Quiz
Loading practice…
Checkpoint: Bot foundations check
Loading practice…