Frictionless Salesforce Agent Skill for Codex, Claude Code, and GitHub Copilot.
Project description
Salesforce Agent Optimizer
English | Italiano | Espanol | Simplified Chinese
Salesforce Agent Optimizer is an MIT-licensed sfao CLI and agent skill for Codex, Claude Code, and GitHub Copilot.
Current version: 2.1.1
It helps AI agents work on Salesforce projects with Salesforce-first planning, configuration before custom code, minimal reversible changes, local Knowledge, token-efficient Salesforce CLI usage, least-privilege checks, explicit org aliases, package.xml awareness, and destructive-operation guardrails.
Quick Start
uv tool install salesforce-agent-optimizer
sfao install
sfao knowledge init --project-root .
sfao doctor
Use uv tool install or python -m pipx install for isolated CLI installs. Plain python -m pip install also works when you intentionally want sfao in the active Python environment.
Install
uv tool install salesforce-agent-optimizer
sfao install
sfao validate
Alternatives:
python -m pipx install salesforce-agent-optimizer
python -m pip install git+https://github.com/lucabenedettini/salesforce-ai-agent-optimizer.git
uv tool install git+https://github.com/lucabenedettini/salesforce-ai-agent-optimizer.git
sfao install installs project-scoped adapters for all supported agents. Use sfao install --user --platform all only when you want a user-scoped Codex/Claude install.
Main Commands
| Command | What it does and when to use it | Principle |
|---|---|---|
sfao version |
Prints the installed package version. Use after install or upgrade. | Version clarity. |
sfao install |
Installs project-scoped adapters for supported agents in the current repo. Use once per Salesforce project. | Frictionless setup. |
sfao install --project --platform all |
Explicit project install for Codex, Claude Code, and GitHub Copilot. Use when onboarding a repo. | Agent compatibility. |
sfao update --project --platform all |
Refreshes managed generated adapters and templates after upgrading the package. | Safe upgrade. |
sfao uninstall --project --platform all --yes |
Removes generated SFAO adapter files only. Use when removing the skill from a project. | Reversible changes. |
sfao doctor |
Checks Python, OS, Git, Salesforce CLI, installed adapters, PATH, and validation status. Use after install/update or when the skill is not visible. | Early diagnostics. |
sfao doctor --verbose |
Shows detailed diagnostics. Use when troubleshooting warnings. | Transparent failure analysis. |
sfao validate |
Validates skill files, versions, generated adapters, formats, and Salesforce metadata guardrails. Use before commits/releases. | Quality gate. |
sfao validate --json |
Emits machine-readable validation. Use in CI or agent validation steps. | Automation-friendly output. |
sfao knowledge init --project-root . |
Builds compact local Salesforce project Knowledge. Use before the first planning pass in a repo. | Knowledge before raw metadata. |
sfao knowledge refresh --project-root . |
Refreshes Knowledge after metadata changes. Use after meaningful Salesforce source changes. | Fresh planning evidence. |
sfao knowledge init --project-root . --scan-root |
Performs an intentional broad project scan. Use only when packageDirectories are not enough. | Token-efficient scope control. |
sfao knowledge doctor --project-root . |
Checks Knowledge structure. Use when the agent reports missing or stale Knowledge. | Reliable local context. |
sfao memory init --project-root . |
Creates curated project memory. Use when starting durable project learning. | Compact durable memory. |
sfao memory add --project-root . --task-type bugfix --summary "..." |
Adds a redacted durable lesson, decision, risk, or follow-up. Use after implementation or validation. | No raw logs, no secrets. |
sfao memory compact --project-root . --max-bytes 60000 |
Keeps memory small and useful. Use when memory grows too large. | Token efficiency. |
sfao memory doctor --project-root . |
Validates memory structure and redaction. Use before relying on memory for planning. | Privacy-safe memory. |
sfao version-context scaffold |
Creates version-context reference files if missing. Use when bootstrapping references. | Official-source readiness. |
sfao version-context update |
Refreshes Salesforce release/API context from official Salesforce sources. Use when version context is stale or release-sensitive. | No invented behavior. |
sfao version-context validate --max-age-days 90 |
Checks version-context freshness. Use in validation or before release-sensitive planning. | Current API evidence. |
sfao command search "permission account" |
Searches the internal safe Salesforce CLI facade registry. Use before running org commands. | Discover before execute. |
sfao command payload-example access-inspect |
Prints a compact payload example for a registered command. Use to avoid invented flags. | Schema-guided commands. |
sfao command execute --payload payload.json |
Executes one registered facade command through compact guardrails. Use only with explicit org alias where required. | Safe Salesforce CLI facade. |
sfao soql build --object Account --fields Id,Name |
Builds focused SOQL and a ready data-query payload. Use before querying org data. | Minimal data retrieval. |
sfao permissions explain --input access.json |
Summarizes access evidence from access-inspect output. Use for least-privilege planning. |
Explainable access. |
sfao live-test --target-org <alias> |
Runs opt-in checks against a real org. Use only with an explicit non-production/scratch org alias for write/destructive suites. | Real validation with consent. |
For org operations the agent must ask for an explicit org alias. Production orgs are read-only through the skill guardrails.
Agent Workflow
Installed agents must follow the same visible phases for information requests, bugfixes, implementation, architecture, reviews, org inspection, and release work:
Request reviewPlanning evidenceApprovalImplementationValidationCompletion
During each phase the agent must state the tool or command it is using or planning. For Salesforce CLI access it must show the compact sfao, scripts/sf_agent_cli.py, or official sf command shape with aliases and secrets redacted.
For simple explanation-only questions with no project decision, org access, metadata inspection, deploy, data operation, secret exposure, destructive action, release-sensitive claim, implementation, or bugfix, agents may use compact information-only mode: Request review, Evidence, Answer, Validation.
Safety
- Prefer Salesforce configuration, Flow, permission sets, UI API/LDS, named credentials, and managed packages before custom code.
- Inspect local Knowledge before changing Salesforce metadata.
- Use project memory at
.salesforce-agent-knowledge/memory.mdfor durable decisions, lessons, risks, and follow-ups. It is project-local curated planning knowledge, not a raw log, and must not contain secrets, customer data, raw records, or large logs. - Knowledge scans Salesforce DX
packageDirectoriesby default when available; usesfao knowledge init --project-root . --scan-rootonly for an intentional broad scan. - Specialized Apex, LWC, Flow, SOQL, deploy, and data-operation guidance is loaded only when relevant.
- External Salesforce skills are optional references only when already available and can never bypass SFAO guardrails.
safe-run --safetycannot downgrade the automatic risk classification.- Apply least privilege before access, sharing, UI, package, integration, or automation changes.
- Do not retrieve or parse all org metadata unless the user asks for broad analysis or the task requires it.
- Never delete data or metadata without separate explicit approval for the exact scope.
- Never expose Salesforce secrets or customer data without separate explicit approval for the exact scope.
- Generate
package.xmlfor added or modified metadata. - Ask whether to generate release notes, technical specifications, impact assessment, user testing, and manual procedures after implementation.
Update
uv tool upgrade salesforce-agent-optimizer
sfao update --project --platform all
sfao doctor
Alternatives:
python -m pipx upgrade salesforce-agent-optimizer
python -m pip install --upgrade salesforce-agent-optimizer
Uninstall
sfao uninstall --project --platform all --yes
uv tool uninstall salesforce-agent-optimizer
Alternative:
python -m pipx uninstall salesforce-agent-optimizer
More Documentation
Detailed installation, command behavior, troubleshooting, publishing, release, and versioning docs live in docs/wiki/.
License
MIT. Anyone can use, copy, modify, distribute, and fork this repository under the terms of LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file salesforce_agent_optimizer-2.1.1.tar.gz.
File metadata
- Download URL: salesforce_agent_optimizer-2.1.1.tar.gz
- Upload date:
- Size: 172.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ceb3de20f6ad508362a53f5171724b3012c760da55bd6382ff88ae7c976e3f5
|
|
| MD5 |
50c8b737e978462834bfc730be975781
|
|
| BLAKE2b-256 |
d9d34414a55c08f7a4a7f82d61fdaf2a37771d6a2589dd7bf02ad0d888c05b98
|
Provenance
The following attestation bundles were made for salesforce_agent_optimizer-2.1.1.tar.gz:
Publisher:
release.yml on lucabenedettini/salesforce-ai-agent-optimizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
salesforce_agent_optimizer-2.1.1.tar.gz -
Subject digest:
3ceb3de20f6ad508362a53f5171724b3012c760da55bd6382ff88ae7c976e3f5 - Sigstore transparency entry: 1740318338
- Sigstore integration time:
-
Permalink:
lucabenedettini/salesforce-ai-agent-optimizer@80f0bc459a7b1f256830f8293d8713ebd0950d6f -
Branch / Tag:
refs/tags/v2.1.1 - Owner: https://github.com/lucabenedettini
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@80f0bc459a7b1f256830f8293d8713ebd0950d6f -
Trigger Event:
push
-
Statement type:
File details
Details for the file salesforce_agent_optimizer-2.1.1-py3-none-any.whl.
File metadata
- Download URL: salesforce_agent_optimizer-2.1.1-py3-none-any.whl
- Upload date:
- Size: 233.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0fa937079e00c91f2c6c697309caf72d07ce4c021bb56c12e68a2d9ead13b01
|
|
| MD5 |
fc0deafd55eb26f0b58ffb220868b139
|
|
| BLAKE2b-256 |
9b49a60a415ff70d22d318d08287ce00c99096b29f20df328e8394aa183a3b5c
|
Provenance
The following attestation bundles were made for salesforce_agent_optimizer-2.1.1-py3-none-any.whl:
Publisher:
release.yml on lucabenedettini/salesforce-ai-agent-optimizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
salesforce_agent_optimizer-2.1.1-py3-none-any.whl -
Subject digest:
c0fa937079e00c91f2c6c697309caf72d07ce4c021bb56c12e68a2d9ead13b01 - Sigstore transparency entry: 1740318342
- Sigstore integration time:
-
Permalink:
lucabenedettini/salesforce-ai-agent-optimizer@80f0bc459a7b1f256830f8293d8713ebd0950d6f -
Branch / Tag:
refs/tags/v2.1.1 - Owner: https://github.com/lucabenedettini
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@80f0bc459a7b1f256830f8293d8713ebd0950d6f -
Trigger Event:
push
-
Statement type: