get writes a directory, and every later command reads and rewrites it. Keep the .sim/ folder: it is how Sim recognizes each block and resource again, and how an apply knows what version you read.
Workflow directory
sim workflows source get <workflowId> --dir <dir> writes:
The declarations of every block are generated once per block catalog into the CLI's cache, ~/.sim/cache/source-catalog/, and shared by every directory. A workflow directory gets no .gitignore, so add the lines for what you ignore.
While a command runs it holds .sim/command.lock/, so two commands on one directory never interleave. A second one exits 10.
Workspace directory
sim workspaces source get --dir <dir> writes one folder per kind of resource. A kind is managed only when its folder or file exists.
A resource's key is its file or folder name, and a workflow names it by that key. Every .ts file starts with the line // @sim-sdk 1, a deployment included; the one-line forms below show only the call. What each kind's file holds:
secrets.ts:export default defineSecrets({ NAME: { description? } }), the workspace secrets workflows read, by name and description only (never a value: set one withsim secrets set NAME --scope workspace). A workflow:env.NAME; one using a declared secret the workspace has no value for is held back, and the rest apply.credentials.ts:export default defineCredentials({ <key>: { provider, name? } }), binding each key to this workspace's credential for that provider (never a token): the one bound already, else the only one, else the one whose display name isname. A workflow:credential('<key>'); one using a key no credential binds to is held back, and the rest apply.tools/<key>.ts(defineTool({ title, schema, code: codeFile('./<key>.js') })) and its code intools/<key>.js, where each schema parameter is a variable. Code holding a literal credential prints ascode: stored(), which keeps the stored code. A workflow:customTool('<key>').skills/<key>.md: a frontmatter block ofnameanddescription, then the content. A workflow:skills: [skill('<key>')]on an agent.mcp/<key>.ts:export default defineMcpServer({ name?, url, headers?, auth?, timeout?, retries?, enabled? }). A credential header holdsenv.NAMEor'Bearer {{NAME}}', never a literal secret;stored()keeps the value the server holds. A new host or path inurlreplaces the server; a new query string updates it in place. A workflow:mcp('<key>').tool('<name>').tables/<key>.ts:export default defineTable({ name, description?, folder?, columns: { … } })withcolumn.string(),column.number(),column.select({ options: [...] }), … from@sim/workflow-sdk/workspace. Rows stay out of source unlessrowsopts in:{ mode: 'managed', key: '<unique column>' }keeps the rows equal totables/<key>.rows.jsonl(one JSON object per line, keyed by column key),{ mode: 'seed' }writes them once into a new table. A workflow:table('<key>').knowledge/<key>/knowledge.ts(defineKnowledgeBase({ name, description?, folder?, chunking?, embeddingModel? })) andknowledge/<key>/docs/, one file per document, flat. A workflow:knowledgeBase('<key>'). Connector-synced documents are never part of source.files/<path>: every file is one workspace file at that folder path; no declaration.workflows/<key>/: one workflow each, exactly asim workflows source get --dirdirectory (workflow.ts,functions/*,.sim/lock.json,.sim/base.json).deployments/<workflow key>.ts:defineDeployment({ live: 'draft' | 'pinned', api?: { public? }, chat? })deploysworkflows/<workflow key>/, so its schedule, webhook, API and chat triggers run.live: 'draft'publishes the draft whenever it differs from the live version;'pinned'never redeploys and says when the draft differs. A chat password isenv.NAME(orstored()to keep the stored one); chat outputs name a block by its name. Removing the file undeploys the workflow (needs--allow-delete). Deploying needs workspace admin, never a workspace API key. MCP publishing is not part of source.
Beside the resources:
The generated .gitignore leaves out only what a command keeps while it runs (.sim/downloads/, .sim/command.lock/, .sim-staging-*) and tsconfig.full.json. Commit the rest, including .sim/: a fresh clone can then run check, apply --dry and apply.