Skip to content

Commit 50f4daa

Browse files
committed
fix(tools): relabel side-effecting reads and tighten the effect definition
`read` now means the call changes nothing outside Sim: no create, update, delete, send, post, trigger, enqueue, consume, or mark-read; no job, run, conversation, history item, or other resource left in an account; no credit-funded reveal; no external delivery. Usage billing for the call itself does not count. `write` is anything else, including input-dependent effects. The definition is stated the same way in ToolEffect, the v2 catalog schema (and OpenAPI), the source catalog types, check:tool-effects, the skills, and CLAUDE.md, and no longer promises dry-run behaviour that has not shipped. 54 tools move from read to write: provider jobs and runs (Firecrawl, Bright Data, Exa, Parallel, You.com research, Harmonic, LogRocket, Coda and Slack List exports, CloudFormation drift, CloudTrail Lake queries, NetSuite async batch reads), media generation and transcription that persist in the provider account (video, image, Higgsfield, ElevenLabs TTS/STS/SFX/isolation/STT, AssemblyAI), parse runs kept by Extend, Reducto, and Pulse, Apollo people reveals, Wiza reveals, Icypeas records, ChatCBI conversations, Fivetran setup tests, Slack reader DMs, Reddit mark-read, RevenueCat get-or-create, and Upstash EXPIRE/INCR/INCRBY. The five GET tools carry `// tool-effect:`. check:tool-effects also flags a read tool whose function-valued method can return PUT, PATCH, or DELETE. Unregistered access ids (model providers) count as write in the source catalog too, matching the block detail.
1 parent b18098c commit 50f4daa

65 files changed

Lines changed: 152 additions & 131 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/skills/add-block/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ Validate the block against every tool in `tools.access`:
10831083
same-origin `/api/...` hop or a `directExecution` property from the block.
10841084
8. **Verify every tool declares `effect`** — the block's catalog `effect` (and its per-operation
10851085
`operationEffects`) is derived from them, so a mislabelled tool misreports the block to agents
1086-
and dry runs. Fix the tool with the `add-tools` rules (Declaring the effect), never the block.
1086+
and Assistant. Fix the tool with the `add-tools` rules (Declaring the effect), never the block.
10871087

10881088
## Option Lists: `selectorKey` or `options`, never a per-block fetcher
10891089

‎.agents/skills/add-integration/SKILL.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,11 @@ Never point a tool at `/api/...`, construct an absolute URL back to Sim, declare
190190
resources. A real external/browser route and an in-process tool may share the same operation, but
191191
neither calls the other. Follow the full transport and handler rules in the `add-tools` skill.
192192

193-
Every tool declares `effect: 'read' | 'write'`. `read` means the documented operation changes
194-
nothing outside Sim (search, list, get, inference); anything that creates, updates, deletes, sends,
195-
charges, triggers, persists, or depends on its params is `write`, and so is anything you are unsure
196-
of. Classify from the API docs you researched in Step 1; the full rules are in `add-tools` →
193+
Every tool declares `effect: 'read' | 'write'`. `read` means the call changes nothing outside Sim:
194+
no create, update, delete, send, post, trigger, enqueue, consume, or mark-read; no job, run,
195+
conversation, history item, or other resource left in an account; no credit-funded reveal; no
196+
external delivery (usage billing for the call itself does not count). Anything else, anything that
197+
depends on its params, and anything you are unsure of is `write`. Classify from the API docs you researched in Step 1; the full rules are in `add-tools` →
197198
Declaring the effect, and `bun run check:tool-effects` enforces them.
198199

199200
**types.ts:**

‎.agents/skills/add-tools/SKILL.md‎

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,19 +188,27 @@ fallback, or caller-controlled `_context` authority.
188188
## Declaring the effect
189189

