Skip to content

Commit 7611288

Browse files
committed
docs(skills): a gated action guards its door only; lock the field an irreversible transition changes
objectstack-ai Common Pitfalls teaches the gated script action plus a readonly or field-permission lock on the state field, and why readonlyWhen and a state_machine rule cannot be the door. The tool-name ladder names MCP_FILE_TOOL_NAMES as its fourth source (here and in content/docs/ai/tools.mdx), and the MCP prompts paragraph names mcpPrompt and the stdio exception. state-machines-and-approvals.md points to the pitfall; restatement cut in both files to pay for it. Claude-Session: https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3fb7025 commit 7611288

4 files changed

Lines changed: 55 additions & 20 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): objectstack-ai teaches that an AI-gated action guards its own door only, and pairs an irreversible transition with a lock on the field it changes; the tool-name ladder names its fourth source and the MCP prompts paragraph names `mcpPrompt`
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
objectstack-ai's Common Pitfalls gains "Gating the action, not the state". `ai.requiresConfirmation` guards the action's door, and an agent can still write the same field with `update_record` or any data write. An irreversible transition is a gated `script` action, whose body writes elevated, over a field a non-system write cannot set: `readonly: true` (the value is stripped) or field permissions that leave the caller no `editable` on it (refused `403`). A declarative `operation: 'update'` action and a `flow` action under `runAs: 'user'` write as the caller, so the lock stops them too. `readonlyWhen` and a `state_machine` rule bind the elevated body as well, so neither is the door; a `state_machine` dead-end still makes the reached state final for every writer. objectstack-automation's `references/state-machines-and-approvals.md` points to it.
11+
12+
The resolution ladder for `skill.tools[]` names four sources: the fourth is `MCP_FILE_TOOL_NAMES`, the MCP door's file tools, resolved only for a skill MCP can offer (`mcpPrompt` not `false`).
13+
14+
The paragraph on which skills MCP offers as prompts names `mcpPrompt`: `false` keeps a skill for the in-product agents only, never offered over MCP on any connection whatever its binding, and the stdio transport withholds it too; absent or `true` keeps the binding rule.

