Files
paperclip-docs/docs/reference/deploy/database.md
T
d627632874 Release docs for paperclip v2026.1106.0 (#172)
Docs for parent release `v2026.1106.0` (`d69631b0`), up from
`v2026.1023.0` (`1b4c8038`): 515 parent commits.

## How this branch was built

The tag is 914 commits behind what `nightly` has drafted, so this branch
isn't cut from `nightly` HEAD. It starts at nightly commit `1952052`
(parent `043f2514`), 19 commits before the tag, then adds:

- the `main` hotfix (#160)
- the sync tooling from `nightly`
- docs for those 19 commits

Later nightly drafts stay on `nightly`, so no pages had to be removed.
No `nightly-draft/*` PRs are open.

## What changed

- **Runner by default:** new Claude, Codex, OpenCode and Pi agents start
on Paperclip Runner on supported hosts, with **Legacy runner** and
**Upgrade runner**.
- **Workspaces:** cleanup of finished workspaces, optional Git
expiration, and restore points for unsaved work. Restore points are off
by default.
- **New pages:** Prompt injection prevention, Google Workspace, GitHub
Copilot, Speko, Braintrust, Daytona, Ditto and Unikraft.
- **Breaking and upgrade notes:** the run history limit, Sentry run
failures off by default and the DSN variables, the Docker start command
for custom images, `--yes` on `instructions-file:delete`, and slower
migrations on large instances.
- **Also covered:** project repositories as skill sources, roster bulk
edit, Artifacts V1 (experimental, off by default), composer dismissal,
`expectedStatusVersion`, `unexecuted_review_stage`, and plugin workspace
providers.
- **Changelog:** a v2026.1106.0 entry in `reference/changelog.md`.

## Older text corrected

These were wrong at the tag, and most are also wrong on the live site:

- which permissions let an agent read a peer's configuration or change
instructions (`api/agents.md`)
- `decideNowCount`, which doesn't exist; the field is `deskBadgeCount`
- `file-resources` routes, which are board-only
- the **Create project** dialog fields, a CEO rule the code doesn't
enforce, and where a terminated agent's reports appear
- `instructions-file:put` and `:delete` examples that always failed
(`cli/agent.md`)
- a curl example that returned `422` (`api/cases.md`)
- Google Workspace **Reconnect** instructions, which claimed it reopens
the service picker
- the `permissionKey` table, which listed 8 of 21 keys
- drafting text at the end of `api/agents.md`

## ⚠ Please check these

- **Product behaviour that may be a parent bug.** The docs now describe
the tag's code, which you may prefer to fix upstream:
- The project **Environment** dropdown saves a choice, but runs ignore
it (`experimental/environments.md`).
- `environments:manage` is granted by roles but no environment route
checks it.
- `suggest-changes` is documented as agent-only, because only agents
have a consent path. Company skill policy decides skill edits.
- **Reader-visible mismatches in the parent UI.** The docs follow the
code. Upstream copy still mentions a "Built-in agents tab", says Copilot
"awaits qualification", and tells people to "Reconnect Google Workspace
to change access".

## ⚠ Post-tag leaks removed

Nothing to remove from an already-drafted page: post-tag surfaces such
as 1Password, Vercel, Supabase deploy, custom gateway onboarding and
Artifacts V1 as default never came onto this branch. Authors left out
post-tag hunks of the next nightly draft, and the reasons are in the run
notes.

## ⚠ Drift

None. Zero findings at the tag, from a full parent snapshot.

## ⚠ Verification Failures

The tag-accuracy gate reports one leak and nine review entries. None is
a real failure:

- **Leak:** `reference/cli/service.md`, `paperclipai payload and`. This
is a false positive; it's prose from a real message at
`cli/src/commands/service.ts:184`.
- **Review, 8 new connector pages:** the gate can't confirm new pages.
Reviewers confirmed each surface exists at the tag.
- **Review, `local_tools`:** an example value from the tag's Runner
README.

Not provable from code, and kept deliberately:

- `sandbox-providers.md` uses `sandbox.yaml`. The tag's README says
`install.yaml`, which returned 404 when checked. The upstream fix is
post-tag.
- The Google Workspace row about older OAuth brokers rests on release
notes and a design doc. The broker isn't in this repo.
- External claims about provider behaviour (for example Braintrust,
Daytona, Unikraft and Google scopes).

## ↻ Renames detected

None. The rename helper wasn't run: the 19-commit delta adds no new
adapter, skill, or plugin directories that it would check.

## Verification

All checks read a checkout pinned to the tag.

- **First round:** authors, a release-notes audit, an audit of
corrections stranded on `nightly`, an audit of 321 lines the last
realign dropped from `main` (about 130 checked directly in code), and
six fresh verifiers.
- **Second round:** seven new verifiers re-checked every changed area,
tracing behaviour rather than matching labels, and fixed about 50 more
defects. That volume means more may remain.
- **Limits of that second round:**
- Each verifier reported what it only string-matched. That includes
parts of Artifacts V1, the **Upgrade runner** notice, Copilot run
behaviour, and some Plugin SDK contract text.
  - The second-round fixes themselves weren't reviewed by a third round.
- **Gates:** `docs:build`, `docs:test` and `sync:check` pass.
- **Nothing was run against a live instance.** All of this comes from
reading code.

## Screenshots

**196 of 278 screenshots are stale and none were recaptured.** The list
is in `SCREENSHOTS_PENDING.md`. Some visibly differ from the text, such
as the removed **Run with provider trace** button and the old roster
tabs.

## After merge

1. Keep the PR title as is: `tag-docs-release.yml` reads the version
from it.
2. Confirm the `docs/v2026.1106.0` tag exists.
3. Run `node scripts/sync/realign-nightly.mjs release/v2026.1106.0
--push`, then audit for dropped lines and duplicated paragraphs, and set
`nightly` state back to `branch_mode: nightly`.
4. Check that `docs.paperclip.ing` serves the release: a new page, a new
claim, and the changelog's top entry.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: DevRel Gemini <[email protected]>
Co-authored-by: Paperclip <[email protected]>
Co-authored-by: Dotta <[email protected]>
Co-authored-by: ClaudeCoder <[email protected]>
2026-11-07 13:02:42 +01:00

7.2 KiB
Raw Blame History

paperclip_version, seo_title, seo_description
paperclip_version seo_title seo_description
v2026.1106.0 Database Configuration Paperclip runs PostgreSQL through Drizzle ORM. One schema across every supported mode — what differs is where Postgres runs and how it is reached.

Database

Paperclip uses PostgreSQL through Drizzle ORM. The same schema works across the supported database modes; the difference is where PostgreSQL is running and how Paperclip connects to it.

Use this page when you are choosing between embedded, local Docker, or hosted PostgreSQL.


Database Modes

Mode Best for Setup cost
Embedded PostgreSQL Local development, one-command installs Zero config
Local PostgreSQL in Docker A local prod-like database Low
Hosted PostgreSQL Production and shared deployments Higher

Note: The app logic does not change across modes. Only DATABASE_URL and the storage location change.


Embedded PostgreSQL

This is the default mode when DATABASE_URL is not set.

pnpm dev

On first start, Paperclip:

  1. creates ~/.paperclip/instances/default/db/
  2. ensures the paperclip database exists
  3. runs migrations for an empty database
  4. starts serving requests

Data persists across restarts in that directory.

Use this mode when you want the simplest possible local setup.

Reset the local database by deleting the data directory:

rm -rf ~/.paperclip/instances/default/db

The Docker quickstart uses embedded PostgreSQL by default too. See Docker for the container setup.


Local PostgreSQL In Docker

Use this if you want a standard PostgreSQL server locally instead of the embedded runtime.

Start the database:

docker compose up -d

This starts PostgreSQL 17 on localhost:5432.

Set the connection string in your environment:

cp .env.example .env
# DATABASE_URL=postgres://paperclip:paperclip@localhost:5432/paperclip

Then push the schema:

DATABASE_URL=postgres://paperclip:paperclip@localhost:5432/paperclip \
  npx drizzle-kit push

Use this mode when you want to mirror a normal PostgreSQL deployment more closely while still staying local.


Hosted PostgreSQL

For production, use a hosted PostgreSQL provider such as Supabase.

Typical setup:

  1. create a project at database.new
  2. copy the connection string from the database settings
  3. set DATABASE_URL in your deployment environment

Supabase exposes two useful connection styles:

  • direct connection on port 5432 for migrations and one-off scripts
  • pooled connection on port 6543 for the running application

If you use the pooled connection in transaction mode and your pooler doesn't support named prepared statements, switch them off with an environment variable. You don't need to edit any code:

DATABASE_PREPARED_STATEMENTS=false

Leave the variable unset everywhere else, so Paperclip keeps its normal behavior.

Warning: Use the direct connection for schema changes. Pointing migrations at the pooled endpoint is a common way to get avoidable connection errors.


Connection Pool Settings

Paperclip keeps a pool of open connections to PostgreSQL and reuses them across requests. The defaults suit most installs, so you only need these settings when you're sharing a database with other apps, running several server processes, or chasing connection limits on a hosted plan. Each one is an optional environment variable, and they apply in every database mode.

Variable Default What it does
DATABASE_POOL_MAX 10 The most connections the pool opens at once.
DATABASE_IDLE_TIMEOUT_SECONDS 60 Closes a connection after it has sat idle this long, so a quiet server gives its connections back. 0 keeps idle connections open indefinitely.
DATABASE_CONNECT_TIMEOUT_SECONDS 30 How long to wait for a new connection before giving up.
DATABASE_MAX_LIFETIME_SECONDS a random 30–60 minutes Replaces a pooled connection with a fresh one once it's this old.
DATABASE_APPLICATION_NAME paperclip The name Paperclip's connections show in PostgreSQL's pg_stat_activity view, so you can tell them apart from other clients.
DATABASE_PREPARED_STATEMENTS unset Prepared statements. See Hosted PostgreSQL.

Values are checked when the server starts, and a bad one stops startup with an error that names the variable instead of being quietly ignored. The number settings take whole numbers of 1 or more, except DATABASE_IDLE_TIMEOUT_SECONDS, which also accepts 0. DATABASE_PREPARED_STATEMENTS takes true or false (1 and 0 work too).

To see Paperclip's connections, run this against your database:

SELECT * FROM pg_stat_activity WHERE application_name LIKE 'paperclip%';

If you've set DATABASE_APPLICATION_NAME, the main pool uses your name instead, so search for that too. The helper connection below keeps its own name.

Sizing max_connections. Each server process can use more than DATABASE_POOL_MAX connections. When you set PostgreSQL's max_connections, budget for these per server process, plus your other clients:

  • the main pool, up to DATABASE_POOL_MAX
  • a second pool of the same size when DATABASE_MIGRATION_URL is set
  • a short-lived single connection named paperclip-workspace-finalization-lock while a workspace is being finalized

Paperclip closes its pools when the server shuts down, and when startup fails after a pool has opened, so restarts don't leave idle connections behind.


Switching Modes

DATABASE_URL Result
Not set Embedded PostgreSQL
postgres://...localhost... Local Docker PostgreSQL
postgres://...supabase.com... Hosted PostgreSQL

The Drizzle schema under packages/db/src/schema/ stays the same in every case.

Upgrading

Upgrading to v2026.1106.0 can take longer on instances with large run histories, because migration 0343 backfills who created each agent from the activity log, and 0345 and 0369 build indexes on large tables. Those index builds run CONCURRENTLY, outside a transaction, and are safe to rerun if interrupted.

What a database backup preserves

A normal instance database backup includes encrypted agent identities and locally stored agent complaints and suggestions. Restoring identities also requires the matching secrets encryption key: preserve PAPERCLIP_SECRETS_MASTER_KEY or the instance's configured master-key file separately.

The database does not contain the bytes of persistent agent files or locally stored uploads. Back up those filesystem directories or your configured asset storage as well; see Storage.

A portable company export creates new identities when imported. A database restore preserves the identities of the original instance, so reserve disaster-recovery backups for recovering that instance rather than making independent agent copies.

Tip: If your deployment feels healthy but the data keeps disappearing, check whether you are still on embedded PostgreSQL. That mode is intentionally local and persistent only inside the instance directory.