File Classification System
Status: Complete
Last Updated: 2025-08-23
Overview
Sasha Studio features an intelligent file classification system that automatically categorizes markdown files based on their directory structure, providing visual badges and organized navigation.
Classification Categories
Primary Categories
| Category | Color | Directory | Description |
|---|---|---|---|
| Specialist | Purple | specialists/ |
AI specialist configuration files |
| Guide | Green | guides/ |
Implementation guides and tutorials |
| Prompt | Orange | prompts/ |
Instructions and AI prompts |
| Tutorial | Teal | getting-started/ |
Learning resources |
| Case Study | Violet | case-studies/ |
Real-world examples |
| Policy | Red | policies/ |
Standards and policies |
Special Categories
| Category | Color | Trigger | Description |
|---|---|---|---|
| System | Gray | Files starting with "CLAUDE" | System configuration files |
| Uploaded | Amber | uploads/ directory |
User uploaded documents |
| Converted | Indigo | converted/ directory |
Processed/converted files |
| Knowledge | Blue | local/ directory |
Organizational knowledge |
Default Classification
- Research (Sky Blue): Default for all other markdown files, especially app-created content
Technical Implementation
Path-Segment Mapping
The system uses an elegant path-segment approach:
const getFileTypeInfo = (filePath, fileName) => {
// Special case: Files starting with "CLAUDE" are system files
if (fileName.toUpperCase().startsWith('CLAUDE')) {
return { label: 'System', className: '...', tooltip: '...' };
}
// Split path and check each segment
const segments = filePath.split('/');
for (const segment of segments) {
if (TYPE_MAP[segment]) {
return TYPE_MAP[segment];
}
}
// Default to Research
return { label: 'Research', ... };
};
Benefits
Path-Agnostic: Works regardless of full path format
specialists/file.mddocs/specialists/file.md/home/nodejs/all-project-files/docs/specialists/file.md
Maintainable: Single source of truth in
TYPE_MAPobjectExtensible: Easy to add new categories without code changes
Consistent: Works in both Docker and local development
UI Integration
File Tree Display
- Files show colored badges next to their names
- Tooltips provide additional context
- Categories are counted and displayed in intelligence banner
Intelligence Banner
Shows breakdown of file types:
π Sasha's Intelligence System (43 files)
[7 Specialists] [15 Guides] [8 Prompts] [3 Uploaded] [1 System] [9 Research]
Migration Notes
Changes from Previous System
- Path Matching: Changed from string inclusion (
includes('/specialists/')) to segment matching - Default Category: Changed from "Knowledge" to "Research"
- New Categories: Added Uploaded, Converted, and System classifications
- Filename-Based: Added special handling for CLAUDE configuration files
Backward Compatibility
- All existing files maintain their classifications
- No data migration required
- Existing directory structures work without changes
File Location
Implementation: claudecodeui/src/components/FileTree.jsx lines 875-950
Key Functions:
getFileTypeInfo()- Main classification logiccountFilesByType()- Category counting for UI- Classification display in intelligence banner
Future Enhancements
- Custom Categories: Allow users to define custom directory-based categories
- Tag-Based: Support metadata-based classification beyond directories
- Smart Suggestions: Suggest appropriate directories for new files
- Bulk Operations: Actions based on file categories (e.g., "Convert all Uploaded files")