Family detection
detectModelFamily(modelId) determines which prompt to use:
| Model ID Pattern | Family | Prompt style |
|---|---|---|
anthropic/*, claude-* | claude | Concise, imperative, zero-filler |
openai/*, xai/*, gpt-*, o1*, o3* | openai | Agent framing, structured guidelines |
google/*, gemini-* | google | Core mandates, enumerated workflows |
| Everything else | other | Generic, works with any model |
llmgateway/claude-sonnet-4 matches claude family.
Prompt assembly
buildSystemPrompt() assembles the final prompt from these sections:
Cache strategy
The system prompt is split for Anthropic prompt caching efficiency:- System prompt (steps 1-10) —marked with
EPHEMERAL_CACHE, stable across steps - Soul Map —injected as a user/assistant message pair (updates after edits without invalidating the cached system prompt)
- Skills —injected as a separate user/assistant message pair
Mode overlays
Modes append additional instructions to the base prompt:| Mode | Behavior |
|---|---|
default | No overlay —full agent |
architect | Read-only, produces structured architecture analysis |
socratic | Investigates first, asks targeted questions |
challenge | Adversarial review with evidence from soul tools |
plan | Research, structured plan, user confirms, execute |
auto | Autonomous execution, minimal interruptions |
full (high context —includes code snippets and diffs) and light (low context —just steps and descriptions).
Soul Map injection
The Soul Map is injected as a user/assistant message pair prepended to the conversation:Adding a new family
-
Create
src/core/prompts/families/yourfamily.ts: -
Add to
FAMILY_PROMPTSinbuilder.ts -
Add detection in
provider-options.tsdetectModelFamily()