SF Compound Engineering Plugin v4.1.2
Skills-first compound engineering for Salesforce — a multi-platform plugin (Claude Code, Cursor, Codex, and 9 other AI coding tools) where each iteration becomes smarter than the last through institutional knowledge capture and parallel persona dispatch. This is a skill-native product, not an instruction pack: workflows auto-route from natural language and from /sf-* invocation.
V4 is compact. Ten skills replace 68; former skills are modes (/sf-plan mode:brainstorm, /sf-generate type:apex) whose guides load only when used. Nine review lenses replace 61 personas. See CHANGELOG.md for the old-name → new-name map.
What this plugin runs on your machine
Both hook features are OFF by default. Installing the plugin enables
nothing; you opt in per feature with /plugin configure, or by setting
SFCE_GATE_ENABLED=1 / SFCE_SKILL_LOG_ENABLED=1.
The scripts, and when they run
| Script | Event | Runs when |
|---|
scripts/session-start | SessionStart (startup) | always — prints the discipline primer, plus a few lines of project facts (API version, packages, default org and its type, source counts, trigger framework) inside a Salesforce DX project, from local files only |
scripts/sfce-gate-selfcheck | SessionStart (startup) | gate enabled |
scripts/sfce-metadata-gate | PreToolUse / PostToolUse on Edit, Write, NotebookEdit | gate enabled |
scripts/sfce-skill-observer | PostToolUse on Skill, UserPromptExpansion, SessionStart (clear/resume), SessionEnd | either feature enabled |
scripts/sfce-bash-observer | PostToolUse on Bash | either feature enabled |
scripts/sfce-deploy-gate | PreToolUse on Bash | on by default; acts only on sf project deploy / sf project delete (set SFCE_DEPLOY_GATE=0 to turn off) |
With both flags unset every gate/observer script exits before reading stdin. The deploy gate reads the payload but exits immediately unless the command is a deploy or delete; it asks before a direct production deploy or a destructive change on a non-scratch org, and denies --test-level NoTestRun on production. It classifies the org from local sf auth files, with no network call.
None of these scripts makes a network call, and that is enforced rather than
promised: cli/tests/hooks/invariants.test.ts walks scripts/ and fails on any
network-capable construct, and fails if any hook in hooks/hooks.json runs a
script outside that scan. There is exactly one declared runtime exception,
below, which no hook may invoke. (The CI-only scripts/check-npm-release.mjs,
which asks the npm registry what it serves, is the other declared exception;
nothing at runtime runs it.)
scripts/sfce-delegate — optional cheap-worker tier
Not a hook. Nothing invokes it unless you or a skill explicitly do, and with
no ANTHROPIC_API_KEY it declines and the caller does the work inline exactly
as before. Default behaviour is unchanged.
It exists because pure pattern-matching generation — a TestDataFactory, a
custom-object field list, the boilerplate half of a service class — costs
frontier tokens twice: once to produce the code, and again because the produced code then
sits in the session's context for the rest of the run. sfce-delegate sends the
spec plus a required reference to a cheaper worker and writes the result
straight to disk. stdout carries only the path, never the code. That
second part is most of the saving.
scripts/sfce-delegate \
--spec /tmp/factory-spec.md \
--reference skills/sf-generate/references/test-data/guide.md \
--out force-app/main/default/classes/TestDataFactory.cls \
--kind test-factory --expect-lines 120
# see every gate's decision without making a call
scripts/sfce-delegate ... --dry-run
| Exit | Meaning |
|---|
0 | delegated; --out was written |
3 | declined — not an error. No key, no worker, below threshold, or an excluded topic. Do the work inline; do not retry. |
1 | a real failure — API error, malformed response, failed write |
2 | usage error |
What it refuses to delegate. Security, sharing, CRUD/FLS, permission
metadata (profiles, permission sets), governor-sensitive and async logic,
callouts, credentials and sessions, and debugging all stay on the frontier
model. Matching is case- and whitespace-insensitive. The denylist scans the spec
and every reference file — a spec that reads as plain boilerplate can point at a reference full of sharing logic — and it is
deliberately over-broad, because the failure costs are not symmetric: a false
refusal costs one round-trip, a false accept ships security logic written by a
weak model. The worker is also instructed to emit DELEGATION_REFUSED if the
spec appears to need that judgement, which is honoured as a second, independent
check.