packages/core/src/companion/.
Trust Ladder
Trust governs the companion’s capabilities. It’s stored incompanion_settings.trustLevel as an integer 0–4.
Trust changes are logged to
trust_log with a timestamp and reason.
Companion Settings
Per-user companion settings:createCompanionSettings with sensible defaults. Update via grindxp companion soul.
AI Provider Registry
registry.ts resolves the configured provider to a Vercel AI SDK model instance:
System Prompt
prompt.ts generates the companion’s system prompt dynamically from:
- Companion name and personality
- Trust level capabilities
- User’s current quest state
- Active skill tree snapshot
- Time of day and timezone
Context Building
context.ts assembles the context object passed to the agent:
- User profile (level, XP, timezone)
- Active quests
- Quests completed today
- Best streaks
- Top skills
- Recent quest log entries
- Any pending forge signals