Deploy & operate

Appwrite

  1. 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:appwrite and provisioning also backups.read and backups.write, functions.write and users.write.
  2. Run pnpm setup:appwrite. It creates the VectorsDB database engram, the collections memories (768), concepts (768), agents (384) and recalls (768) with HNSW cosine indexes, the checkpoints bucket, 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.
  3. Generate the checkpoint key pair with pnpm keygen. Put the private key only in the checkpoint Function; publish the public key.
  4. Build and deploy the Functions with pnpm functions:deploy (it reads appwrite.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 by appwrite.json; they never receive your server key.
  5. 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 backup as 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.

VariableWherePurpose
APPWRITE_ENDPOINT, APPWRITE_PROJECT_IDNetlifyRegional endpoint and project (Functions get them from Appwrite)
APPWRITE_API_KEYNetlify (secret)Server key. Not given to the Functions, which use Appwrite’s dynamic key
APPWRITE_DB_IDNetlify, FunctionsDefault engram
NEXT_PUBLIC_APPWRITE_ENDPOINT, NEXT_PUBLIC_APPWRITE_PROJECT_ID, NEXT_PUBLIC_DB_IDNetlifyBrowser SDK and Realtime
CP_PRIVATE_KEYcheckpoint Function onlyEd25519 signing key
CP_KEY_ID, NEXT_PUBLIC_CP_KEY_ID, NEXT_PUBLIC_CP_PUBLIC_KEYNetlify, FunctionsThe current signing key’s ID and public key
CP_PUBLIC_KEYS, NEXT_PUBLIC_CP_PUBLIC_KEYSNetlify, FunctionsEvery 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_IDNetlifyLets the write path trigger a checkpoint
CLASSIFIER_MODEL, MODEL_API_KEYNetlify, FunctionsFor example anthropic:claude-haiku-5-5
GITHUB_ANCHOR_TOKEN, GITHUB_ANCHOR_REPOcheckpoint FunctionOptional anchoring
NEXT_PUBLIC_APP_URL, NEXT_PUBLIC_DEMO_SPACENetlifyPublic URL; the demo space linked from the landing page
CRON_SECRET, SEED_ADMIN_TOKENNetlifyCron routes; the seed route (delete after seeding)
ENGRAM_PROVISION, ENGRAM_PROVISION_STEPS, ENGRAM_REPORT_PUBKEYNetlify (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_URL must match it.
  • Signing in requires the visitor to accept cookies; the server rejects sign-in and sign-up without the engram_consent=accepted cookie.
  • 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. Set ERROR_WEBHOOK_URL to a Slack or Discord incoming webhook to be alerted. Point an uptime monitor at /api/v1/health: it returns 503 with status: "down" when a dependency is down, and 200 with ok: 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_EMAIL to the address shown on the Terms, Privacy and Cookie pages.