UNPKG

sf-agent-framework

Version:

AI Agent Orchestration Framework for Salesforce Development - Two-phase architecture with 70% context reduction

263 lines (192 loc) 5.19 kB
# Web Bundle Command Processor ## Overview This utility helps agents process slash commands when operating in web UI environments (ChatGPT, Gemini, Claude). ## Command Implementation Guide When a user types a slash command, process it according to this specification: ### \*help Display the complete list of available commands with descriptions and examples. ### \*status Show: - Current agent name and ID - Current phase (planning/development) - Context usage (approximate) - Active artifacts created in session - Current workflow step (if applicable) Example output: ``` 📊 Current Status: Agent: sf-architect (Solution Architect) Phase: Planning (128k context) Context Usage: ~45k tokens (35%) Artifacts Created: 3 - requirements.md - architecture.md - data-model.md Current Workflow: salesforce-implementation (Step 3/7) ``` ### \*agent <name> Switch to specified agent persona: 1. Save current agent state 2. Load new agent from embedded resources 3. Apply agent's specific context and dependencies 4. Confirm switch with greeting ### \*list-agents Display all available agents in the bundle: ``` Available Agents: - sf-architect: Solution Architecture - sf-developer: Apex & LWC Development - sf-admin: Configuration & Setup - sf-qa: Testing & Quality - sf-data-architect: Data Architecture [etc...] ``` ### \*transform <agent> For orchestrator mode: 1. Dynamically load agent configuration 2. Adopt agent persona while maintaining orchestrator capabilities 3. Keep workflow context intact ### \*phase <planning|development> Switch context mode: - Planning: 128k tokens, rich context, all documentation - Development: 32k tokens, lean context, focused on implementation ### \*workflow Start interactive workflow: 1. Present user with choices 2. Track decisions 3. Execute appropriate branches 4. Maintain state throughout ### \*task <task-name> Execute specific task: 1. Load task from embedded resources 2. Follow task instructions 3. Create specified outputs 4. Update artifact registry ### \*handoff <to-agent> Create formal handoff: 1. Package current artifacts 2. Generate handoff instructions 3. Specify requirements for next agent 4. Create transition summary ### \*artifacts List all artifacts created: ``` 📁 Session Artifacts: 1. requirements.md (Created: 10:30 AM) 2. architecture.md (Created: 10:45 AM) 3. data-model.md (Created: 11:00 AM) Total: 3 artifacts ``` ### \*save <artifact-name> Mark artifact as saved (for user tracking): ``` Marked 'requirements.md' as saved Remember to copy the content above to your local system ``` ### \*load <path> Load embedded resource: ``` Loading: .sf-core/templates/user-story-tmpl.yaml [Display content] ``` ### \*checkpoint Create session checkpoint: ``` 📌 Checkpoint Created: Time: 11:15 AM Agent: sf-architect Artifacts: 3 Decisions Made: 5 Next: Data model review ``` ### \*summary Generate work summary: ``` 📋 Session Summary: Duration: 45 minutes Agents Used: sf-architect, sf-developer Artifacts Created: 5 Key Decisions: - Chose brownfield approach - Selected event-driven architecture - Implemented approval process Next Steps: - Review security model - Create test cases ``` ### \*next-steps Suggest next actions: ``` 🎯 Suggested Next Steps: 1. Review and validate architecture document 2. Create detailed data model 3. Define integration patterns 4. Begin story creation Based on: Current workflow step 3/7 ``` ### \*capabilities Show current agent capabilities: ``` 🛠️ sf-architect Capabilities: - Solution design and architecture - Data model creation - Integration pattern selection - Security architecture - Performance optimization Available Tasks: 12 Available Templates: 8 ``` ### \*dependencies List loaded dependencies: ``` 📦 Loaded Dependencies: Templates: - architecture-tmpl.yaml - data-model-tmpl.yaml Tasks: - solution-design.md - data-model-design.md Checklists: - architecture-review-checklist.md Data: - salesforce-best-practices.md ``` ### \*templates Show available templates: ``` 📄 Available Templates: - user-story-tmpl.yaml - architecture-tmpl.yaml - data-model-tmpl.yaml - integration-design-tmpl.yaml Use: *load .sf-core/templates/<name> to view ``` ### \*checklists Show available checklists: ``` Available Checklists: - architecture-review-checklist.md - security-checklist.md - deployment-checklist.md - code-review-checklist.md Use: *load .sf-core/checklists/<name> to view ``` ## Implementation Notes 1. **State Management**: Maintain session state throughout conversation 2. **Context Awareness**: Track context usage and warn when approaching limits 3. **Artifact Tracking**: Keep registry of all created content 4. **Command History**: Remember command sequence for workflow continuity 5. **Error Handling**: Gracefully handle unknown commands with suggestions ## Command Aliases Support common variations: - _/help, _/h - _/status, _/s - _/agent, _/a - _/workflow, _/w - _/task, _/t ## Response Format Always format command responses clearly: - Use emojis for visual distinction - Include timestamps where relevant - Provide actionable information - Suggest next commands when appropriate