190190
Every tool declares `effect: 'read' | 'write'` (required by `ToolConfig`; `bun run check:tool-effects`
191-
fails a registered tool without one). It is public catalog metadata: dry runs execute `read` tools
192-
for real and stub `write` ones, Assistant applies its read or write policy by it, and `sim blocks get`
193-
and `sim workflows source params` show it to agents. Labelling a write `read` is the one unsafe
194-
mistake, so classify from the provider's documented semantics, never the name alone:
195-
196-
- `read`: no externally visible change, so no create, update, delete, send, charge, or trigger.
197-
GET/HEAD reads, and POST endpoints the docs define as search, query, list, get, lookup, enrich, or
198-
verify; LLM, embedding, transcription, TTS, and media-generation calls that persist nothing;
199-
queries the server enforces as read-only.
200-
- `write`: everything else, including an effect that depends on the params (a `method` param, a
201-
function-valued `request.method`, raw SQL or Cypher the server does not restrict to reads, a
202-
generic RPC or command), a GET whose `transformResponse` or `postProcess` then writes, a read
203-
that consumes or acknowledges (a queue receive, mark-as-read), and anything that saves to the
191+
fails a registered tool without one). It is public catalog metadata: Assistant applies its read or
192+
write policy by it, and `sim blocks get` and `sim workflows source params` show it to agents.
193+
Labelling a write `read` is the one unsafe mistake, so classify from the provider's documented
194+
semantics, never the name alone.
195+
196+
`read` means the call changes nothing outside Sim: no create, update, delete, send, post, trigger,
197+
enqueue, consume, or mark-read; no job, run, conversation, history item, or other resource left in
198+
an account; no credit-funded reveal; no external delivery. Usage billing for the call itself does
199+
not count. `write` is anything else.
200+
201+
- `read`: GET/HEAD reads, and POST endpoints the docs define as search, query, list, get, lookup, or
202+
verify; LLM, embedding, transcription, TTS, and media-generation calls that leave nothing in the
203+
provider account; enrichment that only spends lookup credits; queries the server enforces as
204+
read-only.
205+
- `write`: an effect that depends on the params (a `method` param or function-valued
206+
`request.method` that can pick PUT/PATCH/DELETE or a mutating POST, raw SQL or Cypher the server
207+
does not restrict to reads, a generic RPC or command); a GET whose `transformResponse` or
208+
`postProcess` then writes; a read that consumes or acknowledges (a queue receive, mark-as-read);
209+
media generation, transcription, crawls, exports, and research or agent runs that leave a job,
210+
run, asset, or history item in the provider account; a chat that keeps a conversation; a reveal or
211+
enrichment that creates a resource or delivers to a webhook; anything that saves to the
204212
workspace. When unsure, `write`.
205213
- PUT/PATCH/DELETE are `write`. A static GET/HEAD labelled `write`, or PUT/PATCH/DELETE labelled
206214
`read`, fails the audit unless the `effect` line carries `// tool-effect: <reason>` on one of the

‎.agents/skills/validate-integration/SKILL.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ For **every** tool file, check:
7979

8080
### Effect
8181
- [ ] Every tool declares `effect`, and the label matches the API docs, not the name: `read` only
82-
when the operation changes nothing outside Sim (no create, update, delete, send, charge, or
83-
trigger); a param-dependent effect (method param, raw SQL, generic command), a GET whose
84-
`transformResponse`/`postProcess` writes, a consuming read, and anything uncertain are `write`
85-
(rules: `add-tools` → Declaring the effect)
82+
when the call changes nothing outside Sim (no create, update, delete, send, trigger, consume,
83+
or mark-read, and no job, run, conversation, history item, or other resource left in the
84+
provider account); a param-dependent effect (method param, raw SQL, generic command), a GET
85+
whose `transformResponse`/`postProcess` writes, and anything uncertain are `write` (rules:
86+
`add-tools` → Declaring the effect)
8687
- [ ] Any `// tool-effect: <reason>` sits on a genuine verb/label exception, and
8788
`bun run check:tool-effects` passes
8889

‎CLAUDE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Use the `test-audit` skill whenever you write, change, or review tests; mechanic
5959
Build order **Tools** → **Block** → **Icon** → optional **Trigger**, from the service's API docs, using `/add-integration` (or `/add-tools`, `/add-block`, `/add-trigger`).
6060

