9. Command line
The command is scf. factory still works as an alias and prints a short note.
| Command | What it does |
|---|---|
scf ui [--port 4777] [--no-open] [--dev] | Web UI, queue and watchers. Restarts itself when a new build is installed and no run is active (set SCF_NO_SUPERVISE=1 to turn that off) |
scf serve [--port 4777] [--dev] | The same without opening a browser. --dev (also on scf ui) serves the component gallery at /gallery/ for developers; leave it off in normal use |
scf service install | uninstall | status | Run scf serve in the background (macOS) |
scf doctor [--simple] [--need node] [--json] | Check what this computer needs (git, Claude Code and Codex with their sign-ins, and with --need node Node.js) and print how to fix each problem; --simple prints plain words only. Exits 0 only when everything needed is ready (Setup check) |
scf data inventory [--json] | List what the data folder holds: each kind of item with its kind, scope, sensitivity, count, size and oldest and newest date, the total, and the paths the catalogue does not know. Read only; it never moves an old data folder. --json prints the whole result. The same as GET /api/admin/data/inventory (admins) |
scf data export [--selection f] [--save f] [--out f [--encrypt [--passphrase-stdin]]] [--wait minutes] [--json] | Choose what a move or backup takes along, and see the count and size of each choice; saves the choice as data-selection.json (or to --save). With --out, drains a running Foundry (see --wait, default 10 minutes), writes one checked bundle (a tar file; secrets are left out unless --encrypt, which asks for a passphrase) (Choose what a move or backup takes along, Write the export bundle) |
scf doctor keychain [--delete] | Count the credential key items in the macOS Keychain and how many credentials.json uses; --delete removes the unused ones for good (keys of another data folder included). Prints no key values (Setup check) |
scf run <flow> --task "…" [--var k=v] [--repo dir|owner/name] [--ref ref] | Run a flow. --repo owner/name is for flows that clone the repository themselves (release-build); --ref sets the variable ref |
scf resume <run-id> [--from <step>] [--force] | Continue a run. Refused when its issue is closed on GitHub; --force continues anyway |
scf approve <run-id> [--note "…"] [--force] / scf reject … | Decide on a waiting run. Refused for a closed issue, like resume |
scf metrics preview [--day YYYY-MM-DD] | Print the numbers-only shared metrics report of one UTC day (default yesterday) as JSON. It covers only the runs of accounts that are not service accounts. Nothing is sent; a note on stderr says so |
scf metrics send [--day YYYY-MM-DD] | Send the shared metrics report of one ended UTC day (default yesterday) to the receiver now (admins; for testing). Refused when nobody shares, for today or a later day, a day over 7 days old, or a day already accepted (Shared metrics) |
scf flows / scf blocks | List flows (each with its warnings, if any) / library blocks |
scf components [kind] / scf components record [kind] | Print the version, SHA-256 and governance status (owner, risk, lifecycle, review) of each flow, policy pack, tool profile, model route set and context selector; record gives new hashes their version in promotions/versions.json. Exits 1 when a component is a problem (Versions of the components) |
scf autonomy status [--json] | Print the autonomy level of each repository and flow and its promotion gate, check by check; read-only; needs a running, signed-in server (admin) (Promotion gate) |
scf autonomy promote <repos|flows> <id> <to> --reason "…" | Ask for one level more when the gate passes; prints the token the owner needs (Change a level) |
scf autonomy approve <repos|flows> <id> <to> <token> | Approve a waiting promotion request (the accountable owner) (Change a level) |
scf autonomy demote <repos|flows> <id> <to> --reason "…" [--yes] | Lower a level at once, any admin, no gate (Change a level) |
scf promote <kind> <id> [--live] | Check that the newest safety reports allow promoting a component; read-only; prints PASSED and PROMOTABLE, or BLOCKED per problem; exits 1 when blocked (Promote a component) |
scf new <name> [--from <flow>] [--global] | Create a flow from a template |
scf skills [--repo dir] [--workspace <id>] | List skill packages with trust, pin state, digest and effect (--workspace lists that workspace's skills folder) (effect helps|no-effect|harms|not-measured|invalid, from the newest record of the digest), plus notes and problems with full paths; exits 1 when there are problems (also a changed pinned package) |
scf skills pin <id@version> <digest> [--replace] | Approve a listed package by its digest; --replace accepts a changed package. Refused for repository skills |
scf skills pin --builtin | Pin the built-in skills that have no pin; exits 1 when one has changed since its pin |
scf skills unpin <id@version> | Remove a pin; exits 1 when there is none |
scf skills lifecycle [<id@version> [<state> --reason <text> [--replacement <id@version>]]] [--runs-dir <dir>] | List the skills that are not active, print the history of one, or set deprecated, quarantined, retired, revoked or active (see Skill lifecycle); a state change also lists the runs that lock the version |
scf skills allow-run <run-id> <id@version> --reason <text> [--runs-dir <dir>] | Let one run go on with a quarantined version; then resume the run |
scf skills overrides check [<file>] | Check the owner overrides (skill-overrides.yaml); prints each entry with its digest; exits 1 on a problem or an expired entry |
scf skills connectors | List the reviewed skill source connectors (id, repository, roots, trust, licences); offline; reads no files |
scf skills project-pins check [<file>] | Check the project pins (.claude-factory/skill-pins.yaml); same output and exit codes |
scf skills assess <source-id> | Print the workflow report of a staged import (CONFLICT, CANDIDATE, EXCLUDED lines); offline and read-only; exits 1 only for a PROBLEM (Assess an import) |
scf skills compare <source-id> | Compare a staged import with the built-in java and spring-boot skills (SKILL, COLLISION, RECOMMEND, CONFLICT lines); for a community source also PROMOTABLE and REFUSED lines; offline and read-only; exits 1 on a conflict, a blocking collision, a refused candidate or a PROBLEM (Compare an import) |
scf skills selections evaluate <source-id> [<selections-file>] | Print per skill of a staged import whether it is ELIGIBLE or HELD, and the OVERLAP lines; offline and read-only; writes nothing; exits 1 for a PROBLEM or a usage error (Evaluate an import) |
scf skills evaluate <source-id> [<technology>@<version> ... | --repo <dir>] | Report compatibility, tools, access, licence and overlap of an enabled source; --repo reads the versions from the package.json files of a folder (sources with a reviewed profile only); writes nothing; exits 1 on a refusal, a block, a conflict, a missing selected folder or a PROBLEM (Evaluate a source) |
scf skills scan <source-id> [<exceptions-file>] | Print the security report of a staged import (FINDING, BLOCKED, OK lines) and, for a known source, the connector report (CONNECTOR lines); offline and read-only; exits 1 when a skill is blocked or a PROBLEM is printed (Scan an import) |
scf skills profiles evaluate <source-id> | Print PASS or BLOCKED per staged skill of a profiled source, with the gate reasons, NEEDS and MISSING lines, and the CANONICAL, CONFLICT, NONE and REJECTED lines per exclusive capability; offline and read-only; exits 1 when a skill is blocked, a PROBLEM is printed or a CONFLICT is found (Evaluate the profile gates, Canonical skill per capability) |
scf skills promote check <source-id> [<exceptions-file>] | Print per skill path whether licence, provenance, findings, evaluations and effect allow promotion (PROMOTABLE, REFUSED, LICENCES, ASSUMES, EVALUATION, EFFECT, CHECKED lines); reads skill-evaluations.yaml (evaluations and effect decisions), skill-selections.yaml and the effect records; offline and read-only; exits 1 when a path is refused or a PROBLEM is printed (Check a promotion, Confluent skills) |
scf skills overlap <source-id> | Compare a staged import with the registered skills: CANONICAL, REJECTED, CONFLICT, NONE, NEW, VERSIONS, PROBLEM and OVERLAP lines; reads skill-selections.yaml; offline and read-only; exits 1 for a conflict or a PROBLEM (Overlap with the catalogue) |
scf skills update <source-id> [--owner <@user>] [--reviewer <@user>] [--licence <id>] | Stage the upstream commit of a source and open a pull request that proposes it, or refresh the open one (UNCHANGED, OPEN, UPDATED or OK line); approves nothing (Update a source) |
scf skills update --due [--all] | Check every enabled source whose update cadence is due (--all: every enabled source), one line per outcome per source and a CHECKED summary; exits 1 on any PROBLEM (Check every due source) |
scf skills review <source-id> [--markdown] | Print the licence, attribution, scan and collision report of a staged import, grouped by category (REVIEW, SKILL, COLLISION, REVIEWED lines); offline and read-only; --markdown for a pull-request body; exits 1 when a skill is blocked, a licence is not allowed, a blocking collision exists or a PROBLEM is printed (Review an import) |
scf skills score <source-id> [<suite-file>] [--agent] | Score every skill of a staged import with the suite (default skill-evaluation.yaml) and store one record each under skill-evaluations/; offline, except --agent, which also runs the instructions scenarios in the macOS sandbox (Run the scenarios in the sandbox); exits 1 on a PROBLEM (Score and gate an import) |
scf skills gate <source-id> [<suite-file>] | Print PASSED, FAILED (with reason codes, including the effect codes), DECISION or PROBLEM per staged skill from its newest evaluation record and its newest effect record; offline and read-only; exits 1 when a skill fails or a PROBLEM is printed (Score and gate an import) |
scf skills effect <source-id> <skill-id> [<suite-file>] or scf skills effect <id@version> [<suite-file>] | Run the skill's sample tasks with and without the skill in the macOS sandbox and store the verdict (helps, no-measurable-effect or harms) under skill-effects/; prints RUN, SKIPPED, EFFECT, STORED lines; exits 1 on a PROBLEM or an interrupt (Measure the effect of a skill) |
scf release-build init --repo <owner/name> [--write] | Print a suggested .factory/release-build.yaml from the build files of a repository; --write opens a pull request that adds it, on the branch release-build-recipe (Suggest a recipe) |
scf validate <flow or file> | Check a flow without running it; prints its warnings too and exits 0 when there are only warnings |
scf flow-guide | Print the flow-writing guide for AI assistants (Let any AI write a flow) |
scf watch [flow] --var github_repo=o/r [--source …] [--once] | Run one watcher from the terminal |
scf plugins (or scf plugins list) | List the plugins loaded at server start, with version, module and what each registered; needs a running, signed-in server (admin) (Plugins) |
scf services (or scf services list) | List the managed services with their state, restarts, last exit and problem; needs a running, signed-in server (admin) (Managed services) |
scf eval <suite.yaml> [--flows a,b] [--models …] [--claude-bin p] [--codex-bin p] [--gh-bin p] | Run an eval suite; the --…-bin options use other programs (Evals) |
scf eval safety [--claude-bin p] [--codex-bin p] [--gh-bin p] | Run every offline safety suite in evals/safety; exits 1 when a case fails (Safety suites) |
scf eval help [--live] | Check Ask Foundry against its fixed scenarios; without --live no model is called |
scf clean [--older-than 7] [--purge] [--dry-run] [--evidence-older-than days] | Remove old run workspaces. With --evidence-older-than it also removes the evidence of the cleaned runs that ended at least that many days ago (Evidence of a run). With --purge it also removes plan records (see below) older than the larger of 90 days and --older-than |
scf user create [--admin] [--name n] [--email e] | Create an account. The first one needs --admin. Name and e-mail are asked for on a terminal |
scf user list | List accounts with the last sign-in; no password yet for an account that has not set one, provider for an account of the identity provider, break-glass for the emergency local admin (never shows passwords, hashes or links) |
scf user role <e-mail> admin|user | Change the role of an account (not the last admin); counts from the next call. A change to user removes the break-glass mark |
scf user break-glass <e-mail> on|off | Mark the one local admin that may sign in with a password while an identity provider is active, or remove the mark. Only an active admin with a password can be marked; marking another account moves the mark. Writes one audit line per changed account |
scf user password <e-mail> | Set a new password and sign the account out; also for an account without a password (its link ends) |
scf user block <e-mail> [--stop-work] / scf user unblock <e-mail> | Block (and sign out) or unblock an account (not the last admin). Queued jobs are cancelled; --stop-work also cancels running and waiting runs |
scf user delete <e-mail> | Delete an account, its sessions and its stored credentials (not the last admin) |
scf credential rotate-key | Re-encrypt all stored credentials under a new key |
scf credential check | Check that the macOS Keychain can store, read and remove the key |
scf auth set-token / status / clear-token | Store the Claude token in the macOS Keychain (stdin or a terminal; no operand or option), show where the sign-in comes from and when it was set, or remove it (chapter 7, "Claude token in the Keychain") |
scf evidence verify <run-id> [--json] [--runs-dir dir] | Check the evidence of a run: manifest, chain of events and named files (Evidence of a run). Exit code 0 verified, 1 not verified, 2 nothing to verify |
scf delivery validate --contract f --signature f --public-key k [--repo dir] [--checks f] [--comment f] [--events f] [--json] | Check a delivery contract against the checked-out commit, for a CI job. Exit code 0 no stop, 1 a stop, 2 a usage or read error (Check a delivery contract in CI) |
scf monitor off / on / status | Stop the monitor from making bug stories, let it make them again (this also closes the circuit breaker), or print the state and the mutes. Works when the server is not running |
scf policy restore <id> [--force] | Put back the last-known-good copy of a mandatory policy overlay as policies/<id>.json. A valid file is only replaced with --force; the replaced file is kept as <id>.json.replaced-<time> (Restore the last-known-good copy) |
scf policy break-glass --reason "<text>" --for <n>m|<n>h | Start a time-limited, audited break-glass record in the data folder. The reason is required (up to 200 characters, no credential-like text) and so is the duration (1 minute to 4 hours). A start while one is active is refused. While it is active, a privileged step that a broken mandatory policy would stop goes on (Break-glass) |
scf policy break-glass --end | End the active break-glass now and write its audit line. Exit 1 when none is active. The steps it let go on are denied again (Break-glass) |
Plan records. When issue-plan posts a plan, the Foundry saves a small plan record in
<data folder>/skill-plans/. It holds the skill request, the plan comment ID and hash, the HEAD
commit and the technology hash — never the plan text. If the record cannot be written and skills
are in play, the run stops with skills not resolved: … and resumes at post_plan; without
skills it only logs a warning. scf clean --purge and Clean up on Administration → Maintenance remove records older than
the larger of 90 days and the cut-off, and report and N plan record(s). A dry run only counts.
Records are only touched when the runs folder is the default one in the data folder.
The password is asked twice on a terminal, or read from the first line of stdin; it is never an
option or an environment variable. A password has 12 to 200 characters and must not be a common
one; scf user create and scf user password refuse others and change nothing. No command needs a signed-in session; only the web UI does.
Choose what a move or backup takes along#
scf data export lets you choose what a move or backup of the data folder takes along, and shows the count and size of each choice before anything is written. It uses the same catalogue as scf data inventory. The same choice is on the admin Settings page, in the card Move or back up (admins; read-only when the page is read-only, with no save button).
- Always: the essentials (settings, users, repositories, watchers, autonomy, refinements, skills lock, policy, and the saved choice itself).
- State (queue, notices, Your turn): taken only when the Foundry is drained, that is when no job is queued and no run is running. When the check cannot read every place, the state is left out and the command says why. It is empty or small after a drain.
- History, one choice per type:
none, the last7,30or90days, orall. Defaults: run records and evidence 90 days, audit log all, usage and costs all, telemetry none, daily digests 30 days, monitor findings 30 days. - Run workspaces and caches: not taken by default, because they are rebuilt. If you take them, the command warns you.
- Never taken: sign-ins, Keychain items, the login agent (LaunchAgent) and the command-line session. They are listed under Set up again on the new computer: sign in to the agents, add the Keychain items again, run
scf service install, and runscf login.
The choice is saved as data-selection.json in the data folder. It is a plain file of at most 64 KB; a key it does not know is refused. A saved file that cannot be read is shown with a note, and the defaults are used.
scf data export # asks on a terminal, then asks whether to save
scf data export --save choice.json # without a terminal: shows the plan, saves to this file
scf data export --selection choice.json # uses this choice and asks nothing
scf data export --json # one JSON document on standard output; asks nothing
Press Enter to keep the default that is shown. Cancelling the questions (for example with Ctrl+C) exits with code 1, prints Cancelled. on standard error and saves nothing. Use a saved file with --selection to repeat the same choice, for example in a scheduled backup.
Without --out the command only shows the plan and saves the choice; nothing else is written. To write the bundle, see the next section.
Write the export bundle#
scf data export --out <file> writes the choice as one bundle: a tar file that holds a manifest and the files the choice takes. It uses the choice you make (or the one in --selection), so the same question and the same drain check apply first.
scf data export --selection choice.json --out ~/Desktop/foundry-2026-12-02.tar
scf data export --out bundle.tar --json # one JSON document: the manifest summary and the check result
scf data export --out bundle.tar --encrypt # asks for the passphrase twice
- Contents.
manifest.jsonis the first member. Every file follows asdata/<path>, where the path is relative to the data folder. The bundle holds the essentials, state only when the Foundry is drained, run workspaces and caches when you chose them, and history cut by its time, as described in History cut below. Items that are never taken, unknown paths and symbolic links are not written. - History cut. Each history type is cut by the range you chose (
none, 7, 30, 90 days orall), measured from the time of the export:- Logs (
.jsonl: audit, usage, telemetry, monitor log and repairs) keep only the lines whose time is in range. A line without a readable time is kept. The file's SHA-256 in the manifest is that of the cut file. - Monitor findings keep only the findings whose last-seen time is in range. Daily digests keep the days in range, by the day in their file name.
- A run folder (
runs/*,workspaces/*/runs/*) is taken whole or not at all, by its start time. Its evidence, logs and test records come with it. Its workspace follows only the rebuildable choice. - Archived runs follow the runs range. An archived run that a kept record refers to, but that is out of range, is listed in
leftOutwith the reasonout-of-range, and the command names it. - A file that is cut to nothing is left out, except when the choice is
all. - A log line larger than 8 MiB, or a document (findings, run record, queue) larger than 64 MiB, cannot be cut exactly, so the export fails with a message. With
allnothing is cut, and such files are copied as they are. - Items that are never taken, unknown paths and symbolic links are not written.
- Logs (
- Manifest. It records the format (
1), the Foundry version and commit, the source host name and data folder, the selection, and per item its catalogue id, schema version, count and size. It has one record per file (path, size and SHA-256),encrypted(false, ortruewithencryption: { cipher: "aes-256-gcm", kdf: "scrypt" }), andleftOut. Itshistorygives, per history type, the choice, the cut time, and the counts of records and files kept and dropped (a run folder or a digest counts as one record). A manifest from an older version has nohistory. - Encryption.
--encryptencrypts the whole tar with a passphrase you choose. On a terminal the passphrase is asked twice, and the two must match. With--passphrase-stdin, the first line of standard input is the passphrase. It must be 12 to 1024 characters. It is never stored, logged or shown in an error. The file starts with a short clear header (the format, the scrypt settings and a salt), then AES-256-GCM chunks of 64 KiB, each checked on its own, so a cut, reordered or changed part is detected.--encryptneeds--out. Without a terminal it needs--passphrase-stdin, and otherwise it fails before anything is written. Keep the passphrase safe: without it the bundle cannot be read. - Secrets. Without
--encrypt, a secret item is never written in plain text. The command lists each one, and the manifest'sleftOutgives it the reasonsecret-not-encrypted. Set these up again on the new computer. With--encryptthe secrets are included, because the whole bundle is encrypted. - Check. After writing, the bundle is read back (and decrypted, when encrypted). Every member must be in the manifest with the same size and SHA-256, and every manifest file must be in the bundle. A mismatch fails the export with a message that names the problems. A wrong passphrase or a changed byte gives "the bundle cannot be decrypted (wrong passphrase, or the file was changed)".
- Safe writing. The file is first written as
<file>.<pid>.tmpand renamed to<file>only when the check passes. On any failure the temporary file is removed and the command exits with code 1. The bundle cannot be written into the data folder, and--outcannot be a folder. - Drain. If a Foundry server runs on the data folder, the export first holds it. No new run starts, and the watchers and the monitor stop. Runs that are still active get
--wait <minutes>(default 10) to finish; the command prints each run that finished. Runs still active after that are stopped, and their resume is saved so they go on after the export. The command prints each stopped run. The stop is not confirmed until the run resumes. Then the bundle is written and checked, and the hold is released, so the Foundry starts again. The release also happens when the export fails or is cancelled with Ctrl-C. A hold is a 10-minute lease that the command renews, so if the command crashes, the hold ends by itself. If a restart is waiting to drain the Foundry, or a held start is waiting, the export is refused (409) until that ends. If the server is running but you are not signed in, the export fails: sign in withscf login, or stop the server. Without a running server, the drain check above is used. The manifest'sdrainrecord names the server, the time, and the runs that finished and were stopped. - Admin routes.
POST /api/admin/data/export-hold({ waitMinutes }to start,{ id }to renew),GET /api/admin/data/export-holdandPOST /api/admin/data/export-release({ id }). They are for admins only and are audited.
The bundle is not an import yet: restoring it on another computer comes in a later version.
Environment variables#
Both names work; if both are set, SCF_… wins.
| Variable | Old name | What it does |
|---|---|---|
SCF_HOME | FACTORY_HOME | Data folder (default ~/.spaghetti-code-foundry) |
SCF_CLAUDE_BIN | FACTORY_CLAUDE_BIN | Claude Code program to run |
SCF_CODEX_BIN | FACTORY_CODEX_BIN | Codex program to run |
SCF_GH_BIN | FACTORY_GH_BIN | gh program to run |
SCF_NO_OPEN | FACTORY_NO_OPEN | Set to 1 to not open a browser |
SCF_NO_SUPERVISE | FACTORY_NO_SUPERVISE | Set to 1 to not restart the server on a new build |
SCF_NO_NOTIFY | FACTORY_NO_NOTIFY | Set to 1 to turn notifications off |
SCF_NO_FAILURE_MODEL | FACTORY_NO_FAILURE_MODEL | Set to 1 to skip the model call that writes the reason of a failed run |
SCF_LOCK_DIR | FACTORY_LOCK_DIR | Where lock files are kept |
FACTORY_DEVELOP_SETTLE_SEC | — | Seconds develop must stay on one commit before a run that waited for it tries again (default 120) |
FACTORY_DEVELOP_QUIET_MAX_SEC | — | The longest wait for a quiet moment in seconds (default 1800, at most 2100) |
FACTORY_DEVELOP_QUIET_POLL_SEC | — | Seconds between two checks while waiting for a quiet moment (default 15) |
Self-update settings for tests and rehearsals. Only the FACTORY_SELF_UPDATE_… names are read; they are not in config.yaml or the API. Read when the server starts; unset, the normal values apply.
| Variable | What it does |
|---|---|
FACTORY_SELF_UPDATE_CHECK_MS | How often self-update looks for a new commit, in milliseconds (1000 to 86400000) |
FACTORY_SELF_UPDATE_HEALTH_MS | How long the supervisor waits for a new version to confirm its start, in milliseconds (5000 to 600000). The wait is fixed: no extra time is added on a busy machine |
FACTORY_SELF_UPDATE_MAX_HEALTH_MS | The longest wait for a new version that reports progress while it starts, in milliseconds (5000 to 600000, default: the health wait). Must not be below the health wait |
FACTORY_SELF_UPDATE_STEPS | JSON that replaces the install, build or test step, each with cmd, optional args and timeoutMs (1000 to 7200000) |
FACTORY_SELF_UPDATE_ORIGIN | A local origin URL that counts as self_update.repo |
A value that is not valid is not used, and the log says so with one line.
Flows are looked up in <repo>/.claude-factory/flows/, then ~/.spaghetti-code-foundry/flows/, then the
built-in ones.