@elevasis/sdk 1.5.5 → 1.7.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 (36) hide show
  1. package/dist/cli.cjs +296 -98
  2. package/dist/index.d.ts +7 -4
  3. package/package.json +2 -2
  4. package/reference/_navigation.md +2 -1
  5. package/reference/_reference-manifest.json +16 -2
  6. package/reference/claude-config/commands/submit-request.md +11 -0
  7. package/reference/claude-config/hooks/__tests__/pre-edit-vibe-gate.test.mjs +169 -0
  8. package/reference/claude-config/hooks/pre-edit-vibe-gate.mjs +128 -0
  9. package/reference/claude-config/logs/pre-edit-vibe-gate.log +23 -0
  10. package/reference/claude-config/rules/organization-os.md +55 -8
  11. package/reference/claude-config/rules/vibe.md +210 -0
  12. package/reference/claude-config/settings.json +11 -0
  13. package/reference/claude-config/skills/configure/SKILL.md +100 -0
  14. package/reference/claude-config/skills/configure/operations/codify-level-a.md +100 -0
  15. package/reference/claude-config/skills/configure/operations/codify-level-b.md +158 -0
  16. package/reference/claude-config/skills/configure/operations/customers.md +150 -0
  17. package/reference/claude-config/skills/configure/operations/features.md +163 -0
  18. package/reference/claude-config/skills/configure/operations/goals.md +147 -0
  19. package/reference/claude-config/skills/configure/operations/identity.md +133 -0
  20. package/reference/claude-config/skills/configure/operations/labels.md +128 -0
  21. package/reference/claude-config/skills/configure/operations/offerings.md +159 -0
  22. package/reference/claude-config/skills/configure/operations/roles.md +153 -0
  23. package/reference/claude-config/skills/configure/operations/techStack.md +139 -0
  24. package/reference/claude-config/skills/project/SKILL.md +96 -39
  25. package/reference/claude-config/skills/setup/SKILL.md +81 -32
  26. package/reference/claude-config/skills/{submit-issue → submit-request}/SKILL.md +41 -26
  27. package/reference/packages/core/src/organization-model/README.md +16 -12
  28. package/reference/scaffold/core/organization-graph.mdx +1 -0
  29. package/reference/scaffold/core/organization-model.mdx +84 -19
  30. package/reference/scaffold/recipes/add-a-feature.md +1 -1
  31. package/reference/scaffold/recipes/customize-organization-model.md +5 -5
  32. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +3 -3
  33. package/reference/scaffold/reference/contracts.md +115 -7
  34. package/reference/scaffold/reference/feature-registry.md +1 -1
  35. package/reference/scaffold/reference/glossary.md +25 -4
  36. package/reference/claude-config/commands/submit-issue.md +0 -11
@@ -35,6 +35,58 @@ allowed-tools: Bash, Read, Write, Edit, Glob, Grep
35
35
  - `/project checklist <client> "<milestone>"` — View checklist for a milestone.
36
36
  - `/project delete <client>` — Delete project (cascades milestones, tasks, notes).
37
37
 
