Skip to content

Commit 256e7b8

Browse files
cevianclaude
andcommitted
fix(skills): prevent create-workflow from eagerly checking integrations
Simplify MCP sandbox instructions to avoid prompting the model to fetch integration guides and check connections during the design phase. Templates, integration gate, and skill guide table removed from MCP context (already in skill guides). Added "stay in design mode" guard to create-workflow skill. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 452f8f4 commit 256e7b8

File tree

2 files changed

+12
-128
lines changed

2 files changed

+12
-128
lines changed

packages/core/src/cli/mcp/sandbox-server.ts

Lines changed: 10 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -59,45 +59,20 @@ const CRAYON_CONTEXT = `## Crayon Workflow Engine
5959
6060
You have access to crayon MCP tools for building and running AI-native workflows.
6161
62-
### Available MCP Tools
63-
64-
**Workflow execution:**
65-
- \`list_workflows\` — discover compiled workflows
66-
- \`run_workflow\` — execute a workflow with JSON input
67-
- \`run_node\` — execute a single node (for testing)
68-
69-
**Run history:**
70-
- \`list_runs\` — list past executions
71-
- \`get_run\` — get details of a specific run
72-
- \`get_trace\` — full execution trace with step-by-step output
73-
74-
**Integrations:**
75-
- \`list_integrations\` — list available OAuth integrations (Salesforce, Slack, etc.)
76-
- \`get_connection_info\` — get credentials for a specific integration + node
77-
78-
**Scaffolding:**
79-
- \`create_app\` — scaffold a new crayon project
80-
- \`create_database\` — set up a database
81-
- \`setup_app_schema\` — initialize crayon tables in existing DB
82-
83-
**Skill guides:**
84-
- \`get_skill_guide\` — detailed procedural guides for workflow development
85-
8662
### Workflow Development Pipeline
8763
88-
1. **Design** — create \`src/crayon/workflows/<name>.ts\` with a \`description\` field that captures the flow (task ordering, conditions, loops)
89-
2. **Create stubs** — for each task, create node stubs in \`src/crayon/nodes/<name>.ts\` or agent stubs in \`src/crayon/agents/<name>.ts\` + \`<name>.md\`
90-
3. **Refine** — add typed Zod schemas, tools, implementation details to each node/agent
91-
4. **Compile** — update the workflow's \`run()\` method from embedded descriptions
64+
1. **Design** (\`create-workflow\`) — write workflow + node stubs with \`description\` fields capturing intent
65+
2. **Refine** (\`refine-node\`) — add typed Zod schemas, tools, SDK setup, check connections
66+
3. **Compile** (\`compile-workflow\`) — regenerate the workflow's \`run()\` method from descriptions
67+
68+
**Each phase has a skill guide.** Call \`get_skill_guide\` with the phase name (e.g., \`create-workflow\`) before starting. The guides contain all templates, connection gates, and step-by-step instructions. Follow them — do not improvise steps from other phases.
9269
9370
### Key Patterns
9471
95-
- **Description-driven:** The \`description\` field in workflows and nodes is the source of truth. It drives code generation.
96-
- **Node types:** \`Node.create()\` for deterministic functions, \`Agent.create()\` for AI reasoning (uses Vercel AI SDK)
97-
- **Agent specs:** Each agent has a colocated \`.md\` file with system prompt, guidelines, and output format
98-
- **Integrations:** Declare in \`integrations: ["salesforce", "openai"]\` array. Credentials fetched at runtime via \`ctx.getConnection()\`.
99-
- **Draft first, ask later:** Make your best guess and let the user correct, rather than interrogating upfront.
100-
- **Run it yourself:** When the user wants to test, use \`run_workflow\` / \`run_node\` tools directly.
72+
- **Description-driven:** The \`description\` field in workflows and nodes is the source of truth
73+
- **Node types:** \`Node.create()\` for deterministic functions, \`Agent.create()\` for AI reasoning
74+
- **Draft first, ask later:** Make your best guess and let the user correct
75+
- **Run it yourself:** When the user wants to test, use \`run_workflow\` / \`run_node\` tools directly
10176
10277
### File Locations
10378
@@ -106,100 +81,7 @@ You have access to crayon MCP tools for building and running AI-native workflows
10681
| Workflows | \`src/crayon/workflows/*.ts\` |
10782
| Nodes | \`src/crayon/nodes/*.ts\` |
10883
| Agents | \`src/crayon/agents/*.ts\` + \`*.md\` (colocated spec) |
109-
| Agent tools | \`src/crayon/tools/*.ts\` |
110-
| Integrations | \`src/crayon/integrations/*.ts\` |
111-
112-
### Workflow Scaffold Template
113-
114-
\`\`\`typescript
115-
import { z } from "zod";
116-
import { Workflow } from "runcrayon";
117-
118-
const InputSchema = z.object({ /* ... */ });
119-
type Input = z.infer<typeof InputSchema>;
120-
const OutputSchema = z.object({ /* ... */ });
121-
type Output = z.infer<typeof OutputSchema>;
122-
123-
export const myWorkflow = Workflow.create({
124-
name: "my-workflow",
125-
version: 1,
126-
description: \\\`
127-
Summary of what the workflow does.
128-
129-
## Tasks
130-
131-
### 1. Task Name
132-
**Node:** \\\\\\\`node-name\\\\\\\` (node|agent)
133-
\\\`,
134-
inputSchema: InputSchema,
135-
outputSchema: OutputSchema,
136-
async run(ctx, inputs: Input): Promise<Output> {
137-
const result = await ctx.run(myNode, { /* inputs */ });
138-
return { /* outputs */ };
139-
},
140-
});
141-
\`\`\`
142-
143-
### Node Stub Template
144-
145-
\`\`\`typescript
146-
import { z } from "zod";
147-
import { Node } from "runcrayon";
148-
149-
export const myNode = Node.create({
150-
name: "my-node",
151-
description: \\\`What this node does.
152-
**Input Description:** what it needs
153-
**Output Description:** what it produces\\\`,
154-
inputSchema: z.object({}),
155-
outputSchema: z.object({}),
156-
async execute(ctx, input) {
157-
return {};
158-
},
159-
});
160-
\`\`\`
161-
162-
### Agent Stub Template
163-
164-
\`\`\`typescript
165-
import { z } from "zod";
166-
import { Agent } from "runcrayon";
167-
import { fileURLToPath } from "url";
168-
import path from "path";
169-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
170-
171-
export const myAgent = Agent.create({
172-
name: "my-agent",
173-
integrations: ["openai"],
174-
description: \\\`What this agent does.
175-
**Input Description:** what it needs
176-
**Output Description:** what it produces\\\`,
177-
inputSchema: z.object({}),
178-
outputSchema: z.object({}),
179-
tools: {},
180-
specPath: path.resolve(__dirname, "./my-agent.md"),
181-
});
182-
\`\`\`
183-
184-
### Integration Gate
185-
186-
Before implementing nodes that use external services, call \`get_connection_info\` to verify the connection exists. If it fails, tell the user to set up the connection in the Dev UI first.
187-
188-
### Skill Guides
189-
190-
Detailed procedural guides are available for complex tasks. Call \`get_skill_guide\` to load them:
191-
192-
| Guide | When to fetch |
193-
|-------|---------------|
194-
| \`create-workflow\` | Designing a new workflow from scratch |
195-
| \`compile-workflow\` | Updating a workflow's run() from descriptions |
196-
| \`refine-node\` | Adding schemas, tools, implementation to nodes |
197-
| \`integrations\` | Index of integration setup guides |
198-
| \`integrations/salesforce\` | Salesforce GraphQL integration setup |
199-
| \`integrations/postgres\` | PostgreSQL query integration setup |
200-
| \`integrations/unlisted\` | Custom integration for unlisted systems |
201-
202-
**Always fetch the relevant guide before starting a complex workflow task.** The guides contain critical steps, connection gates, and templates that ensure correct implementation.`;
84+
| Integrations | \`src/crayon/integrations/*.ts\` |`;
20385

20486
/**
20587
* Start the sandbox MCP server in stdio mode.

skills/create-workflow/SKILL.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Then stop. Do not proceed to any subsequent steps.
3838

3939
Once the tool succeeds, the returned integration IDs are what nodes declare in their `integrations: [...]` arrays.
4040

41+
**IMPORTANT — stay in design mode:** Do NOT read integration-specific guides (e.g., `integrations/salesforce`), call `get_connection_info`, or research SDKs/libraries during this phase. You only need the integration IDs for node stub `integrations: [...]` arrays. All integration research and connection checks happen later in `/crayon:refine-node`.
42+
4143
### 3. Read Existing Context
4244

4345
- Read `src/crayon/workflows/*.ts` — existing workflows to reuse or reference

0 commit comments

Comments
 (0)