Claude Code, Cursor, Codex and other coding agents work from a directory that get writes.
What get gives an agent
- A primer, which opens
.sim/AGENTS.md.getprints a short summary instead (the files written, the guide, and theeditLoopcommand to run). It covers the edit loop, how block identity, references and renames work, failures and retries, test runs, deletes, deploy, exit codes, and the params of each builder the workflow already uses. .sim/AGENTS.md: the primer followed by a reference, by task..sim/GUIDE-advanced.mdbeside it has the rest, by task, in a workflow directory and a workspace directory alike..sim/examples/: one correct example of each common block to copy from..sim/sdk/: the type declarations, with.sim/sdk/INDEX.mdlisting the builders.
Point the agent at .sim/AGENTS.md before it edits.
The loop
-
sim workflows source get <workflow> --dir <dir> && cat <dir>/.sim/AGENTS.mdwrites the workflow and the guide and reads the guide's primer in the same call.<workflow>is the workflow's id or its exact name. -
Write every file the change needs.
-
Run one chained command, then fix whatever it reports in the next step:
Code A non-zero exit code stops the chain at the first failure.
applycompiles the source and compares it with the saved draft again, so an agent can skip--dry.checkalso type-checks the directory, so the chain needs no separatetsc. People and CI useapply --dryto review the plan, andstatusshows what changed and what to run next.--rundry-runs the saved draft with that input, and--deploydeploys only if the run completed; a run that fails exits 1, deploys nothing, and maps the failing block to its file and line. Drop--deployto keep the change a draft. The result opens with a one-linesummaryand ends witherrors,warnings,liveandnext, so a| heador| tailof it still shows the outcome.The dry run (also
sim workflows run <workflowId> --dry) tests the saved draft without sending its writes: each write returns a placeholder and is listed undersideEffectswith the request it would have sent, so the agent checks payloads instead of cleaning up rows or messages.--allow <block>sends one block's writes for real against a test resource, and--draftruns everything for real.
For a whole workspace, use sim workspaces source with the same steps: its chained command is sim workspaces source check --dir <dir> && sim workspaces source apply --dir <dir> --yes --run <key>='{...}', one --run per workflow folder (workflows/<key>/) to test, and deployments/ is applied only if every run completed. See Test workflows on apply.
Look things up
sim workflows source find <block>prints one block of the workflow by name, key or identifier, from the directory without a request: its declaration with line numbers, its function file, its incoming and outgoing wiring and every block that reads its outputs, each asfile:line. A part of a name prints every block it matches.sim workflows source params <builder>prints a builder in brief (an example call, the required params with types, the optional ones by name and the outputs) from the cached block catalog without a request.--fullprints every param with its type, options, default and doc. A legacy builder names the one that replaces it, and a namespace such asgmaillists its builders.sim workflows source resourceslists the tables, knowledge bases, credentials, workflows, skills, custom tools, MCP servers and environment variable names the file can name.sim workflows source catalogshows the block catalog the source is checked against.
Exit codes and retries
An agent can branch on the exit code: 5 means the workflow changed and it must get into a fresh directory, 14 means it forgot --yes, and 9 means wait a minute. See Exit codes.
Over MCP and the API
getWorkflowSource returns a workflow as TypeScript source files with its lock and base. Edit the files and send them back, with the same lock and base, through applyWorkflowSource, first with query: {"dry": true}. One call replaces a batch of graph operations. See MCP tools and Build and run workflows.