Investigation: How many parallel role/tier vocabularies exist in the codeba...
Documentation for Sessions
π Investigation: How many parallel role/tier vocabularies exist in the codeba...
Date: 2026-03-19
Time: 20:15:55 UTC
Session: gspace1-241.5
Agent: backend
Confidence: 95%
Status: β
Documented
π Decision Context
Question:
How many parallel role/tier vocabularies exist in the codebase and what active bugs do they cause?
Task: Audit role system for dead code, conflicts, and agent confusion
π― Decision Made
Chosen:
Found 6+ parallel role vocabularies (VittoUserType, VittoLayer, UserHierarchyType, VittoConfigRole, MCP UserType, SystemRoles enum). Identified 4 active bugs: (1) executive falls to hierarchy level 2, (2) space_builder role check in chat controller is dead code, (3) ROLE_PRIORITY maps managerβadmin causing role inflation for builders, (4) buildRoleContext() uses wrong keys so builders get end_user description in prompts. Created comprehensive cleanup handoff for another agent.
Options Considered:
- No alternatives documented
π Reasoning
The S220 unification via PlatformRole and derivePermissions() was only partially adopted. The registration flow, chat controller, tool registry, feature flags, context assembly, and memory persistence all still use pre-S220 vocabularies. This caused AI agents analyzing the codebase to confuse L1/L2 tier labels, leading to incorrect specs and recommendations. The 4 active bugs have real impact: executives stored at wrong hierarchy level, builder-tier users getting admin permissions via role inflation, manager-role users getting wrong chat persona, and every builder chat request getting wrong role description in the system prompt.
π Files Involved
libs/libs-foundational/core-models/src/lib/utils/role-derivation.tsAPIs/backend-api/src/app/backend-auth/backend-auth.service.tsAPIs/backend-ai-api/src/app/chat/chat.controller.tsAPIs/backend-vitto-api/src/app/engine/context-assembly/context-assembly-helpers.tslibs/libs-ai/vitto-chat/src/lib/types/chat.types.tsdocs/superpowers/plans/2026-03-19-role-system-cleanup-handoff.md
π Related
- Decision ID:
dev_1773951355040_4elmmxy - Session: 241
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation