@elevasis/sdk 1.8.2 → 1.8.3

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 +1 -1
  2. package/dist/index.d.ts +88 -39
  3. package/dist/types/worker/adapters/lead.d.ts +1 -1
  4. package/dist/worker/index.js +2 -0
  5. package/package.json +2 -2
  6. package/reference/_navigation.md +7 -1
  7. package/reference/_reference-manifest.json +14 -0
  8. package/reference/claude-config/logs/scaffold-registry-reminder.log +3 -0
  9. package/reference/claude-config/rules/agent-start-here.md +254 -254
  10. package/reference/claude-config/rules/frontend.md +43 -43
  11. package/reference/claude-config/rules/operations.md +64 -64
  12. package/reference/claude-config/rules/organization-model.md +42 -43
  13. package/reference/claude-config/rules/organization-os.md +107 -107
  14. package/reference/claude-config/rules/shared-types.md +2 -2
  15. package/reference/claude-config/rules/task-tracking.md +1 -1
  16. package/reference/claude-config/rules/ui.md +202 -202
  17. package/reference/claude-config/rules/vibe.md +202 -202
  18. package/reference/claude-config/skills/configure/SKILL.md +98 -98
  19. package/reference/claude-config/skills/configure/operations/codify-level-a.md +100 -100
  20. package/reference/claude-config/skills/configure/operations/codify-level-b.md +158 -158
  21. package/reference/claude-config/skills/configure/operations/customers.md +150 -150
  22. package/reference/claude-config/skills/configure/operations/features.md +162 -162
  23. package/reference/claude-config/skills/configure/operations/goals.md +147 -147
  24. package/reference/claude-config/skills/configure/operations/identity.md +133 -133
  25. package/reference/claude-config/skills/configure/operations/labels.md +128 -128
  26. package/reference/claude-config/skills/configure/operations/offerings.md +159 -159
  27. package/reference/claude-config/skills/configure/operations/roles.md +153 -153
  28. package/reference/claude-config/skills/configure/operations/techStack.md +139 -139
  29. package/reference/claude-config/skills/explore/SKILL.md +78 -78
  30. package/reference/claude-config/skills/git-sync/SKILL.md +126 -0
  31. package/reference/claude-config/skills/save/SKILL.md +183 -183
  32. package/reference/claude-config/skills/setup/SKILL.md +275 -275
  33. package/reference/claude-config/skills/sync/SKILL.md +10 -44
  34. package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -0
  35. package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -0
  36. package/reference/claude-config/sync-notes/README.md +43 -0
  37. package/reference/packages/core/src/README.md +39 -36
  38. package/reference/packages/core/src/business/README.md +52 -52
  39. package/reference/packages/core/src/organization-model/README.md +97 -97
  40. package/reference/packages/core/src/test-utils/README.md +42 -0
  41. package/reference/scaffold/core/organization-graph.mdx +272 -272
  42. package/reference/scaffold/core/organization-model.mdx +320 -320
  43. package/reference/scaffold/index.mdx +64 -64
  44. package/reference/scaffold/operations/propagation-pipeline.md +125 -104
  45. package/reference/scaffold/operations/scaffold-maintenance.md +122 -122
  46. package/reference/scaffold/operations/workflow-recipes.md +436 -436
  47. package/reference/scaffold/recipes/add-a-feature.md +158 -158
  48. package/reference/scaffold/recipes/add-a-resource.md +158 -158
  49. package/reference/scaffold/recipes/customize-organization-model.md +400 -400
  50. package/reference/scaffold/recipes/extend-a-base-entity.md +140 -140
  51. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +158 -158
  52. package/reference/scaffold/recipes/index.md +32 -32
  53. package/reference/scaffold/reference/contracts.md +608 -607
  54. package/reference/scaffold/reference/feature-registry.md +2 -0
  55. package/reference/scaffold/reference/glossary.md +105 -105
  56. package/reference/scaffold/ui/composition-extensibility.mdx +1 -1
  57. package/reference/scaffold/ui/feature-flags-and-gating.md +1 -1
