@elevasis/sdk 1.36.5 → 1.38.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 +64 -22
  2. package/dist/index.d.ts +105 -7
  3. package/dist/index.js +81 -33
  4. package/dist/node/index.d.ts +6 -5
  5. package/dist/test-utils/index.d.ts +6 -5
  6. package/dist/test-utils/index.js +70 -32
  7. package/dist/worker/index.js +7 -11
  8. package/package.json +4 -4
  9. package/reference/claude-config/Overview.md +140 -32
  10. package/reference/claude-config/rules/active-change-index.md +13 -2
  11. package/reference/claude-config/rules/agent-start-here.md +13 -2
  12. package/reference/claude-config/rules/deployment.md +13 -2
  13. package/reference/claude-config/rules/error-handling.md +13 -2
  14. package/reference/claude-config/rules/execution.md +13 -2
  15. package/reference/claude-config/rules/frontend.md +13 -2
  16. package/reference/claude-config/rules/observability.md +13 -2
  17. package/reference/claude-config/rules/operations.md +13 -2
  18. package/reference/claude-config/rules/organization-model.md +1 -1
  19. package/reference/claude-config/rules/organization-os.md +1 -1
  20. package/reference/claude-config/rules/package-taxonomy.md +13 -2
  21. package/reference/claude-config/rules/platform.md +13 -2
  22. package/reference/claude-config/rules/shared-types.md +13 -2
  23. package/reference/claude-config/rules/task-tracking.md +13 -2
  24. package/reference/claude-config/rules/topbar-actions.md +2 -2
  25. package/reference/claude-config/rules/ui.md +13 -2
  26. package/reference/claude-config/rules/vibe.md +13 -2
  27. package/reference/claude-config/settings.json +30 -34
  28. package/reference/claude-config/skills/deploy/SKILL.md +159 -156
  29. package/reference/claude-config/skills/elevasis/SKILL.md +11 -4
  30. package/reference/claude-config/skills/explore/SKILL.md +78 -78
  31. package/reference/claude-config/skills/git-sync/SKILL.md +166 -126
  32. package/reference/claude-config/skills/om/SKILL.md +15 -15
  33. package/reference/claude-config/skills/om/operations/build.md +2 -2
  34. package/reference/claude-config/skills/project/SKILL.md +1 -1
  35. package/reference/claude-config/skills/save/SKILL.md +183 -183
  36. package/reference/claude-config/skills/setup/SKILL.md +9 -3
  37. package/reference/claude-config/skills/status/SKILL.md +59 -59
  38. package/reference/claude-config/skills/sync/SKILL.md +47 -47
  39. package/reference/claude-config/skills/tutorial/SKILL.md +1 -1
  40. package/reference/claude-config/skills/tutorial/technical.md +11 -11
  41. package/reference/claude-config/sync-notes/2026-06-15-session-chat-zero-wiring.md +46 -0
  42. package/reference/claude-config/sync-notes/2026-06-17-agent-session-ux-features.md +34 -0
  43. package/reference/claude-config/sync-notes/2026-06-25-shared-page-scroll-contract-guard.md +52 -0
  44. package/reference/claude-config/sync-notes/2026-06-26-leadgen-overview-om-telemetry.md +47 -0
  45. package/reference/claude-config/sync-notes/2026-07-21-agent-scaffold-hardening.md +75 -0
  46. package/reference/rules/active-change-index.md +5 -5
  47. package/reference/rules/agent-start-here.md +34 -30
  48. package/reference/rules/deployment.md +21 -8
  49. package/reference/rules/frontend.md +4 -4
  50. package/reference/rules/observability.md +1 -1
  51. package/reference/rules/organization-model.md +1 -1
  52. package/reference/rules/organization-os.md +29 -29
  53. package/reference/rules/ui.md +205 -202
  54. package/reference/rules/vibe.md +5 -4
  55. package/reference/scaffold/operations/propagation-pipeline.md +1 -1
  56. package/reference/scaffold/recipes/extend-lead-gen.md +505 -332
  57. package/reference/scaffold/reference/contracts.md +14 -21
