Skip to content

Reference

Directory layout

Every file a workflow directory and a workspace directory holds, who writes it, and what to commit.

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:

PathWhat it isIn git
workflow.tsThe workflow, in file syntaxCommit
functions/One file per Function block's codeCommit
.sim/lock.jsonTies each block in the file to the stored block, so renaming a block keeps its webhook URL, schedules and run historyCommit
.sim/base.jsonThe workflow ID and the version you readCommit
.sim/written.jsonA digest of each file as the CLI last wrote it, so status and get tell your edits from the CLI'sCommit
.sim/stored-edges.jsonThe connections the stored workflow held when it was printed, so an offline check tells them from connections you added. The CLI's own record, never sentCommit
.sim/starter.jsonThe workspace a starter was written for, before createNot kept: removed once the workflow exists
.sim/AGENTS.mdThe guide for coding agents: the primer, then a referenceOptional, written again by get
.sim/GUIDE-advanced.mdThe rest of the guide, by task: the edit loop step by step and what a dry run stubs, a new workflow or a fork, finding a builder and its types, the rules, and every diagnostic and exit codeOptional, written again by get
.sim/examples/Example workflows to copy fromOptional, written again by get
.sim/sdk/Type declarations for the blocks the workflow uses, and your workspace's tables, credentials, knowledge bases and environment variable names. .sim/sdk/INDEX.md lists the buildersOptional, written again by get and check
tsconfig.jsonResolves the declarations and type-checks the blocks the workflow uses. Left as it is if you already have oneCommit
tsconfig.full.jsonType-checks every block through the CLI's cacheIgnore: it names the cache on your machine, and check writes it again
.gitattributesKeeps the source files on LF line endingsCommit

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.

text
secrets.ts                        the env variable names workflows read (never a value)
credentials.ts                    the saved credentials workflows use, by provider
tables/orders.ts                  a table: name, description, columns
tables/plans.rows.jsonl           a table's rows, one JSON object per line (only when the table opts in)
knowledge/policies/knowledge.ts   a knowledge base: name, chunking
knowledge/policies/docs/*.md      one file per document
files/templates/reply.md          a workspace file, at its folder path
tools/lookup-order.ts             a custom tool: title and schema
tools/lookup-order.js             the tool's code
skills/tone.md                    a skill: name and description, then its content
mcp/docs.ts                       an MCP server: url, headers
workflows/support/workflow.ts     a workflow directory
deployments/support.ts            how workflows/support is deployed

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 with sim 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 is name. 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 in tools/<key>.js, where each schema parameter is a variable. Code holding a literal credential prints as code: stored(), which keeps the stored code. A workflow: customTool('<key>').
  • skills/<key>.md: a frontmatter block of name and description, 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 holds env.NAME or 'Bearer {{NAME}}', never a literal secret; stored() keeps the value the server holds. A new host or path in url replaces 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: { … } }) with column.string(), column.number(), column.select({ options: [...] }), … from @sim/workflow-sdk/workspace. Rows stay out of source unless rows opts in: { mode: 'managed', key: '<unique column>' } keeps the rows equal to tables/<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? })) and knowledge/<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 a sim workflows source get --dir directory (workflow.ts, functions/*, .sim/lock.json, .sim/base.json).
  • deployments/<workflow key>.ts: defineDeployment({ live: 'draft' | 'pinned', api?: { public? }, chat? }) deploys workflows/<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 is env.NAME (or stored() 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:

PathWhat it isIn git
.sim/base.jsonThe workspace the directory was read from and the version of every resourceCommit
workflows/<key>/.sim/Each workflow's lock.json, base.json and stored-edges.json, as aboveCommit
.sim/written.jsonA digest of each file as the CLI last wrote it, so status and get tell your edits from the CLI'sCommit
.sim/targets/<workspaceId>.jsonWhat each promotion left in that workspaceCommit
.sim/skipped.jsonDocuments and files a get left out, with the reasonOptional
.sim/AGENTS.md, .sim/GUIDE-advanced.md, .sim/examples/, .sim/sdk/The agent guide with deletes, Git and CI, and promotion in depth; examples of every kind; type declarations including .sim/sdk/workspace.d.tsOptional, written again by get
.sim/cache/This machine's file stats. It ignores itselfNot committed
tsconfig.json, tsconfig.full.json, .gitattributes, .gitignoreAs for a workflow directory. .gitattributes also keeps workspace files and knowledge base documents byte for byteCommit all but tsconfig.full.json

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.

Was this helpful?
Suggest an edit