salesforce-apex-log-analyzer-skill
T1 read-only runtime skill for Apex debug log retrieval and analysis. This skill is a
diagnostic flashlight — it retrieves log content, identifies governor-limit hits,
surfaces SOQL N+1 patterns, traces exceptions, and produces a prioritized finding report.
It does not execute code, mutate data, or deploy anything.
When This Skill Owns the Task
Use salesforce-apex-log-analyzer-skill when the work requires log-based diagnosis:
- "Why is my Account trigger hitting a governor limit?"
- "Analyze the debug log from my sandbox — it shows a heap size limit"
- "This trigger is slow — can you read the log and find the SOQL bottleneck?"
- "I got an unhandled exception in my batch job — here is the log"
- "Check if my Queueable is completing successfully in the async log"
- "Retrieve the latest log for user jsmith@myorg.sandbox and diagnose it"
Delegate elsewhere when:
| Situation |
Skill to use |
| User wants to run Apex tests (not read logs) |
salesforce-apex-test-runner-skill |
| Static code review without log evidence |
salesforce-apex-lwc-code-review-skill |
| Generate a fix for the identified code problem |
salesforce-apex-generator-skill |
| Agentforce session traces / parquet telemetry |
salesforce-agentforce-stdm-observer-skill |
| SOQL query performance analysis without logs |
salesforce-soql-explorer-skill |
Required Context to Gather First
Before retrieving or analyzing any log, confirm:
- Target org alias — the
--target-org value from sf org list.
- Log identifier — log ID, log file path, user/transaction context, or timeframe.
Accept a pasted log file if the user provides one directly.
- Transaction context — which trigger, class, batch job, or user action generated the log.
- Goal — governor-limit diagnosis, exception trace, performance analysis, or all.
- Sensitivity level — does the log likely contain PII (email, phone, record data from
regulated objects)? Apply stricter redaction if so.
Recommended Workflow
Step 1 — Verify org alias and reachability
sf org display --target-org <alias>
Confirm the org is reachable. Note org type (production vs sandbox) for the audit envelope.
Apply stricter scrutiny for production org logs — log content may contain PII.
Step 2 — List available logs
sf apex get log --list --target-org <alias>
Identify the relevant log(s) by user, timestamp, and log type. If the user provides a log ID,
skip this step and proceed to Step 3.
Step 3 — Retrieve the log
Option A — specific log by ID:
sf apex get log \
--log-id <logId> \
--target-org <alias>
Option B — latest log for current user:
sf apex get log \
--number 1 \
--target-org <alias>
Option C — tail live logs (non-blocking diagnostic):
sf apex tail log \
--target-org <alias> \
--color
Option D — user has pasted log content directly:
Accept the pasted content and proceed to Step 4.
Step 4 — Parse the log in order
Analyze in this sequence per references/log-format-reference.md:
- Entry point — identify transaction type (Apex class invocation, trigger, REST callout, batch execute)
- Fatal errors and unhandled exceptions —
FATAL_ERROR and EXCEPTION_THROWN lines
- Governor limit hits —
LIMIT_USAGE_FOR_NS entries; compare to limits in references/governor-limit-signatures.md
- SOQL patterns —
SOQL_EXECUTE_BEGIN / SOQL_EXECUTE_END pairs; look for repeated queries in loop context
- DML patterns —
DML_BEGIN / DML_END pairs; check for loop context
- CPU hotspots — high cumulative CPU entries; identify top consumers
- Heap usage —
HEAP_ALLOCATE patterns; identify large collection accumulation
- Async job indicators —
ENTERING_MANAGED_PKG, CALLOUT_REQUEST, FUTURE_CALL_PROCESS
Step 5 — Classify findings by severity
| Severity |
Criteria |
| Critical |
Runtime failure, hard limit hit, unhandled exception, data corruption risk |
| Warning |
Near-limit (>75% of a governor limit), non-selective SOQL, slow DML path |
| Info |
Optimization opportunity, hygiene issue, async pattern note |
Step 6 — Apply redaction
Apply all redaction rules (see Redaction Rules section) before emitting any log excerpt
in output. Never echo raw log lines containing record IDs, user IDs, or PII field values.
Step 7 — Emit findings with audit envelope
Score findings against the quality rubric (see below). Emit the full audit envelope.
Propose the smallest correct fix for each Critical and Warning finding.
Step 8 — Route to repair skill
If a code fix is needed, hand off to salesforce-apex-generator-skill with the
specific finding as context. If a deeper test run is needed, route to
salesforce-apex-test-runner-skill.
Quality Scoring Rubric (100-point)
Score the analysis quality before presenting. Threshold: 80+ acceptable.
| Dimension |
Points |
What earns full marks |
| Governor-limit identification |
25 |
All governor limit hits identified with limit name, current value, and limit ceiling; near-limit warnings included |
| Root cause clarity |
25 |
Each finding traces to a specific class, method, and line number; not just "SOQL limit hit" but "AccountSelector.getByOwner line 45 in loop at TriggerHandler line 12" |
| SOQL N+1 detection |
15 |
Repeated SOQL_EXECUTE_BEGIN entries in loop context identified and the responsible pattern named |
| Sanitization quality |
15 |
All record IDs, user IDs, and PII values redacted in output; no raw log lines echoed; audit envelope populated |
| Handoff routing |
10 |
Each Critical/Warning finding includes a specific next action and the skill to route to |
| Audit envelope |
10 |
All required fields present; log ID hashed if PII risk; timestamp accurate |
Scoring penalties:
- Raw log lines with record IDs echoed: -20 (immediate caveat)
- Governor limit hit identified but not traced to source: -15
- SOQL in loop not flagged: -15
- Missing audit envelope: -15
- PII field values in output: score voided (immediate reject)
T1 Least-Privilege Contract
This skill operates at T1 — read-only runtime.
- OAuth scopes:
api and refresh_token only.
- Run As account permissions:
- REQUIRED:
View Setup and Configuration
- DENIED:
ModifyAllData, ViewAllData, ViewEncryptedData, ModifyMetadata,
AuthorApex, ManageConnectedApps
- No View All Data: Unlike the test runner skill, this skill does NOT require
View All Data. Log retrieval uses sf apex get log which operates under the
View Setup and Configuration permission scope.
- Read-only: Retrieves log content only. No code execution, no DML, no metadata change.
- Log content sensitivity: Debug logs may contain field values from records processed
during the transaction. Apply PII redaction rules strictly.
Audit Envelope Schema
audit_envelope:
matter_id: "<caller-provided-or-generated-uuid>"
skill_id: "salesforce-apex-log-analyzer-skill"
skill_version: "0.1.0"
target_org_alias: "<alias>"
run_as_user_id: "<user_id_placeholder>"
org_type_verified: "sandbox | production | unknown"
log_id: "<log-id-or-hash-if-pii-risk>"
log_size_bytes: <integer>
transaction_entry_point: "<class or trigger name>"
timestamp: "<ISO-8601-UTC>"
pii_risk_assessed: true | false
redactions_applied:
- field_or_pattern: "<pattern>"
reason: "<record_id|user_id|pii|session_token>"
findings_count:
critical: <integer>
warning: <integer>
info: <integer>
Output Format
verdict: "acceptable | caveat | reject"
quality_score: <0-100>
quality_notes: "<scoring rationale>"
transaction_summary:
entry_point: "<class/trigger/batch>"
transaction_type: "<trigger|class|batch|queueable|schedulable|rest>"
org_alias: "<alias>"
org_type: "sandbox | production | unknown"
findings:
critical:
- finding: "<title>"
location: "<ClassName.method line N>"
evidence: "<redacted log excerpt>"
governor_limit: "<limit name if applicable>"
current_value: <integer>
limit_ceiling: <integer>
suggested_fix: "<specific remediation>"
route_to: "<skill or action>"
warning:
- finding: "<title>"
location: "<ClassName.method line N>"
evidence: "<redacted log excerpt>"
suggested_fix: "<specific remediation>"
info:
- finding: "<title>"
notes: "<optimization or hygiene note>"
soql_analysis:
total_queries: <integer>
governor_limit: 100
n_plus_1_patterns:
- query_excerpt: "<SELECT ... FROM ...>"
invocation_count: <integer>
loop_context: "<loop location>"
suggested_fix: "<move SOQL outside loop; use Map pattern>"
non_selective_queries: ["<query excerpt>"]
cpu_analysis:
total_cpu_ms: <integer>
cpu_limit_ms: 10000
hotspots: ["<ClassName.method: N ms>"]
heap_analysis:
peak_heap_bytes: <integer>
heap_limit_bytes: 6291456
large_allocations: ["<description>"]
audit_envelope:
<see Audit Envelope Schema>
next_steps:
- "<Critical/Warning: route to salesforce-apex-generator-skill for fix>"
- "<if tests needed after fix: salesforce-apex-test-runner-skill>"
assumptions:
- "<explicit list>"
missing_evidence:
- "<what additional log context would help>"
Redaction Rules
Apply in order before emitting any output. Never bypass for any reason.
- OAuth tokens, refresh tokens, session IDs: Never include. Strip from any CLI output.
- Salesforce Org IDs (18-char starting with
00D): Replace with <org_id_placeholder>.
- Salesforce Record IDs (15/18-char alphanumeric): Replace with
<record_id_placeholder>
in all log excerpts. Record IDs appear frequently in USER_DEBUG, DML_BEGIN, and
SOQL_EXECUTE_BEGIN lines.
- User IDs (OwnerId, CreatedById, Running User ID, User.Id): Replace with
<user_id_placeholder>.
- Email addresses in log output: Replace with
<email_placeholder> unless the user
explicitly acknowledges PII scope and the org is non-production.
- Phone numbers, SSNs, financial account numbers in log output: Replace with
<pii_placeholder>. Flag in redactions_applied.
- Session tokens and access tokens in USER_DEBUG lines: Strip entirely. Do not include
a placeholder that implies a token value was present.
- Instance URLs: Replace with org alias in output. Do not emit raw instance URLs.
- Stack traces: Retain class names and line numbers — required for diagnosis. Replace
any record IDs embedded in exception messages.
Handoff Rules
| Finding |
Hand off to |
| Code fix needed (SOQL in loop, DML pattern, exception handling) |
salesforce-apex-generator-skill |
| Test coverage gap surfaced by log |
salesforce-apex-test-generator-skill |
| Verification run needed after fix |
salesforce-apex-test-runner-skill |
| Permission or FLS finding in log |
salesforce-permission-model-review-skill |
| Agentforce / Einstein AI trace in log |
salesforce-agentforce-stdm-observer-skill |
| Critical finding needing deployment review |
salesforce-deployment-validator-skill |
Required handoff fields: matter_id, audit_envelope, findings (sanitized), next_steps.
Stop Conditions
Stop and do not continue if:
- Log retrieval fails and the user cannot provide log content directly — stop and explain
that a log ID, user context, or pasted log content is required.
- Log content contains fields identified as encrypted (Shield PE / PMLE) — skip those
entries, note the redaction, and analyze the remainder.
- The audit envelope cannot be completed — stop until matter_id or org alias is resolved.
- The user requests redaction to be disabled — stop and explain the policy.
- Log content is from a production org and contains PII fields — apply maximum redaction;
if PII is pervasive and the matter classification does not permit, stop and escalate to
the compliance specialist.
Security Notes
- T1 read-only runtime: No code execution, no DML, no metadata mutation.
- No View All Data required: Log retrieval operates under
View Setup and Configuration
only. This distinguishes this skill from the test runner and reduces its permission footprint.
- Log content sensitivity: Apex debug logs may capture field values, user data, and API
payloads. PII and encrypted field redaction is mandatory.
- Sanitized output only: All record IDs, user IDs, session tokens, and PII values
redacted before emission. Raw log lines are never echoed.
- Structured audit: Every execution produces a complete audit envelope including
pii_risk_assessed and redactions_applied fields.
- Revocable: Rotating the Run As account's refresh token immediately revokes all access.
Reference File Index
| File |
When to read |
references/log-format-reference.md |
Apex log levels, log line categories (USER_DEBUG, METHOD_ENTRY, SOQL_EXECUTE_BEGIN, LIMIT_USAGE_FOR_NS, FATAL_ERROR, etc.) |
references/governor-limit-signatures.md |
Common governor limit hit patterns, limit ceilings, and remediation strategies |
references/redaction-rules.md |
Detailed redaction patterns for record IDs, user IDs, session tokens, PII field values; jq and grep patterns for automated stripping |
1---2name: salesforce-apex-log-analyzer-skill3description: Retrieves and analyzes Apex debug logs from a connected Salesforce org to identify governor-limit hits, SOQL N+1 patterns, unhandled exceptions, and async job failures. T1 read-only runtime — retrieves logs only, never executes code or mutates data. TRIGGER when: user asks to analyze an Apex log, debug a trigger failure, diagnose a governor limit hit, interpret a stack trace from a Salesforce org, or review a DEBUG log for performance issues. Trigger phrases: analyze apex log, debug this trigger, why is my trigger failing, governor limit hit, DEBUG log analysis, check my log file. DO NOT TRIGGER when: user wants to run live tests (use salesforce-apex-test-runner-skill), static code review without logs (use salesforce-apex-lwc-code-review-skill), generating new Apex code (use salesforce-apex-generator-skill), or Agentforce session telemetry (use salesforce-agentforce-stdm-observer-skill).4license: MIT5---67# salesforce-apex-log-analyzer-skill89T1 read-only runtime skill for Apex debug log retrieval and analysis. This skill is a10**diagnostic flashlight** — it retrieves log content, identifies governor-limit hits,11surfaces SOQL N+1 patterns, traces exceptions, and produces a prioritized finding report.12It does not execute code, mutate data, or deploy anything.1314## When This Skill Owns the Task1516Use `salesforce-apex-log-analyzer-skill` when the work requires **log-based diagnosis**:1718- "Why is my Account trigger hitting a governor limit?"19- "Analyze the debug log from my sandbox — it shows a heap size limit"20- "This trigger is slow — can you read the log and find the SOQL bottleneck?"21- "I got an unhandled exception in my batch job — here is the log"22- "Check if my Queueable is completing successfully in the async log"23- "Retrieve the latest log for user jsmith@myorg.sandbox and diagnose it"2425**Delegate elsewhere when:**2627| Situation | Skill to use |28|---|---|29| User wants to run Apex tests (not read logs) | `salesforce-apex-test-runner-skill` |30| Static code review without log evidence | `salesforce-apex-lwc-code-review-skill` |31| Generate a fix for the identified code problem | `salesforce-apex-generator-skill` |32| Agentforce session traces / parquet telemetry | `salesforce-agentforce-stdm-observer-skill` |33| SOQL query performance analysis without logs | `salesforce-soql-explorer-skill` |3435---3637## Required Context to Gather First3839Before retrieving or analyzing any log, confirm:40411. **Target org alias** — the `--target-org` value from `sf org list`.422. **Log identifier** — log ID, log file path, user/transaction context, or timeframe.43 Accept a pasted log file if the user provides one directly.443. **Transaction context** — which trigger, class, batch job, or user action generated the log.454. **Goal** — governor-limit diagnosis, exception trace, performance analysis, or all.465. **Sensitivity level** — does the log likely contain PII (email, phone, record data from47 regulated objects)? Apply stricter redaction if so.4849---5051## Recommended Workflow5253### Step 1 — Verify org alias and reachability5455```bash56sf org display --target-org <alias>57```5859Confirm the org is reachable. Note org type (production vs sandbox) for the audit envelope.60Apply stricter scrutiny for production org logs — log content may contain PII.6162### Step 2 — List available logs6364```bash65sf apex get log --list --target-org <alias>66```6768Identify the relevant log(s) by user, timestamp, and log type. If the user provides a log ID,69skip this step and proceed to Step 3.7071### Step 3 — Retrieve the log7273**Option A — specific log by ID:**7475```bash76sf apex get log \77 --log-id <logId> \78 --target-org <alias>79```8081**Option B — latest log for current user:**8283```bash84sf apex get log \85 --number 1 \86 --target-org <alias>87```8889**Option C — tail live logs (non-blocking diagnostic):**9091```bash92sf apex tail log \93 --target-org <alias> \94 --color95```9697**Option D — user has pasted log content directly:**98Accept the pasted content and proceed to Step 4.99100### Step 4 — Parse the log in order101102Analyze in this sequence per `references/log-format-reference.md`:1031041. **Entry point** — identify transaction type (Apex class invocation, trigger, REST callout, batch execute)1052. **Fatal errors and unhandled exceptions** — `FATAL_ERROR` and `EXCEPTION_THROWN` lines1063. **Governor limit hits** — `LIMIT_USAGE_FOR_NS` entries; compare to limits in `references/governor-limit-signatures.md`1074. **SOQL patterns** — `SOQL_EXECUTE_BEGIN` / `SOQL_EXECUTE_END` pairs; look for repeated queries in loop context1085. **DML patterns** — `DML_BEGIN` / `DML_END` pairs; check for loop context1096. **CPU hotspots** — high cumulative CPU entries; identify top consumers1107. **Heap usage** — `HEAP_ALLOCATE` patterns; identify large collection accumulation1118. **Async job indicators** — `ENTERING_MANAGED_PKG`, `CALLOUT_REQUEST`, `FUTURE_CALL_PROCESS`112113### Step 5 — Classify findings by severity114115| Severity | Criteria |116|---|---|117| **Critical** | Runtime failure, hard limit hit, unhandled exception, data corruption risk |118| **Warning** | Near-limit (>75% of a governor limit), non-selective SOQL, slow DML path |119| **Info** | Optimization opportunity, hygiene issue, async pattern note |120121### Step 6 — Apply redaction122123Apply all redaction rules (see Redaction Rules section) before emitting any log excerpt124in output. Never echo raw log lines containing record IDs, user IDs, or PII field values.125126### Step 7 — Emit findings with audit envelope127128Score findings against the quality rubric (see below). Emit the full audit envelope.129Propose the smallest correct fix for each Critical and Warning finding.130131### Step 8 — Route to repair skill132133If a code fix is needed, hand off to `salesforce-apex-generator-skill` with the134specific finding as context. If a deeper test run is needed, route to135`salesforce-apex-test-runner-skill`.136137---138139## Quality Scoring Rubric (100-point)140141Score the analysis quality before presenting. Threshold: 80+ acceptable.142143| Dimension | Points | What earns full marks |144|---|---|---|145| **Governor-limit identification** | 25 | All governor limit hits identified with limit name, current value, and limit ceiling; near-limit warnings included |146| **Root cause clarity** | 25 | Each finding traces to a specific class, method, and line number; not just "SOQL limit hit" but "AccountSelector.getByOwner line 45 in loop at TriggerHandler line 12" |147| **SOQL N+1 detection** | 15 | Repeated `SOQL_EXECUTE_BEGIN` entries in loop context identified and the responsible pattern named |148| **Sanitization quality** | 15 | All record IDs, user IDs, and PII values redacted in output; no raw log lines echoed; audit envelope populated |149| **Handoff routing** | 10 | Each Critical/Warning finding includes a specific next action and the skill to route to |150| **Audit envelope** | 10 | All required fields present; log ID hashed if PII risk; timestamp accurate |151152**Scoring penalties:**153- Raw log lines with record IDs echoed: -20 (immediate caveat)154- Governor limit hit identified but not traced to source: -15155- SOQL in loop not flagged: -15156- Missing audit envelope: -15157- PII field values in output: score voided (immediate reject)158159---160161## T1 Least-Privilege Contract162163This skill operates at T1 — read-only runtime.164165- **OAuth scopes:** `api` and `refresh_token` only.166- **Run As account permissions:**167 - REQUIRED: `View Setup and Configuration`168 - DENIED: `ModifyAllData`, `ViewAllData`, `ViewEncryptedData`, `ModifyMetadata`,169 `AuthorApex`, `ManageConnectedApps`170- **No View All Data:** Unlike the test runner skill, this skill does NOT require171 `View All Data`. Log retrieval uses `sf apex get log` which operates under the172 `View Setup and Configuration` permission scope.173- **Read-only:** Retrieves log content only. No code execution, no DML, no metadata change.174- **Log content sensitivity:** Debug logs may contain field values from records processed175 during the transaction. Apply PII redaction rules strictly.176177---178179## Audit Envelope Schema180181```yaml182audit_envelope:183 matter_id: "<caller-provided-or-generated-uuid>"184 skill_id: "salesforce-apex-log-analyzer-skill"185 skill_version: "0.1.0"186 target_org_alias: "<alias>"187 run_as_user_id: "<user_id_placeholder>"188 org_type_verified: "sandbox | production | unknown"189 log_id: "<log-id-or-hash-if-pii-risk>"190 log_size_bytes: <integer>191 transaction_entry_point: "<class or trigger name>"192 timestamp: "<ISO-8601-UTC>"193 pii_risk_assessed: true | false194 redactions_applied:195 - field_or_pattern: "<pattern>"196 reason: "<record_id|user_id|pii|session_token>"197 findings_count:198 critical: <integer>199 warning: <integer>200 info: <integer>201```202203---204205## Output Format206207```yaml208verdict: "acceptable | caveat | reject"209quality_score: <0-100>210quality_notes: "<scoring rationale>"211212transaction_summary:213 entry_point: "<class/trigger/batch>"214 transaction_type: "<trigger|class|batch|queueable|schedulable|rest>"215 org_alias: "<alias>"216 org_type: "sandbox | production | unknown"217218findings:219 critical:220 - finding: "<title>"221 location: "<ClassName.method line N>"222 evidence: "<redacted log excerpt>"223 governor_limit: "<limit name if applicable>"224 current_value: <integer>225 limit_ceiling: <integer>226 suggested_fix: "<specific remediation>"227 route_to: "<skill or action>"228 warning:229 - finding: "<title>"230 location: "<ClassName.method line N>"231 evidence: "<redacted log excerpt>"232 suggested_fix: "<specific remediation>"233 info:234 - finding: "<title>"235 notes: "<optimization or hygiene note>"236237soql_analysis:238 total_queries: <integer>239 governor_limit: 100240 n_plus_1_patterns:241 - query_excerpt: "<SELECT ... FROM ...>"242 invocation_count: <integer>243 loop_context: "<loop location>"244 suggested_fix: "<move SOQL outside loop; use Map pattern>"245 non_selective_queries: ["<query excerpt>"]246247cpu_analysis:248 total_cpu_ms: <integer>249 cpu_limit_ms: 10000250 hotspots: ["<ClassName.method: N ms>"]251252heap_analysis:253 peak_heap_bytes: <integer>254 heap_limit_bytes: 6291456255 large_allocations: ["<description>"]256257audit_envelope:258 <see Audit Envelope Schema>259260next_steps:261 - "<Critical/Warning: route to salesforce-apex-generator-skill for fix>"262 - "<if tests needed after fix: salesforce-apex-test-runner-skill>"263264assumptions:265 - "<explicit list>"266267missing_evidence:268 - "<what additional log context would help>"269```270271---272273## Redaction Rules274275Apply in order before emitting any output. Never bypass for any reason.2762771. **OAuth tokens, refresh tokens, session IDs:** Never include. Strip from any CLI output.2782. **Salesforce Org IDs (18-char starting with `00D`):** Replace with `<org_id_placeholder>`.2793. **Salesforce Record IDs (15/18-char alphanumeric):** Replace with `<record_id_placeholder>`280 in all log excerpts. Record IDs appear frequently in `USER_DEBUG`, `DML_BEGIN`, and281 `SOQL_EXECUTE_BEGIN` lines.2824. **User IDs (OwnerId, CreatedById, Running User ID, User.Id):** Replace with `<user_id_placeholder>`.2835. **Email addresses in log output:** Replace with `<email_placeholder>` unless the user284 explicitly acknowledges PII scope and the org is non-production.2856. **Phone numbers, SSNs, financial account numbers in log output:** Replace with286 `<pii_placeholder>`. Flag in `redactions_applied`.2877. **Session tokens and access tokens in USER_DEBUG lines:** Strip entirely. Do not include288 a placeholder that implies a token value was present.2898. **Instance URLs:** Replace with org alias in output. Do not emit raw instance URLs.2909. **Stack traces:** Retain class names and line numbers — required for diagnosis. Replace291 any record IDs embedded in exception messages.292293---294295## Handoff Rules296297| Finding | Hand off to |298|---|---|299| Code fix needed (SOQL in loop, DML pattern, exception handling) | `salesforce-apex-generator-skill` |300| Test coverage gap surfaced by log | `salesforce-apex-test-generator-skill` |301| Verification run needed after fix | `salesforce-apex-test-runner-skill` |302| Permission or FLS finding in log | `salesforce-permission-model-review-skill` |303| Agentforce / Einstein AI trace in log | `salesforce-agentforce-stdm-observer-skill` |304| Critical finding needing deployment review | `salesforce-deployment-validator-skill` |305306Required handoff fields: `matter_id`, `audit_envelope`, `findings` (sanitized), `next_steps`.307308---309310## Stop Conditions311312Stop and do not continue if:313314- Log retrieval fails and the user cannot provide log content directly — stop and explain315 that a log ID, user context, or pasted log content is required.316- Log content contains fields identified as encrypted (Shield PE / PMLE) — skip those317 entries, note the redaction, and analyze the remainder.318- The audit envelope cannot be completed — stop until matter_id or org alias is resolved.319- The user requests redaction to be disabled — stop and explain the policy.320- Log content is from a production org and contains PII fields — apply maximum redaction;321 if PII is pervasive and the matter classification does not permit, stop and escalate to322 the compliance specialist.323324---325326## Security Notes327328- **T1 read-only runtime:** No code execution, no DML, no metadata mutation.329- **No View All Data required:** Log retrieval operates under `View Setup and Configuration`330 only. This distinguishes this skill from the test runner and reduces its permission footprint.331- **Log content sensitivity:** Apex debug logs may capture field values, user data, and API332 payloads. PII and encrypted field redaction is mandatory.333- **Sanitized output only:** All record IDs, user IDs, session tokens, and PII values334 redacted before emission. Raw log lines are never echoed.335- **Structured audit:** Every execution produces a complete audit envelope including336 `pii_risk_assessed` and `redactions_applied` fields.337- **Revocable:** Rotating the Run As account's refresh token immediately revokes all access.338339---340341## Reference File Index342343| File | When to read |344|---|---|345| `references/log-format-reference.md` | Apex log levels, log line categories (USER_DEBUG, METHOD_ENTRY, SOQL_EXECUTE_BEGIN, LIMIT_USAGE_FOR_NS, FATAL_ERROR, etc.) |346| `references/governor-limit-signatures.md` | Common governor limit hit patterns, limit ceilings, and remediation strategies |347| `references/redaction-rules.md` | Detailed redaction patterns for record IDs, user IDs, session tokens, PII field values; jq and grep patterns for automated stripping |