Overview
Labels enable rich classification of your sessions:Hierarchical
Organize labels into parent-child trees
Multi-Value
Apply multiple labels per session
Typed Values
Store strings, numbers, or dates with labels
Label Types
Boolean Labels (Presence-Only)
Simple tags that indicate a category:Valued Labels
Labels with associated data:Labels are stored as flat strings using
:: as the separator. The system automatically parses and types values based on the label’s valueType configuration.Default Label Configuration
New workspaces are initialized with organized label groups:packages/shared/src/labels/storage.ts
- Development (Blue Family)
- Content (Purple Family)
- Valued Labels
Parent: Development (#3B82F6)
- Code - Code changes and refactoring
- Bug - Bug fixes and issues
- Automation - Scripts and workflows
Label Configuration
Storage Location
Labels are stored at:Label Properties
packages/shared/src/labels/types.ts
Hierarchical Structure
Labels form a recursive tree:Array position determines display order - there’s no separate
order field. Reorder by rearranging array elements.Value Types
Labels can store typed values:String Values
Number Values
Date Values
CRUD Operations
Create Label
packages/shared/src/labels/crud.ts
Update Label
packages/shared/src/labels/crud.ts
Delete Label
packages/shared/src/labels/crud.ts
Move Label
packages/shared/src/labels/crud.ts
Reorder Labels
packages/shared/src/labels/crud.ts
Auto-Labeling
Labels can include regex rules that automatically extract values from user messages:Auto-Label Rules
packages/shared/src/labels/types.ts
Example: GitHub Issue Auto-Labeling
Example: Priority Auto-Labeling
Evaluation Flow
Code Example
packages/shared/src/labels/auto/evaluator.ts
Filtering & Search
Filter Sessions by Label
Parse Label Values
packages/shared/src/labels/values.ts
Tree Utilities
packages/shared/src/labels/tree.ts
UI Workflows
Typical user interactions in the Craft Agents SaaS:- Apply Labels
- Edit Labels
- Filter by Labels
During Session Creation
- Auto-labels extracted from first message
- User can add/remove labels manually
- Label picker shows hierarchical tree
- Recent labels appear at top
Storage Format
Labels are stored as flat string arrays on sessions:packages/shared/src/sessions/types.ts
Best Practices
Use Hierarchy for Related Labels
Group related labels under parent categories (Development → Code, Bug, Automation)
Combine Boolean and Valued Labels
Use boolean for categories (bug, feature) and valued for metadata (priority, project)
Configure Auto-Labeling for Common Patterns
Extract issue numbers, ticket IDs, and priorities automatically from messages
Performance Considerations
Auto-label evaluation runs on every user message. Keep regex patterns efficient and limit the number of rules per label.
- Code block stripping prevents false matches in code examples
- 10-match cap prevents label explosion from large pastes
- Deduplication ensures each label+value combination appears once
- Tree flattening is cached during storage load
Next Steps
Session Overview
Learn about session persistence and storage
Status System
Understand exclusive status vs additive labels