38
+ ## Prerequisites
39
+
40
+ **Run from the project root** (the directory containing `.elevasis`). Before issuing any other commands, run:
41
+
42
+ ```bash
43
+ pnpm elevasis-sdk doctor
44
+ ```
45
+
46
+ If `doctor` fails, **stop immediately and surface the error** — do not retry other commands. Fix the reported issue first (missing `.env`, bad API key, wrong directory, etc.), then re-run `doctor` before proceeding.
47
+
48
+ ---
49
+
50
+ ## Invocation Contract
51
+
52
+ All `elevasis-sdk` commands in this skill use the wrapper script form:
53
+
54
+ ```bash
55
+ pnpm elevasis-sdk <subcommand> [flags]
56
+ ```
57
+
58
+ This form is available from the **project root** — the directory that contains the `.elevasis` marker file. The `.elevasis` file is the project-root anchor: `elevasis-sdk` walks up from its invocation directory until it finds this file, then resolves `.env` and all relative paths from that location. After the project-root refactor, CWD within the project tree matters less — but you must still be somewhere inside the project directory tree.
59
+
60
+ The long form `pnpm -C operations exec elevasis-sdk <subcommand>` still works and is equivalent. Use the short wrapper form (`pnpm elevasis-sdk`) in all new automation and agent scripts.
61
+
62
+ **If the `.elevasis` marker is missing**, the CLI exits with:
63
+
64
+ ```
65
+ Not inside an Elevasis project. Run this command from a project directory (an Elevasis project has a .elevasis file at its root).
66
+ ```
67
+
68
+ If you see this error, confirm you are inside a project that was created from the template and has the `.elevasis` marker at its root.
69
+
70
+ ---
71
+
72
+ ## Transient Input Files (`tmp/`)
73
+
74
+ Agents that need to pass structured JSON to `request:submit` or `exec` should write the file to `<projectRoot>/tmp/` rather than to an arbitrary path. The `tmp/` directory is tracked in git (via `tmp/.gitkeep`) but its contents are gitignored, so transient files never pollute the commit history.
75
+
76
+ **Workflow:**
77
+
78
+ 1. Write the input payload to `tmp/<descriptive-name>.json` from the project root.
79
+ 2. Pass the path to the CLI command using the relative form — it resolves against the project root automatically:
80
+
81
+ ```bash
82
+ pnpm elevasis-sdk request:submit -f tmp/request-report.json --cleanup-input
83
+ pnpm elevasis-sdk exec my-workflow -f tmp/exec-payload.json --cleanup-input
84
+ ```
85
+
86
+ 3. The `--cleanup-input` flag deletes the file automatically after a successful command. On failure the file is left intact for inspection.
87
+
88
+ **Safety guard:** `--cleanup-input` only deletes files that are under `<projectRoot>/tmp/`. If the resolved path is outside `tmp/`, the CLI prints a warning to stderr and leaves the file untouched. Files passed via `--input <json>` (inline JSON, no file) are never affected.
89
+
38
90
  ---
39
91
 
40
92
  ## Orientation Mode (bare `/project` invocation)
@@ -43,10 +95,11 @@ When invoked without a subcommand, enter **project mode**: present the portfolio
43
95
 
44
96
  ### Flow
45
97
 
46
- 1. **List active work** — run:
98
+ 1. **List active work** — `--status` accepts exactly one value. Run two calls and merge the results:
47
99
 
48
100
  ```bash
49
- pnpm -C operations exec elevasis-sdk project:list --status active,blocked --format brief
101
+ pnpm elevasis-sdk project:list --status active --pretty
102
+ pnpm elevasis-sdk project:list --status blocked --pretty
50
103
  ```
51
104
 
52
105
  Show a compact table: client, status, last-touched.
@@ -154,13 +207,16 @@ No `--prod` flag is needed — the template targets production by default via `E
154
207
 
155
208
  ### CLI Invocation
156
209
 
157
- All project operations go through the `elevasis-sdk` CLI installed in `operations/`. Run every
158
- command from the template project root using `-C operations`:
210
+ All project operations go through the `elevasis-sdk` CLI. Use the wrapper script form from the
211
+ project root:
159
212
 
160
213
  ```bash
161
- pnpm -C operations exec elevasis-sdk project:<command> [args]
214
+ pnpm elevasis-sdk project:<command> [args]
162
215
  ```
163
216
 
217
+ The long form `pnpm -C operations exec elevasis-sdk project:<command> [args]` is equivalent and
218
+ still works — use it if the wrapper script is not yet available in an older project.
219
+
164
220
  Organization scoping is handled server-side via `ELEVASIS_PLATFORM_KEY`. No org header or
165
221
  `--org` flag is required.
166
222
 
@@ -239,7 +295,7 @@ To clear a checklist: `--checklist '[]'`.
239
295
  For a plain project table without resume context or next-action suggestions (use the bare `/project` orientation mode above when the user wants the full hub experience):
240
296
 
241
297
  ```bash
