Skip to content
31 changes: 31 additions & 0 deletions .changeset/34770-automation-skill-router.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
'@objectstack/skills': patch
---

docs(skills): the objectstack-automation entry file is cut back to the router budget

Clause-②: no
Metadata-protocol: none

`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.

**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.

**What left, and what answers it now.**

- First check 1 no longer names `node_modules/@objectstack/spec/package.json`; the installed package's version is where every package keeps it.
- 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.
- The gloss on `autolaunched` ("no user interaction: started by events, APIs or other flows"): `references/examples-flows.md` § Flow Types.
- The second `variables` entry (`{ name: 'approval_result', type: 'boolean', isOutput: true }`): the contract, `FlowVariableSchema` in `node_modules/@objectstack/spec/src/automation/flow.zod.ts`.
- `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).
- 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).
- "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`.
- 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.
- 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`.
- 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`).
- "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.
- 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".

**`references/examples-flows.md`** grows by 776 bytes: about 655 are the passages that left the entry and had no other home (listed above), and about 120 are what seats them there (the sentence that introduces the persisting node, its code fence, indentation, and the clause naming the three doors that refuse a `{…}` token). Nothing else in it changed. The skill as a whole is 1,043 bytes smaller.

**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.
38 changes: 36 additions & 2 deletions scripts/check-skills-token-ratchet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,29 @@ export const CEILINGS = new Map([
// pinned AT the measurement. The entry is over the 2670 of ruling record 7168461386 by this
// raise and by no more than it.
// ceil(($(wc -c < skills/objectstack-automation/SKILL.md) - 27) / 4) == ceil(10783 / 4)
['skills/objectstack-automation/SKILL.md', 2696],
// 2696 -> 2241 (#34770, the entry is cut back to the router budget its Done-when names, 6-9
// KB): LOWERED. Every fact ruling record 7168461386 ordered into the entry stays in it (the
// project form and the `type` list with `type: 'schedule'` and its cadence, `variables`, the
// `type: 'approval'` node, the option label evaluated once per run, the refused `{…}` token
// beside its CEL envelope, `requiredPermissions`, `defineAssignmentRule` beside its approval
// node), and so do the `save_notice` translation key and the delegated-administration gate
// of the 2696 block above, both whole. What pays: restatements whose other home is
// `references/examples-flows.md` (the `autolaunched` gloss, the long form of the button
// rule, the widened-query clause and the computed-operand sentence of § Filter operands, the
// value-slot keys that file lists, the assignment rule's once-per-insert sentence), the
// routing table's rows for triggers (now on the `examples-flows.md` routing line) and for
// assignment rules (now a link inside that section), the package.json path of first check
// 1, the second `variables` entry and "Most are caught by `objectstack build`". The limit
// of the button rule stays in the entry as one clause on the `readonly` bullet (contract
// review 7364905628, S1: no publish-time check covers that trap). 776 bytes had no other
// home and MOVED to `references/examples-flows.md`, whose row rises by them: the notify
// `message` and source-pair examples, the two remedies of a `null` operand, the three doors
// that refuse a `{…}` token with the empty-field spelling, and the node that persists a
// `script` node's `outputVariable`. The state-introspection route stays for the reason the
// 6903 block gives. 10810 bytes (10783 priced) -> 8991 (8964 priced) -> 2241 tokens, pinned
// AT the measurement; the 9 KB budget is pinned again from here on.
// ceil(($(wc -c < skills/objectstack-automation/SKILL.md) - 27) / 4) == ceil(8964 / 4)
['skills/objectstack-automation/SKILL.md', 2241],
// 13783 -> 13892 (2026-08-31 app-repo-principles raise, see the block above).
// The invariant-vs-transition-gate choice, placed in the field-conditional-rule
// bullet list where the tool is actually picked. Both wrong picks are silent:
Expand Down Expand Up @@ -2512,7 +2534,19 @@ export const CEILINGS = new Map([
// record 7168461386. `references/state-machines-and-approvals.md` keeps `main`'s row: its one
// re-pointed reference is paid inside the file.
// ceil($(wc -c < skills/objectstack-automation/references/examples-flows.md) / 4) == ceil(25729 / 4)
['skills/objectstack-automation/references/examples-flows.md', 6433],
// 6433 -> 6627 (#34770, the entry is cut back to the router budget): RAISED by text that
// MOVED in from `skills/objectstack-automation/SKILL.md`, which had no other home: the
// notify `message` example with its formatter and the `sourceObject` / `sourceId` /
// `actionUrl` example (`## notify — the rest`), "Route around the node with a `decision`; to
// match an empty field, write the literal `null`" (`## Filter operands — the rest`), the
// three doors that refuse a `{…}` token and the empty-field spelling (item 1 of `## Value
// slots and the other silent traps — the rest`) and the `update_record` node that persists
// a `script` node's `outputVariable` (item 2 there). Authority: ruling record 7128031203,
// fork 4 = A, which covers later moves of the same kind: the row equals the measured bytes
// moved in, with zero headroom, and the sum of ceilings does not rise (this row +194, the
// entry's row -455). 25729 -> 26505 bytes (+776) -> 6627 tokens, pinned AT the measurement.
// ceil($(wc -c < skills/objectstack-automation/references/examples-flows.md) / 4) == ceil(26505 / 4)
['skills/objectstack-automation/references/examples-flows.md', 6627],
// NEW FILE (card #27223): one recipe per integration archetype — OpenAPI with
// a static key, remote MCP with a static header, plain REST, the vendor
// callback, a hand-written document for a spec-less vendor — plus the two
Expand Down
Loading
Loading