@elevasis/sdk 1.0.2 → 1.2.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.
- package/dist/cli.cjs +704 -3568
- package/dist/index.d.ts +316 -135
- package/package.json +1 -7
- package/reference/_navigation.md +1 -1
- package/reference/cli.mdx +2 -113
- package/reference/deployment/index.mdx +1 -1
- package/reference/framework/index.mdx +10 -0
- package/reference/framework/project-structure.mdx +2 -3
- package/reference/framework/tutorial-system.mdx +2 -2
- package/reference/getting-started.mdx +1 -11
- package/reference/index.mdx +16 -1
- package/reference/platform-tools/index.mdx +3 -3
- package/reference/platform-tools/type-safety.mdx +2 -2
- package/reference/templates/index.mdx +3 -3
- package/reference/troubleshooting.mdx +4 -4
- package/dist/templates.js +0 -2253
- package/dist/types/templates.d.ts +0 -2
package/dist/templates.js
DELETED
|
@@ -1,2253 +0,0 @@
|
|
|
1
|
-
// package.json
|
|
2
|
-
|
|
3
|
-
// src/cli/commands/templates/core/workspace.ts
|
|
4
|
-
var TEMPLATE_VERSION = 34;
|
|
5
|
-
function configTemplate() {
|
|
6
|
-
return `import type { ElevasConfig } from '@elevasis/sdk'
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
templateVersion: ${TEMPLATE_VERSION},
|
|
10
|
-
// defaultStatus: 'dev', // Default status for new resources ('dev' | 'prod')
|
|
11
|
-
// dev: { port: 5170 }, // Local API port (internal development only)
|
|
12
|
-
} satisfies ElevasConfig
|
|
13
|
-
`;
|
|
14
|
-
}
|
|
15
|
-
function gitignoreTemplate(ctx = {}) {
|
|
16
|
-
let content = `node_modules/
|
|
17
|
-
.env
|
|
18
|
-
dist/
|
|
19
|
-
__elevasis_worker.ts
|
|
20
|
-
.claude/settings.local.json
|
|
21
|
-
.claude/memory/
|
|
22
|
-
package-lock.json
|
|
23
|
-
`;
|
|
24
|
-
if (ctx.hasUI) {
|
|
25
|
-
content += `ui/node_modules/
|
|
26
|
-
ui/dist/
|
|
27
|
-
`;
|
|
28
|
-
}
|
|
29
|
-
return content;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// src/cli/commands/templates/core/claude.ts
|
|
33
|
-
function claudeSettingsTemplate() {
|
|
34
|
-
return JSON.stringify(
|
|
35
|
-
{
|
|
36
|
-
autoCompact: false,
|
|
37
|
-
statusLine: {
|
|
38
|
-
type: "command",
|
|
39
|
-
command: "node .claude/scripts/statusline-command.js"
|
|
40
|
-
},
|
|
41
|
-
hooks: {
|
|
42
|
-
PreToolUse: [
|
|
43
|
-
{
|
|
44
|
-
matcher: "Write|Edit|MultiEdit|Bash",
|
|
45
|
-
hooks: [
|
|
46
|
-
{
|
|
47
|
-
type: "command",
|
|
48
|
-
command: "node .claude/hooks/enforce-sdk-boundary.mjs"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
PostToolUse: [
|
|
54
|
-
{
|
|
55
|
-
matcher: "Write|Edit|MultiEdit",
|
|
56
|
-
hooks: [
|
|
57
|
-
{
|
|
58
|
-
type: "command",
|
|
59
|
-
command: "node .claude/hooks/post-edit-validate.mjs"
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
PostToolUseFailure: [
|
|
65
|
-
{
|
|
66
|
-
matcher: "Bash",
|
|
67
|
-
hooks: [
|
|
68
|
-
{
|
|
69
|
-
type: "command",
|
|
70
|
-
command: "node .claude/hooks/tool-failure-recovery.mjs"
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
null,
|
|
78
|
-
2
|
|
79
|
-
) + "\n";
|
|
80
|
-
}
|
|
81
|
-
function claudeStatuslineScriptTemplate() {
|
|
82
|
-
return `#!/usr/bin/env node
|
|
83
|
-
let input = '';
|
|
84
|
-
process.stdin.on('data', chunk => input += chunk);
|
|
85
|
-
process.stdin.on('end', () => {
|
|
86
|
-
const data = JSON.parse(input);
|
|
87
|
-
const model = data.model?.display_name || '?';
|
|
88
|
-
const pct = Math.floor(data.context_window?.used_percentage || 0);
|
|
89
|
-
|
|
90
|
-
const DIM = '\\x1b[90m', RESET = '\\x1b[0m';
|
|
91
|
-
const GREEN = '\\x1b[32m', YELLOW = '\\x1b[33m', RED = '\\x1b[31m';
|
|
92
|
-
|
|
93
|
-
const color = pct >= 90 ? RED : pct >= 70 ? YELLOW : GREEN;
|
|
94
|
-
|
|
95
|
-
const width = 20;
|
|
96
|
-
const filled = Math.floor(pct * width / 100);
|
|
97
|
-
const empty = width - filled;
|
|
98
|
-
const bar = '#'.repeat(filled) + '-'.repeat(empty);
|
|
99
|
-
|
|
100
|
-
console.log(\`\${DIM}[\${RESET}\${model}\${DIM}]\${RESET} \${color}\${bar}\${RESET} \${pct}%\`);
|
|
101
|
-
});
|
|
102
|
-
`;
|
|
103
|
-
}
|
|
104
|
-
function claudeSdkBoundaryHookTemplate() {
|
|
105
|
-
return String.raw`#!/usr/bin/env node
|
|
106
|
-
// enforce-sdk-boundary.mjs
|
|
107
|
-
// Blocks file modifications (Write, Edit, MultiEdit, destructive Bash) outside the project root.
|
|
108
|
-
// Git, gh, and other CLI tools are NOT blocked -- the agent can use them freely.
|
|
109
|
-
|
|
110
|
-
import { resolve, normalize } from "node:path";
|
|
111
|
-
import { appendFileSync, mkdirSync } from "node:fs";
|
|
112
|
-
|
|
113
|
-
const LOG_DIR = (process.env.CLAUDE_PROJECT_DIR ?? process.cwd()) + "/.claude/logs";
|
|
114
|
-
const LOG_FILE = LOG_DIR + "/boundary-hook.log";
|
|
115
|
-
|
|
116
|
-
function log(msg) {
|
|
117
|
-
try {
|
|
118
|
-
mkdirSync(LOG_DIR, { recursive: true });
|
|
119
|
-
appendFileSync(LOG_FILE, "[" + new Date().toISOString() + "] " + msg + "\n");
|
|
120
|
-
} catch {}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function deny(reason) {
|
|
124
|
-
log("DENY -- " + reason);
|
|
125
|
-
process.stdout.write(
|
|
126
|
-
JSON.stringify({
|
|
127
|
-
hookSpecificOutput: {
|
|
128
|
-
hookEventName: "PreToolUse",
|
|
129
|
-
permissionDecision: "deny",
|
|
130
|
-
permissionDecisionReason: reason,
|
|
131
|
-
},
|
|
132
|
-
})
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
try {
|
|
137
|
-
const chunks = [];
|
|
138
|
-
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
139
|
-
const input = JSON.parse(Buffer.concat(chunks).toString());
|
|
140
|
-
|
|
141
|
-
const projectDir = normalize(process.env.CLAUDE_PROJECT_DIR ?? process.cwd());
|
|
142
|
-
const sep = process.platform === "win32" ? "\\" : "/";
|
|
143
|
-
const prefix = projectDir.endsWith("\\") || projectDir.endsWith("/") ? projectDir : projectDir + sep;
|
|
144
|
-
|
|
145
|
-
function isOutside(filePath) {
|
|
146
|
-
const target = normalize(resolve(filePath));
|
|
147
|
-
return !target.startsWith(prefix) && target !== projectDir;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (input.tool_name === "Bash") {
|
|
151
|
-
const cmd = input.tool_input?.command ?? "";
|
|
152
|
-
|
|
153
|
-
// Path-scoped blocks -- destructive commands or redirects outside project root
|
|
154
|
-
const winPaths = cmd.match(/(?<![A-Za-z])[A-Za-z]:[/\\][^\s"'|;&)]+/g) || [];
|
|
155
|
-
const unixPaths = cmd.match(/(?<=\s|^|"|')\/[^\s"'|;&)]+/g) || [];
|
|
156
|
-
const allPaths = [...winPaths, ...unixPaths]
|
|
157
|
-
.map((p) => p.trim())
|
|
158
|
-
.filter((p) => !p.startsWith("/dev/"));
|
|
159
|
-
|
|
160
|
-
const outsidePaths = allPaths.filter((p) => isOutside(p));
|
|
161
|
-
|
|
162
|
-
if (outsidePaths.length > 0) {
|
|
163
|
-
const hasDestructiveCmd = /(?<![-])\b(rm|rmdir|del|unlink|mv|cp|touch|mkdir|chmod|chown|truncate|tee|dd|install)\b/.test(cmd);
|
|
164
|
-
const hasInPlaceEdit = /\bsed\b.*\s-i/.test(cmd);
|
|
165
|
-
const hasRedirect = />{1,2}\s*[^\s&>]/.test(cmd);
|
|
166
|
-
|
|
167
|
-
const hasTempPath = outsidePaths.some(
|
|
168
|
-
(p) => /[/\\]tmp[/\\]/i.test(p) || /[/\\]Temp[/\\]/i.test(p)
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
if (hasDestructiveCmd || hasInPlaceEdit || hasRedirect) {
|
|
172
|
-
const instead = hasTempPath
|
|
173
|
-
? "INSTEAD: Use pipes instead of temp files: cmd 2>&1 | grep pattern not cmd > /tmp/out.txt. All file writes must target paths inside the project."
|
|
174
|
-
: "INSTEAD: Only files within the project directory may be modified. Ask the user to run this command manually if external paths are needed.";
|
|
175
|
-
|
|
176
|
-
deny(
|
|
177
|
-
"BLOCKED: destructive command references path(s) outside the project: " + outsidePaths.join(", ") + ".\n" +
|
|
178
|
-
"WHY: File modifications outside the project boundary are not allowed.\n" +
|
|
179
|
-
instead
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
} else {
|
|
184
|
-
// Write, Edit, MultiEdit: check file_path
|
|
185
|
-
const filePath = input.tool_input?.file_path;
|
|
186
|
-
if (filePath && isOutside(filePath)) {
|
|
187
|
-
deny(
|
|
188
|
-
"BLOCKED: " + filePath + " is outside the project.\n" +
|
|
189
|
-
"WHY: [" + (input.tool_name ?? "Unknown") + "] file operations outside the project boundary are not allowed.\n" +
|
|
190
|
-
"INSTEAD: Only files within the project directory may be modified."
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
} catch (err) {
|
|
195
|
-
log("ERROR: " + err.message + "\n" + err.stack);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
process.exit(0);
|
|
199
|
-
`;
|
|
200
|
-
}
|
|
201
|
-
function claudeMdTemplate(ctx = {}) {
|
|
202
|
-
return `<!-- initialized: false -->
|
|
203
|
-
|
|
204
|
-
# CLAUDE.md
|
|
205
|
-
|
|
206
|
-
## Session Initialization
|
|
207
|
-
|
|
208
|
-
At the start of every session:
|
|
209
|
-
|
|
210
|
-
0. Check the \`<!-- initialized: ... -->\` flag at the top of this file.
|
|
211
|
-
If \`false\`, read \`.claude/commands/init.md\` and run the \`/init\` flow.
|
|
212
|
-
After initialization completes, change the flag to \`<!-- initialized: true -->\`.
|
|
213
|
-
If \`true\`, proceed with steps below.
|
|
214
|
-
1. Read \`.claude/memory/profile/skills.md\` -- adapt all responses to the user's
|
|
215
|
-
assessed skill levels (see Interaction Guidance below).
|
|
216
|
-
2. Read \`.claude/memory/index.md\` -- drill into relevant topic files as needed.
|
|
217
|
-
Balance context relevance against token usage.
|
|
218
|
-
3. Check installed \`@elevasis/sdk\` template version against \`templateVersion\`
|
|
219
|
-
in \`elevasis.config.ts\`. If newer, notify and suggest \`/fix\`.
|
|
220
|
-
4. If \`.claude/memory/\` does not exist, suggest \`/init\`.
|
|
221
|
-
5. If user Platform Navigation level is none (from skills.md) and
|
|
222
|
-
\`.claude/memory/tutorial-progress.md\` does not exist, suggest \`/tutorial\`.
|
|
223
|
-
If tutorial-progress.md exists and Phase is not complete, mention that the
|
|
224
|
-
tutorial has more to explore.
|
|
225
|
-
|
|
226
|
-
Do this silently. Do not narrate the steps to the user.
|
|
227
|
-
|
|
228
|
-
## Identity
|
|
229
|
-
|
|
230
|
-
You are the development agent for an Elevasis workspace. You help the user
|
|
231
|
-
design, build, and deploy business automation workflows on the Elevasis
|
|
232
|
-
platform. You are not just a code assistant -- you are a guide who translates
|
|
233
|
-
business intent into working automation.
|
|
234
|
-
|
|
235
|
-
Your users range from experienced developers to business operators who have
|
|
236
|
-
never written code. Read the user's skill profile at session start and adapt
|
|
237
|
-
every interaction -- vocabulary, code completeness, explanation depth, and
|
|
238
|
-
proactivity -- to their assessed levels.
|
|
239
|
-
|
|
240
|
-
## Navigation
|
|
241
|
-
|
|
242
|
-
| Resource | Location | When to Load |
|
|
243
|
-
| --- | --- | --- |
|
|
244
|
-
| Workspace concepts | \`reference/concepts.mdx\` | User asks "what is...?" or needs conceptual grounding |
|
|
245
|
-
| SDK patterns and examples | \`reference/resources/patterns.mdx\` | Building or modifying a workflow |
|
|
246
|
-
| Platform tool catalog | \`reference/platform-tools/index.mdx\` | Connecting to external services |
|
|
247
|
-
| CLI reference | \`reference/cli.mdx\` | Running execution/platform operations |
|
|
248
|
-
| Credential model | \`reference/platform-tools/index.mdx\` | Setting up integrations or credential security |
|
|
249
|
-
| Interaction guidance | \`reference/framework/interaction-guidance.mdx\` | Unsure how to adapt for a skill combination |
|
|
250
|
-
| Error history | \`.claude/memory/errors/index.md\` | Debugging errors, checking past fixes |
|
|
251
|
-
| Command View model | \`reference/deployment/command-center.mdx\` | Deploying or building resources that invoke other resources |
|
|
252
|
-
| Command Center UI reference | \`reference/deployment/command-center.mdx\` | User asks about post-deployment UI or Command Center navigation |
|
|
253
|
-
| SDK error reference | \`reference/troubleshooting.mdx\` | Unknown error not in workspace memory |
|
|
254
|
-
| Project map | \`docs/project-map.mdx\` | Session start, project orientation |
|
|
255
|
-
| Resource inventory | \`docs/resource-map.mdx\` | Finding a specific resource by name or ID |
|
|
256
|
-
| Project priorities | \`docs/priorities.mdx\` | Deciding what to work on next |
|
|
257
|
-
| User profile and skills | \`.claude/memory/profile/skills.md\` | Session start (mandatory) |
|
|
258
|
-
| Cross-session memory | \`.claude/memory/index.md\` | Session start, recalling past context |${ctx.hasUI ? `
|
|
259
|
-
| UI app source | \`ui/src/\` | Modifying the frontend, adding routes or components |` : ""}
|
|
260
|
-
|
|
261
|
-
All \`reference/\` paths resolve to \`node_modules/@elevasis/sdk/reference/\`.
|
|
262
|
-
|
|
263
|
-
## Elevasis CLI
|
|
264
|
-
|
|
265
|
-
**MANDATORY:** Use the \`elevasis-sdk\` CLI for all execution/platform operations -- never \`curl\` or any other tool.
|
|
266
|
-
|
|
267
|
-
Use pnpm scripts for check and deploy (they resolve the local binary automatically):
|
|
268
|
-
|
|
269
|
-
- \`pnpm run check\` -- validate resource definitions without deploying
|
|
270
|
-
- \`pnpm run deploy\` -- deploy to the platform
|
|
271
|
-
|
|
272
|
-
Use \`pnpm exec elevasis-sdk\` for runtime commands (resolves the locally installed binary):
|
|
273
|
-
|
|
274
|
-
- \`pnpm exec elevasis-sdk exec <resource-id> --input '{...}'\` -- run a resource synchronously
|
|
275
|
-
- \`pnpm exec elevasis-sdk exec <resource-id> --input '{...}' --async\` -- run async, returns execution ID
|
|
276
|
-
- \`pnpm exec elevasis-sdk execution <resource-id> <execution-id>\` -- inspect execution detail
|
|
277
|
-
- \`pnpm exec elevasis-sdk rename <old-id> --to <new-id> [--execute] [--prod]\` -- rename a resource ID across platform tables (dry run by default)
|
|
278
|
-
|
|
279
|
-
Organization is derived from your API key -- no org prefix needed in the resource ID.
|
|
280
|
-
For full CLI reference: \`reference/cli.mdx\`
|
|
281
|
-
|
|
282
|
-
## Rules
|
|
283
|
-
|
|
284
|
-
SDK patterns (imports, source structure, platform tools) are auto-loaded from
|
|
285
|
-
\`.claude/rules/sdk-patterns.md\`. Project-specific patterns live in
|
|
286
|
-
\`.claude/rules/workspace-patterns.md\`.
|
|
287
|
-
|
|
288
|
-
- Documentation goes in \`docs/\` as \`.mdx\` files
|
|
289
|
-
- Resources are not visible in the Command Center until deployed. Always deploy before directing users to verify in the UI.
|
|
290
|
-
|
|
291
|
-
### Error Handling
|
|
292
|
-
|
|
293
|
-
When an error occurs:
|
|
294
|
-
1. Check \`.claude/memory/errors/\` first for past fixes
|
|
295
|
-
2. If new, check \`reference/troubleshooting.mdx\`
|
|
296
|
-
3. After resolving, record in \`.claude/memory/errors/\` with context and fix
|
|
297
|
-
4. If an error recurs 3+ times, add a rule to \`.claude/rules/workspace-patterns.md\`${ctx.hasUI ? `
|
|
298
|
-
|
|
299
|
-
### UI App (\`ui/\`)
|
|
300
|
-
|
|
301
|
-
- \`ui/\` is a standalone Vite + React app with its own \`package.json\` -- not part of the pnpm workspace
|
|
302
|
-
- Import from \`@elevasis/sdk-ui\`, never from \`@elevasis/sdk\` or \`@repo/ui\`
|
|
303
|
-
- Dev server runs on port 5100: \`cd ui && pnpm dev\`
|
|
304
|
-
- Set \`VITE_WORKOS_CLIENT_ID\` in \`ui/.env\` before running
|
|
305
|
-
- \`ElevasisCoreProvider\` (headless, no Mantine dependency) is pre-configured in \`ui/src/App.tsx\` with \`auth={{ mode: 'oauth', clientId, redirectUri }}\`, \`apiUrl="http://localhost:5170"\`, and \`theme={{ colorScheme: 'dark', preset: 'default' }}\`
|
|
306
|
-
- To use pre-built Mantine components from \`@elevasis/sdk-ui\`, switch to \`ElevasisUIProvider\` and install \`@mantine/core\` and \`@mantine/hooks\`
|
|
307
|
-
- OAuth redirect is handled by the \`AuthRedirect\` component at \`/auth-redirect\` -- it uses \`useAuthContext()\` from \`@elevasis/sdk-ui/auth\` and navigates home once \`user\` is set
|
|
308
|
-
- API must be running on port 5170 for the UI to work (\`pnpm --filter api dev\` from the platform monorepo)` : ""}
|
|
309
|
-
|
|
310
|
-
## Interaction Guidance
|
|
311
|
-
|
|
312
|
-
Adapt your communication based on \`.claude/memory/profile/skills.md\`.
|
|
313
|
-
Read the profile at session start (Step 1). Adjust every response --
|
|
314
|
-
vocabulary, code completeness, explanation depth, and proactivity --
|
|
315
|
-
based on what you find.
|
|
316
|
-
|
|
317
|
-
- Match vocabulary to the user's level. Avoid jargon for beginners;
|
|
318
|
-
be precise for experts. Define technical terms in parentheses the first time.
|
|
319
|
-
- Provide step-by-step UI navigation for users with Platform Navigation below comfortable.
|
|
320
|
-
Reference exact page names and paths until they are oriented.
|
|
321
|
-
- Explain "why" before "how" for users new to automation.
|
|
322
|
-
- For users comfortable with the platform, focus on SDK-specific patterns and advanced operations.
|
|
323
|
-
- Leverage domain expertise -- if the user knows sales but not code,
|
|
324
|
-
ask for business process descriptions and translate.
|
|
325
|
-
- When growth is observed, note it in the skills.md Growth Log.
|
|
326
|
-
|
|
327
|
-
For detailed per-dimension adaptation rules, read
|
|
328
|
-
\`reference/framework/interaction-guidance.mdx\`.
|
|
329
|
-
|
|
330
|
-
## Commands
|
|
331
|
-
|
|
332
|
-
| Command | Purpose |
|
|
333
|
-
| --- | --- |
|
|
334
|
-
| \`/init\` | First-run workspace setup and competency assessment |
|
|
335
|
-
| \`/status\` | Project health dashboard |
|
|
336
|
-
| \`/fix\` | Maintenance, drift repair, and SDK upgrade |
|
|
337
|
-
| \`/deploy\` | Full deploy pipeline (validate \u2192 deploy \u2192 verify) |
|
|
338
|
-
| \`/docs\` | Browse, create, and verify permanent documentation |
|
|
339
|
-
| \`/tutorial\` | Progressive learning path (21 items across 4 sections) |
|
|
340
|
-
|
|
341
|
-
## Skills
|
|
342
|
-
|
|
343
|
-
Skills auto-trigger based on conversation context. You do not need to invoke them manually.
|
|
344
|
-
|
|
345
|
-
| Skill | Triggers When |
|
|
346
|
-
| --- | --- |
|
|
347
|
-
| \`work\` | You say /work, ask to track or save progress across sessions, ask what you were working on, want to create/resume/complete a task doc, or say you are done for today. Also proactively save when conversation is heavy or 2+ steps completed |
|
|
348
|
-
| \`creds\` | You mention credentials, API keys, secrets, webhook secrets, or setting up integrations |
|
|
349
|
-
| \`diagnostics\` | An execution fails, user asks why something failed, user mentions runtime errors, or agent observes a failed execution |
|
|
350
|
-
|
|
351
|
-
## Maintaining Memory
|
|
352
|
-
|
|
353
|
-
### What Memory Is
|
|
354
|
-
|
|
355
|
-
Memory stores persistent state and observations that inform future sessions.
|
|
356
|
-
Every file must contain data the agent writes and later reads to make better
|
|
357
|
-
decisions. File names must clearly indicate they contain state or data
|
|
358
|
-
(e.g., \`deployment-state.md\`, \`tutorial-progress.md\`, \`skills.md\`).
|
|
359
|
-
|
|
360
|
-
Priorities live in \`docs/priorities.mdx\`, not in memory. Memory is for internal
|
|
361
|
-
agent state; priorities are project documentation the user may also read.
|
|
362
|
-
|
|
363
|
-
### What Memory Is NOT
|
|
364
|
-
|
|
365
|
-
Do not store in \`.claude/memory/\`:
|
|
366
|
-
- Instructions, commands, or procedures (belong in \`.claude/commands/\`)
|
|
367
|
-
- Reference documentation or teaching material (belong in \`docs/\` or SDK reference)
|
|
368
|
-
- Templates or boilerplate code
|
|
369
|
-
- Conversation transcripts or chat history
|
|
370
|
-
- Anything the agent reads but never updates
|
|
371
|
-
|
|
372
|
-
### Structure
|
|
373
|
-
|
|
374
|
-
- \`.claude/memory/index.md\` is the root -- maps to topic files and subdirectories
|
|
375
|
-
- Every subdirectory has its own \`index.md\` mapping to children
|
|
376
|
-
- Start at the root index and drill down
|
|
377
|
-
- When a file outgrows a single document, split into a subdirectory
|
|
378
|
-
|
|
379
|
-
### Pruning
|
|
380
|
-
|
|
381
|
-
- Keep ~20 recent entries per table; drop stale patterns (30+ days, no recurrence)
|
|
382
|
-
- If a file/index references a missing child, remove the row
|
|
383
|
-
- If a child exists without an index entry, add it
|
|
384
|
-
- If an error pattern recurs 3+ times, promote to Rules above
|
|
385
|
-
`;
|
|
386
|
-
}
|
|
387
|
-
function claudeTutorialCommandTemplate() {
|
|
388
|
-
return `# /tutorial command
|
|
389
|
-
|
|
390
|
-
You are a tutorial guide for this Elevasis workspace.
|
|
391
|
-
|
|
392
|
-
## Context
|
|
393
|
-
|
|
394
|
-
Read \`.claude/memory/profile/skills.md\` first. The \`automation\` skill level
|
|
395
|
-
controls which docs you load and which lesson variant you deliver.
|
|
396
|
-
|
|
397
|
-
**automation: none**
|
|
398
|
-
- Load from \`reference/concepts.mdx\`: Glossary, What is a Workflow,
|
|
399
|
-
Platform Tools Overview only. Skip Zod, Execution Model, Design Decisions.
|
|
400
|
-
- Load \`reference/deployment/command-center.mdx\` for UI-first teaching.
|
|
401
|
-
- Do NOT load \`reference/resources/patterns.mdx\` or
|
|
402
|
-
\`reference/platform-tools/adapters.mdx\` during core lessons.
|
|
403
|
-
|
|
404
|
-
**automation: low-code**
|
|
405
|
-
- Load all sections of \`reference/concepts.mdx\`.
|
|
406
|
-
- Load \`reference/resources/patterns.mdx\` with Zapier/Make mapping in mind.
|
|
407
|
-
- Load \`reference/platform-tools/adapters.mdx\` on-demand (when tools are used).
|
|
408
|
-
|
|
409
|
-
**automation: custom**
|
|
410
|
-
- Load all docs listed per-lesson and per-module as specified below.
|
|
411
|
-
|
|
412
|
-
Read \`.claude/memory/tutorial-progress.md\` to check current lesson progress.
|
|
413
|
-
|
|
414
|
-
## Invocation
|
|
415
|
-
|
|
416
|
-
\`/tutorial\` -- ALWAYS shows the main menu first. Never silently auto-resumes without giving the user a choice. See ## Menu section for the exact menu format.
|
|
417
|
-
|
|
418
|
-
## Menu
|
|
419
|
-
|
|
420
|
-
When \`/tutorial\` is invoked:
|
|
421
|
-
|
|
422
|
-
1. Read \`.claude/memory/tutorial-progress.md\` (if it exists)
|
|
423
|
-
2. Display the full menu table. Fill in progress indicators from the progress file.
|
|
424
|
-
3. User picks a number -> start or resume that item directly. No track gating.
|
|
425
|
-
|
|
426
|
-
Progress indicators: \`[ ]\` not started, \`[>]\` in progress, \`[x] YYYY-MM-DD\` complete.
|
|
427
|
-
|
|
428
|
-
Example (first time, no progress):
|
|
429
|
-
|
|
430
|
-
\`\`\`
|
|
431
|
-
Elevasis Tutorial
|
|
432
|
-
==================
|
|
433
|
-
|
|
434
|
-
INTRODUCTION 0/4
|
|
435
|
-
1 Welcome & Orientation [ ]
|
|
436
|
-
2 How This Workspace Works [ ]
|
|
437
|
-
3 Project Commands (/init, /status, /fix, /deploy) [ ]
|
|
438
|
-
4 /work and /docs [ ]
|
|
439
|
-
|
|
440
|
-
CORE CONCEPTS 0/6
|
|
441
|
-
5 Your First Custom Workflow [ ]
|
|
442
|
-
6 Understanding Data (Schemas) [ ]
|
|
443
|
-
7 Using Platform Tools [ ]
|
|
444
|
-
8 Multi-Step Workflows [ ]
|
|
445
|
-
9 Decision Points [ ]
|
|
446
|
-
10 Going to Production [ ]
|
|
447
|
-
|
|
448
|
-
ADVANCED MODULES 0/9
|
|
449
|
-
11 Human-in-the-Loop [ ]
|
|
450
|
-
12 Task Scheduling [ ]
|
|
451
|
-
13 Notification System [ ]
|
|
452
|
-
14 Real-World Integrations [ ]
|
|
453
|
-
15 Error Handling Mastery [ ]
|
|
454
|
-
16 Advanced Workflows [ ]
|
|
455
|
-
17 Resource Composition [ ]
|
|
456
|
-
18 LLM Integration [ ]
|
|
457
|
-
19 AI Agents [ ]
|
|
458
|
-
|
|
459
|
-
ADVANCED WORKSPACE 0/2
|
|
460
|
-
20 Rules, Memory, and Customization [ ]
|
|
461
|
-
21 Template Lifecycle [ ]
|
|
462
|
-
|
|
463
|
-
Pick a number to start.
|
|
464
|
-
\`\`\`
|
|
465
|
-
|
|
466
|
-
Always show this full table when \`/tutorial\` is invoked. Populate progress
|
|
467
|
-
indicators from completed/current state. \`"status"\` -> show the same table.
|
|
468
|
-
|
|
469
|
-
## Progress Logic
|
|
470
|
-
|
|
471
|
-
1. Read \`.claude/memory/tutorial-progress.md\`
|
|
472
|
-
2. Show the full menu table (## Menu) with progress filled in
|
|
473
|
-
3. User picks a number -> start or resume that lesson or module directly
|
|
474
|
-
4. After user confirms readiness: mark done in progress file, show updated menu table
|
|
475
|
-
5. All 21 items complete -> congratulate, suggest exploring docs/ or /work
|
|
476
|
-
|
|
477
|
-
## Lesson Flow
|
|
478
|
-
|
|
479
|
-
Each lesson follows this flow:
|
|
480
|
-
1. Announce lesson title and what they'll learn (1-2 sentences)
|
|
481
|
-
2. Explain the concept (read docs per skill level, adapt to user)
|
|
482
|
-
3. Guide user to build or modify something (agent writes all code for automation: none)
|
|
483
|
-
4. Verify it works (CLI primary for all levels; Command Center for visual review -- Command View, Execution Logs)
|
|
484
|
-
5. Celebrate success and ask: "Any questions, or ready to continue?"
|
|
485
|
-
6. Once the user confirms, record observations in \`.claude/memory/tutorial-progress.md\`
|
|
486
|
-
|
|
487
|
-
## Lessons
|
|
488
|
-
|
|
489
|
-
**Item 1: Welcome & Orientation**
|
|
490
|
-
|
|
491
|
-
When automation is none:
|
|
492
|
-
Skip the file tour. Start with what Elevasis does for their business -- use analogies
|
|
493
|
-
from \`reference/framework/interaction-guidance.mdx\` (recipe, assembly line, kitchen
|
|
494
|
-
appliance). Explain deployment plainly: "You write the recipe here, then deploy it so
|
|
495
|
-
it's live." Deploy the starter echo workflow (\`elevasis-sdk check\` + \`elevasis-sdk deploy\`),
|
|
496
|
-
THEN tour the Command Center so the user sees populated pages, not empty ones. Tour:
|
|
497
|
-
Command View (echo node), Execution Logs (result).
|
|
498
|
-
Observation focus: automation value understanding, Command Center comfort.
|
|
499
|
-
|
|
500
|
-
When automation is low-code or custom:
|
|
501
|
-
Tour project files: src/index.ts (registry), src/example/echo.ts (starter
|
|
502
|
-
workflow), src/operations/platform-status.ts (platform API example),
|
|
503
|
-
elevasis.config.ts, .env, docs/. Explain the execution model.
|
|
504
|
-
Verify: run \`elevasis-sdk resources\`. Then open the Command Center and tour the
|
|
505
|
-
main pages: Command View (resource graph), Execution Logs.
|
|
506
|
-
Point out the echo workflow node in Command View.
|
|
507
|
-
Observation focus: cloud deployment model, UI navigation comfort.
|
|
508
|
-
|
|
509
|
-
**Item 2: How This Workspace Works**
|
|
510
|
-
|
|
511
|
-
When automation is none:
|
|
512
|
-
"This workspace comes with a built-in assistant that knows your project, your tools,
|
|
513
|
-
and your goals. Let me show you how it's set up." Open CLAUDE.md and explain in
|
|
514
|
-
plain terms: it's the agent's instruction sheet. Point out the commands in the
|
|
515
|
-
Commands table. Show /status, /tutorial. Explain the work and creds skills as
|
|
516
|
-
"the assistant automatically helps when you mention tasks or API keys." Tour the memory folder
|
|
517
|
-
at a high level -- "this is where the agent stores what it learns about your project."
|
|
518
|
-
Verify: Ask the user a question about their business goal and show how the agent
|
|
519
|
-
references their profile in the answer.
|
|
520
|
-
Observation focus: agent-as-assistant concept, CLAUDE.md as instruction sheet.
|
|
521
|
-
|
|
522
|
-
When automation is low-code:
|
|
523
|
-
Read CLAUDE.md and walk through each section. Explain: what the agent reads on
|
|
524
|
-
session start, how the navigation table works, what the Skills section means.
|
|
525
|
-
Explain the three commands briefly and the two auto-triggering skills (work, creds). Show that the agent has memory: open
|
|
526
|
-
\`.claude/memory/profile/skills.md\` and show their own profile -- "every session,
|
|
527
|
-
the agent reads this and adapts." Explain the initialized flag.
|
|
528
|
-
Verify: Run /status to see project status.
|
|
529
|
-
Observation focus: memory system concept, session initialization flow.
|
|
530
|
-
|
|
531
|
-
When automation is custom:
|
|
532
|
-
Read CLAUDE.md in full. Explain the session initialization sequence: CLAUDE.md ->
|
|
533
|
-
navigation table -> memory files -> context loading. Walk through: Commands section
|
|
534
|
-
(3 commands + work and creds skills), Rules section (auto-loaded based on file paths), Skills
|
|
535
|
-
section (auto-triggered by content patterns). Point out the initialized flag and
|
|
536
|
-
explain how /init set it.
|
|
537
|
-
Verify: Run /status to see project status; observe which fields it reports.
|
|
538
|
-
Observation focus: initialization model, command-vs-rule-vs-skill distinction.
|
|
539
|
-
|
|
540
|
-
**Item 3: Project Commands (/init, /status, /fix, /deploy)**
|
|
541
|
-
|
|
542
|
-
When automation is none:
|
|
543
|
-
"Think of /status as your project dashboard -- it shows what's healthy and what needs
|
|
544
|
-
attention." Run /status and narrate the output in plain language: what each field means.
|
|
545
|
-
Explain /fix as "the agent tidies up and applies updates."
|
|
546
|
-
Explain /deploy as "the agent publishes your changes in one step." Mention the
|
|
547
|
-
diagnostics skill: "If something goes wrong, the assistant automatically investigates."
|
|
548
|
-
Verify: Run /status. Narrate the output together.
|
|
549
|
-
Observation focus: project lifecycle concept, dashboard reading.
|
|
550
|
-
|
|
551
|
-
When automation is low-code:
|
|
552
|
-
Show all project commands with their purpose. Map to familiar concepts: /fix is
|
|
553
|
-
like "repair this Zap" in Zapier; /deploy is a one-command publish pipeline.
|
|
554
|
-
Walk through /status output: template version (SDK template your workspace
|
|
555
|
-
uses), SDK version (installed package), profile summary, drift check. Mention the
|
|
556
|
-
diagnostics skill auto-triggers on execution failures.
|
|
557
|
-
Verify: Run /status and interpret each field together.
|
|
558
|
-
Observation focus: deploy pipeline understanding, version tracking.
|
|
559
|
-
|
|
560
|
-
When automation is custom:
|
|
561
|
-
Read each command file in \`.claude/commands/\`: init.md (/init -- first-run setup
|
|
562
|
-
with assessment), status.md (/status -- health dashboard), fix.md (/fix -- drift
|
|
563
|
-
repair + SDK upgrade + rules health), deploy.md (/deploy -- 9-step pipeline: check,
|
|
564
|
-
typecheck, docs, git, deploy, project-map, verify, state, push). Explain the
|
|
565
|
-
diagnostics skill (auto-triggered on execution failures for runtime debugging).
|
|
566
|
-
Explain the merge strategy for CLAUDE.md and commands. Note the template access
|
|
567
|
-
model: templates read from @elevasis/sdk/templates subpath.
|
|
568
|
-
Verify: Run /status to see project status. Identify what a version mismatch looks like.
|
|
569
|
-
Observation focus: full lifecycle coverage, pipeline internals.
|
|
570
|
-
|
|
571
|
-
**Item 4: /work and /docs**
|
|
572
|
-
|
|
573
|
-
When automation is none:
|
|
574
|
-
"You can ask the assistant to track work across conversations. Just say /work and tell it
|
|
575
|
-
what you're working on -- it figures out the rest. It'll save your progress automatically,
|
|
576
|
-
and next session you just say /work to pick up where you left off." Walk through the
|
|
577
|
-
concept without deep command details. Then introduce /docs:
|
|
578
|
-
"When a task is done, the assistant will ask if you want to finalize it -- that moves it
|
|
579
|
-
to docs/ permanently. /docs helps you find and read what's there -- like a notebook for
|
|
580
|
-
your project." Run /docs (no args) to show the docs/ overview together.
|
|
581
|
-
Verify: Run \`/work\` and describe "practice task", see it created automatically.
|
|
582
|
-
Then run /docs to see the docs/ structure.
|
|
583
|
-
Observation focus: persistence concept, cross-session continuity, docs as permanent notes.
|
|
584
|
-
|
|
585
|
-
When automation is low-code:
|
|
586
|
-
Show /work as intent-driven: the agent detects whether to create, resume, or save based
|
|
587
|
-
on context. Create happens when you describe new work, resume when you pick an existing
|
|
588
|
-
task, save happens automatically when progress is made. Complete is the only action that
|
|
589
|
-
asks permission first.
|
|
590
|
-
Then introduce /docs: "/docs is for permanent knowledge -- things that don't expire. Use
|
|
591
|
-
/docs create to document a workflow or integration. Use /docs verify to check if your
|
|
592
|
-
docs match the current code." Explain the boundary: /work manages in-progress/, /docs
|
|
593
|
-
manages permanent docs/.
|
|
594
|
-
Verify: Run \`/work\` and describe "practice task", see auto-create. Make some changes,
|
|
595
|
-
then notice auto-save. Then run /docs to browse docs/.
|
|
596
|
-
Observation focus: intent-driven task tracking, /work vs /docs separation.
|
|
597
|
-
|
|
598
|
-
When automation is custom:
|
|
599
|
-
Read \`.claude/skills/work/SKILL.md\`. Full /work coverage:
|
|
600
|
-
Intent detection table (list, create, resume, save auto-invoked; complete always suggests).
|
|
601
|
-
Task doc anatomy: kebab-case filename, frontmatter with status, Objective/Plan/Progress/
|
|
602
|
-
Resume Context sections. Auto-save behavior: triggers on heavy context, wrap-up signals,
|
|
603
|
-
2+ steps completed. Resolution order for resume: number, keyword match, single in-progress.
|
|
604
|
-
Then read \`.claude/commands/docs.md\`. Cover /docs operations:
|
|
605
|
-
/docs (default): browse permanent docs/, categorized with read-only auto-generated files
|
|
606
|
-
separate; /docs create: interview-driven, resource-aware doc creation from src/ code
|
|
607
|
-
analysis; /docs verify: cross-references resource IDs, schema fields, platform tools in
|
|
608
|
-
docs against src/ -- standalone analog of /fix step 5.
|
|
609
|
-
Explain the relationship: /work owns docs/in-progress/ (task lifecycle), completing a task
|
|
610
|
-
moves docs to permanent location, /docs browses and verifies what's there.
|
|
611
|
-
Verify: Create a task via /work, make progress, observe auto-save, then run /work complete
|
|
612
|
-
to move it. Run /docs to see it in the permanent docs/ listing.
|
|
613
|
-
Observation focus: intent detection, auto-save behavior, /work-to-/docs handoff, docs verification.
|
|
614
|
-
|
|
615
|
-
**Item 5: Your First Custom Workflow**
|
|
616
|
-
|
|
617
|
-
When automation is none:
|
|
618
|
-
Frame the workflow as "a recipe." Use plain language: "settings" not "config",
|
|
619
|
-
"what data it needs" not "contract", "instructions" not "steps", "where it starts"
|
|
620
|
-
not "entryPoint." Agent writes all code changes. Agent runs \`elevasis-sdk exec\` to verify
|
|
621
|
-
and narrates the result in plain terms.
|
|
622
|
-
Observation focus: recipe-to-result connection.
|
|
623
|
-
|
|
624
|
-
When automation is low-code or custom:
|
|
625
|
-
Modify the echo workflow. Walk through each part: config, contract, steps,
|
|
626
|
-
entryPoint. Deploy: \`elevasis-sdk check\` then \`elevasis-sdk deploy\`. Test with
|
|
627
|
-
\`elevasis-sdk exec echo --input '{"message":"hello"}'\`. Then open the Execution
|
|
628
|
-
Runner in the Command Center, find the echo workflow, fill out the form, and
|
|
629
|
-
run it from the UI. Compare the result to the CLI output.
|
|
630
|
-
Observation focus: deployment-to-execution loop, TypeScript syntax comfort.
|
|
631
|
-
|
|
632
|
-
**Item 6: Understanding Data (Schemas)**
|
|
633
|
-
|
|
634
|
-
When automation is none:
|
|
635
|
-
Frame as "What information does your automation need?" Describe types in plain English:
|
|
636
|
-
text, number, yes/no, a choice from a list. NO Zod, no z.string(), no z.infer(), no
|
|
637
|
-
code shown. Agent reads identity.md goals and writes the workflow schema. Agent runs
|
|
638
|
-
\`elevasis-sdk exec\` with sample input and narrates the result.
|
|
639
|
-
Observation focus: data-to-input connection, required vs optional understanding.
|
|
640
|
-
|
|
641
|
-
When automation is low-code:
|
|
642
|
-
"Field mapping like Zapier, but with validation." Show Zod types briefly. Demonstrate
|
|
643
|
-
how \`.describe()\` documents each field. Build schema based on identity.md goals.
|
|
644
|
-
After deploy, run with \`elevasis-sdk exec --input '{...}'\` to verify each field.
|
|
645
|
-
Observation focus: schema-to-input mapping, optional fields, types.
|
|
646
|
-
|
|
647
|
-
When automation is custom:
|
|
648
|
-
Explain schemas in plain English (concepts page). Show common Zod types.
|
|
649
|
-
Explain \`z.infer\`. Build a new workflow with real-world input schema based
|
|
650
|
-
on the user's goals (read .claude/memory/profile/identity.md). After deploy,
|
|
651
|
-
run with \`elevasis-sdk exec --input '{...}'\` to verify the schema and inspect
|
|
652
|
-
the execution output.
|
|
653
|
-
Observation focus: schema-to-input mapping, optional fields, types.
|
|
654
|
-
|
|
655
|
-
**Item 7: Using Platform Tools**
|
|
656
|
-
|
|
657
|
-
When automation is none:
|
|
658
|
-
Frame as "Connecting your automation to a service you already use." Pick ONE
|
|
659
|
-
service from identity.md tools. Agent makes the code edit -- no adapter or
|
|
660
|
-
singleton explanation, no imports shown. Guide credential creation step-by-step
|
|
661
|
-
via Command Center UI (Settings > Credentials). Show where the connection appears
|
|
662
|
-
in Command View after deploy.
|
|
663
|
-
Observation focus: service-connection concept, credential comfort.
|
|
664
|
-
|
|
665
|
-
When automation is low-code or custom:
|
|
666
|
-
Explain platform tools (concepts page). Browse available tools via
|
|
667
|
-
reference/platform-tools/index.mdx. Pick a tool based on user's goals.
|
|
668
|
-
Build: add a tool step using typed adapters (preferred) or platform.call().
|
|
669
|
-
Show adapter pattern: \`const attio = createAttioAdapter('cred')\`.
|
|
670
|
-
Show singleton pattern: \`import { scheduler, llm } from '@elevasis/sdk/worker'\`.
|
|
671
|
-
Guide credential creation: for API keys, use the \`creds\` skill or Settings >
|
|
672
|
-
Credentials in the Command Center. For OAuth credentials, the UI is required.
|
|
673
|
-
If using the approval tool, note that pending requests surface in Command Queue.
|
|
674
|
-
See reference/platform-tools/adapters.mdx for full API.
|
|
675
|
-
Observation focus: credential setup (CLI + UI), async/await.
|
|
676
|
-
|
|
677
|
-
**Item 8: Multi-Step Workflows**
|
|
678
|
-
|
|
679
|
-
When automation is none:
|
|
680
|
-
Frame as "Step 1 passes its result to Step 2, like a relay race." Command View is
|
|
681
|
-
PRIMARY teaching tool -- show the visual graph before explaining code. Agent builds
|
|
682
|
-
the 2-step workflow. Agent runs \`elevasis-sdk exec\` to verify and shows output flow.
|
|
683
|
-
User opens Command View to see the two nodes + arrow. Code is secondary.
|
|
684
|
-
Observation focus: relay-race concept, visual graph comprehension.
|
|
685
|
-
|
|
686
|
-
When automation is low-code or custom:
|
|
687
|
-
Chain steps with StepType.LINEAR. Build a 2-step workflow. Explain data
|
|
688
|
-
flow between steps. Deploy and test. Then open the Command View and show the
|
|
689
|
-
relationship edges between resources. Explain how declared relationships map
|
|
690
|
-
to the visual graph.
|
|
691
|
-
Observation focus: data flow reasoning, relationship visualization.
|
|
692
|
-
|
|
693
|
-
**Item 9: Decision Points**
|
|
694
|
-
|
|
695
|
-
When automation is none:
|
|
696
|
-
Frame as "If the customer is VIP, do this -- otherwise, do that." No StepType.CONDITIONAL
|
|
697
|
-
jargon -- focus on the concept, not the implementation. Agent adds the condition.
|
|
698
|
-
Agent runs \`elevasis-sdk exec\` for both paths. Open Execution Logs to see which
|
|
699
|
-
path ran. Guide log navigation step-by-step.
|
|
700
|
-
Observation focus: branching concept understanding, log navigation.
|
|
701
|
-
|
|
702
|
-
When automation is low-code or custom:
|
|
703
|
-
Conditional routing with StepType.CONDITIONAL. Add a condition to the
|
|
704
|
-
multi-step workflow from Lesson 5. Test both paths. After testing, open
|
|
705
|
-
Execution Logs in the Command Center, filter by the resource, and show how
|
|
706
|
-
each path appears in the log detail (step trace, input/output).
|
|
707
|
-
Observation focus: branching logic reasoning, execution log interpretation.
|
|
708
|
-
|
|
709
|
-
**Item 10: Going to Production**
|
|
710
|
-
|
|
711
|
-
When automation is none:
|
|
712
|
-
Frame as "draft vs live" not "dev vs production." Error handling: "when something
|
|
713
|
-
goes wrong with your data" / "when a connected service fails" -- no type names.
|
|
714
|
-
Task Scheduler and Knowledge Base stay as-is (UI-friendly already). Open Deployments
|
|
715
|
-
page to show version is active.
|
|
716
|
-
Observation focus: draft/live concept, readiness for independent Command Center use.
|
|
717
|
-
|
|
718
|
-
When automation is low-code or custom:
|
|
719
|
-
Change status from dev to production. Cover error handling: try/catch,
|
|
720
|
-
ExecutionError, PlatformToolError. Create a schedule in Task Scheduler (use
|
|
721
|
-
Recurring type for a cron schedule). If docs/ has pages, show Knowledge Base.
|
|
722
|
-
Open Deployments page to confirm the latest version is active. Show CLI
|
|
723
|
-
monitoring: elevasis-sdk executions, elevasis-sdk execution. Suggest next steps.
|
|
724
|
-
Observation focus: readiness for independent operation (CLI + UI).
|
|
725
|
-
|
|
726
|
-
## Module Menu
|
|
727
|
-
|
|
728
|
-
Module order (items 11-19 in the main menu): hitl, schedules, notifications,
|
|
729
|
-
integrations, error-handling, workflows, composition, llm, agents.
|
|
730
|
-
|
|
731
|
-
After completing a module, show the updated full menu table (## Menu).
|
|
732
|
-
|
|
733
|
-
## Module Flow
|
|
734
|
-
|
|
735
|
-
Each module follows this flow:
|
|
736
|
-
1. Announce module title and what they'll build (1-2 sentences)
|
|
737
|
-
2. Read the listed SDK reference docs for teaching context
|
|
738
|
-
3. Guide user to build a resource exercising the module's concepts
|
|
739
|
-
4. Verify it works (CLI + Command Center where applicable)
|
|
740
|
-
5. Record observations in \`.claude/memory/tutorial-progress.md\`
|
|
741
|
-
6. Show updated full menu table (## Menu)
|
|
742
|
-
|
|
743
|
-
## Modules
|
|
744
|
-
|
|
745
|
-
**Module: hitl -- Human-in-the-Loop**
|
|
746
|
-
Read: \`reference/deployment/command-center.mdx\` (Command Queue section).
|
|
747
|
-
Build: Add an approval gate using \`approval.requestApproval()\`. Test full lifecycle:
|
|
748
|
-
trigger, see pending in Command Queue, approve/reject, observe resume.
|
|
749
|
-
Key concepts: approval adapter, pending state, Command Queue UI, resume on decision.
|
|
750
|
-
Verify: Trigger workflow, open Command Queue, approve, confirm completion.
|
|
751
|
-
|
|
752
|
-
**Module: schedules -- Task Scheduling**
|
|
753
|
-
Read: \`reference/deployment/command-center.mdx\` (Task Scheduler section).
|
|
754
|
-
Build: Create all three schedule types (Recurring cron, Relative delay, Absolute
|
|
755
|
-
datetime). Use \`scheduler\` adapter for in-workflow scheduling.
|
|
756
|
-
Key concepts: schedule types, cron syntax, scheduler adapter, Task Scheduler UI.
|
|
757
|
-
Verify: Create each type in Task Scheduler, confirm scheduled execution in Execution Logs.
|
|
758
|
-
|
|
759
|
-
**Module: notifications -- Notification System**
|
|
760
|
-
Read: \`reference/platform-tools/adapters.mdx\` (notifications, email singletons).
|
|
761
|
-
Build: Add notification and email steps to a workflow. Send alerts on completion.
|
|
762
|
-
Key concepts: notifications singleton, email singleton, alert patterns.
|
|
763
|
-
Verify: Run workflow, check notification in Command Center, confirm email received.
|
|
764
|
-
|
|
765
|
-
**Module: integrations -- Real-World Integrations**
|
|
766
|
-
Read: \`reference/platform-tools/index.mdx\`, \`reference/platform-tools/adapters.mdx\`,
|
|
767
|
-
\`reference/platform-tools/index.mdx\`.
|
|
768
|
-
Build: Pick a real integration adapter based on user's goals (read \`identity.md\`).
|
|
769
|
-
Set up credential (OAuth via UI, API key via CLI). Build end-to-end integration workflow.
|
|
770
|
-
Key concepts: adapter pattern, credential scoping, error handling for external calls.
|
|
771
|
-
Verify: Run workflow with real credential, confirm external service call, test error
|
|
772
|
-
handling with invalid credential.
|
|
773
|
-
|
|
774
|
-
**Module: error-handling -- Error Handling Mastery**
|
|
775
|
-
Read: \`reference/resources/patterns.mdx\` (error handling),
|
|
776
|
-
\`reference/troubleshooting.mdx\`.
|
|
777
|
-
Build: Create a workflow demonstrating all three error types. Add try/catch,
|
|
778
|
-
\`context.logger\`, and error recovery.
|
|
779
|
-
Key concepts: ExecutionError, PlatformToolError, ToolingError, recovery patterns.
|
|
780
|
-
Verify: Trigger each error type, confirm messages in Execution Logs with correct
|
|
781
|
-
categorization.
|
|
782
|
-
|
|
783
|
-
**Module: workflows -- Advanced Workflows**
|
|
784
|
-
Read: \`reference/resources/patterns.mdx\` (execution store, logging, organizing).
|
|
785
|
-
Build: Refactor an existing workflow to use \`context.store\` for cross-step data,
|
|
786
|
-
\`context.logger\` for structured logging, and organize into a domain directory.
|
|
787
|
-
Add advanced schema patterns (nested objects, arrays, optional fields).
|
|
788
|
-
Key concepts: context.store, context.logger, domain organization, schema depth.
|
|
789
|
-
Verify: Run workflow, confirm store values in step output, check logs in Execution Logs.
|
|
790
|
-
|
|
791
|
-
**Module: composition -- Resource Composition**
|
|
792
|
-
Read: \`reference/deployment/command-center.mdx\`, \`reference/resources/patterns.mdx\`.
|
|
793
|
-
Build: Create two workflows where the first triggers the second using
|
|
794
|
-
\`execution.trigger()\`. Declare the relationship.
|
|
795
|
-
Key concepts: execution.trigger, relationship declarations, Command View graph edges.
|
|
796
|
-
Verify: Deploy, see relationship edge in Command View, trigger parent and confirm
|
|
797
|
-
child executes.
|
|
798
|
-
|
|
799
|
-
**Module: llm -- LLM Integration**
|
|
800
|
-
Read: \`reference/platform-tools/adapters.mdx\` (llm singleton).
|
|
801
|
-
Build: Create a workflow step using \`llm.generate()\` with structured output.
|
|
802
|
-
Experiment with model selection and temperature.
|
|
803
|
-
Key concepts: llm singleton, structured output, model selection, temperature.
|
|
804
|
-
Verify: Run workflow, compare outputs with different settings, confirm structured output.
|
|
805
|
-
|
|
806
|
-
**Module: agents -- AI Agents**
|
|
807
|
-
Read: \`reference/framework/agent.mdx\`.
|
|
808
|
-
Build: Create an agent definition with tools. Configure LLM tool calling.
|
|
809
|
-
Compare agent vs workflow for a task.
|
|
810
|
-
Key concepts: agent definition, tool registration, LLM tool calling, execution trace.
|
|
811
|
-
Verify: Run agent with \`elevasis-sdk exec\`, review tool call trace in Execution Logs.
|
|
812
|
-
|
|
813
|
-
## Advanced Workspace Track
|
|
814
|
-
|
|
815
|
-
The Advanced Workspace track teaches power-user workspace customization and maintenance --
|
|
816
|
-
rules, memory, and the template lifecycle. Independent of the core path; can be taken at any time.
|
|
817
|
-
|
|
818
|
-
Each item follows the same flow as core lessons: announce, explain per skill level, verify, record observations.
|
|
819
|
-
|
|
820
|
-
**Item 20: Rules, Memory, and Customization**
|
|
821
|
-
|
|
822
|
-
When automation is none:
|
|
823
|
-
"The assistant has a set of reminders specific to your project. Over time, when it
|
|
824
|
-
makes the same mistake 3 times, you can tell it to always remember that rule -- it
|
|
825
|
-
lives in a file so the rule sticks across conversations."
|
|
826
|
-
Show \`.claude/rules/workspace-patterns.md\` without technical detail. Explain: "This
|
|
827
|
-
is where YOUR project's rules go. The other rule files are updated automatically by
|
|
828
|
-
SDK releases."
|
|
829
|
-
Verify: Open \`.claude/rules/workspace-patterns.md\` and read the current content together.
|
|
830
|
-
Observation focus: customization concept, owned vs managed files.
|
|
831
|
-
|
|
832
|
-
When automation is low-code:
|
|
833
|
-
Show the \`.claude/rules/\` directory. Explain the two types: sdk-patterns.md (MANAGED --
|
|
834
|
-
updated by elevasis-sdk update) and workspace-patterns.md (INIT_ONLY -- yours to edit).
|
|
835
|
-
Explain path-scoping briefly: "These rules only activate when the agent is working on
|
|
836
|
-
certain file types." Show an example rule with WRONG/RIGHT pattern. Explain error
|
|
837
|
-
promotion: if something goes wrong 3+ times, add it here.
|
|
838
|
-
Verify: Read \`.claude/rules/workspace-patterns.md\`. Note the "When to Add a Rule" section.
|
|
839
|
-
Observation focus: two-tier ownership model, rule format.
|
|
840
|
-
|
|
841
|
-
When automation is custom:
|
|
842
|
-
Read \`.claude/rules/sdk-patterns.md\` and \`.claude/rules/workspace-patterns.md\`.
|
|
843
|
-
Explain MANAGED vs INIT_ONLY lifecycle. Show rule frontmatter structure (paths: for
|
|
844
|
-
auto-loading by the agent). Explain the memory system layout: \`.claude/memory/\`
|
|
845
|
-
(index.md root, profile/ subdirectory, errors/ for promoted issues,
|
|
846
|
-
tutorial-progress.md). Explain error promotion: 3+ recurrences -> rule in
|
|
847
|
-
workspace-patterns.md. Walk through how to add a new rule.
|
|
848
|
-
Verify: Read \`.claude/rules/workspace-patterns.md\`. Add a sample rule entry together.
|
|
849
|
-
Observation focus: MANAGED vs INIT_ONLY lifecycle, rule authoring, memory layout.
|
|
850
|
-
|
|
851
|
-
**Item 21: Template Lifecycle**
|
|
852
|
-
|
|
853
|
-
When automation is none:
|
|
854
|
-
"When Elevasis SDK releases updates, the assistant can apply them to your workspace
|
|
855
|
-
automatically. You don't have to redo your customizations." Explain /fix as
|
|
856
|
-
the command that applies updates. Skip technical file classification details.
|
|
857
|
-
Show \`docs/project-map.mdx\` briefly: "This is an auto-generated map of everything
|
|
858
|
-
in your project -- the agent uses it for navigation."
|
|
859
|
-
Verify: Run /fix (or explain what it would do). Check \`docs/project-map.mdx\`.
|
|
860
|
-
Next steps: point to reference docs in docs/, encourage using /work for new tasks.
|
|
861
|
-
Observation focus: update model concept, project map as navigation aid.
|
|
862
|
-
|
|
863
|
-
When automation is low-code:
|
|
864
|
-
Explain MANAGED (auto-updated by elevasis-sdk update) vs INIT_ONLY (set once, yours).
|
|
865
|
-
Show how /fix applies SDK updates with conflict handling: "If a file changed,
|
|
866
|
-
it shows you both versions and lets you decide."
|
|
867
|
-
Show \`docs/project-map.mdx\` and explain what it contains: resources, commands,
|
|
868
|
-
rules, memory index. Note that deploy auto-regenerates it.
|
|
869
|
-
Verify: Read \`elevasis.config.ts\` templateVersion. Compare to the running SDK version from /status.
|
|
870
|
-
Observation focus: update workflow, project map freshness.
|
|
871
|
-
|
|
872
|
-
When automation is custom:
|
|
873
|
-
Read \`elevasis.config.ts\` for the current templateVersion. Read \`docs/project-map.mdx\`.
|
|
874
|
-
Explain the full template lifecycle: init (writes all files with classification),
|
|
875
|
-
update (applies MANAGED changes, flags conflicts, preserves INIT_ONLY), fix (detects
|
|
876
|
-
drift, offers SDK upgrade, runs full repair). Explain conflict handling: read current
|
|
877
|
-
file, read template from @elevasis/sdk/templates, merge preserving customizations.
|
|
878
|
-
Explain the project map: auto-generated by deploy, contains resource inventory,
|
|
879
|
-
command list, rule list, memory index.
|
|
880
|
-
Next steps: explore reference docs, use /work for complex tasks, build custom rules.
|
|
881
|
-
Verify: Compare elevasis.config.ts templateVersion with output of /status. Identify any drift.
|
|
882
|
-
Observation focus: full template lifecycle, conflict resolution pattern.
|
|
883
|
-
|
|
884
|
-
## Adaptation Rules
|
|
885
|
-
|
|
886
|
-
**automation: none**
|
|
887
|
-
Use the non-technical variant for each lesson. Agent writes all code -- user
|
|
888
|
-
never types code. Agent runs \`elevasis-sdk exec\` for verification and narrates results.
|
|
889
|
-
Avoid all jargon; use analogies. CLI is the primary verification tool.
|
|
890
|
-
Always deploy before directing the user to the Command Center.
|
|
891
|
-
|
|
892
|
-
**automation: low-code**
|
|
893
|
-
Map concepts to Zapier/Make equivalents. Show code with plain-English explanations.
|
|
894
|
-
CLI is the primary verification tool. Show Zod types with labels.
|
|
895
|
-
|
|
896
|
-
**automation: custom**
|
|
897
|
-
Full technical content. Code-first. CLI and UI are equal. Condense explanations
|
|
898
|
-
for intermediate/advanced users.
|
|
899
|
-
|
|
900
|
-
**General rules (all levels)**
|
|
901
|
-
- If user is fast, acknowledge and offer to skip ahead within a lesson
|
|
902
|
-
- After the user confirms readiness at the end of a lesson, update \`.claude/memory/tutorial-progress.md\`
|
|
903
|
-
- If user demonstrates a level change, promote to skills.md Growth Log
|
|
904
|
-
- After completing a module, show the updated full menu table
|
|
905
|
-
- Adapt module depth to skill level as with lessons
|
|
906
|
-
|
|
907
|
-
## Progress Format
|
|
908
|
-
|
|
909
|
-
On first \`/tutorial\` invocation, if \`.claude/memory/tutorial-progress.md\` does not exist,
|
|
910
|
-
create it with this exact format:
|
|
911
|
-
|
|
912
|
-
\`\`\`markdown
|
|
913
|
-
# Tutorial Progress
|
|
914
|
-
|
|
915
|
-
Current: Not started
|
|
916
|
-
Started: {today's date}
|
|
917
|
-
Last Session: {today's date}
|
|
918
|
-
|
|
919
|
-
## Completed Lessons
|
|
920
|
-
|
|
921
|
-
| Item | Title | Completed | Duration |
|
|
922
|
-
| --- | --- | --- | --- |
|
|
923
|
-
|
|
924
|
-
## Completed Modules
|
|
925
|
-
|
|
926
|
-
| Module | Title | Completed | Duration |
|
|
927
|
-
| --- | --- | --- | --- |
|
|
928
|
-
|
|
929
|
-
## Capability Observations
|
|
930
|
-
|
|
931
|
-
| Source | Observation |
|
|
932
|
-
| --- | --- |
|
|
933
|
-
|
|
934
|
-
## Assessment Notes
|
|
935
|
-
|
|
936
|
-
(none yet)
|
|
937
|
-
\`\`\`
|
|
938
|
-
|
|
939
|
-
Update rules:
|
|
940
|
-
- \`Current\`: free-form, e.g. "7: Using Platform Tools" or "M:integrations" or "20: Rules, Memory, and Customization"
|
|
941
|
-
- \`Last Session\`: update to today's date on each \`/tutorial\` invocation
|
|
942
|
-
- Completed Lessons: add a row when any numbered item (1-10, 20-21) finishes
|
|
943
|
-
- Completed Modules: add a row when any module (items 11-19) finishes
|
|
944
|
-
- Capability Observations: prefix source with item number for lessons (#), M:<id> for modules
|
|
945
|
-
- Assessment Notes: bullet points of general skill observations
|
|
946
|
-
|
|
947
|
-
Backward-compatible: missing Completed Modules treated as empty. Old files with Completed MF Lessons: map entries to items 2-4 and 20-21 by lesson title match.
|
|
948
|
-
`;
|
|
949
|
-
}
|
|
950
|
-
function claudeInitCommandTemplate() {
|
|
951
|
-
return `# /init command
|
|
952
|
-
|
|
953
|
-
You are a project management assistant for this Elevasis workspace.
|
|
954
|
-
|
|
955
|
-
## Context
|
|
956
|
-
|
|
957
|
-
Read \`elevasis.config.ts\` to get the current \`templateVersion\`.
|
|
958
|
-
Read \`package.json\` to get the installed \`@elevasis/sdk\` version.
|
|
959
|
-
Read \`.claude/memory/index.md\` if it exists for project state.
|
|
960
|
-
|
|
961
|
-
## Operation
|
|
962
|
-
|
|
963
|
-
Guided setup for a freshly scaffolded workspace. Triggered automatically
|
|
964
|
-
by the \`<!-- initialized: false -->\` flag in CLAUDE.md, or run manually.
|
|
965
|
-
|
|
966
|
-
1. **Install dependencies**
|
|
967
|
-
Run \`pnpm install\`. Wait for completion. Report any errors.
|
|
968
|
-
|
|
969
|
-
2. **Setup environment**
|
|
970
|
-
Read \`.env\`. It should contain only a single line: \`ELEVASIS_PLATFORM_KEY=\`.
|
|
971
|
-
If \`ELEVASIS_PLATFORM_KEY\` is empty or missing, ask the user: "What is your
|
|
972
|
-
Elevasis API key?" When the user provides it, write \`.env\` with exactly:
|
|
973
|
-
\`\`\`
|
|
974
|
-
ELEVASIS_PLATFORM_KEY=<value they provided>
|
|
975
|
-
\`\`\`
|
|
976
|
-
No other keys (no \`NODE_ENV\`, no extras). The \`.env\` file must contain
|
|
977
|
-
only \`ELEVASIS_PLATFORM_KEY\`.
|
|
978
|
-
Validate the key works: run \`elevasis-sdk resources\` (should return an empty
|
|
979
|
-
list, not an auth error). If auth fails, tell the user their key appears
|
|
980
|
-
invalid and ask them to check it in the Elevasis dashboard.
|
|
981
|
-
|
|
982
|
-
3. **Competency Assessment**
|
|
983
|
-
Ask these questions to build the user's profile:
|
|
984
|
-
|
|
985
|
-
Identity & Goals (3 questions):
|
|
986
|
-
- "What does your business or team do?"
|
|
987
|
-
- "What do you want to automate with Elevasis?"
|
|
988
|
-
- "Which tools does your team already use?" (email, CRM, spreadsheets, etc.)
|
|
989
|
-
|
|
990
|
-
Competency (2 questions):
|
|
991
|
-
- "Have you used the Elevasis Command Center before?"
|
|
992
|
-
Never used it -> platformNavigation: none
|
|
993
|
-
Explored it / know the main sections -> platformNavigation: oriented
|
|
994
|
-
Use it regularly -> platformNavigation: comfortable
|
|
995
|
-
- "Have you used automation tools? (Zapier, Make, cron jobs, scripts)"
|
|
996
|
-
No -> automation: none
|
|
997
|
-
Zapier/Make flows -> automation: low-code
|
|
998
|
-
Custom scripts -> automation: custom
|
|
999
|
-
|
|
1000
|
-
Inferred dimensions (do NOT ask, derive from answers above):
|
|
1001
|
-
- apiIntegration: automation: none -> none, low-code -> basic, custom -> proficient.
|
|
1002
|
-
Override: if tools answer includes API services (Stripe API, webhook, REST), upgrade one level.
|
|
1003
|
-
- domainExpertise: if goals are specific (names processes, metrics, edge cases) -> high.
|
|
1004
|
-
If goals are vague -> low.
|
|
1005
|
-
|
|
1006
|
-
Communication (1 question):
|
|
1007
|
-
- "Step-by-step explanations or concise answers?"
|
|
1008
|
-
|
|
1009
|
-
Write responses to memory:
|
|
1010
|
-
- Create \`.claude/memory/index.md\` (root index)
|
|
1011
|
-
- Create \`.claude/memory/profile/index.md\` (profile index)
|
|
1012
|
-
- Create \`.claude/memory/profile/identity.md\` (org, goals, tools)
|
|
1013
|
-
- Create \`.claude/memory/profile/skills.md\` using this exact format:
|
|
1014
|
-
|
|
1015
|
-
\`\`\`markdown
|
|
1016
|
-
# Skills
|
|
1017
|
-
|
|
1018
|
-
| Dimension | Level | Since |
|
|
1019
|
-
| --- | --- | --- |
|
|
1020
|
-
| platformNavigation | {level} | {date} |
|
|
1021
|
-
| apiIntegration | {level} | {date} |
|
|
1022
|
-
| automation | {level} | {date} |
|
|
1023
|
-
| domainExpertise | {level} | {date} |
|
|
1024
|
-
|
|
1025
|
-
## Growth Log
|
|
1026
|
-
|
|
1027
|
-
| Date | Observation | Dimension | Change |
|
|
1028
|
-
| --- | --- | --- | --- |
|
|
1029
|
-
\`\`\`
|
|
1030
|
-
|
|
1031
|
-
- Create \`.claude/memory/profile/preferences.md\` (verbosity, guidance)
|
|
1032
|
-
|
|
1033
|
-
4. **Git check**
|
|
1034
|
-
- If \`.git/\` exists: note git is configured in .claude/memory/profile/preferences.md
|
|
1035
|
-
- If \`.git/\` does not exist: suggest \`git init\` and optionally GitHub
|
|
1036
|
-
- If git remote exists: note remote URL in .claude/memory/profile/preferences.md
|
|
1037
|
-
|
|
1038
|
-
5. **Verify project**
|
|
1039
|
-
Run \`elevasis-sdk check\` to confirm the starter resource is valid.
|
|
1040
|
-
Optionally deploy the echo workflow.
|
|
1041
|
-
|
|
1042
|
-
6. **Report**
|
|
1043
|
-
Summary of what was set up. Suggest next steps based on goals.
|
|
1044
|
-
|
|
1045
|
-
If the user's Platform Navigation level is none or automation level is none,
|
|
1046
|
-
suggest /tutorial: "I recommend starting with /tutorial -- it walks
|
|
1047
|
-
you through building workflows step by step, at your own pace."
|
|
1048
|
-
|
|
1049
|
-
7. **Update flag**
|
|
1050
|
-
Change \`<!-- initialized: false -->\` to \`<!-- initialized: true -->\`
|
|
1051
|
-
in CLAUDE.md.
|
|
1052
|
-
`;
|
|
1053
|
-
}
|
|
1054
|
-
function claudeStatusCommandTemplate() {
|
|
1055
|
-
return `# /status command
|
|
1056
|
-
|
|
1057
|
-
You are a project management assistant for this Elevasis workspace.
|
|
1058
|
-
|
|
1059
|
-
## Context
|
|
1060
|
-
|
|
1061
|
-
Read \`elevasis.config.ts\` to get the current \`templateVersion\`.
|
|
1062
|
-
Read \`package.json\` to get the installed \`@elevasis/sdk\` version.
|
|
1063
|
-
Read \`.claude/memory/index.md\` if it exists for project state.
|
|
1064
|
-
|
|
1065
|
-
## Operation
|
|
1066
|
-
|
|
1067
|
-
Display a project health summary:
|
|
1068
|
-
1. Template version (from elevasis.config.ts) and installed SDK version (from package.json). Suggest \`elevasis-sdk update\` to check for updates
|
|
1069
|
-
2. Profile summary (from .claude/memory/profile/skills.md)
|
|
1070
|
-
3. Quick drift check: count of missing managed files, missing gitignore entries
|
|
1071
|
-
4. Last deployment status (from .claude/memory/deployment-state.md if it exists)
|
|
1072
|
-
`;
|
|
1073
|
-
}
|
|
1074
|
-
function claudeFixCommandTemplate() {
|
|
1075
|
-
return `# /fix command
|
|
1076
|
-
|
|
1077
|
-
You are a project management assistant for this Elevasis workspace.
|
|
1078
|
-
|
|
1079
|
-
## Context
|
|
1080
|
-
|
|
1081
|
-
Read \`elevasis.config.ts\` to get the current \`templateVersion\`.
|
|
1082
|
-
Read \`package.json\` to get the installed \`@elevasis/sdk\` version.
|
|
1083
|
-
Read \`.claude/memory/index.md\` if it exists for project state.
|
|
1084
|
-
|
|
1085
|
-
## Operation
|
|
1086
|
-
|
|
1087
|
-
Detect and repair all drift. Optionally upgrades the SDK first.
|
|
1088
|
-
|
|
1089
|
-
0. **SDK version check** -- Compare installed \`@elevasis/sdk\` against the latest
|
|
1090
|
-
available. If behind, offer to run \`pnpm update @elevasis/sdk\` before
|
|
1091
|
-
continuing. If the user accepts, run it, then run \`elevasis-sdk update\` to add
|
|
1092
|
-
any new managed files and flag conflicts. For each flagged file:
|
|
1093
|
-
- Read the current project file and the new template from \`@elevasis/sdk/templates\`
|
|
1094
|
-
- Add new sections that don't exist; preserve user customizations
|
|
1095
|
-
- If a section differs, show both versions and let the user choose
|
|
1096
|
-
1. **Missing managed files:** Regenerate from templates
|
|
1097
|
-
2. **Gitignore drift:** Append missing entries
|
|
1098
|
-
3. **CLAUDE.md sections:** Add missing sections in correct position
|
|
1099
|
-
4. **Memory structure:** Create base structure if missing, then verify index consistency.
|
|
1100
|
-
If \`.claude/memory/\` does not exist or is empty:
|
|
1101
|
-
- Create \`.claude/memory/index.md\` (root index with placeholder entries)
|
|
1102
|
-
- Create \`.claude/memory/errors/index.md\` (error category summary, empty tables)
|
|
1103
|
-
- Create \`.claude/memory/errors/deploy.md\`, \`.claude/memory/errors/runtime.md\`, \`.claude/memory/errors/typescript.md\`
|
|
1104
|
-
If memory exists, verify: every file referenced in an index exists; every file
|
|
1105
|
-
without an index entry gets one added; broken references are removed.
|
|
1106
|
-
5. **Documentation verification:** For each file in docs/:
|
|
1107
|
-
a. Cross-reference claims against src/ code (resource IDs, schema fields, platform tools used)
|
|
1108
|
-
b. Verify file path references point to real files
|
|
1109
|
-
c. Flag mismatches between documented schemas and actual resource definitions
|
|
1110
|
-
d. Check for undocumented resources (resources in src/ without docs coverage)
|
|
1111
|
-
e. Report discrepancies with suggested fixes
|
|
1112
|
-
Note: \`/docs verify\` is available for standalone interactive verification outside this pipeline.
|
|
1113
|
-
6. **Settings consistency:** Verify expected fields
|
|
1114
|
-
7. **Rules health:** Scan \`.claude/memory/errors/\` -- flag any entry that has recurred
|
|
1115
|
-
3+ times and is not yet in \`.claude/rules/workspace-patterns.md\`.
|
|
1116
|
-
If \`workspace-patterns.md\` has no rules yet and 5+ resources exist in \`src/\`,
|
|
1117
|
-
suggest adding patterns. Surface suggestions only -- do not auto-generate.
|
|
1118
|
-
8. **Project map freshness:** Check whether \`docs/project-map.mdx\` reflects the
|
|
1119
|
-
current project state (resources, commands, rules, skills, memory files).
|
|
1120
|
-
Compare filesystem state against the map. If stale, run \`elevasis-sdk deploy\`
|
|
1121
|
-
to regenerate, or patch inline for minor drift.
|
|
1122
|
-
|
|
1123
|
-
Each step reports its result. Steps 1-8 run even if step 0 is skipped.
|
|
1124
|
-
|
|
1125
|
-
## Merge Strategy
|
|
1126
|
-
|
|
1127
|
-
- **CLAUDE.md:** Add new sections in correct position. Preserve customizations.
|
|
1128
|
-
- **Commands:** Usually additive. Show diff for changes.
|
|
1129
|
-
- **.gitignore:** Append-only -- never remove existing entries.
|
|
1130
|
-
|
|
1131
|
-
## Template Access
|
|
1132
|
-
|
|
1133
|
-
The agent reads current templates from the installed SDK:
|
|
1134
|
-
\`@elevasis/sdk/templates\` subpath exports all template functions.
|
|
1135
|
-
`;
|
|
1136
|
-
}
|
|
1137
|
-
function claudeDeployCommandTemplate() {
|
|
1138
|
-
return `# /deploy command
|
|
1139
|
-
|
|
1140
|
-
You are a project management assistant for this Elevasis workspace.
|
|
1141
|
-
|
|
1142
|
-
## Context
|
|
1143
|
-
|
|
1144
|
-
Read \`elevasis.config.ts\` to get the current \`templateVersion\`.
|
|
1145
|
-
Read \`package.json\` to get the installed \`@elevasis/sdk\` version.
|
|
1146
|
-
Read \`.claude/memory/index.md\` if it exists for project state.
|
|
1147
|
-
|
|
1148
|
-
## Operation
|
|
1149
|
-
|
|
1150
|
-
0. Read \`reference/deployment/command-center.mdx\` -- understand the Command View
|
|
1151
|
-
model, relationship declarations, and what deploy-time validation checks.
|
|
1152
|
-
This context is essential for diagnosing validation failures in steps 1-2.
|
|
1153
|
-
1. Run \`elevasis-sdk check\` (validation)
|
|
1154
|
-
2. Type check if \`tsconfig.json\` exists
|
|
1155
|
-
3. Verify docs reflect current resources
|
|
1156
|
-
4. If git configured: stage changes, commit with deploy message
|
|
1157
|
-
5. Run \`elevasis-sdk deploy\`
|
|
1158
|
-
6. \`docs/project-map.mdx\` is auto-regenerated by deploy (no manual bump needed)
|
|
1159
|
-
7. Verify deployment via platform
|
|
1160
|
-
8. Update \`.claude/memory/deployment-state.md\` with count, timestamp, inventory
|
|
1161
|
-
9. If git configured and remote exists: optionally push
|
|
1162
|
-
|
|
1163
|
-
Each step reports its result. Pipeline stops on failure with suggested fix.
|
|
1164
|
-
If validation fails with relationship errors, re-read \`reference/deployment/command-center.mdx\`
|
|
1165
|
-
for the enforcement model and common fixes.
|
|
1166
|
-
`;
|
|
1167
|
-
}
|
|
1168
|
-
function claudeDiagnosticsSkillTemplate() {
|
|
1169
|
-
return `---
|
|
1170
|
-
name: diagnostics
|
|
1171
|
-
description: "Execution diagnostics and runtime debugging. TRIGGER when: an execution fails, user asks why something failed or errored, user mentions runtime errors or unexpected behavior, or agent observes a failed execution result. DO NOT TRIGGER when: user is discussing errors in code (type errors, lint errors) or build failures -- those are development issues, not runtime diagnostics."
|
|
1172
|
-
---
|
|
1173
|
-
|
|
1174
|
-
# Execution Diagnostics
|
|
1175
|
-
|
|
1176
|
-
You are a runtime diagnostics assistant for this Elevasis workspace.
|
|
1177
|
-
|
|
1178
|
-
## Context
|
|
1179
|
-
|
|
1180
|
-
Read \`.claude/memory/errors/index.md\` if it exists for past error patterns.
|
|
1181
|
-
Read \`.claude/memory/deployment-state.md\` if it exists for deployment context.
|
|
1182
|
-
|
|
1183
|
-
## When Triggered
|
|
1184
|
-
|
|
1185
|
-
Diagnose runtime failures and environment issues:
|
|
1186
|
-
|
|
1187
|
-
1. **Identify the failure** -- get the execution ID and resource ID from the error or conversation context
|
|
1188
|
-
2. **Pull execution details** -- run \`elevasis-sdk execution <resource-id> <execution-id>\` to get logs
|
|
1189
|
-
3. **Cross-reference** -- check \`.claude/memory/errors/\` for known patterns
|
|
1190
|
-
4. **Check deployment status** -- is the resource deployed? Is it the latest version?
|
|
1191
|
-
5. **Verify environment** -- API key valid, required credentials accessible
|
|
1192
|
-
6. **Diagnose root cause** -- analyze logs, identify the failing step, trace the error
|
|
1193
|
-
7. **Record** -- save new error patterns to \`.claude/memory/errors/\` with context and fix
|
|
1194
|
-
8. **Suggest fix** -- propose a concrete fix or next step
|
|
1195
|
-
|
|
1196
|
-
If the error has occurred before (found in memory/errors/), apply the known fix directly.
|
|
1197
|
-
If it recurs 3+ times, suggest adding a rule to \`.claude/rules/workspace-patterns.md\`.
|
|
1198
|
-
`;
|
|
1199
|
-
}
|
|
1200
|
-
function claudeWorkSkillTemplate() {
|
|
1201
|
-
return `---
|
|
1202
|
-
name: work
|
|
1203
|
-
description: "Task tracking and progress persistence. TRIGGER when: user says /work, asks to track or save progress across sessions, asks what they were working on, wants to create/resume/complete a task doc, or says they are done for today. DO NOT TRIGGER when: user is just doing work without wanting to track it in docs/in-progress/."
|
|
1204
|
-
---
|
|
1205
|
-
|
|
1206
|
-
# Task Tracking
|
|
1207
|
-
|
|
1208
|
-
You are a task tracking assistant for this Elevasis workspace. \`/work\` is the primary interface for managing all work and projects.
|
|
1209
|
-
|
|
1210
|
-
Your job is to **intelligently manage tasks without requiring the user to know subcommands**. Detect what the user needs from context and act accordingly.
|
|
1211
|
-
|
|
1212
|
-
## Context
|
|
1213
|
-
|
|
1214
|
-
Read \`docs/priorities.mdx\` if it exists for current priorities.
|
|
1215
|
-
Scan \`docs/in-progress/\` recursively for \`.mdx\` files with \`status\` frontmatter.
|
|
1216
|
-
|
|
1217
|
-
## Directory Structure
|
|
1218
|
-
|
|
1219
|
-
Task docs live in \`docs/in-progress/\`. Organize intelligently:
|
|
1220
|
-
|
|
1221
|
-
- **Small standalone tasks**: \`docs/in-progress/<slug>.mdx\`
|
|
1222
|
-
- **Multi-file tasks**: \`docs/in-progress/<slug>/index.mdx\` (+ supporting docs)
|
|
1223
|
-
- **Related tasks**: group under the same directory
|
|
1224
|
-
|
|
1225
|
-
When scanning, treat \`index.mdx\` as the primary task doc for a directory.
|
|
1226
|
-
|
|
1227
|
-
## Status Values
|
|
1228
|
-
|
|
1229
|
-
Enforce exactly three values in frontmatter: \`planned\`, \`in-progress\`, \`complete\`.
|
|
1230
|
-
|
|
1231
|
-
## Intent Detection
|
|
1232
|
-
|
|
1233
|
-
When \`/work\` is invoked (with or without arguments), detect intent from context:
|
|
1234
|
-
|
|
1235
|
-
| Signal | Action |
|
|
1236
|
-
|--------|--------|
|
|
1237
|
-
| No arguments, no active conversation context | **List** tasks, then let user pick |
|
|
1238
|
-
| User picks a number or names a task | **Resume** that task automatically |
|
|
1239
|
-
| User describes new work (not matching existing tasks) | **Create** a task doc automatically |
|
|
1240
|
-
| \`/work\` with a description that matches no existing task | **Create** automatically |
|
|
1241
|
-
| \`/work\` with a keyword/name matching an existing task | **Resume** automatically |
|
|
1242
|
-
| Conversation is getting heavy, user wrapping up, or 2+ steps completed | **Save** automatically |
|
|
1243
|
-
| All plan steps are COMPLETE | **Suggest** \`/work complete\` (never auto-invoke) |
|
|
1244
|
-
|
|
1245
|
-
**Key principle:** Create, save, and resume are auto-invoked. Complete always asks permission first.
|
|
1246
|
-
|
|
1247
|
-
## Behaviors
|
|
1248
|
-
|
|
1249
|
-
### List and Pick (default when no context)
|
|
1250
|
-
|
|
1251
|
-
1. Scan \`docs/in-progress/\` recursively for \`.mdx\` files with \`status\` frontmatter
|
|
1252
|
-
2. For directories, read \`index.mdx\` as the primary task doc
|
|
1253
|
-
3. Display a numbered list sorted by status (\`in-progress\` first, then \`planned\`, then \`complete\`):
|
|
1254
|
-
|
|
1255
|
-
\`\`\`
|
|
1256
|
-
Active Tasks
|
|
1257
|
-
============
|
|
1258
|
-
|
|
1259
|
-
1. [in-progress] SDK Adapter Migration
|
|
1260
|
-
Last saved: 2026-03-02 | Step 3/5: Building factory adapters
|
|
1261
|
-
|
|
1262
|
-
2. [planned] Email Template System
|
|
1263
|
-
Created: 2026-03-01 | Not started
|
|
1264
|
-
|
|
1265
|
-
3. [complete] CRM Integration
|
|
1266
|
-
Completed: 2026-03-03
|
|
1267
|
-
|
|
1268
|
-
Pick a task by number or name, or describe new work to start.
|
|
1269
|
-
\`\`\`
|
|
1270
|
-
|
|
1271
|
-
4. Cross-reference with \`docs/priorities.mdx\` if it exists
|
|
1272
|
-
5. When the user picks a number or describes a task, auto-invoke the appropriate flow (resume or create)
|
|
1273
|
-
6. If no tasks found, ask: "What are you trying to accomplish?"
|
|
1274
|
-
|
|
1275
|
-
### Create (auto-invoked when new work detected)
|
|
1276
|
-
|
|
1277
|
-
1. If the user's intent is clear, skip the interview and create directly
|
|
1278
|
-
2. If ambiguous, ask 1-2 focused questions:
|
|
1279
|
-
- "What does success look like?" (acceptance criteria)
|
|
1280
|
-
- "Do we need to investigate anything first, or is the path clear?"
|
|
1281
|
-
3. Scan \`docs/in-progress/\` for existing directories related to the topic
|
|
1282
|
-
4. Determine directory placement:
|
|
1283
|
-
- If related to existing directory, create as a file within it
|
|
1284
|
-
- If new concept that may grow, create \`docs/in-progress/<slug>/index.mdx\`
|
|
1285
|
-
- If small/standalone, create \`docs/in-progress/<slug>.mdx\`
|
|
1286
|
-
5. Create the doc with \`status: planned\` and structured sections:
|
|
1287
|
-
|
|
1288
|
-
\`\`\`yaml
|
|
1289
|
-
---
|
|
1290
|
-
title: {Task Title}
|
|
1291
|
-
description: {Concise description}
|
|
1292
|
-
status: planned
|
|
1293
|
-
---
|
|
1294
|
-
\`\`\`
|
|
1295
|
-
|
|
1296
|
-
Sections: Objective (what and why), Plan (numbered steps), Progress (per-step tracking with PENDING markers), Resume Context (current state, key docs, "To continue" prompt).
|
|
1297
|
-
|
|
1298
|
-
6. Update \`docs/priorities.mdx\` if it exists
|
|
1299
|
-
7. Report what was created with location and step count
|
|
1300
|
-
|
|
1301
|
-
### Save (auto-invoked when progress detected)
|
|
1302
|
-
|
|
1303
|
-
Auto-save triggers (do NOT ask, just save):
|
|
1304
|
-
- The conversation context is getting heavy (many tool calls, large file reads)
|
|
1305
|
-
- The user appears to be wrapping up (thanks, goodbye, switching topics)
|
|
1306
|
-
- Significant progress has been made (2+ steps completed without saving)
|
|
1307
|
-
- Before a context reset
|
|
1308
|
-
|
|
1309
|
-
Save flow:
|
|
1310
|
-
1. Identify the current task from conversation context
|
|
1311
|
-
2. If not working on a tracked task, offer to create a new one
|
|
1312
|
-
3. Update Progress section:
|
|
1313
|
-
- Mark completed steps as \`COMPLETE\` with: what was done, key decisions, files changed
|
|
1314
|
-
- Mark current step as \`IN PROGRESS\` with current state
|
|
1315
|
-
- Leave future steps as \`PENDING\`
|
|
1316
|
-
4. Update Resume Context section with:
|
|
1317
|
-
- Current State ({today's date}): summary of accomplishments and next steps
|
|
1318
|
-
- Files Modified: table of file paths and descriptions of changes
|
|
1319
|
-
- Key docs to read on resume: file paths with why they matter
|
|
1320
|
-
- To continue: copy-pasteable prompt for the next session
|
|
1321
|
-
5. Set \`status\` appropriately (\`in-progress\` if ongoing)
|
|
1322
|
-
6. Briefly confirm: "Progress saved to {path}."
|
|
1323
|
-
|
|
1324
|
-
### Resume (auto-invoked when existing task detected)
|
|
1325
|
-
|
|
1326
|
-
**Resolution order:**
|
|
1327
|
-
1. If a number is given, map to the numbered list from the task list
|
|
1328
|
-
2. If a name/keyword is given, substring match against task titles and filenames in \`docs/in-progress/\`
|
|
1329
|
-
3. If no argument, scan for \`status: in-progress\` docs -- if one found, use it; if multiple, list and ask
|
|
1330
|
-
4. If multiple matches, list them and ask which to resume
|
|
1331
|
-
|
|
1332
|
-
**Resume flow:**
|
|
1333
|
-
1. Read the target task doc
|
|
1334
|
-
2. Parse the Resume Context section
|
|
1335
|
-
3. Load key docs listed in "Key docs to read on resume" in parallel
|
|
1336
|
-
4. Quick verify: check that referenced files exist (Glob), report warnings for missing files
|
|
1337
|
-
5. Present resume summary:
|
|
1338
|
-
|
|
1339
|
-
\`\`\`
|
|
1340
|
-
Resuming: {task title}
|
|
1341
|
-
========================
|
|
1342
|
-
|
|
1343
|
-
Last completed: Step {N}: {title}
|
|
1344
|
-
Next: Step {M}: {title}
|
|
1345
|
-
|
|
1346
|
-
Key context loaded:
|
|
1347
|
-
- {doc 1}
|
|
1348
|
-
- {doc 2}
|
|
1349
|
-
|
|
1350
|
-
Ready to continue. {Copy of "To continue" prompt}
|
|
1351
|
-
\`\`\`
|
|
1352
|
-
|
|
1353
|
-
### Complete (NEVER auto-invoked -- always suggest)
|
|
1354
|
-
|
|
1355
|
-
When all plan steps are COMPLETE, suggest: "All steps for '{task}' look done. Want me to finalize it?"
|
|
1356
|
-
|
|
1357
|
-
Only proceed after explicit user confirmation. Then:
|
|
1358
|
-
|
|
1359
|
-
1. **Validate readiness:** Check that all plan steps are marked COMPLETE. If not, warn and ask for confirmation.
|
|
1360
|
-
2. **Clean up the doc:**
|
|
1361
|
-
- Strip \`## Resume Context\` section entirely (header through next \`##\` or EOF)
|
|
1362
|
-
- Strip progress markers: \`COMPLETE\`, \`IN PROGRESS\`, \`PENDING\` from step headings
|
|
1363
|
-
- Remove steps still marked PENDING entirely (header + body) -- they were never done
|
|
1364
|
-
- Remove \`status\` from frontmatter (keep \`title\` and \`description\`)
|
|
1365
|
-
- Target 200-400 lines; flag if result exceeds 500 lines
|
|
1366
|
-
3. **Determine destination:**
|
|
1367
|
-
- Scan \`docs/\` (excluding \`docs/in-progress/\`) for existing directories related to this work
|
|
1368
|
-
- If a related directory exists, propose merging into it
|
|
1369
|
-
- If no related directory, propose \`docs/<slug>/\` or \`docs/<slug>.mdx\`
|
|
1370
|
-
- Present the proposed destination and ask user to confirm
|
|
1371
|
-
4. **Move the doc(s):**
|
|
1372
|
-
- Single file: move from \`docs/in-progress/\` to destination
|
|
1373
|
-
- Directory: move entire directory
|
|
1374
|
-
5. **Verify and report:**
|
|
1375
|
-
- Confirm destination exists, source removed
|
|
1376
|
-
- Check no leftover \`status:\` or \`## Resume Context\` in moved files
|
|
1377
|
-
- Update \`docs/priorities.mdx\` if it exists
|
|
1378
|
-
- Report: task title, cleanup stats (lines before/after), destination path
|
|
1379
|
-
`;
|
|
1380
|
-
}
|
|
1381
|
-
function claudeDocsCommandTemplate() {
|
|
1382
|
-
return `# /docs command
|
|
1383
|
-
|
|
1384
|
-
You are a documentation assistant for this Elevasis workspace. \`/docs\` manages the
|
|
1385
|
-
permanent \`docs/\` tree -- browsing, creating reference content, and verifying accuracy
|
|
1386
|
-
against code.
|
|
1387
|
-
|
|
1388
|
-
**Scope:** Everything in \`docs/\` EXCEPT:
|
|
1389
|
-
- \`docs/in-progress/\` -- \`/work\`'s territory
|
|
1390
|
-
- \`docs/project-map.mdx\` and \`docs/resource-map.mdx\` -- auto-generated, read-only
|
|
1391
|
-
|
|
1392
|
-
## Context
|
|
1393
|
-
|
|
1394
|
-
Read \`.claude/memory/profile/skills.md\` first. The \`automation\` skill level controls
|
|
1395
|
-
how results are presented.
|
|
1396
|
-
|
|
1397
|
-
## Operations
|
|
1398
|
-
|
|
1399
|
-
### \`/docs\` (no arguments) -- Browse
|
|
1400
|
-
|
|
1401
|
-
Scan \`docs/\` recursively. Display:
|
|
1402
|
-
|
|
1403
|
-
\`\`\`
|
|
1404
|
-
Your Docs
|
|
1405
|
-
=========
|
|
1406
|
-
|
|
1407
|
-
Auto-generated (read-only):
|
|
1408
|
-
project-map.mdx Updated 2026-03-03
|
|
1409
|
-
resource-map.mdx Updated 2026-03-03
|
|
1410
|
-
|
|
1411
|
-
Reference (3):
|
|
1412
|
-
1. index.mdx Workspace overview
|
|
1413
|
-
2. priorities.mdx Current priorities
|
|
1414
|
-
3. crm-integration/ CRM integration guide (2 files)
|
|
1415
|
-
|
|
1416
|
-
Pick a number to read and discuss, or say:
|
|
1417
|
-
"create" to write a new doc
|
|
1418
|
-
"verify" to check docs against current code
|
|
1419
|
-
\`\`\`
|
|
1420
|
-
|
|
1421
|
-
Steps:
|
|
1422
|
-
1. Scan \`docs/\` recursively for \`.mdx\` files, excluding \`in-progress/\`
|
|
1423
|
-
2. Separate auto-generated files (\`project-map.mdx\`, \`resource-map.mdx\`) into a
|
|
1424
|
-
read-only group -- show modification date, no number
|
|
1425
|
-
3. Number all user-maintained docs. For directories, show \`index.mdx\` as primary
|
|
1426
|
-
with file count
|
|
1427
|
-
4. Sort: \`index.mdx\` first, \`priorities.mdx\` second, then alphabetical
|
|
1428
|
-
5. When user picks a number: read the file and present a summary. Ask what they
|
|
1429
|
-
want -- discuss, update, or go back
|
|
1430
|
-
6. If only auto-generated files and \`index.mdx\` exist, suggest: "Your docs/ is
|
|
1431
|
-
mostly empty. Run \`/docs create\` to add reference documentation."
|
|
1432
|
-
|
|
1433
|
-
**automation: none** -- Frame as "your project's knowledge base." Plain language:
|
|
1434
|
-
"These are your project's permanent notes. Pick one to read or discuss."
|
|
1435
|
-
|
|
1436
|
-
**automation: low-code** -- Standard presentation. Map to "like a wiki for your automations."
|
|
1437
|
-
|
|
1438
|
-
**automation: custom** -- Compact. Show file sizes and last-modified dates.
|
|
1439
|
-
|
|
1440
|
-
---
|
|
1441
|
-
|
|
1442
|
-
### \`create [description]\` -- Reference Doc Creation
|
|
1443
|
-
|
|
1444
|
-
Interview-driven creation for permanent documentation. Task docs go through \`/work\`.
|
|
1445
|
-
|
|
1446
|
-
1. If no description given, ask: "What do you want to document?"
|
|
1447
|
-
2. Determine doc type (infer or ask):
|
|
1448
|
-
- **Resource guide** -- documents a specific workflow or agent
|
|
1449
|
-
- **Integration guide** -- how a specific external tool is used
|
|
1450
|
-
- **Architecture notes** -- design decisions, system diagrams
|
|
1451
|
-
- **Process doc** -- operational procedures, runbooks
|
|
1452
|
-
- **General reference** -- glossaries, onboarding, anything else
|
|
1453
|
-
3. If the doc is about a specific resource: scan \`src/\` for matching resource IDs.
|
|
1454
|
-
If found, pre-populate with resource config, schemas, step names, and platform
|
|
1455
|
-
tools used. The user does not need to describe what the resource does.
|
|
1456
|
-
4. Determine placement:
|
|
1457
|
-
- Scan \`docs/\` for existing directories related to the topic
|
|
1458
|
-
- If related to an existing directory, propose adding to it
|
|
1459
|
-
- If the topic may grow into multiple files, create \`docs/<slug>/index.mdx\`
|
|
1460
|
-
- If small and standalone, create \`docs/<slug>.mdx\`
|
|
1461
|
-
5. Create with proper frontmatter:
|
|
1462
|
-
\`\`\`yaml
|
|
1463
|
-
---
|
|
1464
|
-
title: Guide Title
|
|
1465
|
-
description: What this covers
|
|
1466
|
-
---
|
|
1467
|
-
\`\`\`
|
|
1468
|
-
Sections by doc type:
|
|
1469
|
-
- **Resource guide:** Overview, Input/Output, How It Works, Platform Tools Used, Configuration
|
|
1470
|
-
- **Integration guide:** Overview, Setup (credentials), Data Model, Usage Patterns, Troubleshooting
|
|
1471
|
-
- **Architecture notes:** Context, Decision, Consequences, Alternatives Considered
|
|
1472
|
-
- **Process doc:** Purpose, Prerequisites, Steps, Recovery
|
|
1473
|
-
- **General reference:** determined by content
|
|
1474
|
-
6. Report what was created and suggest next steps.
|
|
1475
|
-
|
|
1476
|
-
**automation: none** -- Agent writes the full doc from code analysis. User reviews and
|
|
1477
|
-
approves. "I've written a guide for your CRM integration based on the code. Take a look
|
|
1478
|
-
and tell me if anything is missing."
|
|
1479
|
-
|
|
1480
|
-
**automation: low-code** -- Agent drafts, highlights sections the user should customize.
|
|
1481
|
-
Shows what was auto-detected vs what needs human input.
|
|
1482
|
-
|
|
1483
|
-
**automation: custom** -- Agent scaffolds structure and fills in code-derived content.
|
|
1484
|
-
Leaves technical prose to the user. Concise.
|
|
1485
|
-
|
|
1486
|
-
---
|
|
1487
|
-
|
|
1488
|
-
### \`verify [file?]\` -- Interactive Documentation Verification
|
|
1489
|
-
|
|
1490
|
-
Standalone interactive version of \`/fix\` step 5. Checks docs against current code.
|
|
1491
|
-
|
|
1492
|
-
**Without argument -- verify all:**
|
|
1493
|
-
|
|
1494
|
-
1. Scan \`docs/\` for user-maintained \`.mdx\` files (skip \`in-progress/\`,
|
|
1495
|
-
\`project-map.mdx\`, \`resource-map.mdx\`)
|
|
1496
|
-
2. For each file: cross-reference resource IDs, schema fields, and platform tools
|
|
1497
|
-
mentioned against \`src/\`
|
|
1498
|
-
3. Check for undocumented resources: resources in \`src/\` without docs coverage
|
|
1499
|
-
4. Present results interactively:
|
|
1500
|
-
|
|
1501
|
-
\`\`\`
|
|
1502
|
-
Docs Verification
|
|
1503
|
-
=================
|
|
1504
|
-
|
|
1505
|
-
crm-integration/index.mdx:
|
|
1506
|
-
- Line 23: references resourceId "attio-sync" but src/ has "attio-sync-v2"
|
|
1507
|
-
- Line 45: schema field "companyName" no longer exists in input schema
|
|
1508
|
-
|
|
1509
|
-
onboarding-guide.mdx:
|
|
1510
|
-
- No issues found
|
|
1511
|
-
|
|
1512
|
-
Undocumented resources (2):
|
|
1513
|
-
- email-sender (src/communications/email-sender.ts)
|
|
1514
|
-
- lead-scorer (src/scoring/lead-scorer.ts)
|
|
1515
|
-
|
|
1516
|
-
Fix crm-integration issues now? (yes/no/skip)
|
|
1517
|
-
\`\`\`
|
|
1518
|
-
|
|
1519
|
-
5. When user says yes: read source code, apply fixes to doc, show the diff
|
|
1520
|
-
6. For undocumented resources: offer to create a doc for each one (invokes \`create\` flow)
|
|
1521
|
-
|
|
1522
|
-
**With argument -- verify one file:**
|
|
1523
|
-
|
|
1524
|
-
Same but scoped to a single file. Resolves by substring match against \`docs/\` file names.
|
|
1525
|
-
|
|
1526
|
-
\`\`\`
|
|
1527
|
-
/docs verify crm-integration
|
|
1528
|
-
\`\`\`
|
|
1529
|
-
|
|
1530
|
-
**automation: none** -- Plain language: "Your CRM guide mentions a field called
|
|
1531
|
-
'companyName' but that field was renamed to 'company'. Want me to fix it?"
|
|
1532
|
-
|
|
1533
|
-
**automation: low-code** -- Standard presentation with suggested fixes.
|
|
1534
|
-
|
|
1535
|
-
**automation: custom** -- Compact diff-style. Auto-fix obvious issues, ask only for
|
|
1536
|
-
ambiguous ones.
|
|
1537
|
-
|
|
1538
|
-
---
|
|
1539
|
-
|
|
1540
|
-
## What /docs Does NOT Do
|
|
1541
|
-
|
|
1542
|
-
- Touch \`docs/in-progress/\` -- \`/work\`'s territory
|
|
1543
|
-
- Handle task lifecycle (planned / in-progress / complete)
|
|
1544
|
-
- Edit \`project-map.mdx\` or \`resource-map.mdx\` -- auto-generated, read-only
|
|
1545
|
-
- Replace \`/fix\` step 5 -- it supplements it with interactivity
|
|
1546
|
-
`;
|
|
1547
|
-
}
|
|
1548
|
-
function claudeCredsSkillTemplate() {
|
|
1549
|
-
return `---
|
|
1550
|
-
name: creds
|
|
1551
|
-
description: "Credential management assistant. TRIGGER when: user mentions credentials, API keys, secrets, webhook secrets, or asks to set up integrations that need authentication. DO NOT TRIGGER when: user is discussing code that references credentials without needing to manage them."
|
|
1552
|
-
---
|
|
1553
|
-
|
|
1554
|
-
# Credential Management
|
|
1555
|
-
|
|
1556
|
-
You are a credential management assistant for this Elevasis workspace.
|
|
1557
|
-
|
|
1558
|
-
## Context
|
|
1559
|
-
|
|
1560
|
-
Credentials are stored encrypted (AES-256-GCM) on the Elevasis platform and scoped to your
|
|
1561
|
-
organization. They are used by workflows and agents at runtime via \`platform.getCredential()\`
|
|
1562
|
-
or the \`credential:\` field on tool steps.
|
|
1563
|
-
|
|
1564
|
-
The SDK CLI (\`elevasis-sdk creds\`) manages credentials via API key authentication.
|
|
1565
|
-
Your \`ELEVASIS_PLATFORM_KEY\` in \`.env\` determines the organization.
|
|
1566
|
-
|
|
1567
|
-
## Credential Types
|
|
1568
|
-
|
|
1569
|
-
| Type | Value Format | Example Providers |
|
|
1570
|
-
| --- | --- | --- |
|
|
1571
|
-
| \`api-key\` | \`{"apiKey": "sk-..."}\` | Stripe, Resend, Apify, Attio, Instantly |
|
|
1572
|
-
| \`webhook-secret\` | \`{"signingSecret": "whsec_..."}\` | Cal.com, Stripe webhooks |
|
|
1573
|
-
| \`oauth\` | N/A (browser flow only) | Notion, Google Sheets, Dropbox |
|
|
1574
|
-
|
|
1575
|
-
OAuth credentials **cannot** be created via CLI. Redirect the user to the Command Center UI.
|
|
1576
|
-
|
|
1577
|
-
## Naming Rules
|
|
1578
|
-
|
|
1579
|
-
- Lowercase letters, digits, and hyphens only (\`[a-z0-9-]\`)
|
|
1580
|
-
- No consecutive hyphens (\`--\`)
|
|
1581
|
-
- 1-100 characters
|
|
1582
|
-
- Convention: \`{org}-{provider}\` (e.g., \`tester-stripe-key\`, \`my-project-resend\`)
|
|
1583
|
-
|
|
1584
|
-
## Operations
|
|
1585
|
-
|
|
1586
|
-
**No arguments (default):** Show this reference and list credentials.
|
|
1587
|
-
|
|
1588
|
-
**\`list\`:** List all credentials for the organization.
|
|
1589
|
-
\`\`\`bash
|
|
1590
|
-
elevasis-sdk creds list
|
|
1591
|
-
\`\`\`
|
|
1592
|
-
Display the output. Note which are \`oauth\` (not modifiable via CLI).
|
|
1593
|
-
|
|
1594
|
-
**\`create\`:** Guided credential creation flow:
|
|
1595
|
-
1. Ask credential type (\`api-key\` or \`webhook-secret\`). Not \`oauth\`.
|
|
1596
|
-
2. Ask credential name. Validate naming rules before proceeding.
|
|
1597
|
-
3. Ask the user to paste the credential value directly in chat.
|
|
1598
|
-
- For \`api-key\`: ask for the API key, construct \`{"apiKey": "..."}\`
|
|
1599
|
-
- For \`webhook-secret\`: ask for the signing secret, construct \`{"signingSecret": "..."}\`
|
|
1600
|
-
4. Pipe to CLI: \`echo '{"apiKey":"..."}' | elevasis-sdk creds create --name {name} --type {type}\`
|
|
1601
|
-
5. Confirm success. **NEVER echo the credential value back.**
|
|
1602
|
-
|
|
1603
|
-
**\`update\`:** Update credential value:
|
|
1604
|
-
1. Run \`elevasis-sdk creds list\` to confirm the credential exists.
|
|
1605
|
-
2. Ask the user to paste the new value.
|
|
1606
|
-
3. Pipe to CLI: \`echo '{"apiKey":"..."}' | elevasis-sdk creds update {name}\`
|
|
1607
|
-
4. Confirm success. **NEVER echo the value.**
|
|
1608
|
-
|
|
1609
|
-
**\`rename\`:** Rename a credential:
|
|
1610
|
-
1. Run \`elevasis-sdk creds list\` to confirm it exists.
|
|
1611
|
-
2. Ask for the new name. Validate naming rules.
|
|
1612
|
-
3. Run: \`elevasis-sdk creds rename {name} --to {newName}\`
|
|
1613
|
-
|
|
1614
|
-
**\`delete\`:** Delete a credential:
|
|
1615
|
-
1. Run \`elevasis-sdk creds list\` to confirm it exists.
|
|
1616
|
-
2. Confirm with user before proceeding.
|
|
1617
|
-
3. Run: \`elevasis-sdk creds delete {name} --force\`
|
|
1618
|
-
|
|
1619
|
-
**\`webhook-url\`:** Generate a webhook URL:
|
|
1620
|
-
Ask for provider, org UUID, resource ID, and credential name. Construct:
|
|
1621
|
-
\`POST https://api.elevasis.io/api/webhooks/{provider}?org={uuid}&resource={resourceId}&credential={credentialName}\`
|
|
1622
|
-
|
|
1623
|
-
**\`audit\`:** Scan project for credential references:
|
|
1624
|
-
1. Search \`src/**/*.ts\` for \`credential:\` patterns and \`platform.getCredential()\` calls.
|
|
1625
|
-
2. Extract all credential names referenced.
|
|
1626
|
-
3. Run \`elevasis-sdk creds list\` to get the actual credential list.
|
|
1627
|
-
4. Report: missing credentials (referenced but not created), unused credentials (created but not referenced).
|
|
1628
|
-
|
|
1629
|
-
## Security Rules (MANDATORY)
|
|
1630
|
-
|
|
1631
|
-
- **NEVER** log, repeat, or display credential values after the user provides them
|
|
1632
|
-
- **NEVER** store credential values in files, memory, or command history
|
|
1633
|
-
- If an API call fails, ask the user to **re-paste** rather than retrying with a cached value
|
|
1634
|
-
- Always confirm name and type **before** asking for the value
|
|
1635
|
-
- OAuth credentials cannot be created via CLI -- redirect to Command Center UI
|
|
1636
|
-
`;
|
|
1637
|
-
}
|
|
1638
|
-
function claudeSdkPatternsRuleTemplate() {
|
|
1639
|
-
return `---
|
|
1640
|
-
description: Elevasis SDK patterns -- imports, source structure, runtime, and platform tools
|
|
1641
|
-
paths:
|
|
1642
|
-
- src/**
|
|
1643
|
-
- elevasis.config.ts
|
|
1644
|
-
---
|
|
1645
|
-
|
|
1646
|
-
# SDK Patterns
|
|
1647
|
-
|
|
1648
|
-
## Imports
|
|
1649
|
-
|
|
1650
|
-
- \`@elevasis/sdk\` -- types and constants: \`WorkflowDefinition\`, \`StepType\`, \`ExecutionError\`, \`ToolingError\`
|
|
1651
|
-
- \`@elevasis/sdk/worker\` -- runtime: \`platform\`, \`PlatformToolError\`, typed adapters
|
|
1652
|
-
- **Never import from \`@repo/core\`** -- monorepo-internal, not available in external projects
|
|
1653
|
-
|
|
1654
|
-
## Source Structure
|
|
1655
|
-
|
|
1656
|
-
- All resource definitions live in \`src/\` and are exported via \`src/index.ts\`
|
|
1657
|
-
- Organize by business domain: \`src/<domain>/\` (e.g., \`src/operations/\`, \`src/acquisition/\`)
|
|
1658
|
-
- Each domain barrel (\`src/<domain>/index.ts\`) exports \`workflows\` and \`agents\` arrays
|
|
1659
|
-
- Cross-domain utilities go in \`src/shared/\`; domain-specific utilities in \`src/<domain>/shared/\`
|
|
1660
|
-
- The default export in \`src/index.ts\` must be a \`DeploymentSpec\` object
|
|
1661
|
-
- \`resourceId\` must be lowercase with hyphens, unique per organization
|
|
1662
|
-
- \`dist/\` is generated by deploy -- never commit it
|
|
1663
|
-
|
|
1664
|
-
## Runtime
|
|
1665
|
-
|
|
1666
|
-
- \`.env\` contains only \`ELEVASIS_PLATFORM_KEY\` for CLI auth -- never deployed, never in worker memory
|
|
1667
|
-
- Integration credentials are managed via the \`creds\` skill or Command Center UI
|
|
1668
|
-
|
|
1669
|
-
## Platform Tools
|
|
1670
|
-
|
|
1671
|
-
Prefer typed adapters over raw \`platform.call()\`.
|
|
1672
|
-
|
|
1673
|
-
### Singleton adapters (no credential needed)
|
|
1674
|
-
|
|
1675
|
-
\`\`\`typescript
|
|
1676
|
-
import { scheduler, storage, llm, notifications, acqDb, pdf, approval, execution, email } from '@elevasis/sdk/worker'
|
|
1677
|
-
\`\`\`
|
|
1678
|
-
|
|
1679
|
-
### Factory adapters (credential-bound)
|
|
1680
|
-
|
|
1681
|
-
\`\`\`typescript
|
|
1682
|
-
import { createAttioAdapter, createResendAdapter } from '@elevasis/sdk/worker'
|
|
1683
|
-
const attio = createAttioAdapter('credential-name')
|
|
1684
|
-
\`\`\`
|
|
1685
|
-
|
|
1686
|
-
Use \`platform.call()\` directly only for tools without adapters: \`supabase\`, \`session-memory\`, \`hitl\`, \`status\`, \`http\`.
|
|
1687
|
-
`;
|
|
1688
|
-
}
|
|
1689
|
-
function claudeDocsAuthoringRuleTemplate() {
|
|
1690
|
-
return `---
|
|
1691
|
-
description: Documentation conventions for docs/ files -- MDX escaping, frontmatter, structure
|
|
1692
|
-
paths:
|
|
1693
|
-
- docs/**/*.mdx
|
|
1694
|
-
---
|
|
1695
|
-
|
|
1696
|
-
# Docs Authoring
|
|
1697
|
-
|
|
1698
|
-
## MDX Escaping
|
|
1699
|
-
|
|
1700
|
-
- Less-than \`<\` must be \`\\<\` (MDX interprets bare \`<\` as JSX tag)
|
|
1701
|
-
- Curly braces \`{var}\` must be in backticks or escaped: \`\\{var\\}\`
|
|
1702
|
-
- Greater-than \`>\` must be \`\\>\`
|
|
1703
|
-
|
|
1704
|
-
## Frontmatter
|
|
1705
|
-
|
|
1706
|
-
Every \`.mdx\` file requires \`title\` and \`description\`:
|
|
1707
|
-
|
|
1708
|
-
\`\`\`yaml
|
|
1709
|
-
---
|
|
1710
|
-
title: Feature Name
|
|
1711
|
-
description: Concise description
|
|
1712
|
-
---
|
|
1713
|
-
\`\`\`
|
|
1714
|
-
|
|
1715
|
-
## Structure
|
|
1716
|
-
|
|
1717
|
-
- \`docs/project-map.mdx\` is auto-generated -- do not edit manually
|
|
1718
|
-
- \`docs/in-progress/\` for task tracking docs
|
|
1719
|
-
- Sort order via \`order\` frontmatter field (lower = earlier)
|
|
1720
|
-
`;
|
|
1721
|
-
}
|
|
1722
|
-
function claudeMemoryConventionsRuleTemplate() {
|
|
1723
|
-
return `---
|
|
1724
|
-
description: Memory system conventions -- what to store, structure, pruning
|
|
1725
|
-
paths:
|
|
1726
|
-
- .claude/memory/**
|
|
1727
|
-
---
|
|
1728
|
-
|
|
1729
|
-
# Memory Conventions
|
|
1730
|
-
|
|
1731
|
-
## What Memory Is
|
|
1732
|
-
|
|
1733
|
-
Memory stores persistent agent state: skills, errors, tutorial progress.
|
|
1734
|
-
It is NOT for instructions (commands), reference docs, or templates.
|
|
1735
|
-
|
|
1736
|
-
## Structure
|
|
1737
|
-
|
|
1738
|
-
- \`index.md\` at every level maps to children
|
|
1739
|
-
- Start at root index and drill down
|
|
1740
|
-
- When a file outgrows a single document, split into a subdirectory
|
|
1741
|
-
|
|
1742
|
-
## Pruning
|
|
1743
|
-
|
|
1744
|
-
- Keep ~20 recent entries per table; drop stale patterns (30+ days)
|
|
1745
|
-
- If an error recurs 3+ times, promote to \`.claude/rules/workspace-patterns.md\`
|
|
1746
|
-
`;
|
|
1747
|
-
}
|
|
1748
|
-
function claudeProjectMapRuleTemplate() {
|
|
1749
|
-
return `---
|
|
1750
|
-
description: Project map conventions -- auto-generated, do not edit, maintained by deploy and /fix
|
|
1751
|
-
paths:
|
|
1752
|
-
- docs/project-map.mdx
|
|
1753
|
-
- docs/resource-map.mdx
|
|
1754
|
-
---
|
|
1755
|
-
|
|
1756
|
-
# Project Map
|
|
1757
|
-
|
|
1758
|
-
- \`docs/project-map.mdx\` and \`docs/resource-map.mdx\` are fully auto-generated by \`elevasis-sdk deploy\`
|
|
1759
|
-
- Do not edit either file manually -- changes are overwritten on next deploy
|
|
1760
|
-
- \`/fix\` step 8 checks for drift and patches the map
|
|
1761
|
-
- If a new command, rule, skill, or memory file is added, run \`/fix\` or \`elevasis-sdk deploy\` to update
|
|
1762
|
-
`;
|
|
1763
|
-
}
|
|
1764
|
-
function claudeTaskTrackingRuleTemplate() {
|
|
1765
|
-
return `---
|
|
1766
|
-
description: In-progress task conventions -- /work command, doc format, status values, auto-save behavior
|
|
1767
|
-
paths:
|
|
1768
|
-
- docs/in-progress/**
|
|
1769
|
-
---
|
|
1770
|
-
|
|
1771
|
-
# Task Tracking
|
|
1772
|
-
|
|
1773
|
-
## Status Values
|
|
1774
|
-
|
|
1775
|
-
Exactly three values for frontmatter \`status\`: \`planned\`, \`in-progress\`, \`complete\`.
|
|
1776
|
-
|
|
1777
|
-
## Doc Format
|
|
1778
|
-
|
|
1779
|
-
- Frontmatter: \`title\`, \`description\`, \`status\`
|
|
1780
|
-
- Sections: Objective, Plan, Progress, Resume Context
|
|
1781
|
-
- Progress subsections use markers: \`### Step N: Title -- PENDING\`, \`-- IN PROGRESS\`, \`-- COMPLETE\`
|
|
1782
|
-
|
|
1783
|
-
## Auto-Update Behavior
|
|
1784
|
-
|
|
1785
|
-
- When working on a tracked task, update the Progress section when a plan step transitions:
|
|
1786
|
-
- PENDING -> IN PROGRESS (starting work on a step)
|
|
1787
|
-
- IN PROGRESS -> COMPLETE (finishing a step)
|
|
1788
|
-
- Do NOT update on every action -- only on step transitions
|
|
1789
|
-
|
|
1790
|
-
## Auto-Save Behavior
|
|
1791
|
-
|
|
1792
|
-
The agent auto-saves progress (no user action needed) when:
|
|
1793
|
-
- The conversation context is getting heavy (many tool calls, large file reads)
|
|
1794
|
-
- The user appears to be wrapping up (thanks, goodbye, switching topics)
|
|
1795
|
-
- Significant progress has been made (2+ steps completed without saving)
|
|
1796
|
-
- Before a context reset
|
|
1797
|
-
|
|
1798
|
-
Auto-save updates the task doc's Progress and Resume Context sections silently, then briefly confirms.
|
|
1799
|
-
|
|
1800
|
-
## Completion Suggestions
|
|
1801
|
-
|
|
1802
|
-
When all plan steps are marked COMPLETE, **suggest** completing the task -- never auto-invoke. Ask: "All steps for '{task}' look done. Want me to finalize it?"
|
|
1803
|
-
|
|
1804
|
-
## Directory Conventions
|
|
1805
|
-
|
|
1806
|
-
- \`docs/in-progress/\` for all active task docs
|
|
1807
|
-
- Small tasks: \`<slug>.mdx\` directly in \`docs/in-progress/\`
|
|
1808
|
-
- Multi-file tasks: \`<slug>/index.mdx\` with supporting docs alongside
|
|
1809
|
-
- Completed tasks move OUT of \`docs/in-progress/\` to \`docs/<relevant-dir>/\`
|
|
1810
|
-
`;
|
|
1811
|
-
}
|
|
1812
|
-
function claudeLoggingRuleTemplate() {
|
|
1813
|
-
return `---
|
|
1814
|
-
description: Logging conventions for workflow and agent handlers
|
|
1815
|
-
paths:
|
|
1816
|
-
- src/**
|
|
1817
|
-
---
|
|
1818
|
-
|
|
1819
|
-
# Logging
|
|
1820
|
-
|
|
1821
|
-
## Always Use \`context.logger\` in Handlers
|
|
1822
|
-
|
|
1823
|
-
**Never use \`console.log\`, \`console.warn\`, or \`console.error\` in step/agent handlers.**
|
|
1824
|
-
The platform does not capture \`console.*\` output \u2014 it will not appear in execution logs.
|
|
1825
|
-
|
|
1826
|
-
\`\`\`typescript
|
|
1827
|
-
// \u274C WRONG \u2014 invisible in Command Center
|
|
1828
|
-
handler: async (rawInput) => {
|
|
1829
|
-
console.log('Processing...')
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
// \u2705 CORRECT \u2014 visible in Command Center
|
|
1833
|
-
handler: async (rawInput, context) => {
|
|
1834
|
-
context.logger.info('Processing...')
|
|
1835
|
-
}
|
|
1836
|
-
\`\`\`
|
|
1837
|
-
|
|
1838
|
-
## Logger Methods
|
|
1839
|
-
|
|
1840
|
-
\`\`\`typescript
|
|
1841
|
-
context.logger.debug('Verbose detail \u2014 shown in debug mode only')
|
|
1842
|
-
context.logger.info('Normal progress messages')
|
|
1843
|
-
context.logger.warn('Non-fatal issue \u2014 skipped, retried, partial result')
|
|
1844
|
-
context.logger.error('Fatal error or unexpected failure')
|
|
1845
|
-
\`\`\`
|
|
1846
|
-
|
|
1847
|
-
## Extensive Logging Standard
|
|
1848
|
-
|
|
1849
|
-
Every handler should log:
|
|
1850
|
-
|
|
1851
|
-
1. **Entry** \u2014 step name + key input params (category, count, domain, etc.)
|
|
1852
|
-
2. **Progress** \u2014 inside loops: per-item status (processed, skipped, failed)
|
|
1853
|
-
3. **Decisions** \u2014 idempotency skips, early exits, conditional branches
|
|
1854
|
-
4. **Summary** \u2014 counts at the end (X processed, Y skipped, Z errors)
|
|
1855
|
-
|
|
1856
|
-
\`\`\`typescript
|
|
1857
|
-
handler: async (rawInput, context) => {
|
|
1858
|
-
const data = rawInput as SomeType
|
|
1859
|
-
context.logger.info(\`[step-name] Starting \u2014 \${data.items.length} items\`)
|
|
1860
|
-
|
|
1861
|
-
let processed = 0, skipped = 0
|
|
1862
|
-
for (const item of data.items) {
|
|
1863
|
-
if (item.alreadyDone) {
|
|
1864
|
-
skipped++
|
|
1865
|
-
context.logger.info(\`[step-name] Skipping \${item.name} \u2014 already complete\`)
|
|
1866
|
-
continue
|
|
1867
|
-
}
|
|
1868
|
-
// ...
|
|
1869
|
-
processed++
|
|
1870
|
-
context.logger.info(\`[step-name] Processed \${item.name}\`)
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
context.logger.info(\`[step-name] Done \u2014 \${processed} processed, \${skipped} skipped\`)
|
|
1874
|
-
}
|
|
1875
|
-
\`\`\`
|
|
1876
|
-
|
|
1877
|
-
## Warnings vs Errors
|
|
1878
|
-
|
|
1879
|
-
- \`warn\`: skipped item, not found in DB, LLM timeout on one domain (processing continues)
|
|
1880
|
-
- \`error\`: step-level failures that propagate as thrown errors (log before throwing if possible)
|
|
1881
|
-
`;
|
|
1882
|
-
}
|
|
1883
|
-
function claudePostEditValidateHookTemplate() {
|
|
1884
|
-
return `#!/usr/bin/env node
|
|
1885
|
-
// post-edit-validate.mjs
|
|
1886
|
-
// PostToolUse hook \u2014 auto-formats with prettier, type-checks .ts/.tsx files.
|
|
1887
|
-
// Fires after Edit|Write|MultiEdit succeeds.
|
|
1888
|
-
|
|
1889
|
-
import { existsSync } from 'node:fs'
|
|
1890
|
-
import { resolve, normalize, extname, join, dirname } from 'node:path'
|
|
1891
|
-
import { execSync } from 'node:child_process'
|
|
1892
|
-
|
|
1893
|
-
const ROOT = process.env.CLAUDE_PROJECT_DIR ?? process.cwd()
|
|
1894
|
-
|
|
1895
|
-
// Extensions prettier should format
|
|
1896
|
-
const PRETTIER_EXTENSIONS = new Set([
|
|
1897
|
-
'.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.json', '.css', '.md', '.mdx'
|
|
1898
|
-
])
|
|
1899
|
-
|
|
1900
|
-
// Extensions that trigger type-checking
|
|
1901
|
-
const TS_EXTENSIONS = new Set(['.ts', '.tsx'])
|
|
1902
|
-
|
|
1903
|
-
function findNearestTsconfig(startDir) {
|
|
1904
|
-
let dir = startDir
|
|
1905
|
-
const root = normalize(ROOT)
|
|
1906
|
-
while (dir.length >= root.length) {
|
|
1907
|
-
const candidate = join(dir, 'tsconfig.json')
|
|
1908
|
-
if (existsSync(candidate)) return candidate
|
|
1909
|
-
const parent = dirname(dir)
|
|
1910
|
-
if (parent === dir) break
|
|
1911
|
-
dir = parent
|
|
1912
|
-
}
|
|
1913
|
-
return null
|
|
1914
|
-
}
|
|
1915
|
-
|
|
1916
|
-
try {
|
|
1917
|
-
const chunks = []
|
|
1918
|
-
for await (const chunk of process.stdin) chunks.push(chunk)
|
|
1919
|
-
const input = JSON.parse(Buffer.concat(chunks).toString())
|
|
1920
|
-
|
|
1921
|
-
const filePath = input.tool_input?.file_path
|
|
1922
|
-
if (!filePath) process.exit(0)
|
|
1923
|
-
|
|
1924
|
-
const ext = extname(filePath).toLowerCase()
|
|
1925
|
-
const absPath = normalize(resolve(filePath))
|
|
1926
|
-
if (!existsSync(absPath)) process.exit(0)
|
|
1927
|
-
|
|
1928
|
-
const results = []
|
|
1929
|
-
|
|
1930
|
-
// 1. Prettier
|
|
1931
|
-
if (PRETTIER_EXTENSIONS.has(ext)) {
|
|
1932
|
-
try {
|
|
1933
|
-
execSync('pnpm exec prettier --write "' + absPath + '"', {
|
|
1934
|
-
cwd: ROOT,
|
|
1935
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
1936
|
-
timeout: 10_000
|
|
1937
|
-
})
|
|
1938
|
-
} catch (err) {
|
|
1939
|
-
const stderr = err.stderr?.toString().trim() || ''
|
|
1940
|
-
if (stderr && !/ignored/i.test(stderr)) {
|
|
1941
|
-
results.push('Prettier error: ' + stderr.slice(0, 300))
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
|
|
1946
|
-
// 2. Type-check for .ts/.tsx
|
|
1947
|
-
if (TS_EXTENSIONS.has(ext)) {
|
|
1948
|
-
const tsconfig = findNearestTsconfig(dirname(absPath))
|
|
1949
|
-
if (tsconfig) {
|
|
1950
|
-
try {
|
|
1951
|
-
execSync('pnpm exec tsc --noEmit -p "' + tsconfig + '"', {
|
|
1952
|
-
cwd: ROOT,
|
|
1953
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
1954
|
-
timeout: 30_000,
|
|
1955
|
-
env: { ...process.env, NODE_OPTIONS: '--max-old-space-size=4096' }
|
|
1956
|
-
})
|
|
1957
|
-
} catch (err) {
|
|
1958
|
-
if (err.killed) process.exit(0) // Don't block on timeout
|
|
1959
|
-
const stdout = err.stdout?.toString() || ''
|
|
1960
|
-
if (stdout.includes('error TS')) {
|
|
1961
|
-
const errorLines = stdout
|
|
1962
|
-
.split('\\n')
|
|
1963
|
-
.filter(l => l.includes('error TS'))
|
|
1964
|
-
.slice(0, 10)
|
|
1965
|
-
results.push('Type errors after editing ' + filePath + ':\\n' + errorLines.join('\\n'))
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
// Output errors to Claude's context (silence = success)
|
|
1972
|
-
if (results.length > 0) {
|
|
1973
|
-
process.stderr.write(results.join('\\n\\n'))
|
|
1974
|
-
process.exit(2) // Exit 2 = send stderr as feedback to Claude
|
|
1975
|
-
}
|
|
1976
|
-
} catch {}
|
|
1977
|
-
|
|
1978
|
-
process.exit(0)
|
|
1979
|
-
`;
|
|
1980
|
-
}
|
|
1981
|
-
function claudeToolFailureRecoveryHookTemplate() {
|
|
1982
|
-
return `#!/usr/bin/env node
|
|
1983
|
-
// tool-failure-recovery.mjs
|
|
1984
|
-
// PostToolUseFailure hook \u2014 pattern-matches known Bash errors and returns
|
|
1985
|
-
// recovery advice via stderr + exit 2 (feedback to Claude).
|
|
1986
|
-
|
|
1987
|
-
const RECOVERY_TABLE = [
|
|
1988
|
-
{
|
|
1989
|
-
test: r => /JavaScript heap out of memory/i.test(r),
|
|
1990
|
-
advice: 'Out of memory.',
|
|
1991
|
-
fix: 'Run the command with NODE_OPTIONS="--max-old-space-size=4096".',
|
|
1992
|
-
why: 'Large TypeScript projects can exceed Node default heap limit.',
|
|
1993
|
-
},
|
|
1994
|
-
{
|
|
1995
|
-
test: r => /boundary hook/i.test(r) && /block|denied/i.test(r),
|
|
1996
|
-
advice: 'Command blocked by SDK boundary hook.',
|
|
1997
|
-
fix: 'Ask the user to run this command manually.',
|
|
1998
|
-
why: 'The boundary hook blocks file modifications (Write, Edit, destructive Bash) outside the project boundary.',
|
|
1999
|
-
see: 'CLAUDE.md',
|
|
2000
|
-
},
|
|
2001
|
-
{
|
|
2002
|
-
test: r => /ENOENT/.test(r) && /node_modules/.test(r),
|
|
2003
|
-
advice: 'Missing node_modules dependency.',
|
|
2004
|
-
fix: 'Run: pnpm install',
|
|
2005
|
-
why: 'Dependencies are not installed or were cleared.',
|
|
2006
|
-
},
|
|
2007
|
-
{
|
|
2008
|
-
test: r => /ERR_MODULE_NOT_FOUND/.test(r) && /@elevasis\\/sdk/.test(r),
|
|
2009
|
-
advice: '@elevasis/sdk module not found.',
|
|
2010
|
-
fix: 'Run: pnpm install \u2014 then verify @elevasis/sdk is in package.json dependencies.',
|
|
2011
|
-
why: 'The SDK package is not installed or the version is mismatched.',
|
|
2012
|
-
},
|
|
2013
|
-
{
|
|
2014
|
-
test: r => /ERR_MODULE_NOT_FOUND/.test(r),
|
|
2015
|
-
advice: 'Module not found at import path.',
|
|
2016
|
-
fix: 'Check the import path and verify the package is installed (pnpm install).',
|
|
2017
|
-
why: 'The import path does not match any installed package or local file.',
|
|
2018
|
-
},
|
|
2019
|
-
{
|
|
2020
|
-
test: r => /TS2307/.test(r) || (/cannot find/i.test(r) && /declaration/i.test(r)),
|
|
2021
|
-
advice: 'TypeScript cannot resolve module or declaration file.',
|
|
2022
|
-
fix: 'Check that the package is installed and tsconfig paths are correct.',
|
|
2023
|
-
why: 'Missing dependency or incorrect TypeScript configuration.',
|
|
2024
|
-
},
|
|
2025
|
-
{
|
|
2026
|
-
test: r => /EPERM/.test(r) || /permission denied/i.test(r),
|
|
2027
|
-
advice: 'Permission denied (EPERM).',
|
|
2028
|
-
fix: 'Close the file in any other process (editor, terminal, or dev server) and retry.',
|
|
2029
|
-
why: 'On Windows, files locked by another process cannot be written to.',
|
|
2030
|
-
},
|
|
2031
|
-
{
|
|
2032
|
-
test: r => /lockfile/i.test(r) && /conflict|outdated|ERR_PNPM/i.test(r),
|
|
2033
|
-
advice: 'pnpm lockfile conflict or outdated.',
|
|
2034
|
-
fix: 'Run: pnpm install to regenerate the lockfile.',
|
|
2035
|
-
why: 'The lockfile is out of sync with package.json changes.',
|
|
2036
|
-
},
|
|
2037
|
-
{
|
|
2038
|
-
test: r => /elevasis-sdk check/.test(r) || /elevasis-sdk deploy/.test(r),
|
|
2039
|
-
advice: 'elevasis-sdk CLI command failed.',
|
|
2040
|
-
fix: 'Check the error output above. Common causes: missing .env ELEVASIS_API_KEY, invalid resource schemas, or network issues.',
|
|
2041
|
-
why: 'The SDK CLI validates resources and communicates with the platform API.',
|
|
2042
|
-
},
|
|
2043
|
-
{
|
|
2044
|
-
test: r => /EADDRINUSE/.test(r),
|
|
2045
|
-
advice: 'Port already in use.',
|
|
2046
|
-
fix: 'Find and kill the process using the port, or use a different port.',
|
|
2047
|
-
why: 'A previous dev server or process is still holding the port.',
|
|
2048
|
-
},
|
|
2049
|
-
]
|
|
2050
|
-
|
|
2051
|
-
function formatRecovery(entry) {
|
|
2052
|
-
let msg = 'FAILED: ' + entry.advice + '\\nFIX: ' + entry.fix
|
|
2053
|
-
if (entry.why) msg += '\\nWHY: ' + entry.why
|
|
2054
|
-
if (entry.see) msg += '\\nSEE: ' + entry.see
|
|
2055
|
-
return msg
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
try {
|
|
2059
|
-
const chunks = []
|
|
2060
|
-
for await (const chunk of process.stdin) chunks.push(chunk)
|
|
2061
|
-
const input = JSON.parse(Buffer.concat(chunks).toString())
|
|
2062
|
-
|
|
2063
|
-
const response = input.tool_response ?? ''
|
|
2064
|
-
|
|
2065
|
-
for (const entry of RECOVERY_TABLE) {
|
|
2066
|
-
if (entry.test(response)) {
|
|
2067
|
-
process.stderr.write(formatRecovery(entry))
|
|
2068
|
-
process.exit(2)
|
|
2069
|
-
}
|
|
2070
|
-
}
|
|
2071
|
-
} catch {}
|
|
2072
|
-
|
|
2073
|
-
process.exit(0)
|
|
2074
|
-
`;
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
// src/cli/commands/templates/core/resources.ts
|
|
2078
|
-
function starterWorkflowTemplate() {
|
|
2079
|
-
return `import type { WorkflowDefinition } from '@elevasis/sdk'
|
|
2080
|
-
import { z } from 'zod'
|
|
2081
|
-
|
|
2082
|
-
const echoInput = z.object({ message: z.string() })
|
|
2083
|
-
const echoOutput = z.object({ echo: z.string() })
|
|
2084
|
-
type EchoInput = z.infer<typeof echoInput>
|
|
2085
|
-
|
|
2086
|
-
export const echo: WorkflowDefinition = {
|
|
2087
|
-
config: {
|
|
2088
|
-
resourceId: 'echo',
|
|
2089
|
-
name: 'Echo',
|
|
2090
|
-
type: 'workflow',
|
|
2091
|
-
description: 'Echoes the input message back',
|
|
2092
|
-
version: '1.0.0',
|
|
2093
|
-
status: 'dev',
|
|
2094
|
-
},
|
|
2095
|
-
contract: {
|
|
2096
|
-
inputSchema: echoInput,
|
|
2097
|
-
outputSchema: echoOutput,
|
|
2098
|
-
},
|
|
2099
|
-
steps: {
|
|
2100
|
-
echo: {
|
|
2101
|
-
id: 'echo',
|
|
2102
|
-
name: 'Echo Message',
|
|
2103
|
-
description: 'Returns the input message',
|
|
2104
|
-
handler: async (input) => {
|
|
2105
|
-
const { message } = input as EchoInput
|
|
2106
|
-
return { echo: message }
|
|
2107
|
-
},
|
|
2108
|
-
inputSchema: echoInput,
|
|
2109
|
-
outputSchema: echoOutput,
|
|
2110
|
-
next: null,
|
|
2111
|
-
},
|
|
2112
|
-
},
|
|
2113
|
-
entryPoint: 'echo',
|
|
2114
|
-
}
|
|
2115
|
-
`;
|
|
2116
|
-
}
|
|
2117
|
-
function platformStatusTemplate() {
|
|
2118
|
-
return `import type { WorkflowDefinition } from '@elevasis/sdk'
|
|
2119
|
-
import { StepType } from '@elevasis/sdk'
|
|
2120
|
-
import { platform } from '@elevasis/sdk/worker'
|
|
2121
|
-
import { llm } from '@elevasis/sdk/worker'
|
|
2122
|
-
import { z } from 'zod'
|
|
2123
|
-
|
|
2124
|
-
const input = z.object({
|
|
2125
|
-
timeRange: z.enum(['1h', '24h', '7d']).default('24h').describe('Time window for status data'),
|
|
2126
|
-
})
|
|
2127
|
-
|
|
2128
|
-
const statusData = z.object({
|
|
2129
|
-
raw: z.unknown().describe('Raw status overview from platform'),
|
|
2130
|
-
})
|
|
2131
|
-
|
|
2132
|
-
const output = z.object({
|
|
2133
|
-
raw: z.unknown().describe('Raw status overview from platform'),
|
|
2134
|
-
summary: z.string().describe('Natural language status summary'),
|
|
2135
|
-
})
|
|
2136
|
-
|
|
2137
|
-
type Input = z.infer<typeof input>
|
|
2138
|
-
|
|
2139
|
-
export const platformStatus: WorkflowDefinition = {
|
|
2140
|
-
config: {
|
|
2141
|
-
resourceId: 'platform-status',
|
|
2142
|
-
name: 'Platform Status',
|
|
2143
|
-
type: 'workflow',
|
|
2144
|
-
description: 'Gathers cross-system platform status and compiles a natural language summary',
|
|
2145
|
-
version: '1.0.0',
|
|
2146
|
-
status: 'dev',
|
|
2147
|
-
},
|
|
2148
|
-
contract: { inputSchema: input, outputSchema: output },
|
|
2149
|
-
steps: {
|
|
2150
|
-
'gather-status': {
|
|
2151
|
-
id: 'gather-status',
|
|
2152
|
-
name: 'Gather Status',
|
|
2153
|
-
description: 'Queries platform status overview (executions, pending items, schedules, credentials)',
|
|
2154
|
-
handler: async (rawInput) => {
|
|
2155
|
-
const { timeRange } = rawInput as Input
|
|
2156
|
-
const raw = await platform.call({
|
|
2157
|
-
tool: 'status',
|
|
2158
|
-
method: 'overview',
|
|
2159
|
-
params: { timeRange },
|
|
2160
|
-
})
|
|
2161
|
-
return { raw }
|
|
2162
|
-
},
|
|
2163
|
-
inputSchema: input,
|
|
2164
|
-
outputSchema: statusData,
|
|
2165
|
-
next: { type: StepType.LINEAR, target: 'compile-report' },
|
|
2166
|
-
},
|
|
2167
|
-
'compile-report': {
|
|
2168
|
-
id: 'compile-report',
|
|
2169
|
-
name: 'Compile Report',
|
|
2170
|
-
description: 'Generates a natural language summary from raw status data',
|
|
2171
|
-
handler: async (rawInput) => {
|
|
2172
|
-
const { raw } = rawInput as z.infer<typeof statusData>
|
|
2173
|
-
const result = await llm.generate({
|
|
2174
|
-
provider: 'google',
|
|
2175
|
-
model: 'gemini-3-flash-preview',
|
|
2176
|
-
messages: [
|
|
2177
|
-
{
|
|
2178
|
-
role: 'user',
|
|
2179
|
-
content: [
|
|
2180
|
-
'Summarize this platform status overview in 3-5 concise bullet points.',
|
|
2181
|
-
'Focus on: execution health, pending items needing attention, upcoming schedules, and credential coverage.',
|
|
2182
|
-
'Be specific with numbers. Flag any issues.',
|
|
2183
|
-
'',
|
|
2184
|
-
JSON.stringify(raw, null, 2),
|
|
2185
|
-
].join('\\n'),
|
|
2186
|
-
},
|
|
2187
|
-
],
|
|
2188
|
-
responseSchema: {
|
|
2189
|
-
type: 'object',
|
|
2190
|
-
properties: {
|
|
2191
|
-
summary: { type: 'string', description: 'Natural language status summary with bullet points' },
|
|
2192
|
-
},
|
|
2193
|
-
required: ['summary'],
|
|
2194
|
-
},
|
|
2195
|
-
temperature: 0,
|
|
2196
|
-
})
|
|
2197
|
-
const summary = (result as any)?.summary ?? String(result)
|
|
2198
|
-
return { raw, summary }
|
|
2199
|
-
},
|
|
2200
|
-
inputSchema: statusData,
|
|
2201
|
-
outputSchema: output,
|
|
2202
|
-
next: null,
|
|
2203
|
-
},
|
|
2204
|
-
},
|
|
2205
|
-
entryPoint: 'gather-status',
|
|
2206
|
-
}
|
|
2207
|
-
`;
|
|
2208
|
-
}
|
|
2209
|
-
function operationsBarrelTemplate() {
|
|
2210
|
-
return `import { platformStatus } from './platform-status.js'
|
|
2211
|
-
|
|
2212
|
-
export const workflows = [platformStatus]
|
|
2213
|
-
export const agents = []
|
|
2214
|
-
`;
|
|
2215
|
-
}
|
|
2216
|
-
function exampleBarrelTemplate() {
|
|
2217
|
-
return `import { echo } from './echo.js'
|
|
2218
|
-
|
|
2219
|
-
export const workflows = [echo]
|
|
2220
|
-
export const agents = []
|
|
2221
|
-
`;
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
// src/cli/commands/templates/core/index.ts
|
|
2225
|
-
function getManagedTemplates(ctx = {}) {
|
|
2226
|
-
return {
|
|
2227
|
-
"elevasis.config.ts": configTemplate,
|
|
2228
|
-
".gitignore": () => gitignoreTemplate(ctx),
|
|
2229
|
-
"CLAUDE.md": () => claudeMdTemplate(ctx),
|
|
2230
|
-
".claude/settings.json": claudeSettingsTemplate,
|
|
2231
|
-
".claude/scripts/statusline-command.js": claudeStatuslineScriptTemplate,
|
|
2232
|
-
".claude/hooks/enforce-sdk-boundary.mjs": claudeSdkBoundaryHookTemplate,
|
|
2233
|
-
".claude/hooks/post-edit-validate.mjs": claudePostEditValidateHookTemplate,
|
|
2234
|
-
".claude/hooks/tool-failure-recovery.mjs": claudeToolFailureRecoveryHookTemplate,
|
|
2235
|
-
".claude/commands/tutorial.md": claudeTutorialCommandTemplate,
|
|
2236
|
-
".claude/commands/init.md": claudeInitCommandTemplate,
|
|
2237
|
-
".claude/commands/status.md": claudeStatusCommandTemplate,
|
|
2238
|
-
".claude/commands/fix.md": claudeFixCommandTemplate,
|
|
2239
|
-
".claude/commands/deploy.md": claudeDeployCommandTemplate,
|
|
2240
|
-
".claude/skills/diagnostics/SKILL.md": claudeDiagnosticsSkillTemplate,
|
|
2241
|
-
".claude/skills/work/SKILL.md": claudeWorkSkillTemplate,
|
|
2242
|
-
".claude/commands/docs.md": claudeDocsCommandTemplate,
|
|
2243
|
-
".claude/skills/creds/SKILL.md": claudeCredsSkillTemplate,
|
|
2244
|
-
".claude/rules/sdk-patterns.md": claudeSdkPatternsRuleTemplate,
|
|
2245
|
-
".claude/rules/docs-authoring.md": claudeDocsAuthoringRuleTemplate,
|
|
2246
|
-
".claude/rules/memory-conventions.md": claudeMemoryConventionsRuleTemplate,
|
|
2247
|
-
".claude/rules/project-map.md": claudeProjectMapRuleTemplate,
|
|
2248
|
-
".claude/rules/task-tracking.md": claudeTaskTrackingRuleTemplate,
|
|
2249
|
-
".claude/rules/logging.md": claudeLoggingRuleTemplate
|
|
2250
|
-
};
|
|
2251
|
-
}
|
|
2252
|
-
|
|
2253
|
-
export { claudeCredsSkillTemplate, claudeDeployCommandTemplate, claudeDiagnosticsSkillTemplate, claudeDocsAuthoringRuleTemplate, claudeFixCommandTemplate, claudeInitCommandTemplate, claudeMdTemplate, claudeMemoryConventionsRuleTemplate, claudeProjectMapRuleTemplate, claudeSdkBoundaryHookTemplate, claudeSdkPatternsRuleTemplate, claudeSettingsTemplate, claudeStatusCommandTemplate, claudeTaskTrackingRuleTemplate, claudeTutorialCommandTemplate, claudeWorkSkillTemplate, exampleBarrelTemplate, getManagedTemplates, gitignoreTemplate, operationsBarrelTemplate, platformStatusTemplate, starterWorkflowTemplate };
|