Integrate with a coding agent

Add Voidhash to an app with one command: the CLI sets it up, a coding agent you already have wires it into your code, and the CLI checks the result.

voidhash integrate takes an app from no Voidhash at all to an integration that builds and is wired into your code. Run it in the app's root:

voidhash integrate

It works in three parts, and tells you the plan before it changes anything.

  1. The CLI sets up what needs no reading of your code. It finds out what kind of app this is, signs you in, lets you choose or create the project, creates the perk and product you ask for, installs the SDK with your package manager, and writes voidhash.json, the SDK client or environment values, and the generated types.
  2. A coding agent wires the SDK into your code. The CLI runs the agent you already have (Claude Code, Codex, OpenCode, Grok Build, Cursor or fx), with a task written for your platform and project: start the SDK where the app starts, identify the user where you sign them in, gate on a perk, sell a product.
  3. The CLI checks the result. Your typecheck or build has to pass, the SDK has to be in your code, and, if you start the app, its first event has to arrive. The summary lists the files git shows as changed, what the agent says it did, and what is left for you.

Nothing is committed. Review the changes with git diff, and undo them with git restore . && git clean -fd if you don't want them.

Before you run it

  • A clean git working tree. Everything the run changes can then be reviewed and undone. --allow-dirty lifts this, also for a directory that isn't a git repository.
  • A coding agent, signed in. The CLI uses the one you have, with your own account; it sends your code nowhere itself. Without one, see Without an agent.
  • A Voidhash account. The command signs you in when needed.

Platforms

App--platformSupportWhat the agent wires in
ExpoexpoSupportedProvider, config plugin, identify, a perk gate, a purchase screen
Next.jsnextjsSupportedProvider, identify, one or two key events
React with VitereactSupportedProvider, identify, one or two key events
React Native without Exporeact-nativeBest effortAs Expo, without the config plugin
Other sites built with VitewebBest effortClient module, identify, one or two key events
Node.js servernodeBest effortClient module, a perk check where the server grants paid access
iOS app in SwiftiosBest effortConfigure at launch, identify, a perk gate, purchases
Android app in KotlinandroidBest effortConfigure at launch, identify, a perk gate, purchases

Supported platforms are the ones the command is tested on with a real app and a real agent. On a best-effort platform the steps are the same, but less is set up and checked for you: the CLI doesn't edit Xcode or Gradle project files, and runs no build unless you name one with --check. Go, PHP and Rust servers aren't covered; follow their library guides instead.

The command picks the platform from what it finds. Pass --platform when it picks wrong.

Agents

Agent--agentSigned in with
Claude Codeclaudeclaude auth login
Codexcodexcodex login
OpenCodeopencodeopencode auth login
Grok Buildgrokgrok login
Cursor (cursor-agent)cursorcursor-agent login
fxfxfx login

The CLI uses the one that is installed. With several, it asks which in a terminal, and otherwise takes the first in this order. The agent runs with its own settings, on your account.

Choose the model

The agent works with the model it is set up with, and the usage is billed to your account with that agent. To choose a cheaper or a stronger one for this run, pass --model, named the way that agent names its models:

voidhash integrate --agent claude --model sonnet
voidhash integrate --agent opencode --model anthropic/claude-sonnet-4-5

Claude Code takes an alias such as sonnet, opus or haiku, or a full model name. OpenCode takes provider/model; opencode models, cursor-agent --list-models and grok models list what those agents offer. fx takes its model from its own settings only. A run that continues an earlier one keeps that run's model.

What the agent may do

The agent runs without its own interface, so nothing is asked of you while it works: what it isn't allowed is refused.

  • It changes files in the app's directory only, and no .env file. It is given the names of the variables, not their values.
  • It runs your project's checks and git status, git diff and git log. It installs nothing; the CLI installed the SDK before it started.
  • It never gets a secret key. Publishable keys, which are safe to ship in an app, are the only keys in its task.

How these limits are kept depends on the agent, and the plan shown before anything runs says it for the one you use:

AgentChanging filesRunning commandsReading .env files
Claude CodeRefused outside the limitsRefusedRefused
CodexRefused outside the directory by its sandboxNo network in its sandboxTold not to
OpenCodeRefused outside the limitsRefusedRefused
Grok Build, fxRefused outside the limitsRefusedTold not to
CursorTold where it may; the CLI warns afterwardsRefusedTold not to

