# Tenant OM Scaffold CLI & Conformance Gate

## Why this note exists

`@elevasis/sdk@1.30` adds a guided, non-technical authoring surface for tenant OM under the new `elevasis-sdk om:scaffold:*` command family, plus a **hard conformance gate** in the deploy preflight that blocks deploys when an API-backed System lacks `system.apiInterface`. Five new interactive commands (`om:scaffold:system`, `om:scaffold:resource`, `om:scaffold:role`, `om:scaffold:knowledge`, `om:scaffold:fill`) walk an author through emitting valid TypeScript into the right file in the split OM layout (`core/config/organization-model/{systems,resources,roles,navigation,profile}.ts`). Every scaffold command refuses to run unless the project uses the split layout (`assertSplitLayout`) and writes through a snapshot-rollback wrapper so an aborted emit never leaves a half-edited file.

The deploy preflight now invokes `detectMissingApiInterfaceDeclarations` from `@repo/core/platform` before `validateDeclaredSystemInterfaceReadiness`. A system is flagged when it has resources with ontology bindings (`resource.ontology.actions` or `resource.ontology.writes`) but no `apiInterface` marker. When the gate trips, the diagnostic points the author at `om:scaffold:fill --gaps` for a non-interactive, snapshot-rollback-protected remediation that fills the missing marker(s) from the gap payload. The sync-engine adds a matching `conformance-blocked` lane to `assessSyncLane` and a Contract Conformance check group to `verify-sync.js`, so the same shape surfaces in both deploy and sync surfaces.

## Applies to

- All tenants whose `core/config/organization-model.ts` is in the split layout (the canonical layout for new tenants since the May 2026 multi-file split sync-note).
- Tenants with API-backed Systems (lead-gen, CRM, or future closed-registry profiles) that don't yet declare `system.apiInterface`.
- Tenants whose template `.claude/skills/om/SKILL.md` is expected to teach the scaffold surface.
- `external/nirvana-marketing` is the canonical first downstream consumer.

## Required actions

1. After `/git-sync` runs `pnpm install` and the new `@elevasis/sdk ^1.30.0` baseline lands, confirm the five new commands resolve:

   ```
   pnpm exec elevasis-sdk om:scaffold:system --help
   pnpm exec elevasis-sdk om:scaffold:resource --help
   pnpm exec elevasis-sdk om:scaffold:role --help
   pnpm exec elevasis-sdk om:scaffold:knowledge --help
   pnpm exec elevasis-sdk om:scaffold:fill --help
   ```

2. Smoke-test the dry-run path from inside the tenant project:

   ```
   pnpm exec elevasis-sdk om:scaffold:system --dry-run
   ```

   Expected: `assertSplitLayout` passes, interactive prompts fire, a dry-run TypeScript block prints, nothing is written.

3. Run `pnpm -C operations check` to exercise the new conformance gate locally. If the gate fails on an API-backed System, run `pnpm exec elevasis-sdk om:scaffold:fill --gaps <gap-json>` (or follow the diagnostic's exact instructions) to remediate. Tenants whose Systems are all UI-backed (no resources with ontology bindings) will not trip the gate.

4. Refresh the team on the updated `/om` skill guidance: `.claude/skills/om/SKILL.md` and its operations now reference the five scaffold commands as the canonical authoring path for non-technical contributors. Pure hand-edits to `organization-model/*.ts` still work but lose the snapshot-rollback safety net.

## Verification

- `pnpm exec elevasis-sdk om:scaffold:system --help` — should print the new command surface (id / title / kind / lifecycle prompts and flags).
- `pnpm -C operations check` — must pass. Conformance gate accepts every API-backed System or reports the gap with a remediation prompt.
- `pnpm sync:verify` (run from the monorepo) — should show the `Contract Conformance` check group passing for the tenant (no `apiInterface` gaps).

## Not handled by /git-sync

- **Projects still on the single-file OM layout** (`organization-model.ts` without a sibling `organization-model/` directory) will see `assertSplitLayout` abort every scaffold command with a remediation message pointing at the multi-file split migration. `/git-sync` does not perform that migration; follow the existing `2026-05-22-org-model-multi-file-split.md` sync-note instructions if the split is still pending.
- **The post-publish `external/_template/.claude/skills/om/operations/scaffold.md` operation file** that documents the new commands inside the `/om` skill is authored during the `/sdk ship` train (post-publish authoring, between `sdk` publish and `external-sync`). Until that file lands, the canonical reference for the new commands is this sync-note plus `--help` on each subcommand.
