WITNESS
Docs · v1 alpha

Witness, in plain words

Witness gives every pull request its own running copy of your app, in a private cloud computer called a sandbox. When it's up and healthy, Witness hands the link to the agent (or person) that opened the PR, so they can test the real thing before anyone merges.

What it does

Builds your whole stack for each PR: every repo of the change, your secrets, and a database copy if the schema changed.

What it doesn't

It runs no AI model and writes no code. Your own agent does that, on your machine. Witness never merges and never pushes.

Who it's for

Teams and solo builders running coding agents who are tired of testing every branch on their own laptop.

What you need

Your code on GitHub, a Node, Go or Python app (or Cloudflare Workers), and an agent that can open PRs.

Quick start

About ten minutes, once. After that, every PR deploys on its own.

  1. Sign in with GitHub

    Open witness.motiontic.com, choose Sign in, then Continue with GitHub. Pick a short handle: it appears in your preview links.

  2. Install the GitHub App

    Choose which repos Witness can see. The app can read code and write checks and comments. It can't push or merge.

  3. Create a project

    A project is the set of repos that deploy together, for example acme/web and acme/api. Search and pick them. Witness reads each repo and suggests how to install, build, start and health-check it. Check it once and save.

  4. Add your secrets

    The first time, Witness creates your account key in the browser and shows a recovery key: write it down. Paste a .env file per repo. Values are encrypted before they leave the page.

  5. Install the CLI and pair this machine

    $ npm i -g @witness/cli
    $ witness login            # approve the pairing in the dashboard
    $ cd ~/code/acme-web && witness init

    During the private alpha the CLI is installed from the Witness repo. witness init remembers which project a checkout belongs to.

  6. Connect your agent

    $ claude mcp add witness -- witness mcp

    Other agents: see the agent loop.

  7. Open a pull request

    Ask your agent for a change. It opens the PR, waits for the deployment, tests the live link and reports back on the PR.

Your first tested PR

Here is what you'll see, in order:

  1. The PR gets a witness/deploy check that turns yellow, then green.
  2. The dashboard shows the feature, for example STR-218, moving through its states with live logs.
  3. Your agent's witness_wait returns ready with a link like str-218.acme.witness.run.
  4. The agent opens it in its browser, clicks through, and calls witness_test_finish with screenshots.
  5. A witness/test check and a comment appear on the PR, linking to the full report.

If anything fails, the agent gets a short event that says what to fix. It fixes, pushes, and waits again. You don't have to step in.

How it works

Every step is triggered by GitHub. There is no "deploy" button to remember.

  1. A PR opens or gets a new commit

    GitHub tells Witness. Witness works out which feature the PR belongs to, using the branch name, a Witness: line, or a manual link. It never guesses.

  2. Witness waits for the whole change

    If the feature touches two repos and only one PR is open, it waits for the other ("waiting for PRs"). Repos with no PR run their target branch, usually main.

  3. A sandbox starts

    A fresh private cloud computer, usually from a warm snapshot so it starts fast. The code is fetched and dependencies installed, before any secret arrives.

  4. Your device unlocks the secrets

    One of your paired devices (the CLI, the MCP server, or an open dashboard tab) decrypts the secrets and seals them to that one sandbox.

  5. Build, migrate, start, check

    Witness builds each service, runs migrations on a database branch if the schema changed, starts everything, and calls every health path and route until they answer.

  6. Ready: the link goes to the agent

    The agent tests the preview in its own browser, reads logs and traces, and records a verdict with evidence.

  7. Results land on the PR

    Two checks and one comment, updated in place. A person reviews and merges. When all PRs merge or close, the sandbox and database branch are deleted.

Concepts

Project

Repos that deploy together, each with a target branch. Has a short key like STR.

Feature

One change across repos: one or more PRs grouped together. Named like STR-218.

Deployment

The running copy of a feature. One per feature, with a state like building or ready.

Attempt

One try at deploying. A new commit cancels the current attempt and starts a new one.

Sandbox

The private cloud computer a deployment runs in. It runs your app only: no model, no agent, no browser.

Repo config

How to install, build, start and health-check a repo. Detected for you, edited by you.

Account key

Your encryption key. It lives on your devices; Witness never has it.

Unlock

A device of yours decrypting a deployment's secrets and sealing them to its sandbox.

Feedback event

What happened, where, and what to do next: the message agents act on.

Test run

An agent's recorded test: verdict, notes, findings and evidence files.

A deployment's life

Every deployment moves through these states. The dashboard, CLI and MCP all show the same ones.

waiting_for_prs→queued→unlocking→building→booting→health_gate→ready→testing→passed
failedsleepingdeleted