OpenCode, Grok Build, Cursor and fx are driven over the Agent Client Protocol: the agent asks the CLI before it acts, and the CLI answers by the limits above. Cursor asks before it runs a command but not before it changes a file, so where it writes is only what its task tells it; the CLI warns you when it changes a file outside the limits. "Told not to" means the task says so and nothing enforces it. fx is supported but not yet tested with a real app.

The task is written to .voidhash/integrate/task.md before the agent starts, so you can read exactly what it is told. That directory ignores itself in git.

Choose what the app uses

On a terminal the command asks for what it needs. A project without perks or products gets an offer to create a first one. In a script, pass flags:

voidhash integrate --project acme/app --perk premium --product pro_monthly --yes
FlagWhat it does
--projectThe project to integrate. Without it: the one voidhash.json names, else the command asks.
--platformThe kind of app, when the one found is wrong.
--agentOne of the agents, or none. Without it, the one installed.
--modelThe model the agent works with. Without it, the one the agent is set up with.
--perkThe perk the app gates on. Created when the project has none by that slug.
--productThe product the app sells. Created as a monthly subscription that grants the perk.
--locationA paywall location the app presents, with your own screen as the fallback.
--checkA command that must pass, instead of the typecheck or build the CLI finds. Repeat for several.
--waitHow long to wait for the app's first event, such as 5m.
--mcpAlso connect your AI agents to Voidhash.
--timeoutHow long the agent may work. 30 minutes by default.
--dry-runPrints the plan and changes nothing.
--yesGoes ahead without asking, with the defaults for what isn't passed.
--jsonPrints the result as JSON.
--allow-dirtyRuns with uncommitted changes, or outside a git repository.
--restartForgets an earlier run in this directory.

The web SDK doesn't check perks or sell products, so --perk and --product are left out for a website.

How the result is checked

The CLI runs your project's own checks before it changes anything and again at the end: a typecheck script or the TypeScript compiler, and for a website the build script too. A check that fails after the changes goes back to the agent once, with its output. A check that already failed before the changes isn't held against the run, except for errors it didn't report then.

It then looks for the SDK in your code, and offers to wait while you start the app. An event that arrives shows the app starts the SDK with the right key against the right server. A debug build sends events with the test key; they appear in Studio under Test.

The command exits with 0 when the checks pass and the SDK is in your code, and with 1 when something is missing, which the summary names.

Run it again

The command is safe to repeat. It looks at the project before each step and does only what is missing: a perk that exists isn't created twice, an installed package isn't installed again, a file that exists is kept, and an agent that finished isn't asked again. After an interruption, the agent continues its own earlier conversation.

voidhash integrate            # continue, or check again
voidhash integrate --restart  # forget the earlier run

Without an agent

With no such agent installed, or with --agent none, the CLI still does its own part and writes the task:

voidhash integrate --agent none

Give .voidhash/integrate/task.md to the coding agent you use, or follow it yourself. Then run voidhash integrate again: it checks the result the same way.

In CI and scripts

Nothing is asked when there is no terminal. Pass --project and --yes, and --json for a result a script can read:

voidhash integrate --project acme/app --agent claude --yes --json
{
  "outcome": "verified",
  "platform": { "id": "react", "name": "React (Vite)", "support": "supported" },
  "agent": { "id": "claude", "status": "finished", "report": { "status": "done" } },
  "checks": [{ "command": "npm run build", "passed": true, "failedBefore": false, "newErrors": 0 }],
  "sdkFoundIn": "src/main.tsx",
  "firstRequest": "not_checked",
  "changedFiles": [" M src/main.tsx", "?? voidhash.json"],
  "leftForYou": ["Set VITE_VOIDHASH_KEY to the production publishable key where you build for production."],
  "task": ".voidhash/integrate/task.md"
}

outcome is verified, incomplete or handed_off. The agent itself has to be signed in on the machine that runs it. Sign the CLI in with a person's token in VOIDHASH_API_KEY: a project secret key doesn't show the team that voidhash.json names.

What stays with you

  • Store setup. Connect the App Store, Google Play or Stripe and map your products before you sell for real. Until then, debug builds of the mobile SDKs simulate purchases.
  • Native builds. The mobile SDKs contain native code, so rebuild the app; Expo Go can't load it.
  • Secret keys. A server needs a secret key, which you create in Studio and put in your environment. The CLI never creates or writes one.
  • The production key on the web. .env.local gets the test key. Set the production key where you build for production.
  • Review. Read the diff before you commit it, as you would a teammate's.

Something wrong or missing on this page? Tell us by email or on Discord.