> For the complete documentation index, see [llms.txt](https://docs.pharos.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/issue-tracker/issue-details/ai-analysis.md).

# AI Analysis

Leverage AI analysis functionality for root cause identification and remediation suggestions.

Pharos AI Analysis uses machine learning and pattern recognition to suggest root causes, recommend fixes, and surface similar issues across your organization. This accelerates troubleshooting by providing intelligent starting points for investigation.

{% hint style="info" %}
**Availability:** AI Analysis features vary by Pharos version and licensing. Check with your admin if this functionality doesn't appear in your org.
{% endhint %}

## What AI Analysis Provides

AI Analysis surfaces four kinds of guidance on an Issue: a suggested root cause, similar Issues in your org, resolution recommendations, and links to relevant documentation.

### Suggested Root Cause

Based on error patterns, stack traces, and historical data, AI suggests the most likely root cause.

**Example suggestions:**

| Error Type                        | AI Suggested Root Cause                                     |
| --------------------------------- | ----------------------------------------------------------- |
| **NullPointerException**          | "Missing null check before accessing related object field"  |
| **DmlException**                  | "Validation rule 'Industry\_Required' blocking record save" |
| **CPU\_TIME\_LIMIT\_EXCEEDED**    | "Inefficient SOQL query inside loop"                        |
| **Flow REQUIRED\_FIELD\_MISSING** | "Flow not populating Industry field before record creation" |

**How it helps:**

* Provides immediate hypothesis to investigate
* Saves time reviewing stack traces and code
* Especially valuable for admins without deep technical knowledge

### Similar Issues

AI identifies other Issues in your org with comparable patterns, even if fingerprints don't match.

**Displayed as:**

* List of related Issues
* Similarity score (e.g., 85% similar)
* Brief description of why they're similar

**Example:**

```
Similar Issues Found:

1. Issue #12345 (92% similar)
   - DML Exception in different trigger
   - Same validation rule blocking save
   - Resolved 2 months ago

2. Issue #67890 (78% similar)
   - Same object (Account)
   - Same error type (Required field missing)
   - Still open
```

**How it helps:**

* Learn from past resolutions
* Identify if current Issue is part of larger pattern
* Find team members who've solved similar problems

### Resolution Recommendations

AI suggests potential fixes based on error type and context.

**Example recommendations:**

| Error                             | Recommended Fix                                                                 |
| --------------------------------- | ------------------------------------------------------------------------------- |
| **NullPointerException line 156** | "Add null check: `if (acc != null && acc.Industry != null)` before line 156"    |
| **Validation rule blocking DML**  | "Either update validation rule criteria or populate Industry field before save" |
| **CPU timeout in loop**           | "Move SOQL query outside for loop to bulkify code"                              |
| **Flow missing required field**   | "Add Assignment element before Record Create to set Industry field"             |

**How it helps:**

* Immediate actionable guidance
* Reduces research time
* Educates less experienced developers

### Documentation Links

AI surfaces relevant Salesforce documentation, Trailhead modules, and known issues.

**Example links:**

* "Salesforce: Understanding Null Pointer Exceptions"
* "Trailhead: Bulkifying Your Code"
* "Known Issue: CPU timeout with nested loops in API v58"

**How it helps:**

* Direct access to official guidance
* Avoid reinventing solutions
* Stay current with platform changes

## How AI Analysis Works

AI Analysis draws on several data sources and machine learning models, and it keeps improving as you provide feedback.

### Data Sources

AI analyzes:

* **Stack traces** → Identifies code patterns and error types
* **Error messages** → Matches against known issue database
* **Historical Issues** → Learns from past resolutions in your org
* **Cross-Org Patterns** → Anonymized patterns from other Pharos customers
* **Salesforce Documentation** → Official docs and release notes
* **Code Context** → If available, reviews referenced code

### Machine Learning Models

Pharos combines several machine learning techniques to generate its suggestions, spanning pattern recognition, natural language processing, and continuous learning from your feedback.

**Pattern Recognition:**

* Clustering algorithms group similar errors
* Classification models categorize error types
* Anomaly detection flags unusual patterns

**Natural Language Processing:**

* Parses error messages for key terms
* Extracts meaningful context from logs
* Generates human-readable suggestions

**Continuous Learning:**

* When you mark suggestions helpful/not helpful, AI improves
* Learns from your org's resolution patterns
* Updates recommendations based on latest Salesforce releases

## Using AI Suggestions in Your Workflow

AI suggestions fit into a simple loop: review, validate, investigate similar Issues, apply and test a fix, then provide feedback.

### Step 1: Review AI Analysis Tab

When investigating an Issue:

1. Open Issue record
2. Navigate to **AI Analysis** tab or component
3. Review suggested root cause
4. Check similar issues

### Step 2: Validate Suggestion

AI provides a starting point, not definitive answer.

**Questions to ask:**

* Does suggested root cause align with stack trace?
* Have similar issues had successful resolutions?
* Is recommended fix appropriate for our org's architecture?

**Don't blindly trust AI:**

* Always review code yourself
* Test suggested fixes in sandbox first
* Consider org-specific context (custom validation rules, triggers, etc.)

### Step 3: Investigate Similar Issues

Click through to similar Issues:

1. Read their resolution comments
2. Check if fix is documented
3. Contact owner if questions arise
4. Adapt solution to current Issue

### Step 4: Apply and Test Fix

Implement recommended fix:

1. Make changes in sandbox
2. Test thoroughly
3. Deploy to production
4. Monitor for recurrence

### Step 5: Provide Feedback

Help AI improve:

* Mark suggestion as "Helpful" or "Not Helpful"
* Add comment explaining why (if not helpful)
* Document actual root cause (AI learns from this)

## AI Analysis for Different User Types

AI Analysis serves admins, developers, and managers differently, matching each role's needs.

### For Admins

**Use AI to:**

* Understand technical errors without deep coding knowledge
* Identify config-level fixes (validation rules, flows, process builders)
* Find similar Issues resolved by other admins

**Example:**

```
AI Suggestion: "Flow missing required field Industry"
Admin Action: Open flow, add Assignment element, deploy
Result: Fixed without involving developers
```

### For Developers

**Use AI to:**

* Get quick hypothesis before diving into code
* Find code patterns that worked for similar errors
* Identify platform-specific gotchas

**Example:**

```
AI Suggestion: "SOQL in loop causing CPU timeout"
Developer Action: Refactor to bulk query, test in sandbox
Result: Fixed governor limit issue
```

### For Managers

**Use AI to:**

* Assess resolution complexity (simple config vs. major refactor)
* Estimate fix time based on similar issue history
* Identify knowledge gaps in team (recurring error types)

**Example:**

```
AI shows: 5 similar NullPointerExceptions resolved in past 3 months
Manager Action: Schedule code review training on null safety
Result: Proactive team improvement
```

## AI Analysis Limitations

### What AI Can't Do

AI Analysis has three important limits: it can't replace human judgment, it can't access everything, and it can't guarantee correctness.

**Can't replace human judgment:**

* AI doesn't understand your business logic
* Can't account for org-specific customizations
* Doesn't know your deployment schedule or priorities

**Can't access everything:**

* May not have visibility into all custom code
* Can't read proprietary external systems
* Limited by data available in logs

**Can't guarantee correctness:**

* Suggestions are probabilistic, not certain
* Org context may differ from training data
* Platform changes may outdate recommendations

### When AI Falls Short

**Scenarios where AI may not help:**

| Scenario                    | Why AI Struggles                      | What to Do                       |
| --------------------------- | ------------------------------------- | -------------------------------- |
| **Highly custom code**      | No similar patterns in training data  | Manual code review required      |
| **External system errors**  | Limited visibility outside Salesforce | Check external system logs       |
| **Intermittent issues**     | Hard to pattern match                 | Use Tracing for more data        |
| **New Salesforce features** | Not in training data yet              | Consult Salesforce docs directly |

## Comparing AI Suggestions with Manual Investigation

### AI Analysis Workflow

With AI Analysis, investigation starts almost immediately after an Issue is created:

```
Issue created → AI analyzes (seconds)
            → Suggestions displayed
            → Developer reviews and validates
            → Implements fix
```

**Time saved:** 15-30 minutes of initial investigation

### Manual Investigation Workflow

Without AI, you work through the same early stages by hand:

```
Issue created → Developer reviews stack trace
            → Searches codebase for relevant classes
            → Checks Salesforce docs for error type
            → Reviews similar past issues manually
            → Formulates hypothesis
            → Implements fix
```

**Time:** 30-60 minutes before starting fix

**AI benefit:** Accelerates initial stages, doesn't replace deep investigation

## AI-Powered Features Roadmap

Pharos AI capabilities continue to evolve. Future enhancements may include:

* **Predictive analytics** → Forecast which Issues will regress
* **Auto-prioritization** → AI-suggested priority based on business impact
* **Code generation** → AI-written fix suggestions (Apex, Flow)
* **Impact prediction** → Estimate user impact before Issue occurs
* **Anomaly detection** → Proactive alerts on unusual error patterns

{% hint style="info" %}
Check release notes for latest AI features and capabilities.
{% endhint %}

## Providing Feedback to Improve AI

Your feedback trains the AI to better serve your org:

### Marking Suggestions

After reviewing AI suggestions:

* **Thumbs up** → Suggestion was accurate and helpful
* **Thumbs down** → Suggestion was inaccurate or unhelpful

### Adding Context

If suggestion wasn't helpful, explain why:

```
"Suggested root cause was incorrect. Actual issue was 
validation rule conflict, not null pointer."
```

This feedback:

* Improves AI for your org specifically
* Helps Pharos product team refine models
* Benefits broader Pharos community (anonymized data)

## AI Analysis and Privacy

### Data Usage

AI Analysis works from error and metadata content rather than from your records: it reads error messages, stack traces, and Issue metadata, but not the underlying record data, credentials, or business logic.

**What AI analyzes:**

* Error messages and stack traces
* Issue metadata (category, type, status)
* Resolution patterns (anonymized)

**What AI doesn't access:**

* Record data (PII, customer info)
* Credentials or auth tokens
* Proprietary business logic details

### Cross-Org Learning

AI learns from patterns across Pharos customers:

* All data is anonymized
* No org-identifying information shared
* Patterns only, not specific code or data

**Compliance:**

* Meets GDPR, HIPAA, SOC2 requirements
* Data never leaves Salesforce org (unless explicitly configured)
* Full audit trail of AI suggestions

{% hint style="success" %}
**Next Steps:**

* [Org Genie](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/issue-tracker/issue-details/org-genie.md) – Ask natural language questions about Issues
* [Resolution](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/issue-tracker/issue-lifecycle/resolution.md) – Full resolution workflow including AI tools
* [Debug Views](https://docs.pharos.ai/platform-overview/pharos-platform-architecture/issue-tracker/issue-details/debug-views.md) – Manual investigation of stack traces and errors
  {% endhint %}