A deployment can also be held, with a reason:

HoldMeansWhat clears it
waiting_for_unlockSecrets are needed and no device of yours is online.Start witness unlock --background, run witness mcp, or open the dashboard.
waiting_on_agentA stage failed and the agent should fix it.A push to the PR.
needs_youThree failures in a row, a missing secret, a provider error, or the spend cap.Fix the cause, then witness redeploy.

A new commit on any PR of the feature cancels the current attempt and starts a fresh one. A preview with no visits for 10 minutes goes to sleep, and wakes when someone opens it.

Architecture

Witness has three parts: your machine, the Witness control plane, and one sandbox per feature.

YOUR MACHINE Your coding agent witness CLI · MCP Unlockerholds your account key GITHUB Repos and pull requests Witness App: read code, write checks and comments WITNESS · CLOUDFLARE APIwebhooks, REST, live stream Feature orchestratorone per feature, runs attempts Account schedulerslots, caps, queue Preview proxysigned links, sign-in gate Dashboardprojects, logs, reports Neon · control database SANDBOX · PER FEATURE witnessdbuilds, runs, checks web · api · worker Front doorone port, all services Secrets in memorymasked in every log Your database branchNeon or Supabase, per PR webhook start events secrets, sealed to this sandbox wait · logs

What runs where

  • Your machine: your agent, the witness CLI and MCP server, and the unlocker. Your account key never leaves your devices.
  • The control plane runs on Cloudflare Workers. It receives GitHub events, groups PRs into features, schedules sandboxes, streams logs, and serves the dashboard and preview links. It makes no AI calls.
  • The sandbox is a fresh, private VM per feature. A small daemon, witnessd, builds and runs your services, checks their health, masks secrets in logs, and reports back.
  • Your database: if a PR changes the schema, the unlocker on your device creates a branch of your Neon or Supabase database for it, using your provider key.

Rules the design never breaks

  • No AI model or agent runs in the control plane or the sandbox.
  • Secret values exist only on your devices and in a running sandbox's memory.
  • No snapshot is taken after secrets enter a sandbox.
  • The GitHub App can't push or merge.
  • A PR is the only trigger, and grouping is never guessed.

Features across repos

One change often touches several repos: a new field in the API and the form that uses it. Witness groups those PRs into one feature and deploys them together. Three ways, checked in this order:

  1. Same branch name. PRs in the project's repos on the same branch, like coupon-field, are one feature.
  2. A Witness: line in a PR description naming the other PRs. Best for agents that pick their own branch names.
  3. A manual link from the dashboard or witness link.
# in a PR description
Witness: acme/web#148, acme/worker#12

# or from the CLI
$ witness link acme/web#148 acme/api#88

If a feature waits for a PR you won't open, run witness deploy --now: the missing repo runs its target branch.

Repo config

When you add a repo, Witness reads it (the package manager, framework, start scripts, ports, routes, migrations and env names) and drafts a config. You review it once. Each service has:

FieldWhat it is
cwdThe folder the service lives in, like . or apps/web.
install · buildCommands run before secrets for install, after for build.
startHow the service starts. One line.
migrateYour migration command, run on the database branch.
portThe port it listens on. Every service shares one sandbox, so ports must differ.
healthA GET path that answers 200 when the service is up.
routesPaths to check before calling it healthy, or auto to detect them.
public · primaryWhether it gets a preview link, and which one is the main link.
dependsOnServices that must start first.

Detection knows Next.js, Vite, Nuxt, Astro, SvelteKit, Remix, Express, Fastify, Hono, Koa, NestJS, Cloudflare Workers (wrangler or the Vite plugin), Go and Python, in single repos and workspaces. Anything it isn't sure of, it asks you to fill in.

Secrets and unlocking

Witness needs your app's secrets to run it. It's built so it can't read them.

  1. You paste secrets in the dashboard, or run witness secrets import .env. They're encrypted on your device with your account key. Witness stores only ciphertext.
  2. When a deployment needs them, Witness asks your devices. The first one online (the MCP server, witness unlock --background, or an open dashboard tab) decrypts them and seals them to that sandbox's one-time key.
  3. The sandbox opens them in memory, masks them out of every log line, and they're gone when it stops.

Each unlock request is signed by Witness, and the CLI remembers Witness's signing key the first time, so a changed request is refused. Each secret is bound to the repo you set it for.

Keep the recovery key safe. It's the only way to get your secrets back on a new device if you lose all of them. Witness can't recover it.

Database branches

Point a project at Neon or Supabase, and save that provider's API key as a project secret. Then choose a rule:

  • When the schema changes: a PR that touches migrations or the schema gets its own database branch, copied from your parent branch.
  • Always: every feature gets a branch.