242
- pnpm -C operations exec elevasis-sdk project:list --kind client_engagement --pretty
298
+ pnpm elevasis-sdk project:list --kind client_engagement --pretty
243
299
  ```
244
300
 
245
301
  Present as:
@@ -261,7 +317,7 @@ For progress detail (milestones/tasks), follow up with `project:milestone:list`
261
317
  Wraps `project:work` for fuzzy-matched resume. Used by intent-detection "resume" classification.
262
318
 
263
319
  ```bash
264
- pnpm -C operations exec elevasis-sdk project:work <query> --pretty
320
+ pnpm elevasis-sdk project:work <query> --pretty
265
321
  ```
266
322
 
267
323
  Prints the matched project/task brief with current `resume_context`. If multiple matches, show top 3 and ask which.
@@ -274,16 +330,16 @@ If client specified, show full detail for that project. If not, show all.
274
330
 
275
331
  ```bash
276
332
  # Get project details
277
- pnpm -C operations exec elevasis-sdk project:get <project-id>
333
+ pnpm elevasis-sdk project:get <project-id>
278
334
 
279
335
  # Milestones (ordered by sequence)
280
- pnpm -C operations exec elevasis-sdk project:milestone:list --project <project-id> --pretty
336
+ pnpm elevasis-sdk project:milestone:list --project <project-id> --pretty
281
337
 
282
338
  # Tasks (grouped by milestone)
283
- pnpm -C operations exec elevasis-sdk project:task:list --project <project-id> --pretty
339
+ pnpm elevasis-sdk project:task:list --project <project-id> --pretty
284
340
 
285
341
  # Recent notes
286
- pnpm -C operations exec elevasis-sdk project:note:list --project <project-id> --pretty
342
+ pnpm elevasis-sdk project:note:list --project <project-id> --pretty
287
343
  ```
288
344
 
289
345
  Present as:
@@ -431,21 +487,21 @@ Create everything in sequence using the CLI:
431
487
 
432
488
  ```bash
433
489
  # 1. Create project
434
- pnpm -C operations exec elevasis-sdk project:create \
490
+ pnpm elevasis-sdk project:create \
435
491
  --name "<name>" \
436
492
  --kind client_engagement \
437
493
  --status active \
438
494
  --description "<desc>"
439
495
 
440
496
  # 2. Create milestones
441
- pnpm -C operations exec elevasis-sdk project:milestone:create \
497
+ pnpm elevasis-sdk project:milestone:create \
442
498
  --project <project-id> \
443
499
  --name "<milestone-name>" \
444
500
  --status upcoming \
445
501
  --due-date <date>
446
502
 
447
503
  # 3. Create kickoff note (if provided)
448
- pnpm -C operations exec elevasis-sdk project:note:create \
504
+ pnpm elevasis-sdk project:note:create \
449
505
  --project <project-id> \
450
506
  --content "<note-content>" \
451
507
  --type call_note
@@ -454,7 +510,7 @@ pnpm -C operations exec elevasis-sdk project:note:create \
454
510
  If `--company` or `--deal` linking was confirmed, use `project:update` after creation:
455
511
 
456
512
  ```bash
457
- pnpm -C operations exec elevasis-sdk project:update <project-id> --description "<updated with link info>"
513
+ pnpm elevasis-sdk project:update <project-id> --description "<updated with link info>"
458
514
  ```
459
515
 
