salesforce-agent-optimizer 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. salesforce_agent_optimizer-1.0.0/LICENSE +21 -0
  2. salesforce_agent_optimizer-1.0.0/PKG-INFO +360 -0
  3. salesforce_agent_optimizer-1.0.0/README.md +327 -0
  4. salesforce_agent_optimizer-1.0.0/pyproject.toml +74 -0
  5. salesforce_agent_optimizer-1.0.0/setup.cfg +4 -0
  6. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/__init__.py +23 -0
  7. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/cli.py +211 -0
  8. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/doctor.py +172 -0
  9. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/installer.py +416 -0
  10. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/knowledge.py +492 -0
  11. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/AGENTS.md +32 -0
  12. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/SKILL.md +83 -0
  13. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/agents/openai.yaml +7 -0
  14. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/claude/SKILL.md +83 -0
  15. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/codex/SKILL.md +83 -0
  16. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/github/copilot-instructions.md +32 -0
  17. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/github/instructions/salesforce-agent-optimizer.instructions.md +34 -0
  18. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/agent-installation.md +112 -0
  19. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/agent-instruction-spine.md +27 -0
  20. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/architecture-solution.md +50 -0
  21. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/backend-apex.md +43 -0
  22. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/completion-artifacts.md +161 -0
  23. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/deletion-guardrails.md +70 -0
  24. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/delivery-methodology.md +155 -0
  25. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/frontend-lwc.md +45 -0
  26. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/knowledge-init.md +116 -0
  27. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/least-privilege-planning.md +54 -0
  28. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/metadata-dependencies.md +69 -0
  29. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/official-salesforce-sources.md +32 -0
  30. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/index.md +45 -0
  31. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/advanced-approvals.md +30 -0
  32. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/box-intelligent-content-management.md +29 -0
  33. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/declarative-lookup-rollup-summaries.md +29 -0
  34. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/docusign-esignature-for-salesforce.md +30 -0
  35. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/fieldspy-field-usage-report.md +28 -0
  36. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/linkedin-sales-navigator-for-salesforce.md +29 -0
  37. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/org-check.md +28 -0
  38. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/query-studio-for-marketing-cloud.md +28 -0
  39. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/salesforce-adoption-dashboards.md +28 -0
  40. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/user-access-and-permissions-assistant.md +28 -0
  41. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/packages/zoom-for-lightning.md +29 -0
  42. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/agentforce.md +30 -0
  43. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/commerce-cloud.md +29 -0
  44. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/data-360-data-cloud.md +30 -0
  45. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/einstein-ai.md +29 -0
  46. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/experience-cloud.md +29 -0
  47. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/industry-clouds.md +29 -0
  48. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/marketing-cloud.md +29 -0
  49. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/mobile-development.md +30 -0
  50. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/mulesoft.md +29 -0
  51. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/net-zero-cloud.md +29 -0
  52. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/partner-prm.md +29 -0
  53. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/sales-cloud.md +29 -0
  54. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/salesforce-cpq.md +29 -0
  55. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/salesforce-field-service.md +29 -0
  56. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/salesforce-platform-data.md +29 -0
  57. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/service-cloud.md +30 -0
  58. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/slack.md +29 -0
  59. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/success-plans-professional-services.md +27 -0
  60. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/products-packages/products/tableau.md +29 -0
  61. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/routing.md +28 -0
  62. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/salesforce-current-version.md +48 -0
  63. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/salesforce-version.json +40 -0
  64. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/sf-agent-cli-commands.md +434 -0
  65. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/sf-cli-token-patterns.md +50 -0
  66. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/sf-official-command-catalog.json +2793 -0
  67. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/sf-official-command-catalog.md +250 -0
  68. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/testing-and-manifest-guardrails.md +61 -0
  69. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/references/version-update.md +72 -0
  70. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/build_release_artifacts.py +100 -0
  71. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/generate_package_manifest.py +285 -0
  72. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/git_knowledge_push.py +126 -0
  73. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/knowledge_history.py +179 -0
  74. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/self_test.py +488 -0
  75. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/sf_agent_cli.py +1003 -0
  76. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/sf_catalog_build.py +120 -0
  77. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/sf_knowledge_init.py +606 -0
  78. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/sf_min.py +150 -0
  79. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/sf_version_update.py +140 -0
  80. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/sync_agent_instructions.py +181 -0
  81. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/templates/scripts/validate_skill.py +39 -0
  82. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/validation.py +572 -0
  83. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer/version_context.py +319 -0
  84. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer.egg-info/PKG-INFO +360 -0
  85. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer.egg-info/SOURCES.txt +90 -0
  86. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer.egg-info/dependency_links.txt +1 -0
  87. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer.egg-info/entry_points.txt +2 -0
  88. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer.egg-info/requires.txt +7 -0
  89. salesforce_agent_optimizer-1.0.0/src/salesforce_agent_optimizer.egg-info/top_level.txt +1 -0
  90. salesforce_agent_optimizer-1.0.0/tests/test_packaging_cli.py +257 -0
  91. salesforce_agent_optimizer-1.0.0/tests/test_salesforce_workflows.py +54 -0
  92. salesforce_agent_optimizer-1.0.0/tests/test_skill_validation.py +34 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luca
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,360 @@
1
+ Metadata-Version: 2.4
2
+ Name: salesforce-agent-optimizer
3
+ Version: 1.0.0
4
+ Summary: Frictionless Salesforce Agent Skill for Codex, Claude Code, and GitHub Copilot.
5
+ Author: Luca Benedettini
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/lucabenedettini/salesforce-ai-agent-optimizer
8
+ Project-URL: Repository, https://github.com/lucabenedettini/salesforce-ai-agent-optimizer
9
+ Project-URL: Issues, https://github.com/lucabenedettini/salesforce-ai-agent-optimizer/issues
10
+ Project-URL: Changelog, https://github.com/lucabenedettini/salesforce-ai-agent-optimizer/blob/main/CHANGELOG.md
11
+ Keywords: salesforce,agent-skills,codex,claude-code,github-copilot,ai-agents
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Software Development :: Code Generators
16
+ Classifier: Topic :: Software Development :: Quality Assurance
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: License :: OSI Approved :: MIT License
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest; extra == "dev"
28
+ Requires-Dist: ruff; extra == "dev"
29
+ Requires-Dist: pyyaml; extra == "dev"
30
+ Requires-Dist: build; extra == "dev"
31
+ Requires-Dist: twine; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # Salesforce Agent Optimizer
35
+
36
+ Salesforce Agent Optimizer is a public, autonomous Salesforce Agent Skill packaged as the `sfao` Python CLI for Codex, Claude Code, and GitHub Copilot.
37
+
38
+ Current version: `1.0.0`
39
+
40
+ 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.
41
+
42
+ ## Quick Start
43
+
44
+ ```bash
45
+ uv tool install salesforce-agent-optimizer
46
+ sfao install --project --platform all
47
+ sfao knowledge init --project-root .
48
+ sfao doctor
49
+ ```
50
+
51
+ Use `uv tool install` or `pipx install` for CLI isolation. Plain `pip install` works, but isolated tool installers reduce PATH and dependency friction.
52
+
53
+ ## Install From PyPI
54
+
55
+ ```bash
56
+ uv tool install salesforce-agent-optimizer
57
+ sfao install --project --platform all
58
+ sfao knowledge init --project-root .
59
+ sfao doctor
60
+ ```
61
+
62
+ Alternative:
63
+
64
+ ```bash
65
+ pipx install salesforce-agent-optimizer
66
+ sfao install --project --platform all
67
+ sfao doctor
68
+ ```
69
+
70
+ ## Install From Git Before PyPI
71
+
72
+ ```bash
73
+ uv tool install git+https://github.com/<owner>/<repository>.git
74
+ sfao version
75
+ sfao install --project --platform all
76
+ sfao doctor
77
+ ```
78
+
79
+ Alternative:
80
+
81
+ ```bash
82
+ pip install git+https://github.com/<owner>/<repository>.git
83
+ sfao install --project --platform all
84
+ sfao doctor
85
+ ```
86
+
87
+ ## Local Development Install
88
+
89
+ ```bash
90
+ git clone https://github.com/lucabenedettini/salesforce-ai-agent-optimizer.git
91
+ cd salesforce-ai-agent-optimizer
92
+ python -m pip install -e ".[dev]"
93
+ sfao version
94
+ sfao validate
95
+ sfao doctor
96
+ ```
97
+
98
+ ## What `sfao` Installs
99
+
100
+ For Codex:
101
+
102
+ ```text
103
+ .agents/skills/salesforce-agent-optimizer/SKILL.md
104
+ .agents/skills/salesforce-agent-optimizer/references/
105
+ .agents/skills/salesforce-agent-optimizer/scripts/
106
+ .agents/skills/salesforce-agent-optimizer/agents/openai.yaml
107
+ ```
108
+
109
+ For Claude Code:
110
+
111
+ ```text
112
+ .claude/skills/salesforce-agent-optimizer/SKILL.md
113
+ .claude/skills/salesforce-agent-optimizer/references/
114
+ .claude/skills/salesforce-agent-optimizer/scripts/
115
+ ```
116
+
117
+ For GitHub Copilot:
118
+
119
+ ```text
120
+ AGENTS.md
121
+ .github/copilot-instructions.md
122
+ .github/instructions/salesforce-agent-optimizer.instructions.md
123
+ ```
124
+
125
+ Generated files contain:
126
+
127
+ ```md
128
+ <!-- Generated by salesforce-agent-optimizer. Managed by sfao. -->
129
+ ```
130
+
131
+ `sfao` never overwrites or removes user-owned files silently.
132
+
133
+ ## Install
134
+
135
+ All agents:
136
+
137
+ ```bash
138
+ sfao install --project --platform all
139
+ ```
140
+
141
+ Only Codex:
142
+
143
+ ```bash
144
+ sfao install --project --platform codex
145
+ ```
146
+
147
+ Only Claude Code:
148
+
149
+ ```bash
150
+ sfao install --project --platform claude
151
+ ```
152
+
153
+ Only GitHub Copilot:
154
+
155
+ ```bash
156
+ sfao install --project --platform copilot
157
+ ```
158
+
159
+ ## Update
160
+
161
+ ```bash
162
+ uv tool upgrade salesforce-agent-optimizer
163
+ sfao update --project --platform all
164
+ sfao doctor
165
+ ```
166
+
167
+ Alternative:
168
+
169
+ ```bash
170
+ pipx upgrade salesforce-agent-optimizer
171
+ sfao update --project --platform all
172
+ sfao doctor
173
+ ```
174
+
175
+ `sfao update` updates only files generated by `sfao`. If a generated file was manually edited, it is skipped and reported.
176
+
177
+ ## Uninstall
178
+
179
+ ```bash
180
+ sfao uninstall --project --platform all --yes
181
+ uv tool uninstall salesforce-agent-optimizer
182
+ ```
183
+
184
+ Alternative:
185
+
186
+ ```bash
187
+ sfao uninstall --project --platform all --yes
188
+ pipx uninstall salesforce-agent-optimizer
189
+ ```
190
+
191
+ `sfao uninstall` removes only generated files. It keeps user-owned files and project folders such as `.github`, `.agents`, `.claude`, and `.salesforce-agent-knowledge`.
192
+
193
+ ## Knowledge Generation
194
+
195
+ Create or refresh compact local Salesforce project Knowledge:
196
+
197
+ ```bash
198
+ sfao knowledge init --project-root .
199
+ sfao knowledge refresh --project-root .
200
+ sfao knowledge doctor --project-root .
201
+ ```
202
+
203
+ 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.
204
+
205
+ Optional org enrichment must use an explicit alias:
206
+
207
+ ```bash
208
+ sfao knowledge refresh --project-root . --target-org my-sandbox
209
+ ```
210
+
211
+ No org access is required by default.
212
+
213
+ ## Salesforce Version-Context Update
214
+
215
+ Create and validate version-context resources:
216
+
217
+ ```bash
218
+ sfao version-context scaffold
219
+ sfao version-context validate
220
+ ```
221
+
222
+ Refresh official-source context:
223
+
224
+ ```bash
225
+ sfao version-context update
226
+ sfao version-context validate
227
+ ```
228
+
229
+ 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.
230
+
231
+ ## Token Optimization And Context Compaction
232
+
233
+ The skill is designed for low-token agent work:
234
+
235
+ - Start from `SKILL.md`.
236
+ - Read `references/routing.md`.
237
+ - Load only task-relevant references.
238
+ - Consult `.salesforce-agent-knowledge/` before repeated metadata reads.
239
+ - Prefer compact JSON, summaries, path lists, diffs, and focused excerpts.
240
+ - Do not paste full metadata files unless strictly necessary.
241
+ - Use `--json`, `--summary`, `--compact`, `--max-items`, and `--verbose` intentionally.
242
+ - After meaningful steps, compact task state into goal, current state, files changed, commands executed, validation status, risks, and next action.
243
+
244
+ Token optimization never removes destructive-operation warnings, validation errors, permission impacts, package.xml scope, or deployment risks.
245
+
246
+ ## Doctor And Validation
247
+
248
+ ```bash
249
+ sfao doctor
250
+ sfao doctor --verbose
251
+ sfao doctor --json
252
+ sfao validate
253
+ sfao validate --verbose
254
+ sfao validate --json
255
+ ```
256
+
257
+ Default output is concise: status first, then warnings and errors. Full diagnostics are opt-in with `--verbose`.
258
+
259
+ ## Release And Publishing
260
+
261
+ Build locally:
262
+
263
+ ```bash
264
+ python -m pip install -e ".[dev]"
265
+ sfao validate
266
+ python -m build
267
+ python -m twine check dist/*
268
+ ```
269
+
270
+ Tag release:
271
+
272
+ ```bash
273
+ git tag v1.0.0
274
+ git push origin v1.0.0
275
+ ```
276
+
277
+ The release workflow builds wheel, sdist, a versioned skill ZIP, SHA256 checksums, and `release-manifest.json`.
278
+
279
+ PyPI publishing uses Trusted Publishing and runs only when repository variable `PUBLISH_TO_PYPI=true` is set.
280
+
281
+ See `docs/publishing.md`.
282
+
283
+ ## Troubleshooting
284
+
285
+ `sfao: command not found`
286
+
287
+ - Run `uv tool update-shell`, open a new terminal, or add the tool bin directory to PATH.
288
+ - On Windows, check the user Scripts directory printed by `pip`.
289
+
290
+ `uv: command not found`
291
+
292
+ - Install `uv`, or use `pipx install salesforce-agent-optimizer`.
293
+
294
+ PyPI package not found
295
+
296
+ - Use the Git install command before PyPI publication.
297
+
298
+ Salesforce CLI `sf` not found
299
+
300
+ - Install the official Salesforce CLI and verify `sf --version`.
301
+
302
+ Skill not visible in Codex or Claude Code
303
+
304
+ - Run `sfao install --project --platform codex` or `sfao install --project --platform claude`.
305
+ - Restart the agent surface if it caches skills.
306
+
307
+ Copilot instructions not loading
308
+
309
+ - Confirm `.github/copilot-instructions.md` and `.github/instructions/salesforce-agent-optimizer.instructions.md` exist.
310
+ - Confirm the instructions file has `applyTo` frontmatter.
311
+
312
+ Version mismatch or stale generated files
313
+
314
+ - Run `sfao update --project --platform all`.
315
+ - Run `sfao validate`.
316
+
317
+ Invalid YAML, TOML, or frontmatter
318
+
319
+ - Run `sfao validate --verbose`.
320
+ - Ensure generated files were not collapsed into one line and have final LF newlines.
321
+
322
+ ## Windows And PowerShell Notes
323
+
324
+ - Prefer `uv tool install` or `pipx install` for a stable `sfao` command.
325
+ - If PowerShell cannot find `sfao`, reopen the terminal after PATH changes.
326
+ - If script execution policy blocks local scripts, use Python module commands such as `python -m build` and `python scripts/validate_skill.py`.
327
+
328
+ ## Privacy And Safety
329
+
330
+ - Do not commit Salesforce credentials, `.sf/`, `.sfdx/`, auth files, tokens, private keys, or local secrets.
331
+ - Least privilege is required during planning: inspect current access before granting permissions and grant only the minimum access needed.
332
+ - The safe Salesforce CLI facade requires explicit org aliases before org operations.
333
+ - Production org operations default to read-only inspection through the skill guardrails.
334
+ - Destructive data or metadata operations require explicit approval for the exact scope.
335
+ - Destructive CLI operations require the exact approval phrase `I explicitly approve this deletion`.
336
+ - Knowledge stores compact summaries and hashes, not raw secrets.
337
+
338
+ ## Backward Compatibility
339
+
340
+ The canonical CLI is `sfao`. Existing slash-command guidance remains as wrappers:
341
+
342
+ - `/sf-init-project-skill` maps to `sfao knowledge init --project-root .`.
343
+ - `/sf-version-update-skill` maps to `sfao version-context scaffold` and `sfao version-context update`.
344
+
345
+ ## Contributing
346
+
347
+ Before opening a pull request:
348
+
349
+ ```bash
350
+ python -m pip install -e ".[dev]"
351
+ sfao validate
352
+ sfao doctor
353
+ python scripts/sync_agent_instructions.py --check --json
354
+ python scripts/validate_skill.py --json
355
+ python scripts/self_test.py --json
356
+ python -m pytest
357
+ python -m ruff check .
358
+ python -m build
359
+ python -m twine check dist/*
360
+ ```
@@ -0,0 +1,327 @@
1
+ # Salesforce Agent Optimizer
2
+
3
+ Salesforce Agent Optimizer is a public, autonomous Salesforce Agent Skill packaged as the `sfao` Python CLI for Codex, Claude Code, and GitHub Copilot.
4
+
5
+ Current version: `1.0.0`
6
+
7
+ 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.
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ uv tool install salesforce-agent-optimizer
13
+ sfao install --project --platform all
14
+ sfao knowledge init --project-root .
15
+ sfao doctor
16
+ ```
17
+
18
+ Use `uv tool install` or `pipx install` for CLI isolation. Plain `pip install` works, but isolated tool installers reduce PATH and dependency friction.
19
+
20
+ ## Install From PyPI
21
+
22
+ ```bash
23
+ uv tool install salesforce-agent-optimizer
24
+ sfao install --project --platform all
25
+ sfao knowledge init --project-root .
26
+ sfao doctor
27
+ ```
28
+
29
+ Alternative:
30
+
31
+ ```bash
32
+ pipx install salesforce-agent-optimizer
33
+ sfao install --project --platform all
34
+ sfao doctor
35
+ ```
36
+
37
+ ## Install From Git Before PyPI
38
+
39
+ ```bash
40
+ uv tool install git+https://github.com/<owner>/<repository>.git
41
+ sfao version
42
+ sfao install --project --platform all
43
+ sfao doctor
44
+ ```
45
+
46
+ Alternative:
47
+
48
+ ```bash
49
+ pip install git+https://github.com/<owner>/<repository>.git
50
+ sfao install --project --platform all
51
+ sfao doctor
52
+ ```
53
+
54
+ ## Local Development Install
55
+
56
+ ```bash
57
+ git clone https://github.com/lucabenedettini/salesforce-ai-agent-optimizer.git
58
+ cd salesforce-ai-agent-optimizer
59
+ python -m pip install -e ".[dev]"
60
+ sfao version
61
+ sfao validate
62
+ sfao doctor
63
+ ```
64
+
65
+ ## What `sfao` Installs
66
+
67
+ For Codex:
68
+
69
+ ```text
70
+ .agents/skills/salesforce-agent-optimizer/SKILL.md
71
+ .agents/skills/salesforce-agent-optimizer/references/
72
+ .agents/skills/salesforce-agent-optimizer/scripts/
73
+ .agents/skills/salesforce-agent-optimizer/agents/openai.yaml
74
+ ```
75
+
76
+ For Claude Code:
77
+
78
+ ```text
79
+ .claude/skills/salesforce-agent-optimizer/SKILL.md
80
+ .claude/skills/salesforce-agent-optimizer/references/
81
+ .claude/skills/salesforce-agent-optimizer/scripts/
82
+ ```
83
+
84
+ For GitHub Copilot:
85
+
86
+ ```text
87
+ AGENTS.md
88
+ .github/copilot-instructions.md
89
+ .github/instructions/salesforce-agent-optimizer.instructions.md
90
+ ```
91
+
92
+ Generated files contain:
93
+
94
+ ```md
95
+ <!-- Generated by salesforce-agent-optimizer. Managed by sfao. -->
96
+ ```
97
+
98
+ `sfao` never overwrites or removes user-owned files silently.
99
+
100
+ ## Install
101
+
102
+ All agents:
103
+
104
+ ```bash
105
+ sfao install --project --platform all
106
+ ```
107
+
108
+ Only Codex:
109
+
110
+ ```bash
111
+ sfao install --project --platform codex
112
+ ```
113
+
114
+ Only Claude Code:
115
+
116
+ ```bash
117
+ sfao install --project --platform claude
118
+ ```
119
+
120
+ Only GitHub Copilot:
121
+
122
+ ```bash
123
+ sfao install --project --platform copilot
124
+ ```
125
+
126
+ ## Update
127
+
128
+ ```bash
129
+ uv tool upgrade salesforce-agent-optimizer
130
+ sfao update --project --platform all
131
+ sfao doctor
132
+ ```
133
+
134
+ Alternative:
135
+
136
+ ```bash
137
+ pipx upgrade salesforce-agent-optimizer
138
+ sfao update --project --platform all
139
+ sfao doctor
140
+ ```
141
+
142
+ `sfao update` updates only files generated by `sfao`. If a generated file was manually edited, it is skipped and reported.
143
+
144
+ ## Uninstall
145
+
146
+ ```bash
147
+ sfao uninstall --project --platform all --yes
148
+ uv tool uninstall salesforce-agent-optimizer
149
+ ```
150
+
151
+ Alternative:
152
+
153
+ ```bash
154
+ sfao uninstall --project --platform all --yes
155
+ pipx uninstall salesforce-agent-optimizer
156
+ ```
157
+
158
+ `sfao uninstall` removes only generated files. It keeps user-owned files and project folders such as `.github`, `.agents`, `.claude`, and `.salesforce-agent-knowledge`.
159
+
160
+ ## Knowledge Generation
161
+
162
+ Create or refresh compact local Salesforce project Knowledge:
163
+
164
+ ```bash
165
+ sfao knowledge init --project-root .
166
+ sfao knowledge refresh --project-root .
167
+ sfao knowledge doctor --project-root .
168
+ ```
169
+
170
+ 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.
171
+
172
+ Optional org enrichment must use an explicit alias:
173
+
174
+ ```bash
175
+ sfao knowledge refresh --project-root . --target-org my-sandbox
176
+ ```
177
+
178
+ No org access is required by default.
179
+
180
+ ## Salesforce Version-Context Update
181
+
182
+ Create and validate version-context resources:
183
+
184
+ ```bash
185
+ sfao version-context scaffold
186
+ sfao version-context validate
187
+ ```
188
+
189
+ Refresh official-source context:
190
+
191
+ ```bash
192
+ sfao version-context update
193
+ sfao version-context validate
194
+ ```
195
+
196
+ 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.
197
+
198
+ ## Token Optimization And Context Compaction
199
+
200
+ The skill is designed for low-token agent work:
201
+
202
+ - Start from `SKILL.md`.
203
+ - Read `references/routing.md`.
204
+ - Load only task-relevant references.
205
+ - Consult `.salesforce-agent-knowledge/` before repeated metadata reads.
206
+ - Prefer compact JSON, summaries, path lists, diffs, and focused excerpts.
207
+ - Do not paste full metadata files unless strictly necessary.
208
+ - Use `--json`, `--summary`, `--compact`, `--max-items`, and `--verbose` intentionally.
209
+ - After meaningful steps, compact task state into goal, current state, files changed, commands executed, validation status, risks, and next action.
210
+
211
+ Token optimization never removes destructive-operation warnings, validation errors, permission impacts, package.xml scope, or deployment risks.
212
+
213
+ ## Doctor And Validation
214
+
215
+ ```bash
216
+ sfao doctor
217
+ sfao doctor --verbose
218
+ sfao doctor --json
219
+ sfao validate
220
+ sfao validate --verbose
221
+ sfao validate --json
222
+ ```
223
+
224
+ Default output is concise: status first, then warnings and errors. Full diagnostics are opt-in with `--verbose`.
225
+
226
+ ## Release And Publishing
227
+
228
+ Build locally:
229
+
230
+ ```bash
231
+ python -m pip install -e ".[dev]"
232
+ sfao validate
233
+ python -m build
234
+ python -m twine check dist/*
235
+ ```
236
+
237
+ Tag release:
238
+
239
+ ```bash
240
+ git tag v1.0.0
241
+ git push origin v1.0.0
242
+ ```
243
+
244
+ The release workflow builds wheel, sdist, a versioned skill ZIP, SHA256 checksums, and `release-manifest.json`.
245
+
246
+ PyPI publishing uses Trusted Publishing and runs only when repository variable `PUBLISH_TO_PYPI=true` is set.
247
+
248
+ See `docs/publishing.md`.
249
+
250
+ ## Troubleshooting
251
+
252
+ `sfao: command not found`
253
+
254
+ - Run `uv tool update-shell`, open a new terminal, or add the tool bin directory to PATH.
255
+ - On Windows, check the user Scripts directory printed by `pip`.
256
+
257
+ `uv: command not found`
258
+
259
+ - Install `uv`, or use `pipx install salesforce-agent-optimizer`.
260
+
261
+ PyPI package not found
262
+
263
+ - Use the Git install command before PyPI publication.
264
+
265
+ Salesforce CLI `sf` not found
266
+
267
+ - Install the official Salesforce CLI and verify `sf --version`.
268
+
269
+ Skill not visible in Codex or Claude Code
270
+
271
+ - Run `sfao install --project --platform codex` or `sfao install --project --platform claude`.
272
+ - Restart the agent surface if it caches skills.
273
+
274
+ Copilot instructions not loading
275
+
276
+ - Confirm `.github/copilot-instructions.md` and `.github/instructions/salesforce-agent-optimizer.instructions.md` exist.
277
+ - Confirm the instructions file has `applyTo` frontmatter.
278
+
279
+ Version mismatch or stale generated files
280
+
281
+ - Run `sfao update --project --platform all`.
282
+ - Run `sfao validate`.
283
+
284
+ Invalid YAML, TOML, or frontmatter
285
+
286
+ - Run `sfao validate --verbose`.
287
+ - Ensure generated files were not collapsed into one line and have final LF newlines.
288
+
289
+ ## Windows And PowerShell Notes
290
+
291
+ - Prefer `uv tool install` or `pipx install` for a stable `sfao` command.
292
+ - If PowerShell cannot find `sfao`, reopen the terminal after PATH changes.
293
+ - If script execution policy blocks local scripts, use Python module commands such as `python -m build` and `python scripts/validate_skill.py`.
294
+
295
+ ## Privacy And Safety
296
+
297
+ - Do not commit Salesforce credentials, `.sf/`, `.sfdx/`, auth files, tokens, private keys, or local secrets.
298
+ - Least privilege is required during planning: inspect current access before granting permissions and grant only the minimum access needed.
299
+ - The safe Salesforce CLI facade requires explicit org aliases before org operations.
300
+ - Production org operations default to read-only inspection through the skill guardrails.
301
+ - Destructive data or metadata operations require explicit approval for the exact scope.
302
+ - Destructive CLI operations require the exact approval phrase `I explicitly approve this deletion`.
303
+ - Knowledge stores compact summaries and hashes, not raw secrets.
304
+
305
+ ## Backward Compatibility
306
+
307
+ The canonical CLI is `sfao`. Existing slash-command guidance remains as wrappers:
308
+
309
+ - `/sf-init-project-skill` maps to `sfao knowledge init --project-root .`.
310
+ - `/sf-version-update-skill` maps to `sfao version-context scaffold` and `sfao version-context update`.
311
+
312
+ ## Contributing
313
+
314
+ Before opening a pull request:
315
+
316
+ ```bash
317
+ python -m pip install -e ".[dev]"
318
+ sfao validate
319
+ sfao doctor
320
+ python scripts/sync_agent_instructions.py --check --json
321
+ python scripts/validate_skill.py --json
322
+ python scripts/self_test.py --json
323
+ python -m pytest
324
+ python -m ruff check .
325
+ python -m build
326
+ python -m twine check dist/*
327
+ ```