Witness runs your migrate command on the branch, injects its connection string as DATABASE_URL, and deletes it when the feature closes. Your main database is never touched.

Health gate

"Started" isn't "working". Before a deployment is ready, Witness calls each service's health path and every known route, and expects a good answer. A route that errors becomes a failure the agent can fix, with the path and the response.

Feedback events

Every failure comes back as a short, structured event, written for an agent to act on without a human:

{
  "status": "failed", "stage": "build", "service": "web",
  "title": "Type error in app/page.tsx",
  "where": "app/page.tsx:16",
  "next": "Pass a number to formatCents on line 16, push, then wait again."
}

Witness reads the build or start output with fixed rules (no AI) to find the file and line. next is always one plain sentence.

Preview links

A ready deployment has a link like str-218.acme.witness.run, plus one per public service (str-218--api.acme.witness.run). Previews are private:

  • Signed in to the dashboard, you can open them.
  • witness url or witness_url gives a signed link, valid for one hour, that your agent's browser can open.
  • Opening a sleeping preview wakes it. The page tells you why it's waiting.

Test runs and evidence

When the agent tests a preview, it records a test run:

$ witness test start
$ witness test finish --verdict pass --evidence ./shots --notes notes.md

Screenshots, videos and traces go into the run's evidence (kept 30 days). Findings have a severity: blocker, major, minor or info. The report page shows all of it, and the PR gets the summary.

PR checks and comment

  • witness/deploy: green when the deployment is healthy, red with the event when it failed.
  • witness/test: the latest test run's verdict.
  • One comment, updated in place: the state, the preview link, findings, evidence and a link to the report.

Re-running the deploy check on GitHub redeploys.

Sleep, wake and snapshots

To keep costs down, a preview nobody uses for 10 minutes goes to sleep: the sandbox stops, and a snapshot taken before secrets arrived is kept. Opening the preview, or a CLI call, wakes it from that snapshot: unlock, build and start again, usually in about a minute.

Witness also keeps a warm base snapshot per project, refreshed when your target branch changes, so new features start fast.

Usage and caps

  • Choose how many sandboxes run at once (1 to 5). Extra features queue.
  • Set a monthly spend cap. A deployment that would pass it waits with needs_you.
  • The dashboard shows what each feature costs.

The agent loop

Every agent follows the same five steps. With MCP they're tools; without, they're commands.

StepMCP toolCLI
Wait for the deploymentwitness_waitwitness wait --json
Read what to testwitness_instructionswitness instructions
Get a linkwitness_urlwitness url
Debugwitness_logs · witness_traceswitness logs · witness traces
Record the testwitness_test_start · witness_test_finishwitness test start|finish

If the wait fails, the agent does what next says, pushes to the same branch, and waits again. If it answers needs_you, it stops and tells you.

Claude Code (MCP)

$ witness login
$ claude mcp add witness -- witness mcp

Add this to the repo's CLAUDE.md:

## Witness
After you open or push to a PR, call witness_wait. If it fails, do what
event.next says, push, and call witness_wait again. When it's ready, read
witness_instructions, test the preview in your browser tool, and record it
with witness_test_start and witness_test_finish (verdict and screenshots).
If it answers needs_you, stop and tell me.

witness_wait returns before the client's timeout with still_waiting and what it's waiting for, so Claude simply calls it again. While witness mcp runs, it also unlocks your deployments.

Claude Code plugin

Optional. It registers the same MCP server and adds three skills and two hooks.

$ claude plugin marketplace add csakash/witness
$ claude plugin install witness@witness
  • /witness:test: wait, read instructions, test in the browser, check logs, finish with evidence.
  • /witness:fix: read the failure, find the cause, push, wait.
  • /witness:setup: fix the repo config until the first deploy is healthy.
  • Hooks: a status line when a session starts, and a reminder to wait after gh pr create or git push.

Codex

Codex runs shell commands, so it uses the CLI. Run witness login where Codex works, and add this to AGENTS.md:

## Witness
After you open or push to a PR, run `witness wait --json`. Exit 1 means the
deployment failed: do what the event's `next` says, push to the same branch,
and run `witness wait --json` again. Exit 0 means it's ready: run
`witness instructions`, test the printed URL, then record it with
`witness test start` and `witness test finish`. Exit 5 means it needs a
person: stop and say why. Never merge, never push to another branch, never
print secret values.

Codex picks its own branch names, so for changes across repos add a Witness: line to the PR description.

Copilot