@@ -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,46 @@
1
+ # Session Chat Zero-Wiring Default Slot
2
+
3
+ ## Why this note exists
4
+
5
+ `@elevasis/ui` (>= 2.56.0) makes `SessionChatPage`'s `renderConversationView` slot
6
+ optional and self-defaulting: when omitted, the page renders the shared
7
+ `SessionConversationView` itself, resolving `apiUrl` from the service context
8
+ (now exposed on `ElevasisServiceContextValue`). The template `SessionChatPage`
9
+ now mounts the shared page with NO slot, and the orphan null-stub
10
+ `ui/src/features/assistant/components/ConversationView.tsx` is deleted. Projects
11
+ that omit the slot get a working session chat out of the box; customization stays
12
+ opt-in via the same prop. Backward-compatible: hosts that still pass the slot are
13
+ unaffected.
14
+
15
+ ## Applies to
16
+
17
+ - All template-derived projects with the agent-sessions page
18
+ (`ui/src/features/operations/sessions/SessionChatPage.tsx`).
19
+ - Any project still wiring a local `ConversationView` stub
20
+ (`ui/src/features/assistant/components/ConversationView.tsx`) -> these render
21
+ a blank chat with a stuck `DISCONNECTED` badge until reconciled.
22
+
23
+ ## Required actions
24
+
25
+ - Bump `@elevasis/ui` to `^2.56.0` (or later) and install. (The ship train's
26
+ `external-sync` stage does this automatically via the package-cascade baseline;
27
+ manual `pnpm update` is not required.)
28
+ - Drop the explicit `renderConversationView={...}` slot from your
29
+ `SessionChatPage.tsx` and remove the local stub import, relying on the new
30
+ default. (To keep a custom body, keep passing the slot.)
31
+ - Delete the now-unused local null-stub
32
+ `ui/src/features/assistant/components/ConversationView.tsx`.
33
+
34
+ ## Verification
35
+
36
+ - `pnpm -C ui check-types` passes against `@elevasis/ui@^2.56.0`.
37
+ - The session-detail chat page (`/operations/sessions/$sessionId`) renders
38
+ history + live messages and the `DISCONNECTED` badge clears, with NO slot wired.
39
+
40
+ ## Not handled by /git-sync
41
+
42
+ - `/git-sync` surfaces this note and pulls the template `SessionChatPage`
43
+ baseline, but the diverged tenant copy is preserved (merge-managed) -- you must
44
+ manually drop the explicit slot.
45
+ - `/git-sync` does NOT delete the local `ConversationView` stub
46
+ (`delete_policy: none`); remove it manually.
@@ -0,0 +1,34 @@
1
+ # Agent session UX features (End Conversation, intake form, session naming)
2
+
3
+ ## Why this note exists
4
+
5
+ This train bumps `@elevasis/core` and `@elevasis/ui` with three tenant-facing agent-session features that ship entirely inside the published packages (no template source edit, package-cascade-only):
6
+
7
+ - **End Conversation** (`@elevasis/ui`) — both the internal Agent Sessions surface (`features/operations/sessions/SessionDetailsPanel`) and the public agent-chat surface (`features/public-agent-chat/PublicAgentChat`) now render an "End conversation" control. Ending preserves history and blocks new turns (distinct from Delete, which removes). The public composer locks out after end with a "This conversation has ended" placeholder.
8
+ - **Welcome intake form** (`@elevasis/ui` + `@elevasis/core`) — the public chat intro screen renders an optional intake form driven by the grant's `capture_fields` column (now typed as `CaptureField[]` in `@elevasis/core`'s public-agent-chat schema). Collected values flow into `session.metadata`. All fields are optional.
9
+ - **Session naming from intake** (`@elevasis/ui` + platform API) — sessions are titled from the collected `name` (server-side, with a first-user-message fallback), and the Agent Sessions list now renders `session.title` as the row label.
10
+
11
+ The session `session:end` / `session:ended` WebSocket messages, the internal `POST /sessions/:id/end` route, and server-side title derivation live in the Elevasis-deployed platform API — tenants receive that behavior automatically; the package bump only delivers the frontend.
12
+
13
+ ## Applies to
14
+
15
+ - All template-derived projects that expose the Agent Sessions page (`ui/src/features/operations/sessions/`) or the public agent-chat surface (`ui/src/features/public-agent-chat/`).
16
+ - Projects that configure public agent grants and want to collect intake fields (Name plus arbitrary configurable fields) on the public intro screen.
17
+
18
+ ## Required actions
19
+
20
+ - Bump `@elevasis/core` to `^0.52.0` and `@elevasis/ui` to `^2.59.0` (or later) and install. The ship train's `external-sync` stage does this automatically via the package-cascade baselines — manual `pnpm update` is not required.
21
+ - No source changes are required to receive End Conversation, the intake form, or title-in-list — they ship inside `@elevasis/ui` / `@elevasis/core`.
22
+ - To enable an intake form on a public agent, populate the grant's `capture_fields` (array of `{ key, label, type?, required? }`). There is no Command Center editor for `capture_fields` yet — configure it via a grant write. Leaving `capture_fields` empty renders the intro exactly as before (no form).
23
+
24
+ ## Verification
25
+
26
+ - `pnpm -C ui check-types` passes against `@elevasis/ui@^2.59.0`.
27
+ - Open the public agent chat for a grant with `capture_fields` set → the intro renders the configured fields; entering a name and starting the session titles the session by that name in the Agent Sessions list.
28
+ - With no `capture_fields` → the intro renders unchanged; the session is titled from the first user message.
29
+ - Click "End conversation" on either the public header or the internal session detail panel → the session ends, history is preserved, and a new turn is rejected ("Session has ended").
30
+
31
+ ## Not handled by /git-sync
32
+
33
+ - `/git-sync` surfaces this note and pulls the propagated package baselines, but it does not run the `@elevasis/core` / `@elevasis/ui` install for you when reconciling manually outside the ship train.
34
+ - The intake/title and End features depend on the Elevasis-deployed platform API (`session:end` handling, `/sessions/:id/end`, server-side title derivation). They are not part of a tenant's own backend and require no tenant action — but they only work once the platform API carrying them is deployed.
@@ -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.
@@ -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
@@ -51,7 +51,7 @@ governance metadata belong in the id-keyed `resources` map; operations code deri
51
51
  Author system-local semantics by boundary:
