# PLATFORM_INVENTORY_DELTA.md How the system changed against `PLATFORM_INVENTORY.md` (the prior read only audit). Only deltas are listed. Verified against code, the live database on M4, and the running services. ## New binaries (`cmd/`) - **`megamind-gateway`** — the stateless inference plane (Go, CGO_ENABLED=0). Deployed and running on M4 at `100.94.8.94:8090` (Tailscale only). Was: did not exist. - **`provision-tenant`** — creates an isolated per tenant Postgres database (embedded migrations + goose). Was: only `provision-org` (an org inside the shared database). - **`embed-backfill`** — embeds candidates and skills through the plane into the vector columns. Was: did not exist; the vector columns were dead. ## New packages - `internal/platform/inference` — typed MEGAMIND client (timeouts, retries, in house circuit breaker). - `internal/platform/scrub` — the contents scrubbed teaching boundary. - `internal/modules/ai` — the augmented generation layer (safety guard + EEO tripwire, TAG intent registry, hybrid RAG retrieval, orchestrator with faithfulness gate and AEDT audit, per tenant memory, KAG skill adjacency, CAG rules, GraphRAG/foresight/federated scaffolds). - `db` (embed.go) — embeds the migration sets for the provisioner. ## Database (live on M4) - **Migration state: goose v16 to v17.** New migration `0017_ai_memory.sql` (the shared database is at v17; a tenant database provisions to v17 + eeo v1). - **New table `ai_memory`** — per tenant episodic and semantic memory: RLS enabled and forced, policy on `app.current_org_id`, `embedding vector(384)` with a partial HNSW index, composite FK to candidates, candidate scoped for erasure. Grants: app SELECT/INSERT/UPDATE/DELETE. - **Embedding columns now populated** (was the audit's headline dead layer): - `skills.embedding`: **0/61 to 61/61**. `SearchSkillsByEmbedding` and `idx_skills_embedding_hnsw` are now live. - `candidates.resume_embedding`: the demo org (1111…1111) **to 1511/1511** (was 144/2787 across all orgs). The hybrid `SearchCandidatesHybrid` (pgvector + tsvector + RRF) is now live. - **A staging tenant database** `tenant_staging_demo` was provisioned on the M4 cluster to validate `provision-tenant` (schema identical, RLS forced, eeo segregated, empty). It is staging only; remove with `DROP DATABASE tenant_staging_demo` when done. - New audit action `aedt.embedding.backfill` (operational) and, when the AI routes are wired, `aedt.ai.answered` / `aedt.ai.refused`. - Note unchanged from the audit: the skills table still carries `FKProbe-` test residue from the composite FK injection integration test, and tenant tables are inflated by test seeding. Not new. ## Running services - **MEGAMIND inference plane added** on M4: the Go gateway on `:8090` (Tailscale only) in front of the already running Ollama on `:11434` (Metal). Additive; the existing MEGAMIND Python services (8081, 9200) are untouched. The model `all-minilm` was pulled into Ollama (384 dim); `llama3.1:8b` was already present. - The Bubbles `mm-api` service is **unchanged** (no live mutation, per the deploy posture). The new env it needs (`MM_EMBED_PROVIDER=megamind`, `MM_MEGAMIND_URL`, ...) is in DEPLOY_PLAN.md. ## New infra artifacts - `infra/launchd/com.missionmatch.megamind-gateway.plist` — the launchd unit for the gateway on M4 (macOS), validated with `plutil -lint`. ## Config and secrets - New embedding provider **`megamind`** (`MM_EMBED_PROVIDER=megamind`) and an `Inference` config block (`MM_MEGAMIND_URL`, `MM_MEGAMIND_EMBED_MODEL`, `MM_MEGAMIND_GENERATE_MODEL`, `MM_MEGAMIND_RERANK_MODEL`, `MM_MEGAMIND_TEACHING_ENABLED`, timeouts and breaker tunables). - **Dead keys removed** from `.env.example`: `DATA_GOV_API_KEY`, `KAGGLE_USERNAME`, `KAGGLE_KEY`, `HF_TOKEN`. They remain in the host `sam-sync.env` until the operator removes them (DEPLOY_PLAN.md). ## RBAC - New capability **`compliance.write`** (owner, admin). The governance writes (register an AEDT tool, run retention) are now gated on it instead of `compliance.read` (the audit's authz granularity flag is closed). ## Tests - New unit tests: scrub boundary, inference breaker and client, AI safety + the EEO unreachability tripwire + TAG registry safety. - New live integration tests (M4): megamind reachability and teach boundary, cross tenant database isolation, erasure wipes the resume vector, real semantic skill match, AI memory store/recall/erasure, KAG skill adjacency, TAG intent. Live integration total **31 to 39**. ## Dependencies (go.mod) - Added `github.com/pressly/goose/v3` (pure Go, used by `provision-tenant`; not imported by the API binary, so the FIPS build is unaffected). pgvector-go and pgx were already present. ## Unchanged and preserved - The deterministic engine, the frozen weights and bands, FIPS, the EEO schema segregation and the compliance pool, the append only audit, RLS on every tenant table, and the three tool split are all unchanged. The AI layer sits on top; it does not modify the engine or route around it.