‎content/docs/ai/tools.mdx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ export const CaseHandoverSkill = defineSkill({
190190

191191
## How the name is resolved
192192

193-
A `skill.tools[]` entry resolves against three sources, in order:
193+
A `skill.tools[]` entry resolves against three sources, in order, and a skill
194+
MCP can offer (`mcpPrompt` not `false`) against a fourth, the MCP door's file
195+
tools (`MCP_FILE_TOOL_NAMES` in `@objectstack/spec/system`):
194196

195197
1. the stack's own `tools[]` names — the refinement records on this page;
196198
2. the curated registry of tools the platform runtime registers at boot;

‎skills/objectstack-ai/SKILL.md‎

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ conditions.
6767
6868
### Naming the tools: the resolution ladder
6969

70-
A `skill.tools[]` entry resolves against the union of three sources
71-
(`collectToolUniverse` in `packages/lint/src/validate-ai-tool-references.ts`):
70+
A `skill.tools[]` entry resolves against the union of four sources
71+
(`packages/lint/src/validate-ai-tool-references.ts`):
7272

73-
1. **`stack.tools[].name`** — records your own stack declares. ADR-0109: the
74-
default third-party path declares **none** (see *Tool metadata* below).
73+
1. **`stack.tools[].name`** — records your own stack declares (none by
74+
default: *Tool metadata* below).
7575
2. **`PLATFORM_PROVIDED_TOOL_NAMES`** — the statically-registered platform
7676
tools, flattened from `PLATFORM_TOOLS_BY_PACKAGE` in
7777
`packages/spec/src/system/constants/platform-tool-names.ts`: data /
@@ -81,8 +81,11 @@ A `skill.tools[]` entry resolves against the union of three sources
8181
3. **`action_<name>`** — one tool per AI-exposed Action of your own stack
8282
(`PLATFORM_TOOL_FAMILY_PREFIXES`). **The default path** for anything your app
8383
does.
84+
4. **`MCP_FILE_TOOL_NAMES`** (same file) — the MCP door's file tools, resolved
85+
only for a skill MCP can offer (`mcpPrompt` not `false`): no in-product turn
86+
registers them.
8487

85-
A name in none of the three raises **`ai-skill-tool-unresolved`** (warning,
88+
A name none of them resolves raises **`ai-skill-tool-unresolved`** (warning,
8689
ADR-0078 advisory-first). The rule exists because one audited app shipped 10
8790
fictional tools across 6 skills through `validate` / `lint` clean, and became a
8891
copilot claiming abilities it did not have.
@@ -332,11 +335,27 @@ there is **no top-level `temperature` / `maxTokens`** on an agent
332335
there is no storage backend to choose — and neither is a gate. For a gate
333336
that is **enforced**, use
334337
`enableActionApproval: true` (approval queue ☁️), `ai.requiresConfirmation` on
335-
the **action**, or `approval: 'always'` on an MCP tool binding. AI metadata
336-
edits are already gated: they land as drafts a human must publish (ADR-0033).
338+
the **action** (its door only, pitfall 2), or `approval: 'always'` on an MCP
339+
tool binding. AI metadata edits are already gated: they land as drafts a
340+
human must publish (ADR-0033).
337341
⚠️ `requiresConfirmation` on the **tool** was REMOVED (ADR-0033 §2; retired
338342
above). There is no `requireApprovalFor` field.
339-
2. **Indexing everything.** A knowledge source without a `where` filter and
343+
2. **Gating the action, not the state.** `ai.requiresConfirmation` guards the
344+
action's own door only: an agent can still write the field it changes with
345+
`update_record` or any data write, and the write lands. An irreversible
346+
transition is a gated action **plus a lock on that field**: a `script`
347+
action, whose body writes elevated (`isSystem`), over a field a non-system
348+
write cannot set — `readonly: true` (the value is stripped,
349+
**objectstack-data** → `readonly`) or field permissions leaving the caller
350+
no `editable` on it (refused `403`; any set granting it wins,
351+
**objectstack-data** `rules/security.md`). A declarative
352+
`operation: 'update'` action, and a `flow` action under `runAs: 'user'`,
353+
write as the caller, so the lock stops them too. `readonlyWhen` and a
354+
`state_machine` rule bind the elevated body as well, so neither is the
355+
door; a `state_machine` dead-end (`closed: []`) still makes the reached
356+
state final for every writer (**objectstack-automation**
357+
`references/state-machines-and-approvals.md`).
358+
3. **Indexing everything.** A knowledge source without a `where` filter and
340359
curated `contentFields` fills the index with drafts and boilerplate that
341360
pollute retrieval. Source hygiene is the metadata's job; relevance tuning
342361
belongs to the adapter.
@@ -351,10 +370,6 @@ there is **no top-level `temperature` / `maxTokens`** on an agent
351370
| Knowledge source | `src/knowledge/sales-kb.ts` | `KnowledgeSourceSchema` metadata, registered at boot via `KnowledgeServicePlugin({ sources })` |
352371
| Central registration | `defineStack({ skills: [...] })` | `agents` / `tools` / `skills` are the only AI stack collections — knowledge sources have none, agents are platform-supplied, and `tools` is not the default path |
353372

354-
Default for metadata apps: push business capability into **skills**, expose
355-
business logic as **AI-exposed Actions**, wire domain knowledge through
356-
**knowledge sources**.
357-
358373
---
359374

360375
## Platform agents — reference only ☁️
@@ -400,8 +415,12 @@ there but is read: `registerSkillPrompts` offers a skill on `prompts/list` /
400415
`prompts/get` only when its server lists every tool the skill binds — a plain
401416
name by that tool, a wildcard by any match, an `action_*` entry also by
402417
`run_action`. That covers the HTTP door and any host server that calls it; the
403-
plugin's own stdio transport lists every skill. Bind a tool no MCP family
404-
serves (the MCP table above) and no filtering server offers the skill.
418+
plugin's own stdio transport lists every skill except one with
419+
`mcpPrompt: false`. That optional key is the owner's opt-out: `false` = written
420+
for the in-product agents only, never offered over MCP on any connection,
421+
whatever the binding; absent or `true` = the binding rule above. Bind a tool no
422+
MCP family serves (the MCP table above) and no filtering server offers the
423+
skill.
405424
`visualize_data` is the only built-in that draws a chart (an inline `data-chart`
406425
part), auto-registered **only** when an analytics service (`IAnalyticsService`)
407426
is wired — `query_data` / `aggregate_data` return numbers, not charts.

‎skills/objectstack-automation/references/state-machines-and-approvals.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ Since **ADR-0020** there is **no `workflow` metadata type** and no
1111
validation rule** in the object's `validations` array: a flat `field` +
1212
`{ from: [allowedTo] }` transition table. It is **enforced on the write path** —
1313
an update whose `field` moves to a state not listed for the current state is
14-
rejected with the rule's `message`. A `from` state mapped to `[]` is a declared
15-
dead-end.
14+
rejected with the rule's `message`.
1615

1716
<!-- os:check -->
1817
```typescript
@@ -36,7 +35,7 @@ const rule: StateMachineValidation = {
3635

3736
Notes:
3837
- **One rule per field.** Parallel lifecycles (e.g. `status` + `payment_status`)
39-
are N separate `state_machine` rules, one per field.
38+
are N separate `state_machine` rules.
4039
- **`initialStates`** (optional) gates INSERT: a record created with its
4140
state field outside this list is rejected. `transitions` only governs
4241
updates, so without it a record can be born mid-flow (e.g. created already
@@ -55,6 +54,8 @@ Notes:
5554
you want guarded rather than relying on an implicit "any → any".
5655
- Predicate conditions in sibling rules evaluate against the merged record in
5756
the **`record.<field>`** CEL scope (bare field names do not resolve).
57+
- **An AI-gated irreversible transition** pairs this rule with a lock on
58+
`field`: **objectstack-ai** → Common Pitfalls.
5859

5960
### Approvals (Flow Nodes)
6061

@@ -260,8 +261,7 @@ entered. Its CEL source sees exactly **three roots** — nothing else:
260261
**`record` and bare field names are NOT available and fail the node loudly.**
261262
Everywhere else on this platform `record` means "the record at event time" — at an
262263
approval node that phrase is ambiguous between two different times, so you must
263-
say which one: `current.x` or `trigger.x`. Do not carry the `record.x` habit
264-
over from conditions.
264+
say which one: `current.x` or `trigger.x`.
265265

266266
Result contract: a user-id string, a CSV string, or an array of ids. An **empty**
267267
result (present-but-empty field/variable) triggers `onEmptyApprovers`. A

0 commit comments

Comments
 (0)