@elevasis/sdk 1.6.0 → 1.8.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 (53) hide show
  1. package/dist/cli.cjs +527 -4564
  2. package/dist/index.d.ts +72 -16
  3. package/package.json +2 -2
  4. package/reference/claude-config/hooks/post-edit-validate.mjs +0 -11
  5. package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +188 -0
  6. package/reference/claude-config/logs/pre-edit-vibe-gate.log +40 -0
  7. package/reference/claude-config/logs/scaffold-registry-reminder.log +17 -0
  8. package/reference/claude-config/rules/active-change-index.md +80 -0
  9. package/reference/claude-config/rules/agent-start-here.md +254 -0
  10. package/reference/claude-config/rules/deployment.md +0 -1
  11. package/reference/claude-config/rules/observability.md +2 -2
  12. package/reference/claude-config/rules/operations.md +64 -0
  13. package/reference/claude-config/rules/organization-model.md +44 -0
  14. package/reference/claude-config/rules/organization-os.md +56 -11
  15. package/reference/claude-config/rules/task-tracking.md +4 -4
  16. package/reference/claude-config/rules/ui.md +202 -0
  17. package/reference/claude-config/rules/vibe.md +202 -0
  18. package/reference/claude-config/settings.json +4 -0
  19. package/reference/claude-config/skills/configure/SKILL.md +98 -0
  20. package/reference/claude-config/skills/configure/operations/codify-level-a.md +100 -0
  21. package/reference/claude-config/skills/configure/operations/codify-level-b.md +158 -0
  22. package/reference/claude-config/skills/configure/operations/customers.md +150 -0
  23. package/reference/claude-config/skills/configure/operations/features.md +161 -0
  24. package/reference/claude-config/skills/configure/operations/goals.md +147 -0
  25. package/reference/claude-config/skills/configure/operations/identity.md +133 -0
  26. package/reference/claude-config/skills/configure/operations/labels.md +128 -0
  27. package/reference/claude-config/skills/configure/operations/offerings.md +159 -0
  28. package/reference/claude-config/skills/configure/operations/roles.md +153 -0
  29. package/reference/claude-config/skills/configure/operations/techStack.md +139 -0
  30. package/reference/claude-config/skills/deploy/SKILL.md +3 -13
  31. package/reference/claude-config/skills/dsp/SKILL.md +2 -2
  32. package/reference/claude-config/skills/elevasis/SKILL.md +0 -4
  33. package/reference/claude-config/skills/explore/SKILL.md +5 -5
  34. package/reference/claude-config/skills/project/SKILL.md +1 -1
  35. package/reference/claude-config/skills/save/SKILL.md +5 -19
  36. package/reference/claude-config/skills/setup/SKILL.md +105 -40
  37. package/reference/claude-config/skills/status/SKILL.md +2 -3
  38. package/reference/claude-config/skills/submit-request/SKILL.md +1 -1
  39. package/reference/deployment/command-center.mdx +0 -17
  40. package/reference/framework/project-structure.mdx +1 -5
  41. package/reference/packages/core/src/organization-model/README.md +16 -12
  42. package/reference/packages/ui/src/hooks/README.md +1 -2
  43. package/reference/scaffold/core/organization-graph.mdx +1 -0
  44. package/reference/scaffold/core/organization-model.mdx +84 -19
  45. package/reference/scaffold/operations/propagation-pipeline.md +10 -11
  46. package/reference/scaffold/operations/scaffold-maintenance.md +1 -4
  47. package/reference/scaffold/recipes/add-a-feature.md +1 -1
  48. package/reference/scaffold/recipes/add-a-resource.md +3 -12
  49. package/reference/scaffold/recipes/customize-organization-model.md +5 -5
  50. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +3 -3
  51. package/reference/scaffold/reference/contracts.md +115 -7
  52. package/reference/scaffold/reference/glossary.md +25 -4
  53. package/reference/claude-config/rules/docs.md +0 -26
