Architecture: What is the correct token budget priority order for a Jarvis...
Documentation for Sessions
🏗️ Architecture: What is the correct token budget priority order for a Jarvis...
Date: 2026-03-19
Time: 11:32:26 UTC
Session: gspace1-234.4
Agent: architecture
Confidence: 96%
Status: ✅ Documented
📋 Decision Context
Question:
What is the correct token budget priority order for a Jarvis-level agent that must always know the user?
Task: S234: Token budget priority redesign for Jarvis-level memory
🎯 Decision Made
Chosen:
User identity (dossier + user context) elevated to priority 9 (SACRED — only core persona and tools above it). Conversation history elevated to priority 8. Page context, learning intel, proactive hints remain low priority (1-3). The principle: Vitto must ALWAYS know WHO it's talking to, even when the context window is tight.
Options Considered:
- Elevate user identity to priority 9 (chosen — SACRED, minimal token cost)
- Increase MAX_SYSTEM_PROMPT_TOKENS to 100K (wrong — wastes context window, doesn't fix ordering)
- Make all sections priority 10 (wrong — everything becomes untrimable, breaks budget)
- Add a separate 'identity budget' outside the main budget (over-engineering for 1500 tokens)
💭 Reasoning
Root cause: User dossier had priority 7 and conversation history had priority 6 in the token budget system. Page context (priority 2) and learning intelligence (priority 3) filled first. When the system prompt approached 60K tokens, user identity got truncated BEFORE page context — meaning Vitto forgot WHO it was talking to but remembered WHAT page they were on. This is the opposite of what a personal assistant should do. A Jarvis agent's hierarchy: (1) identity anchor ('I am Vitto'), (2) user knowledge ('I know this person'), (3) conversation continuity ('we were talking about X'), (4) everything else. The fix reorders priorities to match this hierarchy. Risk: if user context is very large (many facts), it could push out space context (priority 6). Mitigation: dossier brief is already capped at 2000 chars (~500 tokens) in getDossierForPrompt(), and user context is typically 200-500 tokens. Total sacred budget: ~1500 tokens out of 60K — well within limits.
📁 Files Involved
APIs/backend-vitto-api/src/app/engine/context-assembly/web-prompt-builder.service.tsAPIs/backend-vitto-api/src/app/engine/context-assembly/token-budget.util.ts
🔗 Related
- Decision ID:
dev_1773919946133_uyjm9ae - Session: 234
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation