Deploy and Operate
Change your product's code, bring your own repository, deploy, and run its database and secrets.
Once your company has a repository and hosting, your agent changes your product's code, ships it live, and runs its database, functions, and secrets.
Work on the Repository
Your repository holds your product's code. Your agent clones it, makes
changes, checks them, and pushes them straight to the production branch, then
deploys. New repositories use main, and existing ones keep their branch.
Your agent starts with cofounder repo status. It shows the production
branch, the last deploy, and open pull requests, so your agent knows what's
already in progress.
cofounder repo clone # clone over HTTPS with CLI-managed credentials
cofounder repo status # production branch, last deploy, open PRsYour agent reaches the repository one of two ways:
- Over HTTPS, with a short-lived token for the company's repository,
including imported ones. A clone made with
cofounder repo clonegets a fresh token from the CLI on each fetch or push, so the token never appears in your agent's output. These pushes can't change GitHub workflow files. - Over SSH on managed repositories, with a key pair your agent makes where it runs. Only the public key is registered with Cofounder. You can list and revoke registered keys. SSH pushes can change workflow files.
Your agent can leave a handoff note for whoever works on the branch next. To enter environment variables yourself, use the dashboard secrets page before continuing an import.
Save a Cofounder Sandbox
Create restores your company's saved environment. When it reports
software_update_available, save a new snapshot to update managed tools and
keep the updated environment for future creates:
cofounder sandbox base-snapshot update --sandbox-id <sandbox_id> --idempotency-key <key> --waitSaving runs as a background job: it updates outdated managed software in the
supplied Cofounder sandbox, checks it, and replaces the saved base. Pass
--wait in scripts so the CLI polls until completion and returns the finished
job with output.snapshot_id. Without --wait in non-interactive shells, the
command returns the accepted job immediately; poll it with
cofounder sandbox base-snapshot updates get --job-id <job_id> and read
output.snapshot_id once it succeeds. Project files and project dependencies
stay in place. A failed update keeps the previous saved base, although the
running Cofounder sandbox can already contain installation changes. Running
programs keep their loaded software until restarted.
base_update_available means the underlying base needs replacing. Use
cofounder sandbox base-snapshot rebuild --wait for that update.
Resize a Cofounder Sandbox
Your agent can give a running sandbox more CPUs, memory, or disk without restarting it, and can lower CPUs and memory again later. Disk can only grow.
cofounder sandbox resize --sandbox-id <sandbox_id> --cpus 4 --memory-gib 8
cofounder sandbox get --sandbox-id <sandbox_id>From MCP, call sandbox_resize. Pass only the sizes you want to change.
- A larger sandbox costs more while it runs.
- If a size is refused, the error names the limit it crossed.
- Memory can't go below the size the sandbox started with. Lowering it stops programs that no longer fit.
- A resize can take a few seconds, and one that was accepted can still fail.
cofounder sandbox getshows the final status and the current size. - Saving a sandbox keeps its size. New sandboxes start with the same CPUs, memory, and disk, and can't lower memory below it. Lower CPUs and memory before saving if you only needed more for one task.
- Rebuilding the saved base returns new sandboxes to 2 CPUs, 4 GiB of memory, and 10 GiB of disk.
Bring Your Own Repository
Your agent can copy a local folder into the repository Cofounder made, or import your GitHub repository, even before its first commit.
Uploading a local folder needs no GitHub connection. Your agent previews the upload first, then sends it:
cofounder repo upload . --dry-run
cofounder repo upload . --yes --expected-head <base_sha>
cofounder repo clone <new-folder>The upload replaces the files on the production branch and keeps the repository's history. Your local files, Git history, and remotes don't change. Git-ignored files, dependencies, build output, common secret files, and symlinks are left out. Environment examples are kept. An active import must be disconnected first. The push can start a deploy. Your agent then works in the new clone and follows the upload's instructions to fix the app, configure Vercel and Supabase, add missing secrets securely, deploy, and check the live app.
Over MCP, your agent gets an upload token with code_upload_token_create and
runs the same upload with Git. The cofounder-repo-mcp skill has the steps.
Importing a GitHub repository makes it the company's app instead of the one setup made:
- You connect GitHub and choose which repositories the Cofounder GitHub App can see.
- Your agent picks a repository automatically only when the first page
contains one writable repository and there are no more pages. Otherwise,
tell it which one.
Your agent follows
page.next_cursoreven after a short or empty page. Browsing your repositories doesn't start an import. - For a single-app company, there's nothing to set up in Vercel. Cofounder deploys the repository whenever your agent deploys and whenever a commit lands on its default branch.
- Otherwise, the repository connects to the existing Vercel project. If Vercel can't read it, the previous connection comes back and the import waits for you. Accept the Vercel invitation, open the Git settings link your agent gives you, and connect the repository to that project. For a personal GitHub repository, its owner must do this. Your agent then finishes the import.
Importing doesn't deploy the app, and any database setup stays attached. Your agent can cancel an unfinished import. After an import finishes, disconnecting switches back to the repository setup made. After a GitHub-only setup there is none to restore, so hosting and the database stay ready for another import.
cofounder repo import --wait --json
cofounder repo import <owner/repo> --wait --json
cofounder repo import continue --wait --jsonAn empty repository can finish importing without code. Hosting uses the Next.js preset, and no sandbox base is prepared. Push your app's code to the repository's default branch before deploying; a deploy before the first push returns a conflict asking you to push code first.
For a Next.js app, push and then deploy. For another framework, or to prepare
a sandbox base, push the code and rerun cofounder repo import <owner/repo> --wait,
then cofounder repo import continue --wait before deploying. Over MCP, use
code_repository_import_start, then code_repository_import_continue.
Deploying alone does not detect a new framework or prepare the sandbox base.
Import, continue, cancel, and disconnect return a call ID. Use --wait to
wait for the result, or read it later:
cofounder code repository-import jobs get --job-id <job-id> --jsonWhen the call succeeds, output has the import state and its next action.
repo import status reads the company's current state. The call result stays
attached to the request that created it, even after the company changes.
If a response is lost, repeat the same call with the same
--idempotency-key value and options. MCP and API callers must supply
idempotency_key; the short CLI commands create it when omitted. After
connecting GitHub or changing an import option, make a new call with a new
value.
Link Repository to Hosting
Connect an existing company GitHub repository to its managed hosting project without publishing a deployment. Future pushes may deploy from the production branch, and a different live repository link is never replaced.
cofounder hosting repository link --resource <hosting-resource-id> \
--repository-resource-id <repository-resource-id>Over MCP, call hosting_repository_link with the company's
repository_resource_id and select the hosting project as the target. Managed
product repositories use their configured production branch (default main);
managed marketing repositories use their configured production branch (default
prod). Imported repositories use the hosting project's saved production
branch, then the repository's default branch (default main).
Deploy
A deploy runs your database migrations and ships your code to Vercel. It takes a while. Your agent follows it until it finishes, then checks that the app came up. Every deploy stays in the history, with its events.
Readiness describes one exact deployment. If a newer deployment owns the
app address, the older one reports mismatch and tells your agent how to
inspect the newer deployment. Follow that check to verify its health.
Matching source revisions alone do not make the older deployment live.
Configure a Preview Branch
New Git-linked managed projects enable Preview builds after their first production release. For a branch push to trigger a build, Vercel must have both the Git repository linked and Preview deployments enabled. Upload-only imports deploy from source archives and do not build on branch pushes. For a study with signed-out participants, also check Deployment Protection and open the preview URL while signed out.
An admin can set a variable for the next Preview build on a managed hosting project. To copy a readable Production value to an existing branch, specify the key and branch. This copies the current value once.
cofounder hosting preview env set --resource <hosting-resource-id> \
--key STUDY_EDITION --branch study --copy-from-productionTo supply a different value, replace --copy-from-production with
--value-file <path>. The file must contain a JSON string, such as
"pilot". Use this option for write-only Production variables. Omit
--branch to set the Preview default. Over MCP, use hosting_preview_env_set.
The next Preview build uses the saved value.
Run the Database
Migrations, functions, secrets, and queries on your app's Supabase database run through your Cofounder login, so you need nothing extra on your machine. See Database for queries, branches, and storage.
Set App Secrets
App secrets go straight to your hosting without touching a local env file. Deploy secrets and local env files are different things. See Secrets and Environment Files.
Hosting and GitHub Credentials
When your agent needs to run the Vercel CLI or check workflow runs through GitHub's API, it can get the providers' own credentials. These are CLI and API only.
The GitHub token works only on the company's repository and expires after
about an hour. Your agent keeps it out of logs and commits and gets a fresh
one after it expires. On MCP, the push token gives only Git access with
contents:write and can't edit workflow files.
Commands
| MCP | CLI | API |
|---|---|---|
| , | ||
| , | ||
| — | — | |
| , , | ||
| , | ||
| , | ||
| , | ||
| — | — | |
| — |
cofounder database also covers query, branches, and storage, and
cofounder database refs list lists the databases.
For desktop/local Git over HTTPS, store the push token in COFOUNDER_GIT_TOKEN
and use it through GIT_ASKPASS for clone, fetch, and push. The cofounder-repo-mcp
skill shows the setup, and the cofounder-repo skill covers CLI access. Use
the returned env.GH_TOKEN and env.GH_REPO from gh-credentials create
with GitHub's API or gh.
In a Cofounder sandbox, use ordinary Git commands with its configured credentials and commit identity.
For desktop work on an existing marketing site, call code_repository_get and
code_desktop_push_token_create with purpose=marketing. The token lets your
agent clone, read, commit, and push to that repository through your Cofounder
connection. Push to the returned production_branch, then call
hosting_deploy with purpose=marketing. The hosting_deployments_* tools
read the product app unless you pass the marketing site's resource. No
separate GitHub connector is needed. In the CLI, use
cofounder code desktop-push-token create --purpose marketing.
Without a purpose, the token targets your product repository.