Skip to main content

Frictionless Salesforce Agent Skill for Codex, Claude Code, and GitHub Copilot.

Project description

Salesforce Agent Optimizer

Salesforce Agent Optimizer is a public, autonomous Salesforce Agent Skill packaged as the sfao Python CLI for Codex, Claude Code, and GitHub Copilot.

Current version: 1.0.1

It optimizes Salesforce delivery for AI agents through Salesforce-first solutioning, configuration-first planning, minimal reversible changes, compact local Knowledge, safe Salesforce CLI usage, least-privilege planning, destructive-operation guardrails, package.xml awareness, and token-efficient progressive disclosure.

Quick Start

uv tool install salesforce-agent-optimizer
sfao install --project --platform all
sfao knowledge init --project-root .
sfao doctor

Use uv tool install or pipx install for CLI isolation. Plain pip install works, but isolated tool installers reduce PATH and dependency friction.

Install From PyPI

uv tool install salesforce-agent-optimizer
sfao install --project --platform all
sfao knowledge init --project-root .
sfao doctor

Alternative:

pipx install salesforce-agent-optimizer
sfao install --project --platform all
sfao doctor

Install From Git Before PyPI

uv tool install git+https://github.com/<owner>/<repository>.git
sfao version
sfao install --project --platform all
sfao doctor

Alternative:

pip install git+https://github.com/<owner>/<repository>.git
sfao install --project --platform all
sfao doctor

Local Development Install

git clone https://github.com/lucabenedettini/salesforce-ai-agent-optimizer.git
cd salesforce-ai-agent-optimizer
python -m pip install -e ".[dev]"
sfao version
sfao validate
sfao doctor

What sfao Installs

For Codex:

.agents/skills/salesforce-agent-optimizer/SKILL.md
.agents/skills/salesforce-agent-optimizer/references/
.agents/skills/salesforce-agent-optimizer/scripts/
.agents/skills/salesforce-agent-optimizer/agents/openai.yaml

For Claude Code:

.claude/skills/salesforce-agent-optimizer/SKILL.md
.claude/skills/salesforce-agent-optimizer/references/
.claude/skills/salesforce-agent-optimizer/scripts/

For GitHub Copilot:

AGENTS.md
.github/copilot-instructions.md
.github/instructions/salesforce-agent-optimizer.instructions.md

Generated files contain:

<!-- Generated by salesforce-agent-optimizer. Managed by sfao. -->

sfao never overwrites or removes user-owned files silently.

Install

All agents:

sfao install --project --platform all

Only Codex:

sfao install --project --platform codex

Only Claude Code:

sfao install --project --platform claude

Only GitHub Copilot:

sfao install --project --platform copilot

Update

uv tool upgrade salesforce-agent-optimizer
sfao update --project --platform all
sfao doctor

Alternative:

pipx upgrade salesforce-agent-optimizer
sfao update --project --platform all
sfao doctor

sfao update updates only files generated by sfao. If a generated file was manually edited, it is skipped and reported.

Uninstall

sfao uninstall --project --platform all --yes
uv tool uninstall salesforce-agent-optimizer

Alternative:

sfao uninstall --project --platform all --yes
pipx uninstall salesforce-agent-optimizer

sfao uninstall removes only generated files. It keeps user-owned files and project folders such as .github, .agents, .claude, and .salesforce-agent-knowledge.

Knowledge Generation

Create or refresh compact local Salesforce project Knowledge:

sfao knowledge init --project-root .
sfao knowledge refresh --project-root .
sfao knowledge doctor --project-root .

Knowledge is written to .salesforce-agent-knowledge/ and stores summaries, indexes, hashes, source paths, wiki pages, and history. Source metadata remains the source of truth.

Optional org enrichment must use an explicit alias:

sfao knowledge refresh --project-root . --target-org my-sandbox

No org access is required by default.

Salesforce Version-Context Update

Create and validate version-context resources:

sfao version-context scaffold
sfao version-context validate

Refresh official-source context:

sfao version-context update
sfao version-context validate

The command uses official Salesforce source links only and stores concise summaries, source links, API version context, SOAP login guardrails, LWC notes, and package-version cautions.

Token Optimization And Context Compaction

The skill is designed for low-token agent work:

  • Start from SKILL.md.
  • Read references/routing.md.
  • Load only task-relevant references.
  • Consult .salesforce-agent-knowledge/ before repeated metadata reads.
  • Prefer compact JSON, summaries, path lists, diffs, and focused excerpts.
  • Do not paste full metadata files unless strictly necessary.
  • Use --json, --summary, --compact, --max-items, and --verbose intentionally.
  • After meaningful steps, compact task state into goal, current state, files changed, commands executed, validation status, risks, and next action.

