Deploy & operate
Appwrite
- Create a project and an API key with the scopes: databases (read, write), vectorsdb (read, write, collections, documents, indexes), embeddings.write, files (read, write), buckets, teams (read, write), users.read, sessions.write, functions.read, executions.read (the health check reads the Functions’ latest runs), executions.write and, for alerts, messages.write. For
pnpm setup:appwriteand provisioning also backups.read and backups.write, functions.write and users.write. - Run
pnpm setup:appwrite. It creates the VectorsDB databaseengram, the collectionsmemories(768),concepts(768),agents(384) andrecalls(768) with HNSW cosine indexes, thecheckpointsbucket, and a daily backup policy for the database where the plan allows it (it says so when it cannot). Exports are streamed to the browser and never stored. - Generate the checkpoint key pair with
pnpm keygen. Put the private key only in the checkpoint Function; publish the public key. - Build and deploy the Functions with
pnpm functions:deploy(it readsappwrite.json). Schedules: checkpoint every 5 minutes, sentinel every 15 minutes (60 on the Free plan). The Functions call Appwrite with its dynamic API key, scoped byappwrite.json; they never receive your server key. - Add your production and preview hostnames as web platforms and set a budget cap. Database backups do not cover team preferences or Storage: run
pnpm backupas well (see the README for restore).
Netlify
netlify.toml at the repository root builds apps/web on Netlify's Next.js runtime. Set the environment variables below with the Functions and Builds scopes, and redeploy after any change. Scheduling and signing run in Appwrite Functions (pnpm functions:deploy), so the signing key is never a Netlify environment variable: when provisioning generates one it lives in the build container’s memory for that build alone and goes straight into the checkpoint Function. The /api/cron/* routes remain for any external scheduler (they need CRON_SECRET). Keep the combined variables under Netlify's 4 KB function limit.
| Variable | Where | Purpose |
|---|---|---|
| APPWRITE_ENDPOINT, APPWRITE_PROJECT_ID | Netlify | Regional endpoint and project (Functions get them from Appwrite) |
| APPWRITE_API_KEY | Netlify (secret) | Server key. Not given to the Functions, which use Appwrite’s dynamic key |
| APPWRITE_DB_ID | Netlify, Functions | Default engram |
| NEXT_PUBLIC_APPWRITE_ENDPOINT, NEXT_PUBLIC_APPWRITE_PROJECT_ID, NEXT_PUBLIC_DB_ID | Netlify | Browser SDK and Realtime |
| CP_PRIVATE_KEY | checkpoint Function only | Ed25519 signing key |
| CP_KEY_ID, NEXT_PUBLIC_CP_KEY_ID, NEXT_PUBLIC_CP_PUBLIC_KEY | Netlify, Functions | The current signing key’s ID and public key |
| CP_PUBLIC_KEYS, NEXT_PUBLIC_CP_PUBLIC_KEYS | Netlify, Functions | Every public key ever used, as keyId:hex,keyId:hex, so older checkpoints stay verifiable after a rotation. The browser verifier pins the keys present at build time |
| CHECKPOINT_FUNCTION_ID | Netlify | Lets the write path trigger a checkpoint |
| CLASSIFIER_MODEL, MODEL_API_KEY | Netlify, Functions | For example anthropic:claude-haiku-5-5 |
| GITHUB_ANCHOR_TOKEN, GITHUB_ANCHOR_REPO | checkpoint Function | Optional anchoring |
| NEXT_PUBLIC_APP_URL, NEXT_PUBLIC_DEMO_SPACE | Netlify | Public URL; the demo space linked from the landing page |
| CRON_SECRET, SEED_ADMIN_TOKEN | Netlify | Cron routes; the seed route (delete after seeding) |
| ENGRAM_PROVISION, ENGRAM_PROVISION_STEPS, ENGRAM_REPORT_PUBKEY | Netlify (production) | One-off provisioning inside the production build; the report is encrypted to the public key (see the README) |
Local development
With no Appwrite variables, Engram runs on a local file-backed backend with a deterministic hashing embedder and a rule-based classifier, so every screen works offline: ENGRAM_BACKEND=local pnpm dev.
Operations
- The sentinel re-verifies every space every 15 minutes and records the integrity badge; on new tampering it can email the owner through Appwrite Messaging (
ENGRAM_ALERT_EMAILS=true). - Retention, when set, is implemented as forget entries, never deletions, so the chain stays valid.
- Never re-embed in place: the vector hash would break. Create a new collection and copy, or mark a new model from a given sequence number onward.
- Rotate the server key after events where it may have been exposed. Rotating the checkpoint key means publishing the new public key and a new key ID; old checkpoints stay verifiable with the old key.
Accounts, email and operations
- Verification and password-reset emails are sent by Appwrite. Add your site’s hostname (for example
engram-os.netlify.app) as a Web platform in the Appwrite console, or Appwrite will refuse the email links.NEXT_PUBLIC_APP_URLmust match it. - Signing in requires the visitor to accept cookies; the server rejects sign-in and sign-up without the
engram_consent=acceptedcookie. - Sign-in, sign-up, password resets, verification emails and agent-key creation are rate limited per IP address, account or user.
- Browser errors are written to the function logs as
[engram:client-error]lines. SetERROR_WEBHOOK_URLto a Slack or Discord incoming webhook to be alerted. Point an uptime monitor at/api/v1/health: it returns 503 withstatus: "down"when a dependency is down, and 200 withok: false, status: "degraded"when the checkpoint signer or the sentinel has fallen behind. Anonymous calls are cached for 5 minutes and never call the model. - Set
NEXT_PUBLIC_CONTACT_EMAILto the address shown on the Terms, Privacy and Cookie pages.