6161
- **Tool IDs are `snake_case`** (`service_action`), registered in `tools/registry.ts`; blocks register alphabetically in `blocks/registry-maps.ts`.
62-
- **Every tool declares `effect: 'read' | 'write'`**, public catalog metadata that dry runs and Assistant trust: `read` only when the documented operation changes nothing outside Sim, `write` for anything that creates, updates, deletes, sends, charges, triggers, persists, or depends on its params, and `write` when unsure (`check:tool-effects`; rules in `/add-tools`).
62+
- **Every tool declares `effect: 'read' | 'write'`**: `read` only when the call changes nothing outside Sim (no write, send, trigger, or consume, and no job, run, or other resource left in an account; usage billing aside); `write` otherwise, including param-dependent effects and anything uncertain (`check:tool-effects`; rules in `/add-tools`).
6363
- **Type coercions go in `tools.config.params`** (runs at execution), never `tools.config.tool` (runs at serialization, where `Number()` destroys `<Block.output>` references).
6464
- **Requests made for a workspace use `outboundFetch`** (`@/lib/core/network/outbound-fetch.server`), never the global `fetch` or another imported `fetch`, so an organization with a dedicated egress gateway keeps its static IPs; `check:organization-egress` enforces this, and a request that rightly goes direct (Sim's own infrastructure, an operator-local server) takes `// egress-direct: <reason>`. AWS SDK clients signing with customer credentials take `organizationAwsRequestHandler()`: no audit catches a missing one, so reviewers check it.
6565
- A surface listing integrations to a viewer reads `useIntegrationAccess`, never a raw catalog (`check:integration-access`).

‎apps/docs/openapi-v2-resources.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21950,7 +21950,7 @@
2195021950
"effect": {
2195121951
"type": "string",
2195221952
"enum": ["read", "write"],
21953-
"description": "What running the tool does outside Sim: `read` changes nothing (no create, update, delete, send, charge, or trigger), so a dry run executes it; `write` is anything else, including an effect that depends on the input."
21953+
"description": "What running the tool does outside Sim. `read` changes nothing there: no create, update, delete, send, post, trigger, enqueue, consume, or mark-read; no job, run, conversation, history item, or other resource left in an account; no credit-funded reveal; no external delivery. Usage billing for the call itself does not count. `write` is anything else, including an effect that depends on the input."
2195421954
},
2195521955
"hostedApiKey": {
2195621956
"type": "string",
@@ -22676,7 +22676,7 @@
2267622676
"effect": {
2267722677
"type": "string",
2267822678
"enum": ["read", "write"],
22679-
"description": "What running the tool does outside Sim: `read` changes nothing (no create, update, delete, send, charge, or trigger), so a dry run executes it; `write` is anything else, including an effect that depends on the input."
22679+
"description": "What running the tool does outside Sim. `read` changes nothing there: no create, update, delete, send, post, trigger, enqueue, consume, or mark-read; no job, run, conversation, history item, or other resource left in an account; no credit-funded reveal; no external delivery. Usage billing for the call itself does not count. `write` is anything else, including an effect that depends on the input."
2268022680
},
2268122681
"hostedApiKey": {
2268222682
"type": "string",
@@ -32956,7 +32956,7 @@
3295632956
}
3295732957
},
3295832958
"effect": {
32959-
"description": "`read` when every tool the block can run changes nothing outside Sim, else `write`. Absent for a block that runs no tool.",
32959+
"description": "`read` when every tool the block can run changes nothing outside Sim, else `write`. Absent for a block with no `tools.access`.",
3296032960
"type": "string",
3296132961
"enum": ["read", "write"]
3296232962
},
@@ -32969,7 +32969,7 @@
3296932969
"additionalProperties": {
3297032970
"type": "string",
3297132971
"enum": ["read", "write"],
32972-
"description": "What running the tool does outside Sim: `read` changes nothing (no create, update, delete, send, charge, or trigger), so a dry run executes it; `write` is anything else, including an effect that depends on the input."
32972+
"description": "What running the tool does outside Sim. `read` changes nothing there: no create, update, delete, send, post, trigger, enqueue, consume, or mark-read; no job, run, conversation, history item, or other resource left in an account; no credit-funded reveal; no external delivery. Usage billing for the call itself does not count. `write` is anything else, including an effect that depends on the input."
3297332973
}
3297432974
},
3297532975
"dynamicOutputs": {

‎apps/sim/lib/api/contracts/v2/catalog.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ const v2HostedApiKeySchema = z
414414
export const v2ToolEffectSchema = z
415415
.enum(['read', 'write'])
416416
.describe(
417-
'What running the tool does outside Sim: `read` changes nothing (no create, update, delete, send, charge, or trigger), so a dry run executes it; `write` is anything else, including an effect that depends on the input.'
417+
'What running the tool does outside Sim. `read` changes nothing there: no create, update, delete, send, post, trigger, enqueue, consume, or mark-read; no job, run, conversation, history item, or other resource left in an account; no credit-funded reveal; no external delivery. Usage billing for the call itself does not count. `write` is anything else, including an effect that depends on the input.'
418418
)
419419

420420
const v2ToolOAuthSchema = z.object({

‎apps/sim/lib/api/contracts/v2/source-catalog.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ const catalogBlockSchema = z
347347
effect: v2ToolEffectSchema
348348
.optional()
349349
.describe(
350-
'`read` when every tool the block can run changes nothing outside Sim, else `write`. Absent for a block that runs no tool.'
350+
'`read` when every tool the block can run changes nothing outside Sim, else `write`. Absent for a block with no `tools.access`.'
351351
),
352352
operationEffects: z
353353
.record(z.string(), v2ToolEffectSchema)

‎apps/sim/lib/workflows/code/catalog/project.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -490,26 +490,27 @@ function projectOperationOutputs(
490490
}
491491

492492
/**
493-
* The block's effect from its registered tools' declared effects, and, when the operation picks the
494-
* tool, each operation whose tool differs from it. Ids that are not registered tools (the model
495-
* providers an Agent calls) do not count.
493+
* The block's effect from its tools' declared effects, and, when the operation picks the tool, each
494+
* operation whose tool differs from it. An id that is not a registered tool (the model providers an
495+
* Agent, Router, or Evaluator calls) counts as `write`. An opaque selector cannot be probed, so its
496+
* operations inherit the block effect.
496497
*/
497498
function projectEffects(
498499
block: BlockConfig,
499500
operations: readonly string[],
500501
selector: CatalogBlock['tools']['selector']
501502
): Pick<CatalogBlock, 'effect' | 'operationEffects'> {
502-
const effects = block.tools.access.flatMap((toolId) => getToolMetadata(toolId)?.effect ?? [])
503-
if (effects.length === 0) return {}
503+
if (block.tools.access.length === 0) return {}
504+
const effects = block.tools.access.map((toolId) => getToolMetadata(toolId)?.effect ?? 'write')
504505
const effect = effects.every((entry) => entry === 'read') ? 'read' : 'write'
505506
const selectTool = block.tools.config?.tool
506507
if (effect === 'read' || selector !== 'operation' || !selectTool) return { effect }
507508
const operationEffects: NonNullable<CatalogBlock['operationEffects']> = {}
508509
for (const operation of operations) {
509510
const probe = probeThunk(selectTool, { operation })
510511
if (!probe.ok || typeof probe.result !== 'string') continue
511-
const operationEffect = getToolMetadata(probe.result)?.effect
512-
if (operationEffect && operationEffect !== effect) operationEffects[operation] = operationEffect
512+
const operationEffect = getToolMetadata(probe.result)?.effect ?? 'write'
513+
if (operationEffect !== effect) operationEffects[operation] = operationEffect
513514
}
514515
return Object.keys(operationEffects).length > 0 ? { effect, operationEffects } : { effect }
515516
}

‎apps/sim/tools/apollo/people_bulk_enrich.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const apolloPeopleBulkEnrichTool: ToolConfig<
1414
name: 'Apollo Bulk People Enrichment',
1515
description: 'Enrich data for up to 10 people at once using Apollo',
1616
version: '1.0.0',
17-
effect: 'read',
17+
effect: 'write',
1818
oauth: APOLLO_CREDENTIAL_OAUTH,
1919

2020
params: {

0 commit comments

Comments
 (0)