@@ -0,0 +1,158 @@
1
+ # Codify Pipeline: Level B (New Extension TypeScript Files)
2
+
3
+ Level B is the codify pipeline for changes that require creating a new TypeScript file under
4
+ `foundations/config/extensions/`. This pipeline is used when the user wants to add a custom
5
+ feature, a custom entity type, or any structural addition that cannot be expressed as a simple
6
+ field override in `foundations/config/organization-model.ts`.
7
+
8
+ Level B is **only offered when the user explicitly asks** for something that requires a new file.
9
+ Never silently escalate from Level A to Level B. If Level A is sufficient, use it.
10
+
11
+ ---
12
+
13
+ ## When Level B applies
14
+
15
+ - Adding a custom feature that does not exist in the platform defaults (new `FeatureSchema` entry
16
+ with a custom ID, manifest wiring, and route references)
17
+ - Adding a custom entity extension (new Zod schema extending a base entity type)
18
+ - Any structural addition the caller's domain operation has determined cannot be expressed as a
19
+ field value in the existing adapter
20
+
21
+ The calling operation (e.g. `features.md`) is responsible for deciding when Level B is needed
22
+ and for confirming the intent with the user before invoking this pipeline.
23
+
24
+ ---
25
+
26
+ ## Pipeline
27
+
28
+ ### Step 1: Snapshot all files that will be touched
29
+
30
+ Before any write, read and snapshot:
31
+
32
+ 1. `foundations/config/organization-model.ts` (always touched for wiring)
33
+ 2. The target extension file path (if it already exists -- confirm overwrite with user)
34
+
35
+ ```
36
+ Read("foundations/config/organization-model.ts") -- store as ROLLBACK_ADAPTER
37
+ Read("foundations/config/extensions/{target}.ts") -- store as ROLLBACK_EXTENSION (if exists)
38
+ ```
39
+
40
+ The target extension file path follows the naming convention:
41
+ `foundations/config/extensions/{kebab-case-feature-id}.ts`
42
+
43
+ ### Step 2: Scaffold the extension file
44
+
45
+ Create `foundations/config/extensions/{id}.ts` using the Write tool.
46
+
47
+ The file shape depends on the extension type:
48
+
49
+ **Custom feature (most common Level B case):**
50
+
51
+ ```typescript
52
+ /**
53
+ * {Feature label} feature extension.
54
+ * Registered in foundations/config/organization-model.ts.
55
+ */
56
+ import type { OrganizationModelFeature } from '@elevasis/core/organization-model'
57
+
58
+ export const {FEATURE_CONST}: OrganizationModelFeature = {
59
+ id: '{feature-id}',
60
+ label: '{Feature Label}',
61
+ description: '{optional description}',
62
+ enabled: true,
63
+ entityIds: [],
64
+ surfaceIds: [],
65
+ resourceIds: [],
66
+ capabilityIds: [],
67
+ }
68
+ ```
69
+
70
+ Replace `{FEATURE_CONST}` with the SCREAMING_SNAKE_CASE version of the feature ID
71
+ (e.g. `CLIENT_PORTAL_FEATURE`).
72
+
73
+ The caller provides the exact field values based on what the user confirmed.
74
+
75
+ ### Step 3: Wire the extension into the adapter
76
+
77
+ Edit `foundations/config/organization-model.ts` to:
78
+
79
+ 1. Import the new constant from the extension file.
80
+ 2. Add it to the `features` array in the `defineOrganizationModel({...})` call.
81
+
82
+ Example import addition:
83
+
84
+ ```typescript
85
+ import { CLIENT_PORTAL_FEATURE } from './extensions/client-portal'
86
+ ```
87
+
88
+ Example features array addition:
89
+
90
+ ```typescript
91
+ features: [
92
+ ...existingFeatures,
93
+ CLIENT_PORTAL_FEATURE,
94
+ ],
95
+ ```
96
+
97
+ ### Step 4: TypeScript type-check
98
+
99
+ ```bash
100
+ pnpm -C operations check-types
101
+ ```
102
+
103
+ Capture stdout and stderr. If the command exits non-zero, proceed to Step 6 (rollback).
104
+
105
+ ### Step 5: Runtime schema validation
106
+
107
+ ```bash
108
+ pnpm -C operations check
109
+ ```
110
+
111
+ If either check fails, proceed to Step 6 (rollback).
112
+
113
+ ### Step 6: Rollback (on failure only)
114
+
115
+ If Step 4 or Step 5 failed:
116
+
117
+ 1. Restore `foundations/config/organization-model.ts` from ROLLBACK_ADAPTER.
118
+ 2. If the extension file did not previously exist, delete it. If it previously existed, restore
119
+ from ROLLBACK_EXTENSION.
120
+ 3. Re-run `pnpm -C operations check-types` to confirm the restore is clean. If the restore
121
+ itself fails type-check, report both the original error and the restore state to the user --
122
+ do not silently leave the project in a broken state.
123
+ 4. Return the error message to the caller.
124
+
125
+ ### Step 7: Success signal
126
+
127
+ If Steps 4 and 5 both passed, return a success signal to the caller with:
128
+
129
+ - Extension file path created
130
+ - Adapter wiring changes (import + features array entry)
131
+ - `Type-check: PASS`
132
+ - `Schema validation: PASS`
133
+
134
+ The caller formats and presents the final report to the user.
135
+
136
+ ---
137
+
138
+ ## Caller Contract
139
+
140
+ Callers must provide before invoking this pipeline:
141
+
142
+ - **Extension file path:** `foundations/config/extensions/{id}.ts`
143
+ - **Extension file content:** the full TypeScript content for the new file
144
+ - **Adapter changes:** the exact import line and features-array addition to write into the adapter
145
+ - **Confirmed:** the user has already said yes to the proposed change and explicitly requested
146
+ a new extension file
147
+
148
+ This pipeline does not ask the user any questions. All confirmation and escalation decisions
149
+ happen in the domain operation before this pipeline is invoked.
150
+
151
+ ---
152
+
153
+ ## Constraint: Extension files are Tier 3 (never synced)
154
+
155
+ Files under `foundations/config/extensions/` are Tier 3 -- project-specific, never overwritten
156
+ by `/external sync`. This means custom features and entity extensions survive template upgrades
157
+ automatically. Do not put platform-default overrides in extension files; those belong directly in
158
+ `foundations/config/organization-model.ts` (Tier 2, merge-aware).
@@ -0,0 +1,150 @@
1
+ # Configure: customers
2
+
3
+ Guides the user through reviewing and updating the `customers` domain of the organization model.
4
+
5
+ The `customers` domain describes who the organization serves — distinct buyer archetypes modeled
6
+ after the Value Proposition Canvas (BMC / VPC). Each segment captures jobs-to-be-done, pains,
7
+ gains, firmographics, and a value proposition. Agents use these segments for targeting, outreach
8
+ context, and personalization.
9
+
10
+ ## Schema reference
11
+
12
+ Source: `packages/core/src/organization-model/domains/customers.ts`
13
+
14
+ ```typescript
15
+ CustomersDomainSchema = z.object({
16
+ segments: z.array(CustomerSegmentSchema).default([])
17
+ })
18
+
19
+ CustomerSegmentSchema = z.object({
20
+ id: z.string().trim().min(1).max(100), // stable ID, e.g. "segment-smb-agencies"
21
+ name: z.string().trim().max(200).default(''), // display name
22
+ description: z.string().trim().max(2000).default(''), // who this segment is
23
+ jobsToBeDone: z.string().trim().max(2000).default(''), // the goal they hire you to accomplish
24
+ pains: z.array(z.string().trim().max(500)).default([]),
25
+ gains: z.array(z.string().trim().max(500)).default([]),
26
+ firmographics: FirmographicsSchema.default({}), // industry, companySize, region
27
+ valueProp: z.string().trim().max(2000).default('') // why your offering fits this segment
28
+ })
29
+
30
+ FirmographicsSchema = z.object({
31
+ industry: z.string().trim().max(200).optional(), // e.g. "Marketing Agency"
32
+ companySize: z.string().trim().max(100).optional(), // e.g. "11–50"
33
+ region: z.string().trim().max(200).optional() // e.g. "North America"
34
+ })
35
+ ```
36
+
37
+ Where this lands in the adapter: `foundations/config/organization-model.ts` under the `customers`
38
+ key of `defineOrganizationModel({...})`.
39
+
40
+ ---
41
+
42
+ ## Process
43
+
44
+ ### Step 1: Read current state
45
+
46
+ Read `foundations/config/organization-model.ts` and extract the current `customers.segments` array.
47
+ Present it as a summary table:
48
+
49
+ ```
50
+ Current customer segments (N):
51
+ 1. {name} ({id}) — {description truncated to 80 chars}
52
+ 2. ...
53
+ (none defined yet)
54
+ ```
55
+
56
+ ### Step 2: Establish intent
57
+
58
+ Ask whether the user wants to:
59
+
60
+ - **Add** a new segment
61
+ - **Edit** an existing segment (by name or number)
62
+ - **Remove** a segment
63
+ - **Review all** segments in detail
64
+
65
+ Handle one segment at a time unless the user explicitly asks to work on multiple at once.
66
+
67
+ ### Step 3: Gather segment details
68
+
69
+ For each segment being added or edited, work through the fields conversationally:
70
+
71
+ **Core identity:**
72
+
73
+ - "What's a good name for this segment? (e.g. 'SMB Marketing Agencies', 'Enterprise SaaS Companies')"
74
+ - "Give it a stable ID I'll use as a key — lowercase with hyphens, like `segment-smb-agencies`."
75
+ - "How would you describe who this segment is in one or two sentences?"
76
+
77
+ **Jobs-to-be-done:**
78
+
79
+ - "What is the main job this segment is trying to get done? The goal they hire you to accomplish —
80
+ describe it in their terms, not yours."
81
+
82
+ **Pains and gains:**
83
+
84
+ - "What are two or three frustrations or obstacles this segment runs into when trying to get that
85
+ job done?"
86
+ - "What outcomes or benefits are they hoping for — beyond just fixing the pain?"
87
+
88
+ **Firmographics (optional):**
89
+
90
+ - "Do you want to capture firmographic filters for targeting? Things like industry vertical,
91
+ typical company size, and geographic region."
92
+
93
+ **Value proposition:**
94
+
95
+ - "How does your organization's offering uniquely address this segment's needs? One or two sentences."
96
+
97
+ If a field already has a value, show it and ask "Keep this or update it?"
98
+
99
+ ### Step 4: Confirm before writing
100
+
101
+ Present a diff for the affected segment(s):
102
+
103
+ ```
104
+ Proposed customers change:
105
+
106
+ ADD segment "SMB Marketing Agencies" (segment-smb-agencies):
107
+ name: "SMB Marketing Agencies"
108
+ description: "Owner-operated agencies with 1–15 employees running campaign delivery for SMB clients."
109
+ jobsToBeDone: "Deliver consistent client results without adding headcount."
110
+ pains: ["Manual campaign QA", "Client reporting takes hours", "Hard to scale without hiring"]
111
+ gains: ["More client capacity without more staff", "Predictable delivery timelines"]
112
+ firmographics: { industry: "Marketing Agency", companySize: "1–15", region: "North America" }
113
+ valueProp: "Automates the repetitive delivery and reporting work so agencies can take on more clients."
114
+
115
+ Apply? (yes/no)
116
+ ```
117
+
118
+ For edits to existing segments, show only the fields that changed.
119
+
120
+ ### Step 5: Codify
121
+
122
+ Execute `.claude/skills/configure/operations/codify-level-a.md` with the proposed `customers`
123
+ block. Only the `segments` array is written — no other keys in the adapter are touched.
124
+
125
+ When adding a segment, append to the array. When editing, replace the matching entry by `id`.
126
+ When removing, filter it out.
127
+
128
+ Cross-reference note: if `offerings.products[].targetSegmentIds` references a segment being
129
+ removed, surface a warning and ask the user whether to clean up those references before writing.
130
+
131
+ ### Step 6: Report
132
+
133
+ After successful validation:
134
+
135
+ ```
136
+ Customers updated.
137
+ Segments: {total count} ({N added / N edited / N removed})
138
+ foundations/config/organization-model.ts — customers.segments updated
139
+ Type-check: PASS
140
+ Schema validation: PASS
141
+ ```
142
+
143
+ If validation failed and rollback occurred:
144
+
145
+ ```
146
+ Customers update rolled back.
147
+ Reason: {error message}
148
+ foundations/config/organization-model.ts — restored to previous state
149
+ No changes persisted.
150
+ ```
@@ -0,0 +1,161 @@
1
+ # Configure: features
2
+
3
+ Guides the user through enabling, disabling, or adding features in the organization model.
4
+
5
+ Features are the top-level capability switches in the platform. Enabling a feature makes its nav
6
+ items and routes visible; disabling hides them without removing the feature from the model. Adding
7
+ a new feature may require only a config edit (Level A) or a new extension TypeScript file
8
+ (Level B), depending on whether the feature already exists in the platform defaults.
9
+
10
+ This operation handles both toggling existing features and introducing custom features.
11
+
12
+ ## Background: Level A vs Level B
13
+
14
+ - **Level A (config-only edit):** The feature exists in the platform defaults
15
+ (`packages/core/src/organization-model/defaults.ts`). The adapter in
16
+ `foundations/config/organization-model.ts` overrides its `enabled` flag or adjusts metadata.
17
+ No new TypeScript files needed.
18
+
19
+ - **Level B (new extension file):** The feature does not exist in platform defaults. A new
20
+ feature ID and manifest need to be declared. This requires a new TypeScript file under
21
+ `foundations/config/extensions/` plus wiring it into the adapter. Level B is only offered when
22
+ the user explicitly asks to create a custom feature.
23
+
24
+ ## Schema reference
25
+
26
+ Source: `packages/core/src/organization-model/domains/features.ts`
27
+
28
+ ```typescript
29
+ FeatureSchema = z.object({
30
+ id: ModelIdSchema, // lowercase, e.g. "crm", "lead-gen", "seo"
31
+ label: LabelSchema, // display label
32
+ description: DescriptionSchema.optional(),
33
+ enabled: z.boolean().default(true),
34
+ color: ColorTokenSchema.optional(),
35
+ icon: IconNameSchema.optional(),
36
+ entityIds: ReferenceIdsSchema,
37
+ surfaceIds: ReferenceIdsSchema,
38
+ resourceIds: ReferenceIdsSchema,
39
+ capabilityIds: ReferenceIdsSchema
40
+ })
41
+ ```
42
+
43
+ Platform default feature IDs (from `packages/core/src/organization-model/contracts.ts`):
44
+ `crm`, `lead-gen`, `projects`, `operations`, `monitoring`, `settings`, `seo`
45
+
46
+ Where this lands in the adapter: `foundations/config/organization-model.ts` under the `features`
47
+ array of `defineOrganizationModel({...})`. The `features` array replaces entirely (no element
48
+ merge), so the adapter must redeclare all features it wants to override.
49
+
50
+ ---
51
+
52
+ ## Process
53
+
54
+ ### Step 1: Read current state
55
+
56
+ Read `foundations/config/organization-model.ts` and extract the current `features` array from the
57
+ adapter. Also read `packages/core/src/organization-model/defaults.ts` to see what the platform
58
+ defaults look like.
59
+
60
+ Present a combined view:
61
+
62
+ ```
63
+ Platform features (current state):
64
+ crm [enabled] -- CRM (adapter override or platform default)
65
+ lead-gen [enabled] -- Lead Generation
66
+ projects [enabled] -- Projects
67
+ operations [enabled] -- Operations
68
+ monitoring [enabled] -- Monitoring
69
+ settings [enabled] -- Settings
70
+ seo [disabled] -- SEO (disabled in platform default)
71
+
72
+ Custom features (adapter-only):
73
+ (none)
74
+ ```
75
+
76
+ ### Step 2: Establish intent
77
+
78
+ Ask what the user wants to do:
79
+
80
+ - **Enable** a disabled feature
81
+ - **Disable** an enabled feature
82
+ - **Add a custom feature** (Level B -- will ask for explicit confirmation)
83
+ - **Edit metadata** on an existing feature (label, color, icon)
84
+
85
+ For enable/disable: this is Level A. For custom add: escalate to Level B branch.
86
+
87
+ ### Step 3a: Level A -- Enable or disable
88
+
89
+ For an enable or disable request:
90
+
91
+ - Identify the target feature by name or ID.
92
+ - Read the current `enabled` value.
93
+ - Confirm the proposed change:
94
+
95
+ ```
96
+ Proposed feature change:
97
+
98
+ DISABLE feature "SEO" (seo):
99
+ enabled: true -> false
100
+
101
+ This will hide the SEO nav item and gate its routes.
102
+ Apply? (yes/no)
103
+ ```
104
+
105
+ After confirmation, execute `.claude/skills/configure/operations/codify-level-a.md`.
106
+
107
+ The write either adds or updates the matching entry in the `features` array of the adapter.
108
+ Because the array replaces entirely, verify that the adapter redeclares all features that should
109
+ remain in their current state.
110
+
111
+ ### Step 3b: Level B -- Add a custom feature
112
+
113
+ Only proceed here when the user explicitly asks to add a new custom feature that does not exist in
114
+ the platform defaults.
115
+
116
+ State clearly: "Adding a custom feature creates a new TypeScript extension file in
117
+ `foundations/config/extensions/`. This is a bigger change than a config toggle. Want to proceed?"
118
+
119
+ If yes, gather:
120
+
121
+ - "What should the feature ID be? Lowercase, hyphens only (e.g. `client-portal`)."
122
+ - "What's the display label? (e.g. 'Client Portal')"
123
+ - "Optional: a short description of what this feature represents."
124
+ - "Which surfaces, entities, or resources does this feature relate to? (IDs -- leave blank to add
125
+ later)"
126
+
127
+ Then execute `.claude/skills/configure/operations/codify-level-b.md` to scaffold the extension
128
+ file and wire it into the adapter.
129
+
130
+ ### Step 4: Validation
131
+
132
+ All changes -- Level A and Level B -- must pass:
133
+
134
+ 1. `pnpm -C operations check-types`
135
+ 2. `resolveOrganizationModel()` and `OrganizationModelSchema.parse()` succeed on the merged result
136
+
137
+ On failure, roll back and report. See `codify-level-a.md` and `codify-level-b.md` for the
138
+ rollback procedure.
139
+
140
+ ### Step 5: Report
141
+
142
+ After successful validation:
143
+
144
+ ```
145
+ Features updated.
146
+ {feature label} ({id}): {old enabled} -> {new enabled} (Level A)
147
+ Custom feature "{label}" ({id}): added (Level B, if applicable)
148
+ foundations/config/organization-model.ts -- features array updated
149
+ foundations/config/extensions/{id}.ts -- created (Level B only)
150
+ Type-check: PASS
151
+ Schema validation: PASS
152
+ ```
153
+
154
+ If validation failed and rollback occurred:
155
+
156
+ ```
157
+ Features update rolled back.
158
+ Reason: {error message}
159
+ All files restored to previous state.
160
+ No changes persisted.
161
+ ```
@@ -0,0 +1,147 @@
1
+ # Configure: goals
2
+
3
+ Guides the user through reviewing and updating the `goals` domain of the organization model.
4
+
5
+ The `goals` domain captures what the organization is working toward — time-bounded goals with
6
+ measurable outcomes. The schema shape is OKR-inspired (objectives + key results) but all
7
+ user-facing language must say "goals" and "measurable outcomes". Never say "OKR", "objective",
8
+ or "key result" to the user.
9
+
10
+ Agents use this domain for quarterly planning, priority routing, and understanding which outcomes
11
+ matter most right now.
12
+
13
+ ## Schema reference
14
+
15
+ Source: `packages/core/src/organization-model/domains/goals.ts`
16
+
17
+ ```typescript
18
+ GoalsDomainSchema = z.object({
19
+ objectives: z.array(ObjectiveSchema).default([])
20
+ })
21
+
22
+ ObjectiveSchema = z.object({
23
+ id: z.string().trim().min(1).max(100), // stable ID, e.g. "goal-grow-arr-q1-2026"
24
+ description: z.string().trim().min(1).max(1000), // plain-language goal statement
25
+ periodStart: z.string().regex(ISO_DATE), // YYYY-MM-DD — must be before periodEnd
26
+ periodEnd: z.string().regex(ISO_DATE), // YYYY-MM-DD — enforced in superRefine
27
+ keyResults: z.array(KeyResultSchema).default([]) // measurable outcomes under this goal
28
+ })
29
+
30
+ KeyResultSchema = z.object({
31
+ id: z.string().trim().min(1).max(100), // e.g. "kr-revenue-q1"
32
+ description: z.string().trim().min(1).max(500), // e.g. "Increase trial-to-paid conversion"
33
+ targetMetric: z.string().trim().min(1).max(200), // what is being measured, e.g. "monthly revenue"
34
+ currentValue: z.number().default(0), // current tracked value
35
+ targetValue: z.number().optional() // target to hit (omit if directional)
36
+ })
37
+ ```
38
+
39
+ Cross-reference constraint: `periodEnd` must be strictly after `periodStart`. Enforced at parse
40
+ time by `OrganizationModelSchema.superRefine()`.
41
+
42
+ The field name in the schema is `objectives` (not `goals`) and the measurable-outcome array is
43
+ `keyResults` (not `outcomes`) — these are internal field names, not user-facing vocabulary.
44
+
45
+ Where this lands in the adapter: `foundations/config/organization-model.ts` under the `goals`
46
+ key of `defineOrganizationModel({...})`.
47
+
48
+ ---
49
+
50
+ ## Process
51
+
52
+ ### Step 1: Read current state
53
+
54
+ Read `foundations/config/organization-model.ts` and extract the current `goals.objectives` array.
55
+ Present as a plain-language summary:
56
+
57
+ ```
58
+ Current goals (N):
59
+ 1. "{description truncated to 80 chars}" ({id})
60
+ Period: {periodStart} → {periodEnd}
61
+ Measurable outcomes: {count}
62
+ (no goals defined yet)
63
+ ```
64
+
65
+ ### Step 2: Establish intent
66
+
67
+ Ask whether the user wants to:
68
+
69
+ - **Add** a new goal
70
+ - **Edit** an existing goal (by description or number)
71
+ - **Remove** a goal
72
+ - **Update progress** on a measurable outcome (update `currentValue`)
73
+
74
+ ### Step 3: Gather goal details
75
+
76
+ For each goal being added or edited:
77
+
78
+ **Core goal:**
79
+
80
+ - "What is the organization working toward? Describe the goal in plain language — one or two sentences."
81
+ - "Give it a stable ID — lowercase with hyphens, e.g. `goal-grow-arr-q1-2026`."
82
+ - "What period does this goal cover? (Start date and end date — e.g. 2026-01-01 to 2026-03-31)"
83
+
84
+ Validate that the end date is strictly after the start date before proceeding.
85
+
86
+ **Measurable outcomes (optional but recommended):**
87
+
88
+ - "Do you want to add any measurable outcomes under this goal? These help track whether you're
89
+ on track."
90
+ - For each outcome: "What are you measuring? (e.g. monthly revenue, NPS score, trial-to-paid
91
+ conversion rate)"
92
+ - "What's the target value? (Optional — leave blank if the outcome is directional.)"
93
+ - "What's the current value?"
94
+ - "Give this outcome an ID — e.g. `kr-revenue-q1`."
95
+
96
+ Capture as many outcomes as the user wants. One at a time is fine.
97
+
98
+ ### Step 4: Confirm before writing
99
+
100
+ Present a diff:
101
+
102
+ ```
103
+ Proposed goals change:
104
+
105
+ ADD goal "Reach $50K MRR by end of Q1 2026" (goal-arr-q1-2026):
106
+ period: 2026-01-01 → 2026-03-31
107
+ outcomes:
108
+ kr-mrr-q1: "Grow monthly recurring revenue"
109
+ metric: "monthly recurring revenue (MRR)"
110
+ current: 32000
111
+ target: 50000
112
+ kr-churn-q1: "Reduce churn rate"
113
+ metric: "monthly churn rate (%)"
114
+ current: 4.2
115
+ target: 2.5
116
+
117
+ Apply? (yes/no)
118
+ ```
119
+
120
+ ### Step 5: Codify
121
+
122
+ Execute `.claude/skills/configure/operations/codify-level-a.md` with the proposed `goals` block.
123
+ Only the `objectives` array is written — no other keys in the adapter are touched.
124
+
125
+ When updating progress only (updating `currentValue` on an existing outcome), make a targeted
126
+ edit rather than rewriting the entire goals block.
127
+
128
+ ### Step 6: Report
129
+
130
+ After successful validation:
131
+
132
+ ```
133
+ Goals updated.
134
+ Goals: {total count} ({N added / N edited / N removed})
135
+ foundations/config/organization-model.ts — goals.objectives updated
136
+ Type-check: PASS
137
+ Schema validation: PASS
138
+ ```
139
+
140
+ If validation failed and rollback occurred:
141
+
142
+ ```
143
+ Goals update rolled back.
144
+ Reason: {error message}
145
+ foundations/config/organization-model.ts — restored to previous state
146
+ No changes persisted.
147
+ ```