Organization Groups
Recursive Group Hierarchy
Groups provide an unlimited-depth organizational structure. A typical hierarchy:
Company (root)
├── Region: Serbia
│ ├── Branch: Belgrade Main
│ │ └── Department: Customer Service
│ └── Branch: Novi Sad
├── Region: Croatia
│ └── Branch: Zagreb
└── Region: Bosnia
└── Branch: Sarajevo
Each group has a parent_id (NULL for root), depth, and a materialized path (e.g., "1/5/12") for fast ancestor/descendant queries.
Group Types
Define custom group types to match your organization: Region, Branch, Department, Team, etc. Each group is assigned a type for filtering and display.
Agent Scoping
Every agent belongs to a group via group_id. An agent can see data from:
- Its own group
- All descendant groups (children, grandchildren, etc.)
This is enforced by agentScoping.js using getSiblingScope() and scopedQuery.js with getGroupScope(). All CRM contacts, orders, pipelines, and other entities respect group scoping.
Knowledge Base Inheritance
Knowledge bases can be agent-specific OR group-shared. When an agent processes a query, RAG searches:
- Agent's own knowledge base
- Agent's group knowledge base
- All ancestor group knowledge bases (parent → grandparent → root)
This means a branch agent inherits company-wide knowledge while also having branch-specific info.
Structure UI
Manage groups in Dashboard → Structure. Features include: tree navigation, detail panel, drag-drop reorganization, search, and context menu for create/edit/delete/move operations.