Skip to content

Commit e07adc1

Browse files
committed
docs(skills): the button rule stays in the automation entry as one clause
Contract review 7364905628, S1: the entry told an author to set runAs: 'system' for a readonly write and had dropped the limit that a button cannot start such a flow, a trap no publish-time check covers. One clause on that bullet restores it: a button starts a system flow only as screen / api, or through a subflow node. Paid inside the entry (the notify row's purpose, the integrations pointer, the last runAs bullet, item 3's sentence, which now follows its script node). Also from that review: "nor a counter field" in the assignment rule, and the ratchet block's routing-row wording. The entry is 8,991 bytes and 190 lines; its row is re-pinned at the measurement, 2242 to 2241. Claude-Session: https://claude.ai/code/session_01Utp6Caj1WJjAUzogG5YWv5 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 40c7410 commit e07adc1

3 files changed

Lines changed: 31 additions & 28 deletions

File tree

‎.changeset/34770-automation-skill-router.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ docs(skills): the objectstack-automation entry file is cut back to the router bu
77
Clause-②: no
88
Metadata-protocol: none
99

10-
`skills/objectstack-automation/SKILL.md` goes from 10.8 KB to 9.0 KB (215 lines to 189). No heading changes, the frontmatter is byte-identical, and nothing an author can write changes: this is wording only. The seven sections a hosted door serves by heading keep their headings and their JSON and TypeScript blocks.
10+
`skills/objectstack-automation/SKILL.md` goes from 10.8 KB to 9.0 KB (215 lines to 190). No heading changes, the frontmatter is byte-identical, and nothing an author can write changes: this is wording only. The seven sections a hosted door serves by heading keep their headings and their JSON and TypeScript blocks.
1111

