@elevasis/sdk 1.37.0 → 1.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/cli.cjs +4 -2
  2. package/dist/index.d.ts +32 -0
  3. package/dist/index.js +3 -1
  4. package/dist/node/index.d.ts +20 -0
  5. package/dist/test-utils/index.d.ts +22 -1
  6. package/dist/test-utils/index.js +73 -33
  7. package/dist/types/worker/index.d.ts +2 -1
  8. package/dist/worker/index.js +70 -32
  9. package/package.json +4 -4
  10. package/reference/claude-config/Overview.md +140 -32
  11. package/reference/claude-config/rules/active-change-index.md +13 -2
  12. package/reference/claude-config/rules/agent-start-here.md +13 -2
  13. package/reference/claude-config/rules/deployment.md +13 -2
  14. package/reference/claude-config/rules/error-handling.md +13 -2
  15. package/reference/claude-config/rules/execution.md +13 -2
  16. package/reference/claude-config/rules/frontend.md +13 -2
  17. package/reference/claude-config/rules/observability.md +13 -2
  18. package/reference/claude-config/rules/operations.md +13 -2
  19. package/reference/claude-config/rules/organization-model.md +1 -1
  20. package/reference/claude-config/rules/organization-os.md +1 -1
  21. package/reference/claude-config/rules/package-taxonomy.md +13 -2
  22. package/reference/claude-config/rules/platform.md +13 -2
  23. package/reference/claude-config/rules/shared-types.md +13 -2
  24. package/reference/claude-config/rules/task-tracking.md +13 -2
  25. package/reference/claude-config/rules/topbar-actions.md +2 -2
  26. package/reference/claude-config/rules/ui.md +13 -2
  27. package/reference/claude-config/rules/vibe.md +13 -2
  28. package/reference/claude-config/settings.json +30 -34
  29. package/reference/claude-config/skills/deploy/SKILL.md +159 -156
  30. package/reference/claude-config/skills/elevasis/SKILL.md +11 -4
  31. package/reference/claude-config/skills/explore/SKILL.md +78 -78
  32. package/reference/claude-config/skills/git-sync/SKILL.md +166 -126
  33. package/reference/claude-config/skills/om/SKILL.md +15 -15
  34. package/reference/claude-config/skills/om/operations/build.md +2 -2
  35. package/reference/claude-config/skills/project/SKILL.md +1 -1
  36. package/reference/claude-config/skills/save/SKILL.md +183 -183
  37. package/reference/claude-config/skills/setup/SKILL.md +9 -3
  38. package/reference/claude-config/skills/status/SKILL.md +59 -59
  39. package/reference/claude-config/skills/sync/SKILL.md +47 -47
  40. package/reference/claude-config/skills/tutorial/SKILL.md +1 -1
  41. package/reference/claude-config/skills/tutorial/technical.md +11 -11
  42. package/reference/claude-config/sync-notes/2026-06-25-shared-page-scroll-contract-guard.md +52 -0
  43. package/reference/claude-config/sync-notes/2026-06-26-leadgen-overview-om-telemetry.md +47 -0
  44. package/reference/claude-config/sync-notes/2026-07-21-agent-scaffold-hardening.md +75 -0
  45. package/reference/claude-config/sync-notes/2026-07-23-agent-session-memory.md +49 -0
  46. package/reference/claude-config/sync-notes/2026-07-23-workos-org-marker.md +50 -0
  47. package/reference/rules/active-change-index.md +5 -5
  48. package/reference/rules/agent-start-here.md +34 -30
  49. package/reference/rules/deployment.md +21 -8
  50. package/reference/rules/frontend.md +4 -4
  51. package/reference/rules/observability.md +1 -1
  52. package/reference/rules/organization-model.md +1 -1
  53. package/reference/rules/organization-os.md +29 -29
  54. package/reference/rules/ui.md +205 -202
  55. package/reference/rules/vibe.md +4 -4
  56. package/reference/scaffold/operations/propagation-pipeline.md +1 -1
  57. package/reference/scaffold/recipes/extend-lead-gen.md +13 -0
@@ -59,7 +59,7 @@ why the scaffold is described as an agent operating environment, not just an app
59
59
  **Estimated time:** 15 min
60
60
 
61
61
  **Files referenced:** `.claude/rules/agent-start-here.md`, `CLAUDE.md`,
62
- `node_modules/@elevasis/sdk/reference/scaffold/index.mdx`
62
+ `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx`
63
63
 
64
64
  **Flow:**
65
65
 
