sf-agent-framework
Version:
AI Agent Orchestration Framework for Salesforce Development - Two-phase architecture with 70% context reduction
368 lines (287 loc) • 7.72 kB
Markdown
# Document Folder Management Utility - Agent Instructions
## Purpose
This utility provides instructions for AI agents to generate automated document
folder structure creation and management solutions for Salesforce projects,
ensuring consistent organization across all implementations.
## Agent Instructions
### When to Generate Document Management
Generate document management components when:
- Projects need standardized folder structures
- Teams require consistent documentation organization
- Workflows need automated folder creation
- Document templates need proper organization
- Multi-team projects need shared structure
- Compliance requires specific folder hierarchies
- Artifacts need systematic storage
### Core Components to Generate
#### 1. Folder Structure Manager
Generate a class that:
- Creates standardized folder hierarchies
- Validates folder naming conventions
- Ensures required folders exist
- Manages folder permissions
- Tracks folder usage and contents
- Archives old project folders
Key capabilities:
- Role-based folder templates
- Workflow-specific structures
- Dynamic folder creation
- Permission management
- Usage analytics
- Cleanup automation
#### 2. Document Organizer
Create components that:
- Categorize documents by type
- Apply naming conventions
- Move files to correct folders
- Maintain document indexes
- Track document versions
- Generate folder README files
#### 3. Template Manager
Implement template handling for:
- Document templates per folder
- Folder-specific README templates
- Index file generation
- Metadata tracking
- Template versioning
- Custom template creation
### Configuration Requirements
#### Folder Structure Configuration
```yaml
folder_structures:
# Core Management Folders
project_management:
- planning/
- planning/roadmaps/
- planning/timelines/
- planning/budgets/
- status-reports/
- meeting-notes/
# Technical Documentation
technical:
- architecture/
- architecture/solution-design/
- architecture/data-models/
- architecture/integration/
- architecture/security/
- api-documentation/
- code-documentation/
# Business Documentation
business:
- requirements/
- requirements/functional/
- requirements/non-functional/
- requirements/user-stories/
- process-flows/
- business-cases/
# Quality Assurance
quality:
- test-plans/
- test-cases/
- test-results/
- bug-reports/
- performance-reports/
- quality-metrics/
# Deployment & Operations
operations:
- deployment-guides/
- runbooks/
- monitoring/
- incident-reports/
- maintenance-logs/
- backup-procedures/
```
#### Metadata Configuration
```yaml
Document_Metadata__c:
- Document_Name__c (Text)
- Folder_Path__c (Text)
- Document_Type__c (Picklist)
- Created_Date__c (DateTime)
- Last_Modified__c (DateTime)
- Author__c (Text)
- Version__c (Text)
- Tags__c (Multi-Picklist)
Folder_Structure__c:
- Path__c (Text)
- Parent_Folder__c (Lookup)
- Folder_Type__c (Picklist)
- Required__c (Checkbox)
- Description__c (Text Area)
- Template_Files__c (Long Text)
```
### Implementation Patterns
#### Role-Based Structure Pattern
1. Define role-specific folders
2. Map roles to folder sets
3. Create on role activation
4. Validate completeness
5. Track usage by role
#### Workflow-Based Pattern
1. Define workflow folder needs
2. Create structure on workflow start
3. Add workflow-specific folders
4. Ensure handoff folders exist
5. Archive on completion
#### Dynamic Creation Pattern
1. Monitor document creation
2. Detect missing folders
3. Create folders as needed
4. Apply permissions
5. Update indexes
### Folder Creation Logic
#### Base Structure Creation
```
1. Check for base docs/ directory
2. Create if missing
3. Apply base permissions
4. Create root README
5. Initialize folder index
```
#### Role-Specific Creation
```
For each active role:
1. Get role folder template
2. Check existing folders
3. Create missing folders
4. Copy template files
5. Set permissions
6. Update role index
```
#### Validation Process
```
1. Scan folder structure
2. Compare to requirements
3. Identify missing folders
4. Check naming compliance
5. Verify permissions
6. Report discrepancies
```
### Document Organization Rules
#### Naming Conventions
- Use lowercase with hyphens
- Include date prefix for versions
- Add status suffix when needed
- Follow pattern: `{date}-{type}-{name}-{status}`
- Example: `2024-01-15-requirements-phase1-draft`
#### Categorization Rules
- Technical docs → technical folders
- Business docs → business folders
- Test artifacts → quality folders
- Deployment docs → operations folders
- Meeting notes → project management
#### Version Control Integration
- Track document versions
- Maintain version history
- Link to source control
- Tag major versions
- Archive old versions
### Automation Features to Implement
#### Auto-Organization
1. **Document Scanner**
- Scan for new documents
- Identify document type
- Determine target folder
- Move to correct location
- Update indexes
2. **Folder Monitor**
- Watch folder changes
- Validate structure
- Alert on violations
- Auto-correct issues
- Report metrics
3. **Cleanup Automation**
- Identify stale documents
- Archive old projects
- Remove empty folders
- Compress large files
- Generate reports
### Integration Requirements
#### CI/CD Integration
- Include in build process
- Validate folder structure
- Check document completeness
- Generate documentation
- Package artifacts
#### Collaboration Tools
- SharePoint sync
- Google Drive integration
- Confluence export
- Teams/Slack notifications
- Email alerts
#### Salesforce Integration
- Files/Attachments sync
- Knowledge article links
- Chatter folder updates
- ContentDocument mapping
- Library management
### Best Practices to Implement
1. **Structure Standards**
- Maximum 3 levels deep
- Clear folder purposes
- Consistent naming
- Logical grouping
- Easy navigation
2. **Documentation Standards**
- README in each folder
- Template availability
- Clear descriptions
- Usage examples
- Maintenance guides
3. **Access Control**
- Role-based permissions
- Folder-level security
- Read/write controls
- Audit trail
- Regular reviews
4. **Maintenance Practices**
- Regular cleanup schedules
- Archive strategies
- Size monitoring
- Performance optimization
- Backup procedures
### Error Handling Instructions
Handle these scenarios:
1. Permission denied errors
2. Path length limitations
3. Invalid characters in names
4. Disk space issues
5. Network folder access
Recovery strategies:
- Graceful error messages
- Alternative path suggestions
- Permission escalation
- Space cleanup options
- Retry mechanisms
### Monitoring and Reporting
Generate reports for:
- Folder structure compliance
- Document organization metrics
- Storage utilization
- Access patterns
- Cleanup recommendations
Dashboard metrics:
- Total documents by type
- Folder utilization rates
- Growth trends
- Compliance scores
- User activity
### Advanced Features to Consider
1. **AI-Powered Organization**
- Auto-categorization
- Smart folder suggestions
- Content-based filing
- Duplicate detection
- Relevance scoring
2. **Workflow Integration**
- Automatic handoffs
- Status-based organization
- Approval folder routing
- Stage gates
- Completion triggers
3. **Search Enhancement**
- Full-text indexing
- Metadata search
- Tag-based retrieval
- Related documents
- Smart recommendations