Agentforce Deep Planning
Agentforce Deep Planning transforms how you build complex Salesforce features by investigating your codebase, understanding your architecture, and creating comprehensive implementation plans before writing a single line of code.
Deep Planning requires models with strong reasoning capabilities. It works best with the latest generation of models, like GPT-5, Claude 4, Gemini 2.5, or Grok 4. Smaller models may struggle with the comprehensive analysis required.
When you use Deep Planning with Agentforce, you follow a four-step process that mirrors how experienced Salesforce developers approach complex features: thorough investigation, discussion and clarification of requirements, detailed planning, and structured task creation with progress tracking.
Agentforce becomes a detective, silently exploring your Salesforce codebase to understand its structure, patterns, and constraints. The investigation is methodical and thorough—Agentforce reads files and executes commands without commentary or narration. This silent research continues until the codebase is fully understood.
During investigation, Agentforce:
- Examines Apex classes, triggers, and their methods.
- Analyzes Lightning Web Component files and dependencies.
- Discovers custom objects, fields, and relationships.
- Reviews validation rules, workflows, and automation patterns.
- Identifies test coverage patterns and technical debt markers.
- Explores configuration files and deployment structures.
The quality of this investigation directly impacts the success of your implementation. Agentforce speaks up only when specific questions arise that require your input.
Once Agentforce understands your codebase, it asks brief, targeted questions that shape the implementation. These questions are conversational and specific to your Salesforce org and the feature you're building. Agentforce asks only when necessary—when the answer will directly influence the implementation plan.
Questions arise for:
- Clarifying ambiguous requirements or specifications.
- Choosing between multiple equally valid implementation approaches.
- Confirming assumptions about existing system behavior or constraints.
- Understanding preferences for specific technical decisions.
Your responses help Agentforce create an accurate, tailored implementation plan for your org.
Agentforce creates a structured implementation plan document that serves as your development blueprint. This isn't a vague outline—it's a detailed specification with exact file paths, method signatures, and implementation order.
Agentforce creates a task that references the plan document and includes trackable implementation steps. The task is self-contained—it doesn't require additional codebase investigation because all necessary information is in the plan document.
Your implementation steps become a progress-tracked list with real-time updates, keeping complex projects organized and on track.
Start Deep Planning by using the /deep-planning slash command. You can start in Plan or Act modes, but you must move to Act mode to create the implementation file.
After initiating Deep Planning, describe your feature requirements. Agentforce begins investigation immediately, examining your Salesforce configuration and existing patterns. After gathering context, Agentforce engages you in discussion before creating the implementation plan.
Here's how Deep Planning works for a real Lightning Web Component implementation:
1. Initiate Planning
Request: "Build a Lightning Web Component that displays contacts with inline favorite toggling"
2. Silent Investigation
Agentforce explores your codebase and examines:
- Existing Contact object schema and custom fields.
- Current Apex controller patterns for Contact queries.
- Lightning Web Component structure and naming conventions.
- Jest test setup and ESLint configuration.
- Field-level security patterns in existing code.
3. Targeted Discussion
Agentforce asks:
- "Should the favorite field be
Favorite__cor do you have an existing field name?". - "Do you need cross-component synchronization when favorites change?".
- "Should this component be available on Contact record pages, app pages, or both?".
- "What contact fields should display in the list: Email, Phone, or others?".
4. Plan Creation
Agentforce generates an implementation plan document with:
[Overview]: Deliver a Lightning Web Component displaying Contacts with inline favorite toggling using the custom Favorite__c field. Leverages existing ContactController Apex class with new methods for data access and mutation. Implements optimistic UI updates, field-level security enforcement, and accessibility standards.
[Types]:
- ContactRow interface: Id, Name, Email, Phone, Favorite__c
- ToggleResult interface: success, message, updatedRecord
- Validation: Favorite__c is boolean, graceful handling of null Email/Phone
[Files]:
- New:
force-app/main/default/lwc/contactFavorites/(html, js, css, meta.xml) - New:
force-app/main/default/lwc/contactFavorites/__tests__/contactFavorites.test.js - Modify:
force-app/main/default/classes/ContactController.cls - Modify:
force-app/main/default/classes/ContactController.cls-meta.xml
[Functions]:
- LWC:
wiredGetContacts(wire adapter),handleToggleFavorite(event handler),showToast(utility) - Apex:
getContacts()(cacheable query),toggleContactFavorite(Id, Boolean)(imperative update)
[Classes]:
- Modify ContactController: Add FLS checks with
Schema.sObjectType.Contact.fields.Favorite__c.isUpdateable(), implement try/catch for DML operations, return updated record or throwAuraHandledException
[Dependencies]:
- Continue using
@salesforce/sfdx-lwc-jestfor unit tests - Import
lightning/platformShowToastEventfor user notifications - No new npm packages required
[Testing]:
- LWC Jest: Mock wire adapter, test toggle optimistic UI, verify rollback on error, check accessibility attributes
- Apex: Test getContacts returns required fields, test toggle happy path, test FLS denial handling, test invalid Id exception
[Implementation Order]:
- Update ContactController with getContacts and toggleContactFavorite methods.
- Scaffold contactFavorites LWC with wire and imperative Apex calls.
- Write Jest and Apex unit tests.
- Run ESLint and Prettier.
- Deploy to sandbox and validate on Lightning App Page and Contact Record Page.
5. Task Generation
Agentforce creates a task with:
- Reference to the implementation plan.
- Commands to read specific sections.
- Trackable items for each implementation step.
- Clear success criteria for validation.
Use Deep Planning for:
- Features touching multiple parts of your codebase.
- Architectural changes requiring careful coordination.
- Complex integrations with external services.
- Refactoring efforts that need systematic execution.
- Any feature where you'd normally spend time whiteboarding.
Let Agentforce complete its investigation thoroughly. The quality of the plan directly correlates with how well it understands your codebase. If you have specific areas you want examined, mention them in your initial request.
Always review the implementation plan before starting development. The plan is comprehensive but not immutable, so you can edit it directly if needed. Think of it as a collaborative document between you and Agentforce.
The plan uses precise technical language with exact file paths, function names, and class names. It considers real-world constraints like governor limits, field-level security, and deployment dependencies. This level of detail ensures successful execution without requiring additional investigation.
Your implementation progress displays with real-time tracking. Agentforce automatically checks off each completed step as you work through the plan, giving you visibility into complex implementations.
The Overview sets implementation context, while Types defines data contracts. Together, these sections ensure everyone understands what's being built and how data flows through the system.
Files maps the file system changes, while Functions details the methods within those files. These sections provide the concrete implementation specification developers need.
Classes focuses on Apex-specific patterns like field-level security (FLS) checks and exception handling. Dependencies ensures all required packages and modules are available before implementation begins.
Testing defines validation criteria, while Implementation Order sequences execution. Following this order respects metadata dependencies and includes checkpoints for catching issues early.