Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
56c7003
fix(workflows): authorize automated runs by deployment (#7181)
TheodoreSpeaks Aug 28, 2026
d28e8d7
refactor(tools): execute internal operations in process (#7179)
icecrasher321 Aug 28, 2026
fa00b63
chore(db): drop orphaned import_* columns from user_table_definitions…
waleedlatif1 Aug 28, 2026
aea5526
fix(storage): stop workspace ledger locks from deadlocking on FK key-…
waleedlatif1 Aug 28, 2026
b5b336a
improvement(config): gate feature flags by workspace id (#7191)
TheodoreSpeaks Aug 28, 2026
e22324f
chore(docs): refresh product screenshots (#7192)
waleedlatif1 Aug 28, 2026
723db1b
docs(library): update what-is-an-mcp-server (#7162)
icecrasher321 Aug 28, 2026
90ff5d0
docs(library): update ai-agent-vs-chatbot (#7163)
icecrasher321 Aug 28, 2026
57235de
feat(mcp): add Codex client configuration (#7164)
TheodoreSpeaks Aug 28, 2026
603f1c2
improvement(tables): simplify column dropdown (#7193)
waleedlatif1 Aug 28, 2026
292e59f
fix(docs): stop publishing unsettable params, fix comment blanking (#…
waleedlatif1 Aug 28, 2026
f7693cd
feat(usage): add enterprise organization usage monitoring (#7182)
icecrasher321 Aug 28, 2026
b01b41f
feat(files): find in an open markdown document with Cmd/Ctrl+F (#7196)
waleedlatif1 Aug 28, 2026
1969779
improvement(files): fill the active find match instead of ringing it …
waleedlatif1 Aug 28, 2026
d8ebcc0
improvement(tools): prevent internal request self-hops (#7190)
icecrasher321 Aug 28, 2026
56abc6c
fix(usage): correct chart clipping, expand truncated rows, add source…
waleedlatif1 Aug 28, 2026
88a9671
improvement(usage): drop the segmented allowance meter from the usage…
waleedlatif1 Aug 28, 2026
46703e3
fix: six pre-existing integration defects surfaced by the docs audit …
waleedlatif1 Aug 28, 2026
3ef51f4
fix(copilot): say whether a withheld tool call changed anything (#7178)
icecrasher321 Aug 28, 2026
1f41ce7
docs(usage-tracking): refresh the overview screenshot and correct two…
waleedlatif1 Aug 28, 2026
4b9c3b7
docs(library): update openai-vs-n8n-vs-sim (#7208)
icecrasher321 Aug 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 4 additions & 0 deletions .agents/skills/add-block/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,10 @@ After creating the block, you MUST validate it against every tool it references:
4. **Verify conditions** — each subBlock should only show for the operations that actually use it
5. **Verify `{Service}BlockMeta` is exported** with at least 7 templates, each having `icon`, `title`, `prompt`, `modules`, `category`, and `tags`
6. **If any tool outputs are still unknown**, explicitly tell the user instead of guessing block outputs
7. **Verify the tool execution boundary** — blocks never create or call API routes. Every referenced
tool must already be either a registered `InternalToolConfig.operation` or an absolute external
HTTP(S) `ToolConfig.request`. If transport needs to change, use the `add-tools` skill; do not add a
same-origin `/api/...` hop from the block.

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

Expand Down
31 changes: 16 additions & 15 deletions .agents/skills/add-feature-flag/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
name: add-feature-flag
description: Add a runtime feature flag (AppConfig-backed on prod, secret fallback off-prod), global by default or optionally gated by org id, user id, or platform admin
description: Add a runtime feature flag (AppConfig-backed on prod, secret fallback off-prod), global by default or optionally gated by workspace id, org id, user id, or platform admin
argument-hint: <flag-name>
---

# Add Feature Flag Skill

You add a **runtime feature flag** to Sim that can change on prod with no redeploy (AWS AppConfig). Prefer a global on/off flag unless the rollout actually needs per-organization, per-user, or platform-admin targeting. When AppConfig isn't the source of truth, the flag falls back to a single **secret** (on/off only).
You add a **runtime feature flag** to Sim that can change on prod with no redeploy (AWS AppConfig). Prefer a global on/off flag unless the rollout actually needs per-workspace, per-organization, per-user, or platform-admin targeting. When AppConfig isn't the source of truth, the flag falls back to a single **secret** (on/off only).

## When to use this vs `env-flags.ts`

- **Feature flag** (`@/lib/core/config/feature-flags.ts`): runtime global on/off by default, optionally scoped by `userId`/`orgId`/admin. This skill.
- **Feature flag** (`@/lib/core/config/feature-flags.ts`): runtime global on/off by default, optionally scoped by `workspaceId`/`userId`/`orgId`/admin. This skill.
- **Env flag** (`@/lib/core/config/env-flags.ts`): deploy-time capability/environment detection (`isProd`, `isHosted`, `isBillingEnabled`). A module-load boolean. **Do not add gated flags here.**

If the user wants a fixed per-deployment toggle, send them to `env-flags.ts` instead.
Expand All @@ -21,10 +21,11 @@ A flag's **gating rule lives only in the hosted AppConfig document**. It is ON f

```ts
interface FeatureFlagRule {
enabled?: boolean // global default for everyone
orgIds?: string[] // allowlisted organization ids
userIds?: string[] // allowlisted user ids
adminEnabled?: boolean // platform admins (user.role === 'admin')
enabled?: boolean // global default for everyone
workspaceIds?: string[] // allowlisted workspace ids
orgIds?: string[] // allowlisted organization ids
userIds?: string[] // allowlisted user ids
adminEnabled?: boolean // platform admins (user.role === 'admin')
}
```

Expand All @@ -34,10 +35,10 @@ Critically, **none of this is expressible in code** — gating (especially `admi

1. **Confirm the granularity before editing code.** If the user has not already specified it, stop and ask:

> Should `<flag-name>` be a global on/off flag (recommended), or does it need rollout targeting by organization, user, and/or platform admin?
> Should `<flag-name>` be a global on/off flag (recommended), or does it need rollout targeting by workspace, organization, user, and/or platform admin?

- Recommend **global**. Do not infer scoped gating merely because the call site already has a user or organization id.
- If the user chooses scoped gating but does not name the dimensions, ask which of organization, user, and platform admin it needs. Wire only the selected dimensions.
- Recommend **global**. Do not infer scoped gating merely because the call site already has a workspace, user, or organization id.
- If the user chooses scoped gating but does not name the dimensions, ask which of workspace, organization, user, and platform admin it needs. Wire only the selected dimensions.
- If the user wants a fixed per-deployment toggle rather than a runtime AppConfig flag, use `env-flags.ts` instead.

2. **Define the flag.** Add one entry to the `FEATURE_FLAGS` registry in `apps/sim/lib/core/config/feature-flags.ts`. Each entry is the flag's whole definition — name (kebab-case key), `description`, and the `fallback` secret consulted when AppConfig isn't the source of truth (truthy ⇒ on globally):
Expand All @@ -51,7 +52,7 @@ Critically, **none of this is expressible in code** — gating (especially `admi
}
```

`fallback` is the env/secret key (typed as `keyof typeof env`), so add `<FLAG_SECRET>` to `apps/sim/lib/core/config/env.ts` first (and the deployment's secret store) — it won't typecheck otherwise. Do **not** add org/user/admin defaults here — that gating exists only in AppConfig. Adding the entry makes `<flag-name>` a valid `FeatureFlagName`.
`fallback` is the env/secret key (typed as `keyof typeof env`), so add `<FLAG_SECRET>` to `apps/sim/lib/core/config/env.ts` first (and the deployment's secret store) — it won't typecheck otherwise. Do **not** add workspace/org/user/admin defaults here — that gating exists only in AppConfig. Adding the entry makes `<flag-name>` a valid `FeatureFlagName`.

3. **Gate the call site at the chosen granularity.** For the recommended global mode, pass no context:

Expand All @@ -70,17 +71,17 @@ Critically, **none of this is expressible in code** — gating (especially `admi
```ts
import { isFeatureEnabled } from '@/lib/core/config/feature-flags'

if (await isFeatureEnabled('<flag-name>', { userId, orgId })) {
if (await isFeatureEnabled('<flag-name>', { workspaceId, userId, orgId })) {
// gated behavior
}
```

- Organization targeting uses `orgId`; user and platform-admin targeting require `userId`.
- Workspace targeting uses `workspaceId`; organization targeting uses `orgId`; user and platform-admin targeting require `userId`.
- Missing ids are fine — a clause with no matching id is skipped; with no `userId`, the admin clause resolves to `false` without a DB read.
- Admin routes that already know the caller is an admin may pass `{ userId, isAdmin: true }` to skip the role lookup.
- **Client/UI flags:** resolve server-side (in a server component, route, or loader) and pass the boolean down as a prop. There is no client AppConfig.

4. **(Prod) configure in AppConfig.** The infra `feature-flags` profile schema is permissive, so a new flag needs **no infra change**. Operators add the flag to the hosted `feature-flags` document using `enabled` for global rollout or only the selected `orgIds`/`userIds`/`adminEnabled` clauses for scoped rollout, then start a `sim-<env>-fast` deployment (see the AppConfig runbook in the infra README — same flow as `access-control`). The fallback secret only applies when AppConfig is disabled.
4. **(Prod) configure in AppConfig.** The infra `feature-flags` profile schema is permissive, so a new flag needs **no infra change**. Operators add the flag to the hosted `feature-flags` document using `enabled` for global rollout or only the selected `workspaceIds`/`orgIds`/`userIds`/`adminEnabled` clauses for scoped rollout, then start a `sim-<env>-fast` deployment (see the AppConfig runbook in the infra README — same flow as `access-control`). The fallback secret only applies when AppConfig is disabled.

5. **Test.** Add a case to `apps/sim/lib/core/config/feature-flags.test.ts` that matches the chosen granularity. For a global flag, exercise `isFeatureEnabled('<flag-name>')` with an AppConfig `enabled` rule and toggle the fallback secret for the off-AppConfig path. For scoped rollout, cover only the selected clauses and mock `isPlatformAdmin` when testing `adminEnabled`.

Expand All @@ -90,6 +91,6 @@ Critically, **none of this is expressible in code** — gating (especially `admi

- Flag keys are `kebab-case`.
- Never read flags via raw `fetch` or a new AppConfig client — always go through `isFeatureEnabled` / `getFeatureFlags`.
- Never bake gating into code. The fallback is a single boolean secret; org/user/admin scoping is AppConfig-only.
- Never bake gating into code. The fallback is a single boolean secret; workspace/org/user/admin scoping is AppConfig-only.
- Never add or propagate request context unless the user chose scoped rollout.
- The admin check reads the DB **replica** (`dbReplica`) and is resolved lazily, so an admin-gated flag adds at most one cheap replica read, and only when `adminEnabled` is the deciding clause.
Loading
Loading