From 2223b190f6d6069b89801588404d45b8ca1a4cc4 Mon Sep 17 00:00:00 2001 From: Kartikeya <176560021+karti-ai@users.noreply.github.com> Date: Sat, 27 Jun 2026 14:17:08 -0700 Subject: [PATCH] feat(infra,database): DO deploy + memory schema infra: Dockerfile (backend from monorepo root) + DigitalOcean App Platform spec with health check and secret env vars. database: MongoDB Atlas + Voyage vector-memory schema and the continual-learning loop notes. Co-Authored-By: Claude Opus 4.8 --- database/.gitkeep | 0 database/README.md | 32 ++++++++++++++++++++++++++++++++ infra/.gitkeep | 0 infra/Dockerfile | 26 ++++++++++++++++++++++++++ infra/README.md | 22 ++++++++++++++++++++++ infra/app.yaml | 26 ++++++++++++++++++++++++++ 6 files changed, 106 insertions(+) delete mode 100644 database/.gitkeep create mode 100644 database/README.md delete mode 100644 infra/.gitkeep create mode 100644 infra/Dockerfile create mode 100644 infra/README.md create mode 100644 infra/app.yaml diff --git a/database/.gitkeep b/database/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/database/README.md b/database/README.md new file mode 100644 index 0000000..edf95a3 --- /dev/null +++ b/database/README.md @@ -0,0 +1,32 @@ +# database + +Continual-learning memory for PodMan: **MongoDB Atlas** for the team model and +outcomes, **Voyage** embeddings for vector recall. This is what makes PodMan +"more useful the more you use it" (the track requirement). + +## Collections + +| Collection | Holds | Notes | +| ---------------- | ---------------------------------------------- | ----------------------------- | +| `pods` | `Pod` docs (members, repo) | one per pod | +| `observations` | `EngineerContext` snapshots over time | sampled, append-only | +| `collisions` | detected `Collision`s | for replay + precision tuning | +| `interventions` | `Intervention`s + outcome (accepted/dismissed) | drives the self-tuning policy | +| `memory_vectors` | Voyage embeddings of file/feature notes | Atlas Vector Search index | + +Types live in [`shared/`](../shared/src). Each engineer/file/feature note is +embedded with Voyage and stored alongside its source doc for retrieval by the +PodMan brain. + +## The continual-learning loop + +1. **Observe** → write `observations`. +2. **Store** → embed notes into `memory_vectors`. +3. **Predict** → collision detector + brain decide whether to intervene. +4. **Outcome** → update the `interventions` doc with accepted/dismissed. +5. **Adapt** → tune thresholds + ownership attribution from outcomes. + +## Setup + +Create an Atlas cluster + a Vector Search index on `memory_vectors.embedding`, +then set `MONGODB_URI` and `VOYAGE_API_KEY` in `.env`. diff --git a/infra/.gitkeep b/infra/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/infra/Dockerfile b/infra/Dockerfile new file mode 100644 index 0000000..43e7534 --- /dev/null +++ b/infra/Dockerfile @@ -0,0 +1,26 @@ +# PodMan backend agent — built from the monorepo root. +# Build: docker build -f infra/Dockerfile -t podman-backend . +FROM node:24-slim AS base +ENV PNPM_HOME=/pnpm +ENV PATH="$PNPM_HOME:$PATH" +RUN corepack enable +WORKDIR /app + +# Install workspace deps (cached on lockfile) +FROM base AS deps +COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./ +COPY shared/package.json shared/ +COPY backend/package.json backend/ +RUN pnpm install --frozen-lockfile + +# Build shared + backend +FROM deps AS build +COPY . . +RUN pnpm --filter @podman/shared build && pnpm --filter @podman/backend build + +# Runtime +FROM base AS runtime +ENV NODE_ENV=production +COPY --from=build /app /app +EXPOSE 8787 +CMD ["node", "backend/dist/index.js"] diff --git a/infra/README.md b/infra/README.md new file mode 100644 index 0000000..a47bf42 --- /dev/null +++ b/infra/README.md @@ -0,0 +1,22 @@ +# infra + +Deploy targets for PodMan (DigitalOcean prize track). + +- `Dockerfile` — builds the backend agent from the monorepo root. +- `app.yaml` — DigitalOcean App Platform spec (auto-deploy on push to `main`). + +## Local container + +```bash +docker build -f infra/Dockerfile -t podman-backend . +docker run --env-file .env -p 8787:8787 podman-backend +``` + +## DigitalOcean + +```bash +doctl apps create --spec infra/app.yaml +``` + +Set the `SECRET` env vars (LiveKit, Gemini, GitHub, Atlas, Voyage) in the DO +dashboard or via `doctl` after the app is created. diff --git a/infra/app.yaml b/infra/app.yaml new file mode 100644 index 0000000..4f6531f --- /dev/null +++ b/infra/app.yaml @@ -0,0 +1,26 @@ +# DigitalOcean App Platform spec for the PodMan backend. +# Deploy: doctl apps create --spec infra/app.yaml +name: podman +region: nyc +services: + - name: backend + dockerfile_path: infra/Dockerfile + source_dir: / + github: + repo: karti-ai/podman + branch: main + deploy_on_push: true + http_port: 8787 + instance_size_slug: basic-xxs + instance_count: 1 + health_check: + http_path: /health + envs: + - { key: LIVEKIT_URL, scope: RUN_TIME } + - { key: LIVEKIT_API_KEY, scope: RUN_TIME, type: SECRET } + - { key: LIVEKIT_API_SECRET, scope: RUN_TIME, type: SECRET } + - { key: GEMINI_API_KEY, scope: RUN_TIME, type: SECRET } + - { key: GITHUB_TOKEN, scope: RUN_TIME, type: SECRET } + - { key: GITHUB_REPO, scope: RUN_TIME } + - { key: MONGODB_URI, scope: RUN_TIME, type: SECRET } + - { key: VOYAGE_API_KEY, scope: RUN_TIME, type: SECRET }