Skip to main content

Welcome to Apex AI Brain

License: MIT Salesforce Powered by Claude & Gemini Architecture: FSD PRs Welcome Version: 1.0.0

Tired of AI generating code that violates Salesforce governor limits? Apex AI Brain enforces best practices automatically.

Apex AI Brain is an enterprise-grade, multi-agent AI framework that generates production-ready Salesforce code with built-in guardrails, not hallucinations.

What Problem Does This Solve?​

Generic AI coding assistants (Copilot, ChatGPT, Claude) were trained on web patterns that don't work in Salesforce. They generate:

  • Non-bulkified code that hits governor limits
  • Triggers instead of Flows
  • Synchronous operations causing timeouts
  • Hardcoded IDs and insecure queries
  • Incorrect folder structures

Apex AI Brain solves this by:

  • Injecting Salesforce rules directly into the AI's prompts
  • Validating every generated line against 50+ governance rules
  • Using multi-agent orchestration for complex tasks
  • Tracking costs and tokens in real-time
  • Enforcing Feature-Sliced Design (FSD) architecture

Enterprise-Grade Salesforce AI Architecture System​

Apex AI Brain is an agentic framework and prompt architecture designed to transform enterprise AI into a strict, best-practice-enforcing Salesforce architect.

Instead of relying on generic AI knowledge (which often hallucinates standard web patterns that violate Salesforce limits), this system injects strict governor limits, bulkification rules, and Feature-Sliced Design (FSD) folder structures directly into the AI's reasoning.

Core Purpose​

Think of Apex AI Brain as architectural ESLint rules for AI. By utilizing this framework, you force the AI to:

  • Write bulkified, WITH USER_MODE compliant Apex
  • Choose Flows over Triggers where appropriate
  • Follow strict LWC data-binding patterns
  • Adhere to an enterprise folder structure
  • Enforce Salesforce governor limits
  • Generate production-ready code with guardrails

Key Features​

FeatureDescription
16 Specialized AgentsEach agent focuses on a specific Salesforce domain (Apex, LWC, Flows, SOQL, etc.)
Multi-Model AISeamless integration with Claude & Google Gemini for optimal performance
Context AwarenessDeep project scanning to understand existing architecture
Token TrackingReal-time cost tracking across multiple AI models
Guardrails & SecurityEnforced best practices and security patterns
Feature-Sliced DesignFSD folder structure enforcement for scalability
CLI-First InterfacePowerful terminal-based commands for rapid development

📦 What's Included​

├── 16 Specialized Agents # Domain-specific AI assistants
├── CLI Tool (sfai) # Terminal interface
├── Context Engine # Project analysis & scanning
├── AI Client Layer # Multi-model API integration
├── Token Tracker # Cost & usage monitoring
└── Memory System # Persistent context management

🏗 Architecture Overview​

Apex AI Brain uses a multi-agent orchestration pattern where:

  1. Context Scanner analyzes your Salesforce project
  2. Planner Agent breaks down feature requests into atomic tasks
  3. Specialized Agents (Architect, LWC Builder, SOQL Optimizer, etc.) execute focused tasks
  4. Reviewers & Validators ensure output meets Salesforce best practices
  5. Memory System maintains shared context across agent interactions

🔄 Typical Workflow​

# 1. Initialize your project
sfai /init

# 2. Get project status
sfai /status

# 3. Plan a feature
sfai /plan "Add customer portal with LWC"

# 4. Let agents build it
sfai /spawn architect "Design the data model"
sfai /spawn lwc-builder "Create the portal component"

# 5. Review generated code
sfai /review

# 6. Check token costs
sfai /tokens

🏆 Who Should Use This?​

  • Enterprise Salesforce Teams - Need structured, scalable development
  • Architects - Want AI that follows your standards
  • Development Leads - Enforcing code quality and patterns
  • Freelancers - Building professional Salesforce solutions at scale

🤝 Contributing​

We welcome contributions! See Contributing Guide for details.

📄 License​

MIT License - See LICENSE file.


Next Steps​

Ready to get started? Head to the Installation Guide!

Have questions? Check out the Frequently Asked Questions or browse the full documentation.