1212
**What the entry keeps.** The four first checks and the "nothing to read yet" line; the routing list; a flow's project form and its `type` list with `type: 'schedule'` and where the cadence sits; `variables` as an array; the trigger on the start node's `config`; the `type: 'approval'` node; the two node tables with the `save_notice` translation key (`flows.{flow}.notices.{node_id}.message`, read in the saver's locale); the `notify` node with its recipient forms, the source pair rule and the option label evaluated once per run; the five failure-routing and `runAs` rules, the delegated-administration gate whole; the `null` filter operand; the four accepted-then-wrong items; `defineAssignmentRule` beside its approval node; and the declared-connector rule.
1313

@@ -17,15 +17,15 @@ Metadata-protocol: none
1717
- The routing table is a list of three files. Its row for triggers is part of the `references/examples-flows.md` line, its row for assignment rules is a link inside `## Assignment rules`, and `## Integrations are declared, not coded` names its reference file as a path, since the routing list links it.
1818
- The gloss on `autolaunched` ("no user interaction: started by events, APIs or other flows"): `references/examples-flows.md` § Flow Types.
1919
- The second `variables` entry (`{ name: 'approval_result', type: 'boolean', isOutput: true }`): the contract, `FlowVariableSchema` in `node_modules/@objectstack/spec/src/automation/flow.zod.ts`.
20-
- `create_record`, `update_record` and `delete_record` share one table row; "Call an HTTP API" and "Display a UI form" left the `http` and `screen` rows; the `connector_action` row no longer says its `connectorConfig.input` is a value-slot map (`references/examples-flows.md` § External Integration — the rest).
20+
- `create_record`, `update_record` and `delete_record` share one table row; "Call an HTTP API" and "Display a UI form" left the `http` and `screen` rows, and the `notify` row points at its section below; the `connector_action` row no longer says its `connectorConfig.input` is a value-slot map (`references/examples-flows.md` § External Integration — the rest).
2121
- From the `notify` JSON node: `message` with its `date:long` formatter and the `sourceObject` / `sourceId` / `actionUrl` keys. Both examples now stand in `references/examples-flows.md` § `notify` — the rest; the entry keeps the rule (the pair is a pair, and a notify that writes none of the three links to the trigger record).
22-
- "A button cannot start a `runAs: 'system'` `autolaunched`, `record_change` or `schedule` flow: elevate the write, not the flow, through a `subflow` node": `references/examples-flows.md` § Failure routing & `runAs` — the rest, which already said it in full with the `403`.
22+
- "A button cannot start a `runAs: 'system'` `autolaunched`, `record_change` or `schedule` flow: elevate the write, not the flow, through a `subflow` node" is one clause now, on the same bullet: "A button starts a system flow only as `screen` / `api`, or through a `subflow` node." The long form, with the `403` and why the `subflow` route is preferred, is `references/examples-flows.md` § Failure routing & `runAs` — the rest. The last bullet of that section reads "gate an elevated flow here", without repeating `screen` / `api`.
2323
- From § Filter operands: "evaluated before the query" is cut; "a dropped condition widens a query" and "a computed operand is a value, never a query operator" are what `references/examples-flows.md` § Filter operands — the rest already says at more length (the dropped condition that lets a `delete_record` empty the object; the value types a computed operand may be); "route around the node with a `decision`; to match an empty field, write the literal `null`" moved there.
2424
- From item 1 of § Valid-but-silently-wrong: `input.*` and `collection` (the reference lists whose slots they are), the `registerFlow` and executor doors and the `has(record.owner) ? record.owner : null` spelling (moved to item 1 of the reference's § Value slots), and the run user `current_user.id` (already there). The entry still names `objectstack validate` and `expression-invalid`.
25-
- From item 3: the second node of the JSON pair. The entry says in one clause what the later node writes; the node itself moved to item 2 of the reference's § Value slots. The remaining node's names are shorter (`helpdesk.triage`, `category`).
25+
- From item 3: the second node of the JSON pair. The entry says in one sentence, under the `script` node, what the later `update_record` writes; the node itself moved to item 2 of the reference's § Value slots. The remaining node's names are shorter (`helpdesk.triage`, `category`).
2626
- "Most are caught by `objectstack build`" under § Valid-but-silently-wrong: cut, with no other home. First check 4 says most traps pass `os validate`, and each item says where it is refused.
27-
- From § Assignment rules: "it routes each inserted row whose `owner_id` and `queue` are both still empty, once, never on update" and the long form of the hook-and-counter warning: `references/examples-flows.md` § Assignment rules, which already held both.
27+
- From § Assignment rules: "it routes each inserted row whose `owner_id` and `queue` are both still empty, once, never on update" and the long form of the hook-and-counter warning: `references/examples-flows.md` § Assignment rules, which already held both. The entry keeps "never a hook that picks an owner, nor a counter field".
2828

29-
**`references/examples-flows.md`** grows by 776 bytes, all of it text that left the entry and had no other home (listed above). Nothing else in it changed. The skill as a whole is 1,042 bytes smaller.
29+
**`references/examples-flows.md`** grows by 776 bytes, all of it text that left the entry and had no other home (listed above). Nothing else in it changed. The skill as a whole is 1,043 bytes smaller.
3030

31-
**Ratchet.** `scripts/check-skills-token-ratchet.mjs`: the `skills/objectstack-automation/SKILL.md` row goes 2696 to 2242 and the `references/examples-flows.md` row 6433 to 6627, each pinned at its file's measurement with no headroom; the sum of ceilings falls by 260.
31+
**Ratchet.** `scripts/check-skills-token-ratchet.mjs`: the `skills/objectstack-automation/SKILL.md` row goes 2696 to 2241 and the `references/examples-flows.md` row 6433 to 6627, each pinned at its file's measurement with no headroom; the sum of ceilings falls by 261.

‎scripts/check-skills-token-ratchet.mjs‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -958,27 +958,29 @@ export const CEILINGS = new Map([
958958
// pinned AT the measurement. The entry is over the 2670 of ruling record 7168461386 by this
959959
// raise and by no more than it.
960960
// ceil(($(wc -c < skills/objectstack-automation/SKILL.md) - 27) / 4) == ceil(10783 / 4)
961-
// 2696 -> 2242 (#34770, the entry is cut back to the router budget its Done-when names, 6-9
961+
// 2696 -> 2241 (#34770, the entry is cut back to the router budget its Done-when names, 6-9
962962
// KB): LOWERED. Every fact ruling record 7168461386 ordered into the entry stays in it (the
963963
// project form and the `type` list with `type: 'schedule'` and its cadence, `variables`, the
964964
// `type: 'approval'` node, the option label evaluated once per run, the refused `{…}` token
965965
// beside its CEL envelope, `requiredPermissions`, `defineAssignmentRule` beside its approval
966966
// node), and so do the `save_notice` translation key and the delegated-administration gate
967967
// of the 2696 block above, both whole. What pays: restatements whose other home is
968-
// `references/examples-flows.md` (the `autolaunched` gloss, the button that cannot start a
969-
// `runAs: 'system'` flow, the widened-query clause and the computed-operand sentence of §
970-
// Filter operands, the value-slot keys that file lists, the assignment rule's
971-
// once-per-insert sentence), the routing rows a section now carries as its own link
972-
// (triggers, assignment rules), the package.json path of first check 1, the second
973-
// `variables` entry and "Most are caught by `objectstack build`". 776 bytes had no other
968+
// `references/examples-flows.md` (the `autolaunched` gloss, the long form of the button
969+
// rule, the widened-query clause and the computed-operand sentence of § Filter operands, the
970+
// value-slot keys that file lists, the assignment rule's once-per-insert sentence), the
971+
// routing table's rows for triggers (now on the `examples-flows.md` routing line) and for
972+
// assignment rules (now a link inside that section), the package.json path of first check
973+
// 1, the second `variables` entry and "Most are caught by `objectstack build`". The limit
974+
// of the button rule stays in the entry as one clause on the `readonly` bullet (contract
975+
// review 7364905628, S1: no publish-time check covers that trap). 776 bytes had no other
974976
// home and MOVED to `references/examples-flows.md`, whose row rises by them: the notify
975977
// `message` and source-pair examples, the two remedies of a `null` operand, the three doors
976978
// that refuse a `{…}` token with the empty-field spelling, and the node that persists a
977979
// `script` node's `outputVariable`. The state-introspection route stays for the reason the
978-
// 6903 block gives. 10810 bytes (10783 priced) -> 8992 (8965 priced) -> 2242 tokens, pinned
980+
// 6903 block gives. 10810 bytes (10783 priced) -> 8991 (8964 priced) -> 2241 tokens, pinned
979981
// AT the measurement; the 9 KB budget is pinned again from here on.
980-
// ceil(($(wc -c < skills/objectstack-automation/SKILL.md) - 27) / 4) == ceil(8965 / 4)
981-
['skills/objectstack-automation/SKILL.md', 2242],
982+
// ceil(($(wc -c < skills/objectstack-automation/SKILL.md) - 27) / 4) == ceil(8964 / 4)
983+
['skills/objectstack-automation/SKILL.md', 2241],
982984
// 13783 -> 13892 (2026-08-31 app-repo-principles raise, see the block above).
983985
// The invariant-vs-transition-gate choice, placed in the field-conditional-rule
984986
// bullet list where the tool is actually picked. Both wrong picks are silent:
@@ -2542,7 +2544,7 @@ export const CEILINGS = new Map([
25422544
// a `script` node's `outputVariable` (item 2 there). Authority: ruling record 7128031203,
25432545
// fork 4 = A, which covers later moves of the same kind: the row equals the measured bytes
25442546
// moved in, with zero headroom, and the sum of ceilings does not rise (this row +194, the
2545-
// entry's row -454). 25729 -> 26505 bytes (+776) -> 6627 tokens, pinned AT the measurement.
2547+
// entry's row -455). 25729 -> 26505 bytes (+776) -> 6627 tokens, pinned AT the measurement.
25462548
// ceil($(wc -c < skills/objectstack-automation/references/examples-flows.md) / 4) == ceil(26505 / 4)
25472549
['skills/objectstack-automation/references/examples-flows.md', 6627],
25482550
// NEW FILE (card #27223): one recipe per integration archetype — OpenAPI with

‎skills/objectstack-automation/SKILL.md‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ A human sign-off is a `type: 'approval'` node.
8383
| Node | Purpose |
8484
|:--|:--|
8585
| `http` | Set `timeoutMs`. `url` and `headers` are served to every member who can read flows: never a credential there, use a declared connector. Retried after a record change: `durable: true` |
86-
| `notify` | Send a notification (below) |
86+
| `notify` | See below |
8787
| `connector_action` | Dispatch a declared connector's action. `connectorConfig.input` is judged against the action's `inputSchema` only at dispatch |
8888
| `script` | Call a **registered** function (*Valid-but-silently-wrong* #3) |
8989
| `screen` | Screen flows only: `config.fields[]`. An upload is `type: 'file'`, a link to a created record `type: 'record_link'`; Next / Submit is never authored |
@@ -114,7 +114,8 @@ fan-out.
114114
- **A failed node is routed by a `fault` edge**, `{ source, target, type: 'fault' }`.
115115
A `label: 'error'` alone does nothing: an ordinary edge traverses on SUCCESS.
116116
- **Writing a `readonly` field? Set `runAs: 'system'`.** Under the default
117-
`runAs: 'user'` the engine **strips** it and the step succeeds.
117+
`runAs: 'user'` the engine **strips** it and the step succeeds. A button
118+
starts a system flow only as `screen` / `api`, or through a `subflow` node.
118119
- **Elevation stops at identity assignment**: a `runAs: 'system'` write of
119120
`sys_user_position`, `sys_user_permission_set`, `sys_invitation` or
120121
`sys_member` is refused `PERMISSION_DENIED`. Grant a position or permission
@@ -124,8 +125,7 @@ fan-out.
124125
- **A `runAs: 'system'` sweep must pin its organization**, or it reads and
125126
writes across every tenant.
126127
- **Who may START a flow: `requiredPermissions: ['…']` on the flow.** Gate an
127-
elevated `screen` / `api` flow here, never on `current_user.positions`
128-
inside it.
128+
elevated flow here, never on `current_user.positions` inside it.
129129

130130
### Filter operands (`config.filter`)
131131

@@ -146,9 +146,7 @@ node.**
146146
✅ `source: 'newRec.id'`
147147
3. **`script` nodes call a registered function — nothing else.**
148148
`config.function` names one registered in `defineStack({ functions })`: a
149-
PURE compute step that receives `ctx.input` and **returns** a value. A
150-
later **declarative** node persists its `outputVariable` (an
151-
`update_record` with `"fields": { "category": { "dialect": "cel", "source": "ai.category" } }`):
149+
PURE compute step that receives `ctx.input` and **returns** a value:
152150

153151
```json
154152
[
@@ -158,6 +156,9 @@ node.**
158156
]
159157
```
160158

159+
A later `update_record` persists its `outputVariable`:
160+
`fields: { category: { dialect: 'cel', source: 'ai.category' } }`.
161+
161162
A function that writes where the platform cannot see declares it (project
162163
code, no JSON form):
163164

@@ -172,7 +173,7 @@ node.**
172173
## Assignment rules
173174

174175
Routing a new record to a queue or a person is a stack `assignmentRules`
175-
entry, ⛔ never a hook that picks an owner or a counter field
176+
entry, ⛔ never a hook that picks an owner, nor a counter field
176177
([the rest](./references/examples-flows.md#assignment-rules)):
177178

178179
`defineAssignmentRule({ name: 'crm_case_intake', object: 'crm_case', entries: [{ name: 'rest', assignTo: { type: 'queue', value: 'crm_support_intake' }, strategy: 'round_robin' }] })`
@@ -185,5 +186,5 @@ An approval for the same people is an `approval` node with
185186
A vendor system reachable over HTTP is a `connectors:` entry inside the app
186187
(`provider: 'openapi' | 'mcp' | 'rest'`, a packaged spec,
187188
`auth.credentialRef`), dispatched by `connector_action`. Never a plugin.
188-
Recipes, credential hand-off, loader limits and the cases that are platform
189-
code: `references/integration-recipes.md`.
189+
Recipes, credential hand-off, loader limits, platform-code cases:
190+
`references/integration-recipes.md`.

0 commit comments

Comments
 (0)