Set up with the CLI
Scan a project for model calls, finish setup on your machine, and apply the wrap behind a review.
On this page
Set up the same integration from the machine your code already lives on: the
tracehatch CLI reads the project for its model calls, wraps the clients you
pick, and hands the project back to Tracehatch for the runs. Source never leaves
the machine, and the scan works before you have an account.
- Package
- tracehatch on npm
- Runtime
- Node.js 18+
- Scan
- Read-only, no account
Find the calls first
npx tracehatch scanRun it in the project; it reports every model call it can see, grouped by what each one needs:
| Status | Meaning |
|---|---|
| Recording | The call already goes through a wrapped client. |
| Wrappable | A supported client — OpenAI or Anthropic, including OpenAI-compatible hosts — not wrapped yet. |
| Not supported | A framework the SDK cannot record yet, named with the honest next step. |
| Unresolved | Model-shaped, but the client behind it cannot be resolved in that file. |
A scan creates nothing, writes nothing and sends nothing, so it is safe to run
in CI. The clients and methods it calls supported are the same ones
wrap() records.
Finish setup from a local page
npx tracehatch studioThe studio opens on 127.0.0.1 and talks only to this machine. Every fact on the
page comes from the CLI, and it walks the rest:
Approve this machine
The CLI shows a code; approving it in Tracehatch grants one scoped token, kept
in ~/.tracehatch/credentials.json. Revoke it any time in Settings → Account
→ Tokens; tracehatch logout only forgets the local copy.
Scan the project
The same read-only scan, with a checkbox on every wrappable call.
Choose where runs land
Pick a workspace, project and environment — or create the project here. It arrives with the three environments every project gets.
Write the ingest key
The studio mints a key for the chosen environment and writes .env.local,
making sure Git ignores it. The secret is never printed back.
Verify
Restart your app, trigger one AI action, and the page watches that key's receipt until the model call arrives and links the run.
Apply the wrap behind a diff
The selected calls become exact edits — the wrap(...) line plus the import the
file still needs — shown as a diff, and nothing is written until you confirm. A
file with uncommitted changes is refused unless you force it, every file about to
change is copied to ~/.tracehatch/backups/ first, and a wrap the engine cannot
confirm afterwards is restored from its copy. The terminal equivalent is
tracehatch wrap --write; without --write it prints the plan and stops.
Open the project from the terminal
npx tracehatch openOpens the project you selected, on the origin you approved — --print writes the
URL instead. tracehatch whoami shows the account and token in use, and
tracehatch connect signs a machine in without opening the studio. From the
dashboard, the same setup is the quickstart.