Same rules, in .github/copilot-instructions.md. A hosted Copilot run that can't keep a machine paired can still open PRs: Witness deploys them and posts the result as checks and a comment. Someone on a paired machine unlocks deployments that need secrets.

Cursor and other agents

Any agent that speaks MCP can use witness mcp the same way as Claude Code. Any agent that can run commands can use the CLI loop. And any agent that can only open PRs still gets a deployment and a result on the PR.

CLI reference

In a checkout, commands find the feature from the git remote and current branch, so you rarely pass ids. Every command takes --json.

CommandWhat it does
witness loginPair this machine. You approve it in the dashboard.
witness initRemember which project this checkout belongs to.
witness secrets import|set|lsEncrypt and upload secrets for a repo; list names (never values).
witness unlock [--background]Keep this machine unlocking your deployments.
witness waitBlock until the feature is ready or fails. Prints the URL or the event.
witness status [--brief]The deployment's state, hold and last event.
witness url · openA signed preview link (1 hour), or open it in your browser.
witness logs [--service] [--follow] [--since]Service logs, secrets masked.
witness traces [--errors] [--slow]Request traces.
witness instructionsWhat to test, and what changed.
witness test start|finishRecord a test run with a verdict and evidence.
witness link a#n b#m [--remove]Group PRs into one feature, or split them.
witness deploy --nowDeploy without waiting for a missing PR.
witness redeployStart a fresh attempt.
witness mcpRun the MCP server (and an unlocker) over stdio.

MCP tools

Each tool returns one JSON block, the same shape as the CLI's --json.

ToolInputNotes
witness_statusbranch?, deployment?State, hold, last event.
witness_waitbranch?, deployment?, maxSeconds? (1–540)Sends progress; returns still_waiting before a timeout.
witness_urldeployment?Signed link, one hour.
witness_logsdeployment?, service?, since?, limit?Up to 5,000 lines.
witness_tracesdeployment?, errors?, slow?
witness_instructionsdeployment?Project and repo instructions, PRs, changed files.
witness_test_startdeployment?Returns the run id.
witness_test_finishrun, verdict, evidencePath?, notes?, findings?Uploads evidence from a local folder.
witness_linkprs[], remove?Group or split PRs.
witness_redeploydeployment?, now?

Exit codes

CodeMeansDo
0OK, or readyCarry on.
1The deployment failedFollow next, push, wait again.
2Usage errorCheck the command.
3Not logged inwitness login.
4Timed outRun it again.
5Needs youStop and tell the developer.

Security

What we protect against

  • Someone reading Witness's database, queues or logs can't get your secrets: we only hold ciphertext.
  • Someone changing those can't point your devices at their own key, or hand you another account's deployment: unlock requests are signed and checked.
  • Secrets are bound to their repo, masked in logs, and never in a snapshot.

What we can't, honestly

  • Changed project settings. Someone who can change Witness's database could change a saved build command, which runs with your secrets. Binding settings to your devices is planned.
  • Witness itself turning hostile. Witness runs the sandbox where your app reads its secrets. It's the same trust you give any hosted CI that runs your code.
  • The dashboard runs code Witness serves. Use witness unlock on your machine for a pinned key.

Limits

  • 1 to 5 sandboxes at once per account; up to 20 repos per project.
  • Logs and traces kept 7 days; evidence and events 30 days.
  • 600 API requests a minute per token or session.
  • A preview link lasts one hour; an unlock request, 60 minutes.
  • Idle previews sleep after 10 minutes; features with no activity for 7 days are deleted.

Troubleshooting

You seeDo
"No deployable service"Open the repo's settings and set a start command, port and health path. Detection tells you which one it couldn't find.
witness wait exits 1Read next in the event; it says what to fix and where.
witness wait exits 5witness status says why. Fix it, then witness redeploy.
Waiting for unlockStart witness unlock --background, or open the dashboard on a browser that holds your key.
Waiting for PRsOpen the missing PR, add a Witness: line, or witness deploy --now.
"An older Witness build holds this machine's unlocker"Stop that process with the kill it names, or restart the session that runs it.
A preview link expiredwitness url makes a new one.
A preview says it's waiting for a slotAll your running slots are busy. Close a feature or let one sleep, or raise the limit.

FAQ

Does Witness use AI?

No. The control plane and sandboxes run no model. Your agent does that work on your side.

Can it merge for me?

No. The GitHub App has no permission to push or merge. A person always merges.

Does it work with private repos?

Yes. The app reads the repos you choose, with read-only contents access.

What if two repos have PRs on different branches?

Add a Witness: line to one PR naming the other, or use witness link.

Do previews use production data?

Only if you give them production secrets. Use a database branch and test keys for previews.