@@ -101,7 +101,7 @@ across sessions). The scaffold is not just an app starter; the agent reads `.cla
101
101
  every session and uses it to route task classes, resolve boundaries, and choose the right tool.
102
102
 
103
103
  **SDK reference scaffold.** After `pnpm install`, the entry point
104
- `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` gives access to canonical recipes, UI
104
+ `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx` gives access to canonical recipes, UI
105
105
  patterns, the gating model, contracts, and a glossary. Whenever the user wants the authoritative
106
106
  answer on a scaffold surface (how to add a System or UI feature, extend an entity, wire a workflow), that
107
107
  index is the starting point.
@@ -431,7 +431,7 @@ and knows how to create a credential in Command Center.
431
431
  **Estimated time:** 20 min
432
432
 
433
433
  **Files referenced:** `.claude/skills/elevasis/SKILL.md` (creds section),
434
- `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
434
+ `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
435
435
 
436
436
  **Flow:**
437
437
 
@@ -493,7 +493,7 @@ how data flows between steps.
493
493
 
494
494
  **Estimated time:** 25 min
495
495
 
496
- **Files referenced:** `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`,
496
+ **Files referenced:** `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`,
497
497
  `apps/docs/content/docs/sdk/sdk/concepts.mdx` (design decisions section)
498
498
 
499
499
  **Flow:**
@@ -828,7 +828,7 @@ full lifecycle through Command Queue.
828
828
  **Estimated time:** 25 min
829
829
 
830
830
  **Files referenced:** `.claude/rules/error-handling.md`,
831
- `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
831
+ `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
832
832
 
833
833
  **Flow:**
834
834
 
@@ -878,7 +878,7 @@ uses the `scheduler` singleton inside a workflow, and knows the cron syntax the
878
878
 
879
879
  **Estimated time:** 20 min
880
880
 
881
- **Files referenced:** `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
881
+ **Files referenced:** `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
882
882
 
883
883
  **Flow:**
884
884
 
@@ -922,7 +922,7 @@ adapter using a credential from the project's identity.
922
922
  **Estimated time:** 25 min
923
923
 
924
924
  **Files referenced:** `.claude/skills/elevasis/SKILL.md` (credentials section),
925
- `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
925
+ `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
926
926
 
927
927
  **Flow:**
928
928
 
@@ -981,7 +981,7 @@ try/catch with retryable vs permanent error distinction.
981
981
  **Estimated time:** 20 min
982
982
 
983
983
  **Files referenced:** `.claude/rules/error-handling.md`,
984
- `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
984
+ `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
985
985
 
986
986
  **Flow:**
987
987
 
@@ -1043,7 +1043,7 @@ result) and understands when to use an agent definition vs a workflow definition
1043
1043
 
1044
1044
  **Estimated time:** 25 min
1045
1045
 
1046
- **Files referenced:** `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`,
1046
+ **Files referenced:** `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`,
1047
1047
  `apps/docs/content/docs/sdk/sdk/concepts.mdx` (workflow vs agent section)
1048
1048
 
1049
1049
  **Flow:**
@@ -1107,7 +1107,7 @@ value. The type system confirms the result matches the schema without a cast.
1107
1107
  **Estimated time:** 20 min
1108
1108
 
1109
1109
  **Files referenced:** `operations/src/index.ts`,
1110
- `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
1110
+ `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md`
1111
1111
 
1112
1112
  **Flow:**
1113
1113
 
@@ -1290,7 +1290,7 @@ following closing script:
1290
1290
  > - **Build real automations.** You now have the full surface: workflows, schemas, HITL, schedules,
1291
1291
  > LLM integration, error handling, and composition. Start with the domain most relevant to your
1292
1292
  > project and use `/project create` to track the work.
1293
- > - **SDK reference scaffold.** `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` is the
1293
+ > - **SDK reference scaffold.** `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx` is the
1294
1294
  > canonical recipe index for anything you want to build: adding a System or UI feature, extending lead-gen,
1295
1295
  > customizing CRM actions, authoring agents. Read it whenever you are starting something new.
1296
1296
  > - **Explore the codebase.** `/explore` is your tool for open-ended questions about how things