Token optimization never removes destructive-operation warnings, validation errors, permission impacts, package.xml scope, or deployment risks.

Doctor And Validation

sfao doctor
sfao doctor --verbose
sfao doctor --json
sfao validate
sfao validate --verbose
sfao validate --json

Default output is concise: status first, then warnings and errors. Full diagnostics are opt-in with --verbose.

Release And Publishing

Build locally:

python -m pip install -e ".[dev]"
sfao validate
python -m build
python -m twine check dist/*

Tag release:

git tag v1.0.1
git push origin v1.0.1

The release workflow builds wheel, sdist, a versioned skill ZIP, SHA256 checksums, and release-manifest.json.

PyPI publishing uses Trusted Publishing and runs only when repository variable PUBLISH_TO_PYPI=true is set.

See docs/publishing.md.

Troubleshooting

sfao: command not found

  • Run uv tool update-shell, open a new terminal, or add the tool bin directory to PATH.
  • On Windows, check the user Scripts directory printed by pip.

uv: command not found

  • Install uv, or use pipx install salesforce-agent-optimizer.

PyPI package not found

  • Use the Git install command before PyPI publication.

Salesforce CLI sf not found

  • Install the official Salesforce CLI and verify sf --version.

Skill not visible in Codex or Claude Code

  • Run sfao install --project --platform codex or sfao install --project --platform claude.
  • Restart the agent surface if it caches skills.

Copilot instructions not loading

  • Confirm .github/copilot-instructions.md and .github/instructions/salesforce-agent-optimizer.instructions.md exist.
  • Confirm the instructions file has applyTo frontmatter.

Version mismatch or stale generated files

  • Run sfao update --project --platform all.
  • Run sfao validate.

Invalid YAML, TOML, or frontmatter

  • Run sfao validate --verbose.
  • Ensure generated files were not collapsed into one line and have final LF newlines.

Windows And PowerShell Notes

  • Prefer uv tool install or pipx install for a stable sfao command.
  • If PowerShell cannot find sfao, reopen the terminal after PATH changes.
  • If script execution policy blocks local scripts, use Python module commands such as python -m build and python scripts/validate_skill.py.

Privacy And Safety

  • Do not commit Salesforce credentials, .sf/, .sfdx/, auth files, tokens, private keys, or local secrets.
  • Least privilege is required during planning: inspect current access before granting permissions and grant only the minimum access needed.
  • The safe Salesforce CLI facade requires explicit org aliases before org operations.
  • Production org operations default to read-only inspection through the skill guardrails.
  • Destructive data or metadata operations require explicit approval for the exact scope.
  • Destructive CLI operations require the exact approval phrase I explicitly approve this deletion.
  • Knowledge stores compact summaries and hashes, not raw secrets.

Backward Compatibility

The canonical CLI is sfao. Existing slash-command guidance remains as wrappers:

  • /sf-init-project-skill maps to sfao knowledge init --project-root ..
  • /sf-version-update-skill maps to sfao version-context scaffold and sfao version-context update.

Contributing

Before opening a pull request:

python -m pip install -e ".[dev]"
sfao validate
sfao doctor
python scripts/sync_agent_instructions.py --check --json
python scripts/validate_skill.py --json
python scripts/self_test.py --json
python -m pytest
python -m ruff check .
python -m build
python -m twine check dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

salesforce_agent_optimizer-1.0.1.tar.gz (120.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

salesforce_agent_optimizer-1.0.1-py3-none-any.whl (167.5 kB view details)

Uploaded Python 3

File details

Details for the file salesforce_agent_optimizer-1.0.1.tar.gz.

File metadata

File hashes

Hashes for salesforce_agent_optimizer-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c6ad8d916533ccad0ad9d66d5f34bd90f80a8a0ae324b2d7b9f81319b8d0dd99
MD5 22ad5b8f7266e7219af0482c06c3268f
BLAKE2b-256 e3d84fd15dbb6460a27469138c97302f428e2b2f61c74d41b93ac24a8139e2b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for salesforce_agent_optimizer-1.0.1.tar.gz:

Publisher: release.yml on lucabenedettini/salesforce-ai-agent-optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file salesforce_agent_optimizer-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for salesforce_agent_optimizer-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2d96ed9bf1677373d6031d1a0dd9aebedd1b57132ba636119ad8de4201745528
MD5 f0ac84f231c0ab66e8221b16da833979
BLAKE2b-256 70ee97851e4c219e4c703bf5377f0efc7d1eaeb82b9969c0b07a8e53dec496be

See more details on using hashes here.

Provenance

The following attestation bundles were made for salesforce_agent_optimizer-1.0.1-py3-none-any.whl:

Publisher: release.yml on lucabenedettini/salesforce-ai-agent-optimizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page