---
name: postgres-memory
description: Install and validate a local PostgreSQL 18 memory database for Clawdie in a dedicated FreeBSD jail. Use when creating the `db` jail, installing PostgreSQL 18, preparing for pgvector, validating service startup, or planning local long-term memory storage on ZFS-backed FreeBSD infrastructure.
---

# postgres-memory

Use this skill for the first local memory database bring-up.

This skill is intentionally narrow:

- jail name: `db`
- hostname: `db.clawdie.si`
- runtime: FreeBSD jail
- provisioning: `thick`
- networking: `shared` first, `vnet` optional later
- PostgreSQL version: `18`
- purpose: memory backend
- `pgvector`: install after base PostgreSQL is healthy

## Scope

This skill covers:

- install planning for the `db` jail
- PostgreSQL-specific ZFS assumptions
- install-time profile choices
- restore-from-dump planning
- PostgreSQL 18 package install
- service initialization and startup
- first validation commands
- ZFS snapshot points before schema and extension work

This skill does not cover:

- memory schema design
- embedding model selection
- Supabase compatibility layers
- migration of old v2 shell scripts

## Install-time choices

Treat these as explicit deployment questions:

1. network profile
   - `shared`
   - `vnet`

2. resource profile
   - `minimal` = `1G RAM / 10G / 1 vCPU`
   - `balanced` = `2G RAM / 15G / 1 vCPU`

3. restore mode
   - `empty`
   - `restore-from-dump`

Recommended default for first install:

- network profile: `shared`
- resource profile: `minimal`
- restore mode: `empty`

## Workflow

1. Ensure the `db` jail exists and starts cleanly.
2. Validate the ZFS assumptions before installing PostgreSQL.
3. Install PostgreSQL 18 inside the jail.
4. Initialize the database cluster.
5. Start the PostgreSQL service.
6. Validate local connectivity.
7. Snapshot the jail dataset before schema work.
8. Add `pgvector` only after the base service is healthy.

## Restore path

Database restore should be designed into deployment from the start.

Target future flow:

1. create jail
2. install PostgreSQL
3. initialize cluster
4. optionally restore from `.sql` or custom dump
5. validate
6. snapshot

## Read next

- Install commands: `references/install.md`
- Validation sequence: `references/validation.md`
- ZFS and service notes: `references/layout.md`
- Failure signatures: `references/troubleshooting.md`
- Security and access control: `references/security.md`

## Scripts

- `scripts/render_install_commands.sh`
- `scripts/render_validation_commands.sh`