@@ -0,0 +1,52 @@
1
+ # Shared Full-Height Page Scroll Contract + Canonical headerActions Pattern
2
+
3
+ ## Why this note exists
4
+
5
+ `@elevasis/ui` (>= 2.61.2) hardens the shared full-height page scroll contract and
6
+ the template now demonstrates the safe customization pattern for it.
7
+
8
+ - `SubshellContentContainer` (the root of the lead-gen list-detail, CRM/delivery/
9
+ clients detail pages, etc.) is a `flex:1 / overflowY:auto / minHeight:0` scroll
10
+ container that only bounds correctly as a **direct flex child** of the shell's
11
+ height-bounded region. Wrapping a shared page in a layout element (e.g. a Mantine
12
+ `<Stack>`, which is `flex:0 1 auto` with no `min-height:0`) breaks the height
13
+ chain: the page balloons to content height and its internal scroll never engages.
14
+ - The package now ships a **dev-only runtime guard** that logs a console warning when
15
+ it detects an unbounded `SubshellContentContainer`, so this mistake is caught while
16
+ authoring a route instead of shipping a silently broken page. No-op in production.
17
+ - The template `lead-gen/lists.$listId.tsx` now injects a `ListExportButton` through
18
+ the page's **`headerActions` slot** (not a wrapper) as the canonical reference for
19
+ customizing a shared full-height page.
20
+
21
+ ## Applies to
22
+
23
+ - All template-derived projects that render shared full-height pages
24
+ (`LeadGenListDetailPage`, CRM/delivery/clients detail pages).
25
+ - Any project that wrapped a shared page in a `<Stack>` (or similar) to bolt on
26
+ extra UI -> that page's scroll is broken; switch to the page's slot props.
27
+
28
+ ## Required actions
29
+
30
+ - Bump `@elevasis/ui` to `^2.61.2` (or later) and install. (The ship train's
31
+ `external-sync` stage does this automatically via the package-cascade baseline;
32
+ manual `pnpm update` is not required.)
33
+ - If any route wraps a shared full-height page, remove the wrapper and pass the
34
+ extra UI through the page's slot props (`headerActions` / `tabs` / `footer`). The
35
+ template `lead-gen/lists.$listId.tsx` is the canonical reference.
36
+ - Heed the new dev console warning if it appears; do not silence it.
37
+
38
+ ## Verification
39
+
40
+ - `pnpm -C ui check-types` passes against `@elevasis/ui@^2.61.2`.
41
+ - Open a shared detail page (e.g. `/lead-gen/lists/:listId`): the page scrolls
42
+ internally, the bottom is reachable, and no scroll-contract console warning fires.
43
+ - Wrapping the page in a `<Stack>` produces the dev warning (negative check).
44
+
45
+ ## Not handled by /git-sync
46
+
47
+ - `/git-sync` surfaces this note and pulls the template `lists.$listId.tsx` +
48
+ `ListExportButton` baseline, but a diverged tenant copy is preserved
49
+ (merge-managed) -- you must manually remove any page wrapper and adopt the slot
50
+ pattern.
51
+ - The dev guard ships inside `@elevasis/ui`; no tenant source change is required to
52
+ receive it beyond the dependency-baseline bump.
@@ -0,0 +1,47 @@
1
+ # Lead Gen Overview — OM-derived telemetry (NaN fix)
2
+
3
+ ## Why this note exists
4
+
5
+ The published `@elevasis/ui` Lead Gen **Overview** page previously hardcoded the
6
+ pre-migration canonical pipeline stage keys (`populated, extracted, qualified,
7
+ discovered, verified, personalized, uploaded`) in its telemetry reducer. Any tenant
8
+ whose Organization Model declares a different stage set got `undefined` stage reads
9
+ and rendered `NaN` in the header and the **Ready Contacts** stat card.
10
+
11
+ `@elevasis/ui@2.62.0` (paired with `@elevasis/core@0.54.0`) makes the Overview render
12
+ generically over the OM-declared stage catalog. Telemetry now derives entirely from
13
+ `getLeadGenStageCatalog()` + `ListTelemetry.stageCounts`; an absent stage contributes
14
+ `0`, never `NaN`. The "ready / next focus" backlog moved from hardcoded
15
+ `personalized − uploaded` to a declared OM descriptor.
16
+
17
+ ## Applies to
18
+
19
+ - Every template-derived project that consumes `@elevasis/ui` for the Lead Gen
20
+ Overview surface and whose pipeline diverges from the old canonical stage set.
21
+ - This is a **package-cascade-only** change: no template SOURCE edits are required.
22
+ The fix is bundled in the published packages; tenants only need the new baselines.
23
+
24
+ ## Required actions
25
+
26
+ - Take the dependency baseline bump propagated by this train:
27
+ - `@elevasis/core` → `0.54.0`
28
+ - `@elevasis/ui` → `2.62.0`
29
+ - Reinstall so the new bundles are live (`pnpm install` in the project's `ui/`
30
+ workspace) and clear any stale Vite optimize cache
31
+ (`node_modules/.vite`) before restarting a running dev server.
32
+
33
+ ## Verification
34
+
35
+ - After the baseline bump + install, open the Lead Gen Overview for a list on a
36
+ divergent pipeline: the header summary and the three stat cards render finite
37
+ numbers, with no `NaN` and no reference to retired stages.
38
+ - `pnpm sync:verify -- <project>` confirms the project is on the new baselines.
39
+
40
+ ## Not handled by /git-sync
41
+
42
+ - **Optional OM authoring (tenant-owned, NOT shipped here):** a tenant MAY declare
43
+ `readinessTarget: true` on one stage in its `core/config/organization-model.ts`
44
+ stage catalog to restore a semantic "Ready: \<stage\>" stat. Until declared, the UI
45
+ correctly falls back to a generic last-incomplete-stage backlog. This is an
46
+ enhancement done via a separate `/om` cycle, never auto-propagated.
47
+ - The visual confirmation that `NaN` is gone on a running tenant page (a human check).
@@ -0,0 +1,75 @@
1
+ # Agent Scaffold Hardening — deploy default, rule paths, ownership split
2
+
3
+ ## Why this note exists
4
+
5
+ Three corrections in this train change guidance agents were previously following
6
+ incorrectly. The first is safety-relevant and is the reason this note exists.
7
+
8
+ **1. Plain `deploy` targets PRODUCTION, not dev.** `resolveApiUrl` in the SDK CLI
9
+ falls through to `https://api.elevasis.io` unless `NODE_ENV === 'development'` is
10
+ set. The template `CLAUDE.md` Commands table and the bundled `deployment.md` both
11
+ stated that plain `deploy` targeted dev. Both were wrong, and every derived project
12
+ inherited the wrong statement. The full resolution order is now documented:
13
+ `--api-url` > `--prod` > `ELEVASIS_API_URL` > `NODE_ENV === 'development'` >
14
+ production fallthrough. `resolveApiKey` follows a separate rule and is documented
15
+ alongside it.
16
+
17
+ If your project has no `NODE_ENV=development` in its environment, it has **no
18
+ working dev target** — `deploy` and `deploy:prod` resolve to the same production
19
+ API. Verify before your next deploy rather than assuming.
20
+
21
+ **2. Bundled rule paths were wrong fleet-wide.** Every drill-down pointer said
22
+ `node_modules/@elevasis/sdk/reference/...`. The SDK actually installs at
23
+ `operations/node_modules/@elevasis/sdk/reference/...`; the project root has no
24
+ `@elevasis` packages at all.
25
+
26
+ **3. `ui.md` documented three import surfaces that do not exist.**
27
+
28
+ | Was documented | Actual |
29
+ | ------------------------------------------------------------ | --------------------------------------------------------- |
30
+ | `useApiClient` from `@/lib/hooks/useApiClient` | `@elevasis/ui/api`, and it takes `API_URL` as an argument |
31
+ | `ProtectedRoute` from `ui/src/features/auth/` | `@elevasis/ui/auth` — that directory does not exist |
32
+ | `sseConnectionManager` from `@/lib/sse/SSEConnectionManager` | `@/lib/sse` (`ui/src/lib/sse.ts`) |
33
+
34
+ ## Applies to
35
+
36
+ - Every template-derived project. All three corrections ship inside the
37
+ `@elevasis/sdk` reference bundle, so they arrive with the dependency baseline —
38
+ no source edits required to receive them.
39
+ - `CLAUDE.md` also changed shape this train. Template-structural guidance (project
40
+ structure, stack, commands, slash-command surface) moved into
41
+ `.claude/Overview.md`, which is replace-managed and propagates by sync.
42
+ `CLAUDE.md` is now project-owned identity only and remains never-touch.
43
+
44
+ ## Required actions
45
+
46
+ - Take the `@elevasis/sdk` dependency baseline bump propagated by this train, then
47
+ reinstall in `operations/` so `reference/rules/` carries the corrected canon.
48
+ - Read the new `OPERATIONS.md` at your project root. It is tenant-owned, never
49
+ synced, and is the sanctioned home for operational facts that contradict generic
50
+ guidance — starting with your real deploy target.
51
+ - Once this train's `.claude/Overview.md` has landed, remove template-structural
52
+ prose from your project's `CLAUDE.md`. Keep your identity sections verbatim.
53
+
54
+ ## Verification
55
+
56
+ - `grep -n "elevasis/ui/api" operations/node_modules/@elevasis/sdk/reference/rules/ui.md`
57
+ returns a match, and `@/lib/hooks/useApiClient` returns none.
58
+ - The bundled `deployment.md` leads with a Dev vs Prod section stating the
59
+ production default.
60
+ - `.claude/Overview.md` contains Project Structure, Stack, and Commands sections.
61
+ - `pnpm sync:verify -- <project>` confirms the project is on the new baseline.
62
+
63
+ ## Not handled by /git-sync
64
+
65
+ - **The `CLAUDE.md` migration is manual and tenant-specific.** The file is
66
+ never-touch by design, so nothing overwrites it. Lifting stale template prose out
67
+ while preserving your identity sections is a per-project edit.
68
+ - **Literal `{CLIENT_CONTEXT}` / `{USER_PREFERENCES}` placeholders must stay
69
+ literal** if setup has not run for your project. Setup only fills them while they
70
+ are still literal; replacing them with stub prose permanently marks an
71
+ unconfigured project as configured.
72
+ - **One-time EOL renormalization.** This train adds `.gitattributes` (LF in-repo).
73
+ After it lands, run `git add --renormalize .` once in your project repo. Until
74
+ then the CRLF/LF false-drift persists in existing checkouts — it accounted for
75
+ roughly 95% of apparent `.claude/` drift before this change.
@@ -0,0 +1,49 @@
1
+ # Session-capable agents now remember earlier turns
2
+
3
+ ## Why this note exists
4
+
5
+ Any agent with `sessionCapable: true` was silently forgetting everything from earlier in the same
6
+ conversation. Two things were broken:
7
+
8
+ - **Its saved memory was never loaded back in.** The agent wrote memory at the end of a turn; the
9
+ next turn started from an empty memory instead of restoring it.
10
+ - **The earlier messages were never given to the model.** The conversation was stored for display
11
+ but the execution path never read it, so turn N could not see turns 1..N-1.
12
+
13
+ Both are now fixed, and both are **on by default** for session-capable agents. Turn N is handed the
14
+ agent's restored memory plus the earlier user/assistant messages (token-budgeted), so it can actually
15
+ continue the conversation. The fix is entirely platform-side — no agent definition changes are
16
+ required to get it.
17
+
18
+ ## Applies to
19
+
20
+ - **Every agent with `sessionCapable: true`.** The behavior arrives with the `@elevasis/sdk` and
21
+ `@elevasis/core` dependency baselines this train propagates.
22
+ - **Especially agents whose memory strategy was written around the old broken behavior.** For
23
+ example, a voice/interview agent told _"never store the full transcript in memory — the transcript
24
+ is the source of truth"_ only worked if the transcript was actually replayed to the model. It
25
+ wasn't, so those agents deliberately declined to remember the one thing they needed. That guidance
26
+ is now correct: the earlier messages are given to the model.
27
+
28
+ ## Required actions
29
+
30
+ 1. **Take the `@elevasis/core` and `@elevasis/sdk` baseline bumps** this train propagates, then
31
+ reinstall in `operations/` so the new worker bundle is present.
32
+ 2. **Redeploy your operations bundle.** The worker is baked into the deployed bundle at build time,
33
+ so an existing deployment stays amnesiac until it is redeployed. `pnpm -C operations exec
34
+ elevasis-sdk deploy --prod` (or your project's deploy command).
35
+ 3. **Revisit any `memoryPreferences` you wrote around the old behavior.** If you told an agent not to
36
+ store something because "the conversation is the source of truth," confirm that still matches what
37
+ you want now that the conversation is actually available to the model.
38
+
39
+ ## Verification
40
+
41
+ - Hard recall probe: plant an unguessable token in turn 1, then in turn 2 ask for it back verbatim
42
+ **without restating it**. A fixed agent returns it; a broken one says the session is empty.
43
+ - `turnInputTokens` grows turn over turn as the conversation accumulates, instead of staying flat at
44
+ system-prompt-plus-current-message size.
45
+
46
+ ## Not handled by /git-sync
47
+
48
+ - **The redeploy.** `/git-sync` commits and pushes the propagated dependency baseline, but it does
49
+ not redeploy your operations bundle. The fix does not go live until you redeploy (action 2 above).
@@ -0,0 +1,50 @@
1
+ # WorkOS single-org binding moves to the `.elevasis` marker
2
+
3
+ ## Why this note exists
4
+
5
+ **This is a correctness fix for a live data-exposure class of bug. Read it before your next deploy.**
6
+
7
+ Single-org apps used to bind to their WorkOS organization through `VITE_WORKOS_ORG_ID`, a build-time env var. That variable lived only in a gitignored `ui/.env`, so it was absent from any clean build — CI, a fresh clone, a new hosting project. When it was absent the org guard in `__root.tsx` silently **no-opped**, and the app inherited whatever organization the WorkOS session happened to be using. It failed **open**.
8
+
9
+ That is not hypothetical. `app.contemplativerecords.com` served a different tenant's data because its production build had no `VITE_WORKOS_ORG_ID` set.
10
+
11
+ The binding now lives in the project's committed `.elevasis` marker:
12
+
13
+ ```yaml
14
+ projectSlug: your-project
15
+ templateVersion: "1.0"
16
+ appMode: client-centric
17
+ workosOrgId: org_01ABCDEFGHIJKLMNOPQRSTUVWX
18
+ ```
19
+
20
+ The shared `elevasisVite()` plugin (from `@elevasis/ui/vite`, already wired into your `ui/vite.config.ts`) walks up from `ui/`, reads the marker, and injects the value as the build-time constant `__ELEVASIS_WORKOS_ORG_ID__`. The org guard, the `login.tsx` `signIn()` calls, and the dev-centric topbar switcher gate all read that constant.
21
+
22
+ **A WorkOS `org_` id is a public identifier, not a secret** — it appears in URLs. Committing it is correct. Treating it as a secret is what put it in a gitignored file and caused the failure.
23
+
24
+ `VITE_WORKOS_ORG_ID` is removed with **no fallback**. There is no transition period and no back-compat read. If you leave the env var set and do not seed the marker, your org guard stops binding.
25
+
26
+ ## Applies to
27
+
28
+ - **Every template-derived project.** The plugin change arrives with the `@elevasis/ui` dependency baseline this train propagates.
29
+ - **`client-centric` projects — action required.** `/external verify` now fails closed: a `client-centric` project whose `.elevasis` lacks a non-empty `org_`-prefixed `workosOrgId` fails the gate. This is deliberate. A loud failure is the point; the old silent no-op is what shipped the bug.
30
+ - **`dev-centric` projects — optional.** The field may be absent or empty. If present and non-empty it must still be `org_`-prefixed.
31
+
32
+ ## Required actions
33
+
34
+ 1. **Add `workosOrgId` to your `.elevasis`.** Sync will not do this for you — see "Not handled by /git-sync" below. Find your org id in Command Center, or in the `organizations` table as `workos_org_id`.
35
+ 2. **Take the `@elevasis/ui` baseline bump** this train propagates, then reinstall in `ui/` so the plugin that injects the constant is actually present.
36
+ 3. **Remove `VITE_WORKOS_ORG_ID` from every environment you set it in** — `ui/.env`, `ui/.env.local`, and your hosting provider's env settings (for Vercel: Project → Settings → Environment Variables). Leaving it set does nothing, but it will mislead the next person who reads it.
37
+ 4. **Redeploy.** The constant is injected at build time, so an existing deployment keeps its old behavior until it is rebuilt.
38
+
39
+ ## Verification
40
+
41
+ - `pnpm external:verify` passes, and your project's `marker` category reports `.elevasis workosOrgId is set for client-centric project`.
42
+ - `grep -rn "VITE_WORKOS_ORG_ID" ui/ .env* 2>/dev/null` returns nothing.
43
+ - In a built bundle, your org id is present: `grep -o "org_[A-Za-z0-9]*" ui/dist/assets/*.js | head`. If this returns nothing for a `client-centric` project, the marker was not read — check that `.elevasis` sits at your project root, one level above `ui/`.
44
+ - After deploying, log in and confirm the app lands in the correct organization.
45
+
46
+ ## Not handled by /git-sync
47
+
48
+ - **Your `.elevasis` marker is project-owned and `never-touch`.** The sync engine will never write it, which means it will never seed `workosOrgId` for you and never overwrite the value once you set it. Step 1 above is a manual, per-project edit. A `client-centric` project that skips it will fail `/external verify` until it is done.
49
+ - **A diverged `__root.tsx` will not auto-merge.** `__root.tsx` is merge-managed with `critical-manual-merge` severity. If your shell has diverged from the template, sync preserves your copy and the `useOrgGuard` swap from `import.meta.env.VITE_WORKOS_ORG_ID` to `__ELEVASIS_WORKOS_ORG_ID__` is a manual edit. When you make it, do **not** remove the structural contract substrings `ElevasisAuthenticatedShell`, `from '@elevasis/ui/app'`, or `SYSTEM_MANIFESTS` — dropping them makes `sync-apply` mis-escalate your project to `catch-up-required`.
50
+ - **A diverged `ui/vite.config.ts` needs reconciliation, not overwrite.** It is `replace-all` managed, so a blind sync would clobber local divergence. Confirm `...elevasisVite()` survives in your plugins array — without it the constant is never defined and the guard reads `undefined`.
@@ -9,7 +9,7 @@ description: Bridge between stable scaffold docs and higher-volatility in-progre
9
9
 
10
10
  Use this rule to decide whether stable scaffold docs are enough, or whether you also need to load in-progress platform architecture docs from the monorepo.
11
11
 
12
- > **Note:** Paths prefixed with `apps/` or `packages/` are monorepo-internal and unavailable in standalone projects. For those areas, use the stable scaffold docs under `node_modules/@elevasis/sdk/reference/scaffold/` as the primary reference. The monorepo paths are retained for contributors working within the monorepo.
12
+ > **Note:** Paths prefixed with `apps/` or `packages/` are monorepo-internal and unavailable in standalone projects. For those areas, use the stable scaffold docs under `operations/node_modules/@elevasis/sdk/reference/scaffold/` as the primary reference. The monorepo paths are retained for contributors working within the monorepo.
13
13
 
14
14
  ## Current Watch Areas
15
15
 
@@ -32,10 +32,10 @@ Load:
32
32
 
33
33
  Stable scaffold docs affected:
34
34
 
35
- - `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
35
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
36
36
  - `.claude/rules/ui.md`
37
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md`
38
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md`
37
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md`
38
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md`
39
39
 
40
40
  ### Package Surface / Reference System
41
41
 
@@ -54,7 +54,7 @@ Load:
54
54
 
55
55
  Stable scaffold docs affected:
56
56
 
57
- - `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
57
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
58
58
 
59
59
  ### Resource / Topology Mapping
60
60
 
@@ -55,7 +55,9 @@ Do not write resume state into markdown frontmatter. Task-doc frontmatter is lim
55
55
 
56
56
  ### Session-Start Dashboard
57
57
 
58
- The session-start dashboard directive lives in `CLAUDE.md`. If you see it there, follow it on the first response of a session. This file (`agent-start-here` rule) is the drill-down reference layer; `CLAUDE.md` owns session bootstrap.
58
+ **This rule owns session bootstrap.** Run the "First Action" flow above on the first response of a session. `CLAUDE.md` only points here it is project-owned and never overwritten by sync, so it deliberately carries no procedure that might need correcting later.
59
+
60
+ Older projects may still have a copy of the dashboard directive inline in their `CLAUDE.md`. If the two ever disagree, this file wins: it ships with the SDK version the project actually runs.
59
61
 
60
62
  ## Template Surfaces
61
63
 
@@ -65,28 +67,29 @@ Once project continuity is resolved (or confirmed irrelevant), the template is n
65
67
  - `operations/` -- Elevasis SDK resources deployed to the platform
66
68
  - `core/` -- runtime-agnostic shared contracts and organization model adaptation
67
69
  - `.claude/` -- local agent rules, skills, and hooks
68
- - `node_modules/@elevasis/sdk/reference/scaffold/` -- SDK reference scaffold: canonical recipes, UI patterns, gating model, contracts, and glossary. Entry point: `index.mdx`.
70
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/` -- SDK reference scaffold: canonical recipes, UI patterns, gating model, contracts, and glossary. Entry point: `index.mdx`.
69
71
 
70
72
  ## Discovery Order
71
73
 
72
74
  Use this order unless a more specific doc tells you otherwise:
73
75
 
74
76
  1. Complete the "First Action: Check Active Projects" flow above.
75
- 2. Read `CLAUDE.md` for project rules, command surface, and navigation pointers.
76
- 3. Read this rule and classify the task using the Task Classes below.
77
- 4. Read `identity.clientBrief` from the OrganizationModel (`core/config/organization-model.ts`) for organization context and naming.
78
- 5. Read the relevant structural map:
79
- - Glob `node_modules/@elevasis/sdk/reference/` for published package surfaces
77
+ 2. Read `CLAUDE.md` for this project's identity, client context, and user preferences. It is deliberately short — for structure, stack, commands, and the slash-command surface, read `.claude/Overview.md`, which sync keeps current.
78
+ 3. Read `OPERATIONS.md` at the project root, if present -- it is tenant-owned, never overwritten by sync, and records operational quirks true for this tenant only (non-obvious deploy targets, environment gotchas). Read it early: it can override generic guidance elsewhere in this file for this specific tenant.
79
+ 4. Read this rule and classify the task using the Task Classes below.
80
+ 5. Read `identity.clientBrief` from the OrganizationModel (`core/config/organization-model.ts`) for organization context and naming.
81
+ 6. Read the relevant structural map:
82
+ - Glob `operations/node_modules/@elevasis/sdk/reference/` for published package surfaces
80
83
  - Read `operations/src/index.ts` for deployment assembly, `core/config/organization-model.ts` for resource descriptors, or run `pnpm elevasis-sdk project:list --pretty` for live DB state
81
- 6. For feature integration, resource authoring, or UI customization tasks, read `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` to find the canonical recipe or reference doc.
82
- 7. Drill into the co-located local explainer for the abstraction boundary you are changing.
83
- 8. Check the `.claude/rules/active-change-index.md` rule before trusting stable assumptions in areas that are under active architecture work.
84
+ 7. For feature integration, resource authoring, or UI customization tasks, read `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx` to find the canonical recipe or reference doc.
85
+ 8. Drill into the co-located local explainer for the abstraction boundary you are changing.
86
+ 9. Check the `.claude/rules/active-change-index.md` rule before trusting stable assumptions in areas that are under active architecture work.
84
87
 
85
88
  ## SDK Reference Scaffold
86
89
 
87
90
  Universal scaffold documentation (recipes, patterns, architecture, reference) has been centralized in the SDK reference. After `pnpm install`, the entry point is:
88
91
 
89
- `node_modules/@elevasis/sdk/reference/scaffold/index.mdx`
92
+ `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx`
90
93
 
91
94
  This index links to all scaffold docs including pathway recipes, UI patterns, core architecture, and auto-generated contracts/feature registry.
92
95
 
@@ -102,14 +105,14 @@ Examples: add a page, change sidebar behavior, adjust feature visibility, update
102
105
 
103
106
  Load first:
104
107
 
105
- - `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` (scaffold index -- UI recipes, feature flags, customization)
108
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx` (scaffold index -- UI recipes, feature flags, customization)
106
109
  - `.claude/rules/ui.md`
107
110
  - `ui/src/routes/README.md`
108
111
  - `core/config/README.md`
109
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/recipes.md` -- specifically recipe 6 when building a "run this resource" surface
110
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md` -- when building or extending CRM pages, sidebars, hooks, workflows, or deal data surfaces
111
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- when building or extending lead-gen pages, sidebars, hooks, workflows, list/member state, or artifacts
112
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` -- when changing CRM deal action buttons or adding a workflow-backed deal action
112
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/recipes.md` -- specifically recipe 6 when building a "run this resource" surface
113
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md` -- when building or extending CRM pages, sidebars, hooks, workflows, or deal data surfaces
114
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- when building or extending lead-gen pages, sidebars, hooks, workflows, list/member state, or artifacts
115
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` -- when changing CRM deal action buttons or adding a workflow-backed deal action
113
116
 
114
117
  Then inspect:
115
118
 
@@ -130,7 +133,7 @@ Examples: add a workflow, update an agent, change resource registration, underst
130
133
 
131
134
  Load first:
132
135
 
133
- - `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` (scaffold index -- workflow recipes, resource authoring)
136
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx` (scaffold index -- workflow recipes, resource authoring)
134
137
  - `.claude/rules/operations.md`
135
138
  - `operations/src/README.md`
136
139
 
@@ -153,21 +156,21 @@ Examples: rename a feature area, change quick access surfaces, map new business
153
156
 
154
157
  Load first:
155
158
 
156
- - `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` (scaffold index -- contracts, gating patterns, glossary)
159
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/index.mdx` (scaffold index -- contracts, gating patterns, glossary)
157
160
  - `core/config/README.md`
158
- - `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
161
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
159
162
  - typed feature/surface constants from `@elevasis/core/organization-model` -- `SALES_FEATURE_ID`, `PROSPECTING_FEATURE_ID`, `PROJECTS_FEATURE_ID`, `OPERATIONS_FEATURE_ID`, `MONITORING_FEATURE_ID`, `SETTINGS_FEATURE_ID`, `SEO_FEATURE_ID`, `SALES_PIPELINE_SURFACE_ID`, `PROSPECTING_LISTS_SURFACE_ID`, `PROJECTS_INDEX_SURFACE_ID`, `OPERATIONS_COMMAND_VIEW_SURFACE_ID`. Use these typed constants instead of magic strings when overriding feature/surface IDs.
160
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md` -- CRM is an Organization OS + UI + hooks + workflow-adapter surface; read this before extending CRM structure.
161
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- lead gen is an Organization OS + UI + hooks + workflow-adapter surface; read this before extending lead-gen lists, members, artifacts, or state transitions.
162
- - `node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` -- CRM action buttons are not `sales.actions` org-model config in v1; use the recipe's provider/custom-button path.
163
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md`
163
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md` -- CRM is an Organization OS + UI + hooks + workflow-adapter surface; read this before extending CRM structure.
164
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md` -- lead gen is an Organization OS + UI + hooks + workflow-adapter surface; read this before extending lead-gen lists, members, artifacts, or state transitions.
165
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` -- CRM action buttons are not `sales.actions` org-model config in v1; use the recipe's provider/custom-button path.
166
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md`
164
167
 
165
168
  Then inspect:
166
169
 
167
170
  - `core/config/organization-model.ts`
168
171
  - `core/config/organization-model.ts` -- Organization Model overrides plus Systems and Resources descriptors. Start here for feature labels, surface mapping, and resource identity/governance changes.
169
172
  - `ui/src/routes/__root.tsx`
170
- - `ui/src/lib/hooks/useFeatureAccess.ts`
173
+ - feature-access gating call sites built from `createFeatureAccessHook` (`@elevasis/ui/hooks`) -- the template no longer ships a local `useFeatureAccess.ts`; the hook factory is the published equivalent
171
174
  - relevant nav config files
172
175
 
173
176
  Verify with:
@@ -209,7 +212,7 @@ Examples: extend a published package contract, understand how a scaffold surface
209
212
  Load first:
210
213
 
211
214
  - `.claude/rules/active-change-index.md`
212
- - Glob `node_modules/@elevasis/sdk/reference/` for the current SDK package surface
215
+ - Glob `operations/node_modules/@elevasis/sdk/reference/` for the current SDK package surface
213
216
  - package README found via that glob
214
217
 
215
218
  Then inspect:
@@ -253,11 +256,12 @@ The deployment aggregation point. Start here for what resources are registered a
253
256
 
254
257
  Trust these in order:
255
258
 
256
- 1. Source code and published package docs
257
- 2. Co-located boundary docs
258
- 3. Generated structural maps
259
- 4. Hand-authored template guidance
260
- 5. In-progress architecture docs when `.claude/rules/active-change-index.md` says the area is actively evolving
259
+ 1. Tenant-owned `OPERATIONS.md` at the project root, when present, for facts specific to this tenant's own environment and operational quirks -- it is never overwritten by sync and can override any generic guidance below for this tenant specifically
260
+ 2. Source code and published package docs
261
+ 3. Co-located boundary docs
262
+ 4. Generated structural maps
263
+ 5. Hand-authored template guidance
264
+ 6. In-progress architecture docs when `.claude/rules/active-change-index.md` says the area is actively evolving
261
265
 
262
266
  If a hand-authored doc conflicts with source or published package docs, trust source and flag the doc drift.
263
267
 
@@ -14,19 +14,31 @@ paths:
14
14
  ```bash
15
15
  pnpm -C operations run check # Validate resource definitions
16
16
  pnpm -C operations run check-types # TypeScript type-check
17
- pnpm -C operations run deploy # Deploy to dev (only after both pass)
17
+ pnpm -C operations run deploy # Deploy (target depends on environment -- see below)
18
18
  ```
19
19
 
20
20
  `check` catches duplicate resource IDs, OM descriptor/code mismatches, invalid step chains, broken relationships, and schema serialization issues. Same validation runs during deploy -- if `check` passes, deploy validation will pass.
21
21
 
22
- ## Dev vs Prod
22
+ ## Dev vs Prod (SAFETY-CRITICAL: plain `deploy` targets PRODUCTION by default)
23
23
 
24
- | Command | Target | When |
25
- | ------------------------------------ | ----------------- | ----------------------- |
26
- | `pnpm -C operations run deploy` | Local dev API | Development and testing |
27
- | `pnpm -C operations run deploy:prod` | `api.elevasis.io` | Production release |
24
+ Plain `pnpm -C operations run deploy` runs `elevasis-sdk deploy` with no flags. There is no dev-safe default baked into the command name. The API URL resolution (`packages/sdk/src/cli/config.ts`, `resolveApiUrl`) checks, in order:
28
25
 
29
- Always test in dev first, verify with `elevasis-sdk exec`, then deploy to prod.
26
+ 1. `--api-url <url>` CLI flag -- explicit override, always wins
27
+ 2. `--prod` CLI flag -- forces `https://api.elevasis.io`
28
+ 3. `ELEVASIS_API_URL` env var -- explicit override
29
+ 4. `NODE_ENV === 'development'` -- ONLY this exact condition returns `http://localhost:5170`
30
+ 5. Otherwise (no flag, no env var, `NODE_ENV` unset or anything other than `'development'`) -- falls through to `https://api.elevasis.io` (**production**)
31
+
32
+ | Command | Target | When |
33
+ | ------------------------------------ | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
34
+ | `pnpm -C operations run deploy` | **Production (`api.elevasis.io`) unless your shell has `NODE_ENV=development` set** | Only safe as a "dev" command in a shell where `NODE_ENV=development` is explicitly exported |
35
+ | `pnpm -C operations run deploy:prod` | `api.elevasis.io`, via explicit `--prod` | Production release |
36
+
37
+ Do not assume plain `deploy` is a dev-safe command. Most tenant shells do not export `NODE_ENV=development`, so plain `deploy` hits production. Before running it, confirm the target: check `echo $NODE_ENV` / `$env:NODE_ENV`, or pass `--api-url` explicitly if you need to target a specific environment. If this tenant project has a checked-in `OPERATIONS.md` at the project root, check it first -- it records tenant-specific deploy-target facts that override this generic guidance.
38
+
39
+ The API key follows a related but distinct rule (`resolveApiKey`): with `--prod`, or whenever `NODE_ENV !== 'development'`, only `ELEVASIS_PLATFORM_KEY` is used. Only when `NODE_ENV === 'development'` (and `--prod` is not passed) does the CLI prefer `ELEVASIS_PLATFORM_KEY_DEV`, falling back to `ELEVASIS_PLATFORM_KEY` if the dev key is unset.
40
+
41
+ Always verify the actual deploy target before treating a deploy as safe-to-repeat, verify with `elevasis-sdk exec`, then deploy to prod deliberately (`deploy:prod` or `--prod`).
30
42
 
31
43
  ## Version Bumping
32
44
 
@@ -39,7 +51,8 @@ Deploy accepts `--major`, `--minor`, `--patch` flags to bump the deployment vers
39
51
 
40
52
  ## Environment
41
53
 
42
- - `ELEVASIS_PLATFORM_KEY` in `.env` is required for CLI auth
54
+ - `ELEVASIS_PLATFORM_KEY` in `.env` is required for CLI auth (used for every deploy unless `NODE_ENV=development` with no `--prod`)
55
+ - `ELEVASIS_PLATFORM_KEY_DEV` is optional -- only consulted when `NODE_ENV=development` and `--prod` is not passed; falls back to `ELEVASIS_PLATFORM_KEY` if unset
43
56
  - `.env` is never included in the bundle -- it stays local
44
57
  - Integration credentials live in Command Center, not `.env`
45
58
 
@@ -38,9 +38,9 @@ When building pages that display external data, use published `@elevasis/ui` com
38
38
 
39
39
  ## Detailed Reference
40
40
 
41
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/recipes.md` -- add a page, add a nav item, theme tokens, feature-scoped components, route patterns (static, nested, dynamic)
42
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md` -- `systemKey` / `SystemGuard` / `AdminGuard` model
43
- - `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` -- sidebar composition via manifest overrides
44
- - `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` -- TypeScript shapes (`SystemModule`, `NavItem`, `OrganizationModel`)
41
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/recipes.md` -- add a page, add a nav item, theme tokens, feature-scoped components, route patterns (static, nested, dynamic)
42
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md` -- `systemKey` / `SystemGuard` / `AdminGuard` model
43
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` -- sidebar composition via manifest overrides
44
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` -- TypeScript shapes (`SystemModule`, `NavItem`, `OrganizationModel`)
45
45
  - `ui/src/config/theme.ts` -- theme configuration and CSS variable definitions
46
46
  - `ui/src/config/nav-items.ts` -- sidebar navigation entries
@@ -31,4 +31,4 @@ pnpm elevasis-sdk executions <resourceId>
31
31
 
32
32
  ## Detailed Reference
33
33
 
34
- - `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- full logging patterns and handler examples
34
+ - `operations/node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- full logging patterns and handler examples