52
52
 
53
53
  - `System.ontology` owns durable object types, action types, catalog types, link types, event types, and surfaces.
54
- - `System.apiInterface` is an adopt-only marker for platform-provided API capabilities. Use only cataloged profiles from `node_modules/@elevasis/sdk/reference/scaffold/reference/system-interface-capabilities.md`, on their convention-locked System paths, and satisfy readiness through ontology/resources/catalogs/topology. Custom Systems do not declare `apiInterface`; route custom behavior through workflows/operations and the OM layers tenants own.
54
+ - `System.apiInterface` is an adopt-only marker for platform-provided API capabilities. Use only cataloged profiles from `operations/node_modules/@elevasis/sdk/reference/scaffold/reference/system-interface-capabilities.md`, on their convention-locked System paths, and satisfy readiness through ontology/resources/catalogs/topology. Custom Systems do not declare `apiInterface`; route custom behavior through workflows/operations and the OM layers tenants own.
55
55
  - `System.config` owns system-local JSON settings and defaults.
56
56
  - `resources` own executable workflow/agent descriptors, `systemPath`, owners, governance status, code references, and runtime implementation links.
57
57
  - `resource.ontology.actions` describes the ontology actions a Resource performs; `resource.ontology.primaryAction` names the default/selectable action when a Resource has one.