# OpenCode on your database, with a safety net.

> Connect OpenCode to Postgres, Supabase, Neon or D1 through Osevel: its own key, only the tools of its level, every change recorded and undoable.

Source: https://osevel.com/integrations/opencode/

Connect OpenCode to your Postgres, Supabase, Neon or Cloudflare D1 database through OsBase. It gets its own key and access level; risky changes wait for you, and any change can be undone.

## Good to know

- **Tried with the real OpenCode.** Registered with write access, it read the database through Osevel, and its session was recorded under its name.
- **Only the tools of its level.** read, write or schema; tools above the level are neither listed nor callable.
- **Data comes back as data.** What it reads from the database is returned in an untrusted-data block, so text in a row is not taken as an instruction.
- **Undo one change or a session.** Every row it changes is kept before and after, so you can undo one change or everything it did in a session.

## Set it up

```sh
# 1. give OpenCode its own key (prints its opencode.json entry)
osevel agent add opencode --ide opencode --access write
# 2. see what waits for you
osevel approvals
# 3. undo a change
osevel undo 5
```

Pre-release (0.2). Install: `npm i -g @osevel/cli` (the command is `osevel`).

More: [The agents guide](https://osevel.com/docs/guides/agents/)
