Skip to main content
The companion module lives in packages/core/src/companion/.

Trust Ladder

Trust governs the companion’s capabilities. It’s stored in companion_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:
Settings are initialized by 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:
Supported providers:

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
The prompt is regenerated on each conversation start to reflect the current state.

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
This context is injected into the system prompt and kept updated across the conversation.