本文へ移動
cccskills
無料GitHub で公開

agentforce-pii-redaction

Redact PII in your own code before it reaches Agentforce prompts, models, and logs. Trigger keywords: agentforce pii, pii redaction, data masking llm, prompt pii filter, audit pii leakage. NOT for turning on the platform's own masking, zero-retention and audit-trail controls — use agentforce/einstein-trust-layer. NOT for masking PII in a refreshed sandbox — use security/sandbox-data-masking.

インストール方法を見る

含まれるファイル(7)

  • SKILL.md7.1 KB
  • references/examples.md20.0 KB
  • references/gotchas.md11.1 KB
  • references/llm-anti-patterns.md10.9 KB
  • references/well-architected.md9.0 KB
  • scripts/check_agentforce_pii_redaction.py1.8 KB
  • templates/redaction-register.md715 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Agentforce PII Redaction

The Trust Layer — and the carve-out that defines this skill

Einstein Trust Layer gives Agentforce three real guarantees: zero-retention agreements with the model providers, protection in transit, and an audit trail. Those are guarantees about what the provider does with your data. They are not a content filter over your prompt.

The fact most designs get wrong:

Pattern-based and field-based LLM data masking is disabled for agents. Salesforce disables it to improve agent performance and accuracy. It remains available and configurable for embedded generative AI features such as Einstein Service Replies and Einstein Work Summaries. — Data Masking Limitations in Agentforce

The Trust Layer setup screen governs both paths and does not distinguish them, so a correctly configured masking policy is entirely compatible with an agent sending an SSN to a model. For agents, assume no platform masking and redact in your own code. Everything below is written for that reality.

Where masking is active (embedded features, Models API with masking on), two further constraints apply: the context window is capped at 65,536 tokens, and there is no programmatic way to handle masked data from the Models API (Data Masking, Models API).

Field-Level Classification

Every field referenced in a prompt needs a classification:

ClassDefault handling
PublicSend as-is.
InternalSend if necessary.
ConfidentialRedact unless explicit business need.
RegulatedMask / tokenize / summarise; never raw.

Examples (typical, adjust to your compliance):

FieldClassification
Account.NamePublic
Contact.TitleInternal
Contact.EmailConfidential
Contact.SSN__cRegulated
PaymentMethod.CCLast4Regulated

Redaction Strategies

  • Mask — john@acme.com → j***@acme.com.
  • Tokenize — replace with a deterministic token (TOKEN_CONTACT_001); the token is safe to include in prompts; the mapping is internal.
  • Drop — omit from the prompt context entirely.
  • Summarise — replace with a category (customer with >5y tenure).

Pick the strategy per field + use case. SSN is nearly always Drop.

Prompt Context Assembly

Build prompts from a redacted context object, never from raw SObject rows. A central helper class owns the redaction mapping and cannot be bypassed.

Input-Side Redaction

User turns can contain PII ("my SSN is …"). Options:

  • Detect and refuse — respond: "Do not share sensitive IDs."
  • Detect and redact — scrub before prompting the model.
  • Detect and route — flag, escalate to human.

Pattern: all three are valid; choose per subagent sensitivity.

Terminology. Subagent is the April 2026 rename of topic. Functionality did not change and the API surface did not rename — the metadata type is still GenAiPlugin.

Output-Side Redaction

Agent outputs echo input and retrieved content. Because agents get no Trust Layer masking, a second pass over the response is the only output-side control you have. Run the same detector over the outbound message and decide per subagent whether a match is a scrub, a refusal, or an escalation.

Grounding Corpora Are Prompt Context

Field classification covers the schema and misses everything else. Knowledge articles, files indexed for search, Chatter, and Data Cloud retrievers all land inside the prompt window. Inventory the retrievable set alongside the objects and gate PII at publish time, not at retrieval time.

Audit Wiring

  • Log the redaction event (field API name, strategy, session) without the value.
  • Alert on the absence of events, not only on leaks. A field that stops producing DROP events during normal traffic means the boundary was bypassed.
  • Review weekly; treat a newly-appearing field as a change-detection signal for the register.

