Skip to content

Commit 63afc09

Browse files
committed
docs(skills): objectstack-data rules/lifecycle.md teaches the save notice
The data skill's lifecycle rule gains a Save Notice section: ctx.notice for inline handler and sandboxed body alike, info severity distinct from validation warnings and from a record:alert banner, one message per write with the last call winning, and the save_notice flow node. Paid inside the file's token ceiling by deleting the Decision Tree, the telemetry-growth anecdote and a Safety Semantics restatement. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2g7RyXa8ErM6GAkHyc
1 parent c064d3a commit 63afc09

2 files changed

Lines changed: 34 additions & 18 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): objectstack-data rules/lifecycle.md teaches the save notice
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- **Before.** A hook can tell the person who made a create or update what the save set in motion (`ctx.notice(message)`, answered as the create/update `notice`), and a flow a record create/update trigger starts can set the same message with a `save_notice` node, but no published skill taught it, so an AI author writing a save hook from `objectstack-data` kept reaching for a `record:alert` banner.
11+
- **Now.** `objectstack-data/rules/lifecycle.md` gains *Save Notice — what the save set in motion*: the `ctx.notice` spelling for inline `handler` and sandboxed `body` alike (no capability), info severity and the distinction from validation `warnings` and from a `record:alert` banner, one message per write with the last call winning, the dispatches that carry it, the non-string refusal, and the flow face (`save_notice`, refused outside a create/update record trigger and after an `approval` / `wait`).
12+
- The file stays under its token ceiling: the new text is paid for by deleting the Decision Tree (which restated the class table and the syntax examples), the telemetry-growth anecdote and a Safety Semantics restatement. No ceiling moves; no schema, key or behaviour changes.

‎skills/objectstack-data/rules/lifecycle.md‎

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@
22

33
Guide for declaring how long an object's data lives and how its space is
44
reclaimed (ADR-0057 — system data lifecycle & retention). Not to be
5-
confused with **lifecycle hooks** (`beforeInsert` / `afterUpdate` …) —
6-
those run business logic on data operations; *this* page is about
7-
retention, rotation, and archival of the rows themselves.
5+
confused with **lifecycle hooks** (`beforeInsert` / `afterUpdate` …): *this*
6+
page is the rows' retention, rotation and archival, plus the save notice a
7+
hook hands the saver.
88

99
## Why This Exists
1010

1111
Every object without a `lifecycle` block is **immortal**: rows are never
1212
deleted, and on SQLite the file never shrinks. That's correct for business
13-
records — and a guaranteed disk leak for anything append-only. A scheduled
14-
flow writing telemetry every 20 seconds once grew a dev database from 2 MB
15-
to 260 MB with zero business data in it.
13+
records — and a guaranteed disk leak for anything append-only.
1614

1715
**Rule: any append-only, high-write-rate object (event log, run history,
1816
delivery outbox, ephemeral tokens) MUST declare a `lifecycle` block.**
@@ -119,8 +117,7 @@ lifecycle: {
119117

120118
## Safety Semantics
121119

122-
- **No `lifecycle` block = today's behavior.** Nothing is deleted. `record`
123-
is the implicit default.
120+
- **No `lifecycle` block = today's behavior**: `record` is the implicit default.
124121
- **Archive-then-delete is atomic-ish and safe by default**: an object
125122
declaring `archive` is never hot-deleted before the copy to the archive
126123
datasource succeeded. If no datasource is registered under the `archive.to`
@@ -144,13 +141,20 @@ lifecycle: {
144141
| `growth_alert_rows` | settings | Per-sweep growth spike alert |
145142
| `OS_LIFECYCLE_DISABLED=1` | env | Disables sweeping entirely |
146143

147-
## Decision Tree
148-
149-
1. Users create/edit it and it represents business state? → `record` (omit the block).
150-
2. Is it a compliance/audit trail? → `audit` + `retention`, add `archive` if cold storage exists.
151-
3. Written by machines at high frequency, value decays in days/weeks? → `telemetry` + `retention` (add rotation `storage` for the hottest tables).
152-
4. Meaningless after a deadline (tokens, receipts, read-state)? → `transient` + `ttl` on the natural expiry field.
153-
5. Bus/fan-out messages? → `event` + a short `ttl` (hours).
154-
6. Table mixes prunable history with live state (e.g. terminal vs paused runs)?
155-
→ add `retention.onlyWhen: { status: { $in: [...] } }` so rows outside the
156-
filter are retained regardless of age. Not combinable with rotation/archive.
144+
## Save Notice — what the save set in motion
145+
146+
A create/update hook calls `ctx.notice('Sent to your manager for approval')`
147+
— inline `handler` and sandboxed `body` alike, no capability. The answer
148+
carries it as `notice`; the console shows it on the save toast. **Info
149+
severity**: an outcome, never a problem — distinct from validation
150+
`warnings`. A `record:alert` banner is page metadata shown by the record's
151+
state on every visit; the notice is for what *this* save started.
152+
153+
- One message per write, **the last call wins**; never stored.
154+
- Insert/update dispatches only. A write nobody waits on (batch, seed,
155+
import, a nested write) sets nothing.
156+
- Not a non-empty string ⇒ the write refuses; a refused write answers its
157+
error, no notice.
158+
- A flow a record create/update trigger starts sets it with a `save_notice`
159+
node (`config.message`, `{{ }}` renders); refused in any other flow, and
160+
after an `approval` / `wait`.

0 commit comments

Comments
 (0)