@@ -1,78 +1,78 @@
1
- ---
2
- name: explore
3
- description: Codebase exploration anchored to project documentation
4
- ---
5
-
6
- # Explore
7
-
8
- Codebase exploration anchored to project documentation.
9
-
10
- **Usage:** `/explore [area or question]`
11
-
12
- ## Process
13
-
14
- ### Step 0: OS-Vocab Classification
15
-
16
- Before orienting, scan the user's query for Organization OS terminology. If any of the following appear, classify the query as **OS-relevant** and follow the OS context steps below; otherwise skip to Step 1.
17
-
18
- **OS vocabulary triggers:**
19
-
20
- - Feature layer: `feature`, `features`, `FeatureModule`, `feature key`, `feature gate`, `feature access`, `gate`, `gating`, `access`, `enable`, `disable`
21
- - Shell / nav: `manifest`, `shell`, `sub-shell`, `sidebar`, `nav`, `navigation`, `route`
22
- - Auth / guards: `guard`, `FeatureGuard`, `AdminGuard`, `ProtectedRoute`, `admin`
23
- - Org model: `organization`, `org model`, `organization model`, `domain`, `surface`
24
- - Foundations: `foundation`, `foundations`, `@foundation/`, `adapter`
25
- - Platform ops: `workflow`, `agent`, `deployment`, `resource`
26
-
27
- **If OS-relevant:**
28
-
29
- 1. Read `.claude/rules/active-change-index.md` immediately. If the target area is flagged as under active refactor, surface the watch-area warning to the user before proceeding — include the "Load:" doc paths listed in that entry so investigation does not rely on stale scaffold prose.
30
- 2. Build the OS context bundle to pass into Step 3:
31
- - Always: `node_modules/@elevasis/sdk/reference/scaffold/reference/glossary.md`, `.claude/rules/active-change-index.md`, `.claude/rules/agent-start-here.md`
32
- - Features / Shell / Gating queries: add `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md` + `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
33
- - Workflow / Operations queries: add `.claude/rules/operations.md` + glob `operations/resources/**`
34
- - Organization-model queries: add `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` + `foundations/config/README.md`
35
-
36
- **OS layer → query intent map** (guides which reference docs the investigator loads first):
37
-
38
- | Query intent | Primary OS layers | Key reference |
39
- | ---------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------- |
40
- | "Why doesn't my feature show up?" | Features + UI Shell Runtime | `glossary.md` (accessFeatureKey, FEATURE_KEY_ALIASES), `feature-flags-and-gating.md` |
41
- | "How do I add a nav item?" | Features + Toolkit | `feature-flags-and-gating.md`, `contracts.md` |
42
- | "How does admin gating work?" | Features + UI Shell Runtime | `glossary.md` (AdminGuard, requiresAdmin, ProtectedRoute), `feature-flags-and-gating.md` |
43
- | "What runs when this workflow triggers?" | Platform Public API + Operations | `.claude/rules/operations.md`, `resources.md` |
44
- | "Why does the foundations adapter fail?" | Foundations | `glossary.md` (domain vs surface, settings asymmetry), `foundations/config/README.md` |
45
-
46
- ### Step 1: Orient
47
-
48
- 1. Read `.claude/rules/agent-start-here.md` for project structure, task-class routing, and boundary resolution
49
- 2. Determine which domain the user's question falls into
50
-
51
- ### Step 2: Load Domain Context
52
-
53
- Read the relevant doc(s) and source directories based on the area being explored. Use the Navigation table in `CLAUDE.md` for quick reference.
54
-
55
- For OS-relevant queries, also inject the OS context bundle assembled in Step 0 into the investigator's starting context.
56
-
57
- ### Step 3: Investigate
58
-
59
- For targeted questions:
60
-
61
- - Use Grep to search for specific patterns, function names, or strings
62
- - Use Glob to find files by pattern
63
- - Read specific files for detailed understanding
64
-
65
- For broad exploration:
66
-
67
- - Dispatch a `general-purpose` subagent with the domain context and exploration question
68
- - The subagent should read files, trace data flow, and return a structured report
69
- - For OS-relevant queries, pass the preloaded OS context bundle so the subagent starts with terminology already resolved
70
-
71
- ### Step 4: Report
72
-
73
- Present findings with:
74
-
75
- - Direct answers to the question
76
- - Relevant code locations (file:function format)
77
- - Connections to other parts of the system
78
- - Suggestions for related areas to explore (if relevant)
1
+ ---
2
+ name: explore
3
+ description: Codebase exploration anchored to project documentation
4
+ ---
5
+
6
+ # Explore
7
+
8
+ Codebase exploration anchored to project documentation.
9
+
10
+ **Usage:** `/explore [area or question]`
11
+
12
+ ## Process
13
+
14
+ ### Step 0: OS-Vocab Classification
15
+
16
+ Before orienting, scan the user's query for Organization OS terminology. If any of the following appear, classify the query as **OS-relevant** and follow the OS context steps below; otherwise skip to Step 1.
17
+
18
+ **OS vocabulary triggers:**
19
+
20
+ - Feature layer: `feature`, `features`, `FeatureModule`, `feature key`, `feature gate`, `feature access`, `gate`, `gating`, `access`, `enable`, `disable`
21
+ - Shell / nav: `manifest`, `shell`, `sub-shell`, `sidebar`, `nav`, `navigation`, `route`
22
+ - Auth / guards: `guard`, `FeatureGuard`, `AdminGuard`, `ProtectedRoute`, `admin`
23
+ - Org model: `organization`, `org model`, `organization model`, `domain`, `surface`
24
+ - Foundations: `foundation`, `foundations`, `@foundation/`, `adapter`
25
+ - Platform ops: `workflow`, `agent`, `deployment`, `resource`
26
+
27
+ **If OS-relevant:**
28
+
29
+ 1. Read `.claude/rules/active-change-index.md` immediately. If the target area is flagged as under active refactor, surface the watch-area warning to the user before proceeding — include the "Load:" doc paths listed in that entry so investigation does not rely on stale scaffold prose.
30
+ 2. Build the OS context bundle to pass into Step 3:
31
+ - Always: `node_modules/@elevasis/sdk/reference/scaffold/reference/glossary.md`, `.claude/rules/active-change-index.md`, `.claude/rules/agent-start-here.md`
32
+ - Features / Shell / Gating queries: add `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md` + `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md`
33
+ - Workflow / Operations queries: add `.claude/rules/operations.md` + glob `operations/resources/**`
34
+ - Organization-model queries: add `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` + `foundations/config/README.md`
35
+
36
+ **OS layer → query intent map** (guides which reference docs the investigator loads first):
37
+
38
+ | Query intent | Primary OS layers | Key reference |
39
+ | ---------------------------------------- | -------------------------------- | ---------------------------------------------------------------------------------------- |
40
+ | "Why doesn't my feature show up?" | Features + UI Shell Runtime | `glossary.md` (accessFeatureKey, FEATURE_KEY_ALIASES), `feature-flags-and-gating.md` |
41
+ | "How do I add a nav item?" | Features + Toolkit | `feature-flags-and-gating.md`, `contracts.md` |
42
+ | "How does admin gating work?" | Features + UI Shell Runtime | `glossary.md` (AdminGuard, requiresAdmin, ProtectedRoute), `feature-flags-and-gating.md` |
43
+ | "What runs when this workflow triggers?" | Platform Public API + Operations | `.claude/rules/operations.md`, `resources.md` |
44
+ | "Why does the foundations adapter fail?" | Foundations | `glossary.md` (domain vs surface, settings asymmetry), `foundations/config/README.md` |
45
+
46
+ ### Step 1: Orient
47
+
48
+ 1. Read `.claude/rules/agent-start-here.md` for project structure, task-class routing, and boundary resolution
49
+ 2. Determine which domain the user's question falls into
50
+
51
+ ### Step 2: Load Domain Context
52
+
53
+ Read the relevant doc(s) and source directories based on the area being explored. Use the Navigation table in `CLAUDE.md` for quick reference.
54
+
55
+ For OS-relevant queries, also inject the OS context bundle assembled in Step 0 into the investigator's starting context.
56
+
57
+ ### Step 3: Investigate
58
+
59
+ For targeted questions:
60
+
61
+ - Use Grep to search for specific patterns, function names, or strings
62
+ - Use Glob to find files by pattern
63
+ - Read specific files for detailed understanding
64
+
65
+ For broad exploration:
66
+
67
+ - Dispatch a `general-purpose` subagent with the domain context and exploration question
68
+ - The subagent should read files, trace data flow, and return a structured report
69
+ - For OS-relevant queries, pass the preloaded OS context bundle so the subagent starts with terminology already resolved
70
+
71
+ ### Step 4: Report
72
+
73
+ Present findings with:
74
+
75
+ - Direct answers to the question
76
+ - Relevant code locations (file:function format)
77
+ - Connections to other parts of the system
78
+ - Suggestions for related areas to explore (if relevant)
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: git-sync
3
+ description: Pull latest changes, surface new sync notes, install when needed, and run baseline verification without auto-reconciling template drift
4
+ ---
5
+
6
+ # Git Sync
7
+
8
+ Pull the latest upstream changes for this project, detect any newly introduced template sync notes, install dependencies when the pull changed package baselines, and run the baseline verification flow.
9
+
10
+ **Usage:** `/git-sync`
11
+
12
+ Use this when:
13
+
14
+ - you just pulled a release-train update from the template repo
15
+ - the branch may include dependency or scaffold baseline changes
16
+ - you want the current sync-note guidance before making any manual reconciliation edits
17
+
18
+ This command is intentionally narrower than template reconciliation. It stops after pull, install, verification, and note surfacing. It never auto-overwrites project-owned files.
19
+
20
+ ## Sync Notes Contract
21
+
22
+ Downstream release guidance lives in `.claude/sync-notes/`.
23
+
24
+ - Operative note files are named `YYYY-MM-DD-<slug>.md`
25
+ - `README.md` documents the contract and is ignored by note detection
26
+ - Notes are append-only release guidance; do not rewrite old note filenames after they ship
27
+ - Every operative note uses these exact headings:
28
+ - `## Why this note exists`
29
+ - `## Applies to`
30
+ - `## Required actions`
31
+ - `## Verification`
32
+ - `## Not handled by /git-sync`
33
+
34
+ ## Process
35
+
36
+ ### Step 1: Check for Uncommitted Changes
37
+
38
+ ```bash
39
+ git status --short
40
+ ```
41
+
42
+ If the worktree is dirty, stop and tell the user to commit, stash, or discard changes first. Do not pull on top of local edits.
43
+
44
+ ### Step 2: Snapshot Current Sync Notes
45
+
46
+ Capture the current operative note filenames before pulling:
47
+
48
+ ```bash
49
+ git ls-files ".claude/sync-notes/*.md"
50
+ ```
51
+
52
+ Ignore `README.md` when building the pre-pull note set.
53
+
54
+ ### Step 3: Pull Latest Changes
55
+
56
+ ```bash
57
+ git pull --rebase
58
+ ```
59
+
60
+ If the pull conflicts, stop and report the conflict. Do not attempt auto-resolution.
61
+
62
+ ### Step 4: Detect Whether Install Is Required
63
+
64
+ If the pull changed any dependency baseline files, run a fresh install:
65
+
66
+ ```bash
67
+ git diff --name-only HEAD@{1} HEAD -- package.json pnpm-lock.yaml pnpm-workspace.yaml ui/package.json operations/package.json shared/package.json
68
+ ```
69
+
70
+ If the diff is non-empty:
71
+
72
+ ```bash
73
+ pnpm install
74
+ ```
75
+
76
+ If none of those files changed, skip install and report that the dependency baseline was unchanged.
77
+
78
+ ### Step 5: Run Baseline Verification
79
+
80
+ Run the standard project verification flow:
81
+
82
+ ```bash
83
+ pnpm -C ui check-types
84
+ pnpm -C ui build
85
+ pnpm -C operations check
86
+ pnpm -C operations check-types
87
+ ```
88
+
89
+ Stop on the first failure and report it clearly.
90
+
91
+ ### Step 6: Surface Newly Introduced Sync Notes
92
+
93
+ Build the post-pull operative note set and compare it to the pre-pull set. Any newly added note filename is considered unread guidance for this pull.
94
+
95
+ When new notes exist:
96
+
97
+ - print each new note filename
98
+ - summarize the `## Required actions`, `## Verification`, and `## Not handled by /git-sync` sections
99
+ - tell the user exactly which manual follow-up remains
100
+
101
+ When no new notes exist, say so explicitly.
102
+
103
+ ### Step 7: Stop Before Reconciliation
104
+
105
+ `/git-sync` ends after pull, optional install, verification, and note surfacing.
106
+
107
+ It does **not**:
108
+
109
+ - run registry/template reconciliation
110
+ - overwrite project-owned files
111
+ - resolve downstream migration conflicts
112
+ - treat a passing baseline verify as proof that manual follow-up is complete
113
+
114
+ If a sync note or the pulled diff requires project-specific changes, leave those as an explicit next step.
115
+
116
+ ## Report
117
+
118
+ ```text
119
+ Git Sync Complete
120
+ =================
121
+ Git: pulled (<branch>)
122
+ Install: ran | skipped (no dependency baseline changes)
123
+ Verify: PASS | FAIL at <step>
124
+ Sync notes: none | 2026-04-22-example-change.md
125
+ Next step: manual reconciliation required | none
126
+ ```
@@ -1,183 +1,183 @@
1
- ---
2
- name: save
3
- description: Auto-manage project documentation and persist task resume context from conversation
4
- ---
5
-
6
- # Save
7
-
8
- Auto-manage project documentation from conversation context, and fan out conversation signals to the canonical project system (`prj_tasks.resume_context`, `prj_notes`) via the `elevasis-sdk` CLI.
9
-
10
- ## Canonical Sources of Truth
11
-
12
- - **Task resume context (DB):** `prj_tasks.resume_context` is canonical. Agents write it via `elevasis-sdk project:task:save`. Humans edit it via the inline task editor in Command Center. **Never** stash resume context into task-doc frontmatter.
13
- - **Task-doc frontmatter:** ONLY `title`, `description`, `status`. No `resume_context`, no files-modified, no next-steps arrays -- those belong in the DB.
14
- - **Project notes (DB):** `prj_notes` via `elevasis-sdk project:note:create`. Typed notes (`status_update` / `issue` / `blocker` / `call_note`) are the durable record of conversation signals.
15
-
16
- ## Process
17
-
18
- ### Step 1: Resolve Project + Task Context
19
-
20
- Before doing anything else, determine the active project / task:
21
-
22
- 1. Look for an active task-doc frontmatter in the current conversation or the most recently edited file. Expected frontmatter:
23
-
24
- ```yaml
25
- ---
26
- title: Short title
27
- description: One-line summary
28
- status: planned | in-progress | blocked | complete
29
- ---
30
- ```
31
-
32
- 2. If the task doc references a project/task UUID anywhere in its body (link, callout, or prior save output), capture those IDs.
33
- 3. If no task / project context is resolvable, PROMPT the user:
34
- - "Which project is this work under?" (accepts slug or UUID)
35
- - "Is there an existing task I should attach this to? (task UUID, or 'new')"
36
-
37
- Do not guess. Without a task ID, skip Step 4 (DB resume-context save) but still perform Steps 2, 3, 5, 6, 7.
38
-
39
- ### Step 2: Analyze Conversation
40
-
41
- Review the current conversation to identify:
42
-
43
- 1. **New knowledge** -- architecture decisions, feature implementations, bug fixes, discoveries
44
- 2. **Changed state** -- what was in-progress that is now complete, what new work started
45
- 3. **Stale docs** -- information in existing docs that is now outdated
46
- 4. **Signal events** -- blocker hit, status update worth recording, issue uncovered, call outcome
47
- 5. **OS contract paths touched** -- scan files read/written/edited for any of these signals:
48
- - `foundations/config/organization-model.ts` -> Foundations layer, Organization Model
49
- - `foundations/types/index.ts` -> Foundations layer, Workflow Contracts
50
- - `ui/src/routes/__root.tsx` -> UI Shell Runtime composition
51
- - `ui/src/features/**/manifest.ts` or any file defining a `FeatureModule` -> Features layer
52
- - `operations/src/index.ts` or `operations/elevasis.config.ts` -> Foundations/Deployment (DeploymentSpec)
53
- - Any file inside `ui/src/features/<feature>/` combined with manifest, nav, or sidebar changes -> Features + Toolkit layers
54
-
55
- Record which OS layers were touched: `foundations`, `features`, `shell-runtime`, `toolkit`, `deployment`. If none matched, OS awareness stays dormant for the rest of this run.
56
-
57
- ### Step 3: Update Knowledge Docs
58
-
59
- Scan for unindexed or stale knowledge docs and draft creates / updates / moves. This template does not have a `docs/` tree — look for any local knowledge files (`.claude/rules/`, `operations/src/README.md`, `foundations/`, or project-specific docs the user has created). All edits are on knowledge/architecture/feature docs -- NOT on task resume state (that flows to the DB in Step 4).
60
-
61
- Determine what needs to happen:
62
-
63
- - **Create** new docs for significant new knowledge (new features, architecture decisions)
64
- - **Update** existing docs with corrections, completions, or new details
65
- - **Move** docs between directories (e.g., `ui/` to `operations/` when ownership shifts)
66
- - **Delete** docs that are fully obsolete (rare -- prefer updating)
67
-
68
- **Frontmatter requirement (all docs in `docs/`):**
69
-
70
- ```markdown
71
- ---
72
- title: Short descriptive title
73
- description: One-line summary of what this doc covers
74
- ---
75
- ```
76
-
77
- In-progress task docs additionally require `status`:
78
-
79
- ```markdown
80
- ---
81
- title: Feature Name
82
- description: What this task is about
83
- status: planned | in-progress | blocked | complete
84
- ---
85
- ```
86
-
87
- No other fields. Do NOT add `resume_context`, `files_modified`, or `next_steps` to frontmatter -- those flow to the DB via Step 4.
88
-
89
- **Doc structure rules:**
90
-
91
- - All docs are `.md` (not .mdx)
92
- - Keep docs focused -- one topic per file
93
- - Use markdown tables for structured data
94
- - Include "Last Updated: YYYY-MM-DD" at the bottom of modified docs
95
-
96
- **OS layer annotation:** If OS contract paths were touched (Step 2), include an `## Organization OS Impact` section in any newly created architecture doc:
97
-
98
- ```markdown
99
- ## Organization OS Impact
100
-
101
- Touched contracts: [list files]
102
- Affected layers: [list of layers]
103
- Cross-reference: `node_modules/@elevasis/sdk/reference/scaffold/reference/glossary.md`
104
- Downstream: template consumer adapters may need review.
105
- ```
106
-
107
- Dispatch a `general-purpose` subagent with the plan, conversation context, and these rules. The subagent must read each target file before editing.
108
-
109
- ### Step 4: Persist Task Resume Context to DB
110
-
111
- If Step 1 resolved a task ID, save the current state to `prj_tasks.resume_context` via the SDK CLI. This is the canonical persistence step and must run every `/save` invocation that has a task in scope:
112
-
113
- ```bash
114
- pnpm elevasis-sdk project:task:save <task-uuid> \
115
- --current-state "<concise prose summary of where we are>" \
116
- --next-steps "<concise prose of the next concrete action>" \
117
- --files-modified '["path/one.ts","path/two.tsx"]' \
118
- --key-docs '["operations/resources/foo/index.ts"]' \
119
- --tools '["project:task:save","project:note:create"]'
120
- ```
121
-
122
- Arg rules:
123
-
124
- - `--current-state` (required) -- terse, present-tense "what is true right now". Prefer latest state over accumulated history.
125
- - `--next-steps` -- single next concrete action another agent could execute without re-deriving intent.
126
- - `--files-modified` -- JSON array of uncommitted / just-changed file paths (relative to project root).
127
- - `--key-docs` -- JSON array of doc paths an agent should re-read to resume.
128
- - `--tools` -- JSON array of tool / CLI names used this session that are worth flagging.
129
-
130
- The endpoint is `PATCH /api/external/tasks/<id>/resume-context` and merges (does not replace) provided fields. Omit any arg that has nothing meaningful to record.
131
-
132
- ### Step 5: Create Typed Project Notes on Signal Events
133
-
134
- For each signal event identified in Step 2, create a typed `prj_note`. One CLI call per note:
135
-
136
- ```bash
137
- pnpm elevasis-sdk project:note:create \
138
- --project <project-uuid> \
139
- --task <task-uuid> # optional, omit if not scoped to a task \
140
- --type <note-type> \
141
- --content "<what happened, why it matters, any next action>"
142
- ```
143
-
144
- Note-type mapping (use the first type that matches, in this order):
145
-
146
- - **`blocker`** -- work cannot proceed without external action (decision, credential, fix elsewhere, upstream change). Always create if detected. Trigger phrases: "I'm stuck", "blocked on", "can't proceed until", "waiting on <X>". When detected AND a task ID is in scope, ALSO fire a status transition -- see Step 5a below.
147
- - **`issue`** -- bug, regression, unexpected failure, contract mismatch. Include reproduction context in `--content`.
148
- - **`status_update`** -- milestone-level progress worth flagging to the human operator (phase complete, substantial deliverable landed, direction change). Keep it substantive -- `/save` runs shouldn't emit a status_update every turn.
149
- - **`call_note`** -- only if the conversation is transcribing a live client / stakeholder call.
150
-
151
- If no signal rises to note-worthy, skip this step entirely. Do not create filler notes.
152
-
153
- ### Step 5a: Blocker Signal -> Task Status Transition
154
-
155
- Run this ONLY when Step 5 created a `blocker` note AND Step 1 resolved a task ID. It's the second half of the "I'm stuck" fanout: the note captures the why, this call flips the task's lifecycle state so it surfaces as blocked in portfolio views.
156
-
157
- ```bash
158
- pnpm elevasis-sdk project:task:update <task-uuid> --status blocked
159
- ```
160
-
161
- Rules:
162
-
163
- - **Explicit task ID only** -- use the UUID resolved in Step 1. Do not re-derive or guess. If no task is in scope, skip this step (the blocker note still ships without it).
164
- - **Best-effort** -- if the CLI returns non-2xx, surface a single warning line in Step 7 ("Warning: could not transition task <id> to blocked: <reason>") and continue. Do not retry, do not block the rest of `/save`.
165
- - **Idempotent** -- if the task is already `blocked`, the update is a no-op. Fire it anyway; do not pre-check.
166
- - **Order** -- the `blocker` note (Step 5) creates first; this transition follows. Keeps the note attached to the task even if the status update later fails.
167
-
168
- ### Step 6: Report
169
-
170
- Summarize:
171
-
172
- - Knowledge docs created / updated / moved / deleted
173
- - Task ID written to (Step 4): `resume_context.last_saved` timestamp from the CLI response
174
- - Notes created (Step 5): count, types, IDs
175
- - OS classification (if applicable): layers detected, contracts touched
176
- - Any files skipped due to missing frontmatter (Step 3 subagent should have added it)
177
- - Any follow-ups for the human operator
178
-
179
- ## Failure Modes
180
-
181
- - **No task in scope + user declines to provide one:** proceed with Steps 2, 3, 6, 7; skip Step 4; still allow Step 5 if a `--project` UUID is available.
182
- - **`project:task:save` returns non-2xx:** surface the error in the report, do not retry silently; Step 5 and Step 6 still run.
183
- - **Knowledge doc edits fail to write:** surface the error; any edits already applied are on disk and not lost.
1
+ ---
2
+ name: save
3
+ description: Auto-manage project documentation and persist task resume context from conversation
4
+ ---
5
+
6
+ # Save
7
+
8
+ Auto-manage project documentation from conversation context, and fan out conversation signals to the canonical project system (`prj_tasks.resume_context`, `prj_notes`) via the `elevasis-sdk` CLI.
9
+
10
+ ## Canonical Sources of Truth
11
+
12
+ - **Task resume context (DB):** `prj_tasks.resume_context` is canonical. Agents write it via `elevasis-sdk project:task:save`. Humans edit it via the inline task editor in Command Center. **Never** stash resume context into task-doc frontmatter.
13
+ - **Task-doc frontmatter:** ONLY `title`, `description`, `status`. No `resume_context`, no files-modified, no next-steps arrays -- those belong in the DB.
14
+ - **Project notes (DB):** `prj_notes` via `elevasis-sdk project:note:create`. Typed notes (`status_update` / `issue` / `blocker` / `call_note`) are the durable record of conversation signals.
15
+
16
+ ## Process
17
+
18
+ ### Step 1: Resolve Project + Task Context
19
+
20
+ Before doing anything else, determine the active project / task:
21
+
22
+ 1. Look for an active task-doc frontmatter in the current conversation or the most recently edited file. Expected frontmatter:
23
+
24
+ ```yaml
25
+ ---
26
+ title: Short title
27
+ description: One-line summary
28
+ status: planned | in-progress | blocked | complete
29
+ ---
30
+ ```
31
+
32
+ 2. If the task doc references a project/task UUID anywhere in its body (link, callout, or prior save output), capture those IDs.
33
+ 3. If no task / project context is resolvable, PROMPT the user:
34
+ - "Which project is this work under?" (accepts slug or UUID)
35
+ - "Is there an existing task I should attach this to? (task UUID, or 'new')"
36
+
37
+ Do not guess. Without a task ID, skip Step 4 (DB resume-context save) but still perform Steps 2, 3, 5, 6, 7.
38
+
39
+ ### Step 2: Analyze Conversation
40
+
41
+ Review the current conversation to identify:
42
+
43
+ 1. **New knowledge** -- architecture decisions, feature implementations, bug fixes, discoveries
44
+ 2. **Changed state** -- what was in-progress that is now complete, what new work started
45
+ 3. **Stale docs** -- information in existing docs that is now outdated
46
+ 4. **Signal events** -- blocker hit, status update worth recording, issue uncovered, call outcome
47
+ 5. **OS contract paths touched** -- scan files read/written/edited for any of these signals:
48
+ - `foundations/config/organization-model.ts` -> Foundations layer, Organization Model
49
+ - `foundations/types/index.ts` -> Foundations layer, Workflow Contracts
50
+ - `ui/src/routes/__root.tsx` -> UI Shell Runtime composition
51
+ - `ui/src/features/**/manifest.ts` or any file defining a `FeatureModule` -> Features layer
52
+ - `operations/src/index.ts` or `operations/elevasis.config.ts` -> Foundations/Deployment (DeploymentSpec)
53
+ - Any file inside `ui/src/features/<feature>/` combined with manifest, nav, or sidebar changes -> Features + Toolkit layers
54
+
55
+ Record which OS layers were touched: `foundations`, `features`, `shell-runtime`, `toolkit`, `deployment`. If none matched, OS awareness stays dormant for the rest of this run.
56
+
57
+ ### Step 3: Update Knowledge Docs
58
+
59
+ Scan for unindexed or stale knowledge docs and draft creates / updates / moves. This template does not have a `docs/` tree — look for any local knowledge files (`.claude/rules/`, `operations/src/README.md`, `foundations/`, or project-specific docs the user has created). All edits are on knowledge/architecture/feature docs -- NOT on task resume state (that flows to the DB in Step 4).
60
+
61
+ Determine what needs to happen:
62
+
63
+ - **Create** new docs for significant new knowledge (new features, architecture decisions)
64
+ - **Update** existing docs with corrections, completions, or new details
65
+ - **Move** docs between directories (e.g., `ui/` to `operations/` when ownership shifts)
66
+ - **Delete** docs that are fully obsolete (rare -- prefer updating)
67
+
68
+ **Frontmatter requirement (all docs in `docs/`):**
69
+
70
+ ```markdown
71
+ ---
72
+ title: Short descriptive title
73
+ description: One-line summary of what this doc covers
74
+ ---
75
+ ```
76
+
77
+ In-progress task docs additionally require `status`:
78
+
79
+ ```markdown
80
+ ---
81
+ title: Feature Name
82
+ description: What this task is about
83
+ status: planned | in-progress | blocked | complete
84
+ ---
85
+ ```
86
+
87
+ No other fields. Do NOT add `resume_context`, `files_modified`, or `next_steps` to frontmatter -- those flow to the DB via Step 4.
88
+
89
+ **Doc structure rules:**
90
+
91
+ - All docs are `.md` (not .mdx)
92
+ - Keep docs focused -- one topic per file
93
+ - Use markdown tables for structured data
94
+ - Include "Last Updated: YYYY-MM-DD" at the bottom of modified docs
95
+
96
+ **OS layer annotation:** If OS contract paths were touched (Step 2), include an `## Organization OS Impact` section in any newly created architecture doc:
97
+
98
+ ```markdown
99
+ ## Organization OS Impact
100
+
101
+ Touched contracts: [list files]
102
+ Affected layers: [list of layers]
103
+ Cross-reference: `node_modules/@elevasis/sdk/reference/scaffold/reference/glossary.md`
104
+ Downstream: template consumer adapters may need review.
105
+ ```
106
+
107
+ Dispatch a `general-purpose` subagent with the plan, conversation context, and these rules. The subagent must read each target file before editing.
108
+
109
+ ### Step 4: Persist Task Resume Context to DB
110
+
111
+ If Step 1 resolved a task ID, save the current state to `prj_tasks.resume_context` via the SDK CLI. This is the canonical persistence step and must run every `/save` invocation that has a task in scope:
112
+
113
+ ```bash
114
+ pnpm elevasis-sdk project:task:save <task-uuid> \
115
+ --current-state "<concise prose summary of where we are>" \
116
+ --next-steps "<concise prose of the next concrete action>" \
117
+ --files-modified '["path/one.ts","path/two.tsx"]' \
118
+ --key-docs '["operations/resources/foo/index.ts"]' \
119
+ --tools '["project:task:save","project:note:create"]'
120
+ ```
121
+
122
+ Arg rules:
123
+
124
+ - `--current-state` (required) -- terse, present-tense "what is true right now". Prefer latest state over accumulated history.
125
+ - `--next-steps` -- single next concrete action another agent could execute without re-deriving intent.
126
+ - `--files-modified` -- JSON array of uncommitted / just-changed file paths (relative to project root).
127
+ - `--key-docs` -- JSON array of doc paths an agent should re-read to resume.
128
+ - `--tools` -- JSON array of tool / CLI names used this session that are worth flagging.
129
+
130
+ The endpoint is `PATCH /api/external/tasks/<id>/resume-context` and merges (does not replace) provided fields. Omit any arg that has nothing meaningful to record.
131
+
132
+ ### Step 5: Create Typed Project Notes on Signal Events
133
+
134
+ For each signal event identified in Step 2, create a typed `prj_note`. One CLI call per note:
135
+
136
+ ```bash
137
+ pnpm elevasis-sdk project:note:create \
138
+ --project <project-uuid> \
139
+ --task <task-uuid> # optional, omit if not scoped to a task \
140
+ --type <note-type> \
141
+ --content "<what happened, why it matters, any next action>"
142
+ ```
143
+
144
+ Note-type mapping (use the first type that matches, in this order):
145
+
146
+ - **`blocker`** -- work cannot proceed without external action (decision, credential, fix elsewhere, upstream change). Always create if detected. Trigger phrases: "I'm stuck", "blocked on", "can't proceed until", "waiting on <X>". When detected AND a task ID is in scope, ALSO fire a status transition -- see Step 5a below.
147
+ - **`issue`** -- bug, regression, unexpected failure, contract mismatch. Include reproduction context in `--content`.
148
+ - **`status_update`** -- milestone-level progress worth flagging to the human operator (phase complete, substantial deliverable landed, direction change). Keep it substantive -- `/save` runs shouldn't emit a status_update every turn.
149
+ - **`call_note`** -- only if the conversation is transcribing a live client / stakeholder call.
150
+
151
+ If no signal rises to note-worthy, skip this step entirely. Do not create filler notes.
152
+
153
+ ### Step 5a: Blocker Signal -> Task Status Transition
154
+
155
+ Run this ONLY when Step 5 created a `blocker` note AND Step 1 resolved a task ID. It's the second half of the "I'm stuck" fanout: the note captures the why, this call flips the task's lifecycle state so it surfaces as blocked in portfolio views.
156
+
157
+ ```bash
158
+ pnpm elevasis-sdk project:task:update <task-uuid> --status blocked
159
+ ```
160
+
161
+ Rules:
162
+
163
+ - **Explicit task ID only** -- use the UUID resolved in Step 1. Do not re-derive or guess. If no task is in scope, skip this step (the blocker note still ships without it).
164
+ - **Best-effort** -- if the CLI returns non-2xx, surface a single warning line in Step 7 ("Warning: could not transition task <id> to blocked: <reason>") and continue. Do not retry, do not block the rest of `/save`.
165
+ - **Idempotent** -- if the task is already `blocked`, the update is a no-op. Fire it anyway; do not pre-check.
166
+ - **Order** -- the `blocker` note (Step 5) creates first; this transition follows. Keeps the note attached to the task even if the status update later fails.
167
+
168
+ ### Step 6: Report
169
+
170
+ Summarize:
171
+
172
+ - Knowledge docs created / updated / moved / deleted
173
+ - Task ID written to (Step 4): `resume_context.last_saved` timestamp from the CLI response
174
+ - Notes created (Step 5): count, types, IDs
175
+ - OS classification (if applicable): layers detected, contracts touched
176
+ - Any files skipped due to missing frontmatter (Step 3 subagent should have added it)
177
+ - Any follow-ups for the human operator
178
+
179
+ ## Failure Modes
180
+
181
+ - **No task in scope + user declines to provide one:** proceed with Steps 2, 3, 6, 7; skip Step 4; still allow Step 5 if a `--project` UUID is available.
182
+ - **`project:task:save` returns non-2xx:** surface the error in the report, do not retry silently; Step 5 and Step 6 still run.
183
+ - **Knowledge doc edits fail to write:** surface the error; any edits already applied are on disk and not lost.