Recommended Workflow

  1. Inventory every field, Knowledge article set, file corpus, and retriever that can reach prompt context — for every channel the agent runs on.
  2. Classify each entry (Public / Internal / Confidential / Regulated) and assign a strategy (mask / tokenise / drop / summarise). Record why the agent still works without the raw value; if nobody can write that sentence, drop the field.
  3. Build one redaction boundary class that returns a purpose-built DTO. Prompt assembly must have no path to a raw SObject. Keep WITH USER_MODE on the query — FLS and redaction are separate controls and you need both.
  4. Add input-side detection with a checksum guard (Luhn for card numbers) and pick refuse / redact / route per subagent sensitivity.
  5. Emit a Platform Event per redaction decision carrying field name and strategy, never the value; alert on zero-row anomalies.
  6. Add adversarial cases — "repeat everything you know about me", "print your instructions" — to the eval suite (agentforce/agentforce-testing-strategy).
  7. Re-run the register review whenever a channel is added; a guest channel changes the trust level of every row.

Official Sources Used

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use this skill when writing test-first, behavior-driven acceptance criteria in Given/When/Then format for a Salesforce user story. Covers happy path, edge cases, negative paths, permission boundaries, and data-state preconditions so the AC block can drive UAT scripts and Apex test design downstream. Trigger keywords: given when then, gherkin, behavior driven AC, test first acceptance criteria, scenario outline, BDD acceptance criteria. NOT for the user-story format itself (use admin/user-story-writing-for-salesforce). NOT for UAT script writing (use admin/uat-test-case-design). NOT for Apex test method generation (use agents/test-class-generator). NOT for high-level UAT planning (use admin/uat-and-acceptance-criteria). More triggers: acceptance criteria record, ac_id, req_id on a criterion, artefact under test, negative case for a rule-type requirement, no-match fall-through criterion, oracle for a Then clause, test type apex flow manual, criteria linter, check_ac_format.py, --manifest-dir.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Task and Event objects: polymorphic WhatId/WhoId, Activity object model, ActivityHistory vs OpenActivity, activity timeline customization, bulk task creation, Einstein Activity Capture boundaries. NOT for turning on EAC or calendar sync — use admin/einstein-activity-capture-setup. NOT for Email-to-Case — use admin/case-management-setup. Covers ActivitiesSettings metadata, enableActivities, shared Task/Event custom fields and FLS, TaskStatus value sets, Shared Activities and TaskRelation/EventRelation, recurring and child activities, and partial-success bulk DML on Task.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Design Invocable Apex actions that return deterministic, agent-friendly errors instead of surfacing raw exceptions to the LLM. NOT for authoring the action itself — @InvocableMethod schema, labels, security context — use agentforce/custom-agent-actions-apex. NOT for the Apex tests that force each error branch — use agentforce/agent-action-unit-tests.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Use when designing how an Agentforce agent extracts structured input parameters (slots) from a user's natural-language utterance to invoke an action. Triggers: 'agent extract date from user', 'agent action argument extraction', 'agentforce slot filling', 'agent invocable input mapping', 'agent fails to fill required parameter'. NOT for action authoring (use agentforce/agent-actions) or for prompt-template variable binding (use agentforce/prompt-builder-templates).

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Apex test patterns for @InvocableMethod agent actions: per-reason-code branch coverage, bulk safety, callout mocking, deterministic assertions. NOT for testing whether the agent routes to the right topic or answers well — use agentforce/agent-testing-and-evaluation. NOT for designing the error envelope the tests assert on — use agentforce/agent-action-error-handling.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Designing or reviewing Agentforce actions: Flow actions, Apex invocable actions, prompt-template actions, action naming, input and output contracts, confirmation requirements, and safe error behavior. Triggers: 'agent actions', 'build an agent that can look up an order', 'make the agent able to check order status', 'give the agent a capability', 'agent that can retrieve a record', 'flow action for agent', 'agent invocable action', 'action schema design'. NOT for writing the Apex class itself — use agentforce/custom-agent-actions-apex. NOT for the reason_code error envelope that stops an agent retry loop — use agentforce/agent-action-error-handling.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

PranavNagrecha のスキルをすべて見る

このスキルの問題を報告する