460
516
  (Note: company/deal linking fields are set via the API. If the CLI `project:update` command
@@ -498,7 +554,7 @@ Next: /project status acme
498
554
  - `--kind <kind>` (default: `client_engagement`)
499
555
 
500
556
  ```bash
501
- pnpm -C operations exec elevasis-sdk project:create \
557
+ pnpm elevasis-sdk project:create \
502
558
  --name "<name>" \
503
559
  --kind client_engagement \
504
560
  --status active \
@@ -514,7 +570,7 @@ pnpm -C operations exec elevasis-sdk project:create \
514
570
  First resolve the client (see Client Inference below), then:
515
571
 
516
572
  ```bash
517
- pnpm -C operations exec elevasis-sdk project:update <project-id> --status <status>
573
+ pnpm elevasis-sdk project:update <project-id> --status <status>
518
574
  ```
519
575
 
520
576
  ### `milestone add <client> "<name>" [options]` — Add Milestone
@@ -526,7 +582,7 @@ pnpm -C operations exec elevasis-sdk project:update <project-id> --status <statu
526
582
  - `--description "<text>"`
527
583
 
528
584
  ```bash
529
- pnpm -C operations exec elevasis-sdk project:milestone:create \
585
+ pnpm elevasis-sdk project:milestone:create \
530
586
  --project <project-id> \
531
587
  --name "<name>" \
532
588
  --status upcoming \
@@ -540,13 +596,13 @@ Resolve milestone by name (see Client Inference for project resolution, then use
540
596
 
541
597
  ```bash
542
598
  # List milestones to find ID
543
- pnpm -C operations exec elevasis-sdk project:milestone:list --project <project-id>
599
+ pnpm elevasis-sdk project:milestone:list --project <project-id>
544
600
 
545
601
  # Update status
546
- pnpm -C operations exec elevasis-sdk project:milestone:update <milestone-id> --status completed
602
+ pnpm elevasis-sdk project:milestone:update <milestone-id> --status completed
547
603
 
548
604
  # Update checklist (full replace)
549
- pnpm -C operations exec elevasis-sdk project:milestone:update <milestone-id> \
605
+ pnpm elevasis-sdk project:milestone:update <milestone-id> \
550
606
  --checklist '[{"id":"uuid","label":"Item label","completed":false}]'
551
607
  ```
552
608
 
@@ -606,10 +662,10 @@ Onboarding & Scope — Checklist (2/3 complete)
606
662
 
607
663
  ```bash
608
664
  # Resolve milestone ID first if --milestone provided
609
- pnpm -C operations exec elevasis-sdk project:milestone:list --project <project-id>
665
+ pnpm elevasis-sdk project:milestone:list --project <project-id>
610
666
 
611
667
  # Create task
612
- pnpm -C operations exec elevasis-sdk project:task:create \
668
+ pnpm elevasis-sdk project:task:create \
613
669
  --project <project-id> \
614
670
  --title "<name>" \
615
671
  --status planned \
@@ -617,7 +673,7 @@ pnpm -C operations exec elevasis-sdk project:task:create \
617
673
  --milestone <milestone-id>
618
674
 
619
675
  # Create task with initial checklist
620
- pnpm -C operations exec elevasis-sdk project:task:create \
676
+ pnpm elevasis-sdk project:task:create \
621
677
  --project <project-id> \
622
678
  --title "<name>" \
623
679
  --checklist '[{"id":"1","label":"Step one","completed":false}]'
@@ -629,17 +685,17 @@ Resolve task by name within the project using `project:task:list`, then update b
629
685
 
630
686
  ```bash
631
687
  # Find the task ID
632
- pnpm -C operations exec elevasis-sdk project:task:list --project <project-id>
688
+ pnpm elevasis-sdk project:task:list --project <project-id>
633
689
 
634
690
  # Update status (positional <id> comes first, then flags)
635
- pnpm -C operations exec elevasis-sdk project:task:update <task-id> --status <status>
691
+ pnpm elevasis-sdk project:task:update <task-id> --status <status>
636
692
 
637
693
  # Update checklist (full replace)
638
- pnpm -C operations exec elevasis-sdk project:task:update <task-id> \
694
+ pnpm elevasis-sdk project:task:update <task-id> \
639
695
  --checklist '[{"id":"uuid","label":"Step","completed":false}]'
640
696
 
641
697
  # Clear checklist
642
- pnpm -C operations exec elevasis-sdk project:task:update <task-id> --checklist '[]'
698
+ pnpm elevasis-sdk project:task:update <task-id> --checklist '[]'
643
699
  ```
644
700
 
645
701
  **Options:** `--status`, `--title`, `--milestone`, `--description`, `--checklist <json>`
@@ -663,13 +719,13 @@ If status changes to `approved`, the API auto-sets `completed_at`.
663
719
  - `--milestone <milestone-id>` — attach to a milestone (UUID)
664
720
 
665
721
  ```bash
666
- pnpm -C operations exec elevasis-sdk project:note:create \
722
+ pnpm elevasis-sdk project:note:create \
667
723
  --project <project-id> \
668
724
  --content "<content>" \
669
725
  --type <type>
670
726
 
671
727
  # Attach to a task
672
- pnpm -C operations exec elevasis-sdk project:note:create \
728
+ pnpm elevasis-sdk project:note:create \
673
729
  --project <project-id> \
674
730
  --content "<content>" \
675
731
  --type agent_learning \
@@ -679,7 +735,7 @@ pnpm -C operations exec elevasis-sdk project:note:create \
679
735
  ### `notes <client>` — List Notes
680
736
 
681
737
  ```bash
682
- pnpm -C operations exec elevasis-sdk project:note:list --project <project-id> --pretty
738
+ pnpm elevasis-sdk project:note:list --project <project-id> --pretty
683
739
  ```
684
740
 
685
741
  ### `delete <client>` — Delete Project
@@ -688,7 +744,7 @@ pnpm -C operations exec elevasis-sdk project:note:list --project <project-id> --
688
744
  note count) using the list commands, then ask for confirmation.
689
745
 
690
746
  ```bash
691
- pnpm -C operations exec elevasis-sdk project:delete <project-id>
747
+ pnpm elevasis-sdk project:delete <project-id>
692
748
  ```
693
749
 
694
750
  Cascade deletes all milestones, tasks, and notes.
@@ -730,11 +786,12 @@ When in doubt and no project context is resolvable, global auto-memory is the sa
730
786
  Before writing a note, the agent resolves which project (and optionally task) to attach it to:
731
787
 
732
788
  1. **Explicit in session** — a project/task UUID was mentioned or returned by a recent `project:work <id>` or `project:task:*` invocation in this session. Use it directly.
733
- 2. **Implicit from task list** — if step 1 yields nothing, run:
789
+ 2. **Implicit from task list** — if step 1 yields nothing, run (`--status` accepts one value; run both calls and merge):
734
790
 
735
791
  ```bash
736
- pnpm -C operations exec elevasis-sdk project:list --status active,blocked --format brief
737
- pnpm -C operations exec elevasis-sdk project:task:list --project <top-project-id> --status in_progress
792
+ pnpm elevasis-sdk project:list --status active --pretty
793
+ pnpm elevasis-sdk project:list --status blocked --pretty
794
+ pnpm elevasis-sdk project:task:list --project <top-project-id> --status in_progress
738
795
  ```
739
796
 
740
797
  Use the most-recently-touched project's in-progress task if there is exactly one. If multiple in-progress tasks exist, prefer the one that most closely matches the current conversation topic.
@@ -754,7 +811,7 @@ When the agent recognizes a project-scoped learning (an API quirk, an undocument
754
811
  3. Write the note:
755
812
 
756
813
  ```bash
757
- pnpm -C operations exec elevasis-sdk project:note:create \
814
+ pnpm elevasis-sdk project:note:create \
758
815
  --project <project-id> \
759
816
  --type agent_learning \
760
817
  --task <task-id> \
@@ -792,7 +849,7 @@ When the user or agent says any of the following in the context of a project tas
792
849
  Resolve the active task from session context (see Project-Scope Resolution), confirm once ("Mark `<task name>` as completed?"), then fire:
793
850
 
794
851
  ```bash
795
- pnpm -C operations exec elevasis-sdk project:task:update <task-id> --status completed
852
+ pnpm elevasis-sdk project:task:update <task-id> --status completed
796
853
  ```
797
854
 
798
855
  If no task resolves, ask the user which task to complete rather than silently skipping.
@@ -817,7 +874,7 @@ Resolve which project the user means using these rules (in priority order):
817
874
  1. **Exact ID** — if the argument looks like a UUID, use it directly with `project:get`
818
875
  2. **Name match** — list projects filtered by `client_engagement` kind, then match by name:
819
876
  ```bash
820
- pnpm -C operations exec elevasis-sdk project:list --kind client_engagement
877
+ pnpm elevasis-sdk project:list --kind client_engagement
821
878
  ```
822
879
  Filter results by partial name match against the user's input (case-insensitive).
823
880
  3. **Single active project** — if only one non-completed `client_engagement` project exists,
@@ -862,7 +919,7 @@ For creating a standard milestone set, run `project:milestone:create` in sequenc
862
919
 
863
920
  ```bash
864
921
  for name in "Discovery" "Implementation" "Testing" "Launch"; do
865
- pnpm -C operations exec elevasis-sdk project:milestone:create \
922
+ pnpm elevasis-sdk project:milestone:create \
866
923
  --project <project-id> \
867
924
  --name "$name" \
868
925
  --status upcoming
@@ -1,35 +1,51 @@
1
1
  ---
2
2
  name: setup
3
- description: First-time project setup — detect and replace template placeholders, install dependencies, verify build
3
+ description: First-time project setup — detect and replace template placeholders, install dependencies, verify build, then hand off to /configure for org-model configuration
4
4
  argument-hint: ""
5
5
  ---
6
6
 
7
7
  # Setup
8
8
 
9
- First-time project setup for projects cloned directly from the template.
9
+ First-time project setup for projects cloned directly from the template. Handles placeholder replacement, dependency install, and build verification. After bootstrap, delegates org-model configuration to `/configure`.
10
10
 
11
11
  **Usage:** `/setup`
12
12
 
13
- ## Process
13
+ ---
14
14
 
15
- ### Step 1: Detect State
15
+ ## State Detection (Run Before Anything Else)
16
16
 
17
- Scan these key files for unresolved placeholders:
17
+ Before collecting any information or running any steps, determine which state the project is in. Read these files:
18
18
 
19
19
  - `package.json` — look for `__PROJECT_SLUG__` in the `name` field
20
- - `CLAUDE.md` — look for `TEMPLATE_PROJECT_NAME`
20
+ - `CLAUDE.md` — look for `TEMPLATE_PROJECT_NAME` AND check whether `{CLIENT_CONTEXT}` and `{USER_PREFERENCES}` are still literal placeholder strings
21
21
  - `ui/package.json` — look for `__PROJECT_SLUG__`
22
22
  - `ui/index.html` — look for `__PROJECT_NAME__`
23
23
 
24
- If NO placeholders are found, the project is already configured. Print:
24
+ **State A — Virgin (placeholders present):** One or more of the above placeholder strings is found. Run the full bootstrap flow (Steps 1–7 below), then hand off to `/configure`.
25
+
26
+ **State B — Already bootstrapped, org-model at defaults:** No placeholders found, but `foundations/config/organization-model.ts` contains only the default branding override (just `branding.organizationName`, `branding.productName`, `branding.shortName` — no identity, customers, offerings, roles, goals, or techStack overrides). Print:
27
+
28
+ ```
29
+ This project is already set up. The organization model has not been configured yet.
30
+ Running /configure to set up your organization profile...
31
+ ```
32
+
33
+ Then execute `/configure` (the full layered flow) and stop.
34
+
35
+ **State C — Fully configured:** No placeholders found AND `foundations/config/organization-model.ts` has at least one non-branding domain populated (identity, customers, offerings, roles, goals, or techStack present). Print:
25
36
 
26
37
  ```
27
- Project is already configured. Running verification...
38
+ This project is already configured. To update your organization profile, run /configure.
39
+ To re-verify the build, run the checks below.
28
40
  ```
29
41
 
30
- Then skip directly to Step 4 (Install) or Step 5 (Verify) as appropriate.
42
+ Offer to run the verification checks (Steps 6b–6e) if the user wants them. Do not re-ask any questions. Do not re-run placeholder replacement. Stop after verification.
43
+
44
+ ---
45
+
46
+ ## Full Bootstrap Flow (State A Only)
31
47
 
32
- ### Step 2: Collect Info
48
+ ### Step 1: Collect Project Info
33
49
 
34
50
  Ask the user for three values:
35
51
 
@@ -49,7 +65,7 @@ Configuring project with:
49
65
  Proceed? (yes/no)
50
66
  ```
51
67
 
52
- ### Step 3: Get to Know the User and Client
68
+ ### Step 2: Get to Know the User and Client
53
69
 
54
70
  Transition naturally after confirming the project values: "Now let me learn a bit about you and the client so I can be more helpful going forward."
55
71
 
@@ -86,7 +102,7 @@ Client: {company}
86
102
  Look good?
87
103
  ```
88
104
 
89
- ### Step 4: Replace Placeholders
105
+ ### Step 3: Replace Placeholders
90
106
 
91
107
  Search ALL files in the project matching these extensions: `.ts`, `.tsx`, `.js`, `.mjs`, `.json`, `.md`, `.mdx`, `.html`, `.yaml`, `.yml`, `.css`, `.env.example`
92
108
 
@@ -105,21 +121,19 @@ For each matching file, replace all occurrences of:
105
121
 
106
122
  Use the Read tool to read each file, then the Edit tool (with `replace_all: true`) or Write tool to apply the replacements. Read each file before writing.
107
123
 
108
- After all replacements, re-scan the four key files from Step 1 to verify zero placeholders remain. If any are still present, report them by file and fix immediately.
124
+ After all replacements, re-scan the four key files from State Detection to verify zero placeholders remain. If any are still present, report them by file and fix immediately.
109
125
 
110
- ### Step 5: Populate Knowledge
126
+ ### Step 4: Populate CLAUDE.md Knowledge Sections
111
127
 
112
- Knowledge is split between `CLAUDE.md` (essentials loaded every turn) and `docs/knowledge/client.md` (detailed context loaded on demand).
128
+ **Idempotency check (MANDATORY before writing):** Read `CLAUDE.md` and check whether `{CLIENT_CONTEXT}` and `{USER_PREFERENCES}` are still literal placeholder strings. Only write if they are still placeholders. If either section is already filled in (user or a previous run already populated it), skip that section entirely — do not overwrite.
113
129
 
114
- #### 5a: CLAUDE.md lightweight summary
115
-
116
- **`{CLIENT_CONTEXT}`** -- replace with a single line:
130
+ **`{CLIENT_CONTEXT}`** -- replace with a single line (only if still a placeholder):
117
131
 
118
132
  ```markdown
119
133
  **{company name}** — {what they do, one sentence}
120
134
  ```
121
135
 
122
- **`{USER_PREFERENCES}`** -- replace with a table:
136
+ **`{USER_PREFERENCES}`** -- replace with a table (only if still a placeholder):
123
137
 
124
138
  ```markdown
125
139
  | Name | Role | Technical Level | Communication |
@@ -129,9 +143,11 @@ Knowledge is split between `CLAUDE.md` (essentials loaded every turn) and `docs/
129
143
 
130
144
  If the user skipped any knowledge questions, fill in what was provided and omit what wasn't -- don't leave placeholder text behind.
131
145
 
132
- #### 5b: docs/knowledge/client.md full client context
146
+ ### Step 5: Create Client Knowledge Doc
147
+
148
+ **Idempotency check:** Check whether `docs/knowledge/client.md` already exists. If it exists and is non-empty, skip this step entirely -- do not overwrite.
133
149
 
134
- Create `docs/knowledge/client.md` with the detailed info:
150
+ If it does not exist, create `docs/knowledge/client.md`:
135
151
 
136
152
  ```markdown
137
153
  ---
@@ -150,7 +166,9 @@ description: Company background, industry, stakeholders, and business goals
150
166
  {any additional context shared -- key stakeholders, business goals, constraints, etc. If nothing was shared, write "No additional context provided yet. Update this as the project evolves."}
151
167
  ```
152
168
 
153
- ### Step 6: Install Dependencies
169
+ ### Step 6: Install and Verify
170
+
171
+ #### Step 6a: Install Dependencies
154
172
 
155
173
  ```bash
156
174
  pnpm install
@@ -158,7 +176,7 @@ pnpm install
158
176
 
159
177
  This generates the project's own `pnpm-lock.yaml`. Report success or any errors.
160
178
 
161
- ### Step 7: Verify
179
+ #### Step 6b–6e: Verify Build
162
180
 
163
181
  Run all checks sequentially (stop and report on first failure, but attempt all):
164
182
 
@@ -171,7 +189,7 @@ pnpm -C operations check-types
171
189
 
172
190
  For each check, record PASS or FAIL. If a check fails, read the output and report the error clearly. Do not silently skip failures.
173
191
 
174
- ### Step 8: Report
192
+ ### Step 7: Bootstrap Report
175
193
 
176
194
  ```
177
195
  You're all set, {name}!
@@ -185,16 +203,23 @@ Verification:
185
203
  [PASS/FAIL] Production build (ui)
186
204
  [PASS/FAIL] Resource validation (operations)
187
205
  [PASS/FAIL] Type-check (operations)
206
+ ```
207
+
208
+ If any verification step failed, add an Errors section listing each failure with its output.
209
+
210
+ ### Step 8: Hand Off to /configure
188
211
 
189
- Next steps:
190
- 1. Copy root .env.example to .env and fill in ELEVASIS_PLATFORM_KEY
191
- 2. Copy ui/.env.example to ui/.env and fill in VITE_WORKOS_CLIENT_ID
192
- 3. See TODO.md for WorkOS dashboard setup and branding
193
- 4. pnpm -C ui dev (start dev server on port 4300)
194
- 5. (If client-workspace/ exists) Open it in Claude Code and run /setup
212
+ After a successful bootstrap, transition to the org-model configuration flow. Print:
213
+
214
+ ```
215
+ Bootstrap complete. Now let's set up your organization profile.
195
216
  ```
196
217
 
197
- If any verification step failed, add an Errors section listing each failure with its output before the Next steps.
218
+ Then execute `/configure` (the full layered flow, no argument). This is where identity, customers, offerings, roles, goals, and techStack are configured. Do not attempt to collect or write org-model data here — that ceremony belongs entirely to /configure.
219
+
220
+ If the user wants to skip org-model setup for now, they can stop here and run `/configure` later.
221
+
222
+ ---
198
223
 
199
224
  ## Error Recovery
200
225
 
@@ -207,4 +232,28 @@ Remaining: <list files and placeholders>
207
232
  Action: Re-applying replacements to affected files...
208
233
  ```
209
234
 
210
- Fix each remaining occurrence before proceeding to Step 6.
235
+ Fix each remaining occurrence before proceeding to Step 6a.
236
+
237
+ ---
238
+
239
+ ## Idempotency Guarantees
240
+
241
+ Running `/setup` more than once is safe:
242
+
243
+ - **Placeholder replacement** only runs when placeholders are detected (State A). It is skipped entirely in States B and C.
244
+ - **CLAUDE.md knowledge sections** (`{CLIENT_CONTEXT}`, `{USER_PREFERENCES}`) are checked before writing. If already replaced, the write is skipped.
245
+ - **`docs/knowledge/client.md`** is only created if it does not exist. An existing file is never overwritten by `/setup`.
246
+ - **Org-model fields** (`foundations/config/organization-model.ts`) are never written by `/setup`. All org-model edits go through `/configure`, which has its own diff-preview and confirm ceremony.
247
+
248
+ ---
249
+
250
+ ## Relationship to /configure
251
+
252
+ `/setup` is a thin bootstrap wrapper. It:
253
+
254
+ 1. Replaces scaffold placeholders (project name, slug, description)
255
+ 2. Fills lightweight CLAUDE.md knowledge sections (user and client basics, idempotent)
256
+ 3. Installs dependencies and verifies the build
257
+ 4. Hands off to `/configure` for org-model configuration
258
+
259
+ `/configure` owns all structural org-model editing (identity, customers, offerings, roles, goals, techStack, features, labels). It is idempotent, confirm-before-overwrite, and includes a runtime validation gate. Re-run `/configure` any time organizational reality changes — no need to re-run `/setup`.