Repository navigation
feat(spec): enable.aiReadable — a system object's author can open its records to the AI read tools, read-only - #32971
Conversation
…a system object A system (sys_*) object's author may declare enable.aiReadable: true to let the AI read tools reach its records; it never opens a write. The parse refuses the key on any non-sys_* object and on the stored-metadata family, and isAiReadExposed is the one reading, judging the family before the key. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czFmroo4m96P6zVdd1
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czFmroo4m96P6zVdd1
…e-arm guidance Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czFmroo4m96P6zVdd1
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czFmroo4m96P6zVdd1
📓 Docs Drift CheckThis PR changes 1 package(s): 6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 171 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a37dc3cf8bd68205af7540699b528a1b62211306 && git checkout a37dc3cf8bd68205af7540699b528a1b62211306
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 25ee507651f7bae209771fb31661e6edf46f4c8f 9782f9e7fcddd21db4d02371afd79fa8453d2cf9 && git checkout -B drift-repro 25ee507651f7bae209771fb31661e6edf46f4c8f && git merge --no-ff 9782f9e7fcddd21db4d02371afd79fa8453d2cf9
node scripts/docs-audit/affected-docs.mjs --json 25ee507651f7bae209771fb31661e6edf46f4c8f
|
|
domain:spec#3 · os-elon-musk · session_016WV4d1T5HEokjRgR6vCBX8 Contract reviewServed-tier: Read, not reviewed (outside the diff): ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentOpen question (parse versus a
First consumer. Liveness verdict Findings, all nit (no effect on correctness or the contract at this head):
Implemented-by: card thread session_016WV4czFmroo4m96P6zVdd1 Verdict: PASS Items: no must-fix, no should-fix; five nits above (final round). Owed outside this PR: the |
|
domain:spec#3 · os-elon-musk · session_016WV4d1T5HEokjRgR6vCBX8 席位核对 · ACCEPT · PR #32971 · head
|
…i#33458) <!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X13WJLvJKXyx6BgqdzPrLLZ)_ Fixes objectstack-ai#32974 domain:skills#1 · os-project-manager · session_01FEkQ5nzn5SncinMdswdSzM Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:`objectstack-data` 技能的对象能力表(`enable`)加一行 `aiReadable`:只用于平台系统对象(`sys_*`,不含 `sys_metadata`、`sys_metadata_history`),开放只读 AI 访问(查询、取单条、聚合、describe、列表,永不写);应用对象从不声明它,连 `false` 也会在解析时被拒。 - 为什么改:objectstack-ai#32971 新增了 `enable.aiReadable`,技能文字没教,AI 照着能力表写应用对象时既不知道它存在,也不知道写在业务对象上会被拒。 - 风险与回滚:纯技能文字,一个文件加 1 行,外加一个 `@objectstack/skills` patch changeset;不动 schema、不动运行时;回滚即还原本 PR。 - 先看:`skills/objectstack-data/SKILL.md` 第 121 行(能力表最后一行)。 - 两分钟验证:`git diff origin/main -- skills/`,预期只见能力表末尾新增 `aiReadable` 一行,默认列为 `—`。 - 需要你做的:受管面 Tier H(`skills/**`):请批准或合并。 ## What changes - **`skills/objectstack-data/SKILL.md`, Object Capabilities (`enable`) table**, one row after `clone`: `| aiReadable | — | Platform sys_* objects only (not sys_metadata, sys_metadata_history): read-only AI access (query, get, aggregate, describe, list; no write). App objects never declare it, false included: refused at parse |` (backticks around the identifiers in the file). The Default column reads `—`, not `false`: an absent key is closed, and writing `false` on an app object is itself refused, so a `false` default would invite the one value that fails. - **`.changeset/32974-skills-enable-ai-readable-row.md`**: `'@objectstack/skills': patch`, carrying both declaration lines. ## Why Read on `origin/main` ba35dfd, `packages/spec/src/data/ai-read-exposure.ts`: - `aiReadExposureRefusal(objectName, enable)` judges any declared value (`false` included; only an absent or `undefined` key passes) in this order: first the stored-metadata family (`isStoredMetadataBodyObject`, `STORED_METADATA_BODY_OBJECTS` = `sys_metadata`, `sys_metadata_history`, in `packages/spec/src/kernel/stored-metadata-body-objects.ts`) is refused whatever the key says; then a `sys_` name (`/^sys_/i`) is accepted; every other name is refused ("is not a system object ... Remove it"). - `ObjectSchema`'s refinement calls it through `refuseMisplacedAiReadExposure` (`object.zod.ts`), so every door that parses an object refuses it: `ObjectSchema.create`, `defineStack`, `os validate` and the object save door. - `isAiReadExposed(schema)` answers `true` only for the boolean `true` on a `sys_*` object outside that family. - The key is live after objectstack-ai#32442: `isAiReadExposed` is read by `packages/runtime/src/domains/mcp.ts`, `packages/mcp/src/mcp-http-tools.ts` and `packages/mcp/src/stdio-data-bridge.ts`, and two platform objects declare it (`sys_user` in `platform-objects`, `sys_approval_request` in `plugin-approvals`). The `.describe` text in `ObjectCapabilities` says the same as the new row. ## Acceptance notes - No eval is added or extended: no eval under `skills/objectstack-data/evals/` asks for the `enable` table (the only `trackHistory` hit is a `must_not_contain` in a lifecycle eval), and `objects-fields-relationships.json` and `rules/relationships.md` belong to open PRs objectstack-ai#33394 and objectstack-ai#33427 and are untouched. - The order expected `SKILL.md` might sit at its token ceiling; measured headroom was 59 tokens before the row and 0 after, so no other text was cut and no ceiling moved. The review round's fix (naming the two refused objects) was paid inside the row itself (`never a write` to `no write`, `An app object never declares` to `App objects never declare`). ## Verification Head `fa4ef05c`, base `origin/main` ba35dfd. <details><summary>Line and token budget (skills/**)</summary> - `skills/objectstack-data/SKILL.md`: 477 to 478 lines, 26441 to 26678 bytes; token ratchet 6606 to 6665 (ceiling 6665, headroom 0). No ceiling raised. - Whole package, all `skills/*/SKILL.md`: 4602 to 4603 lines, 235787 to 236024 bytes. Bundle total (whole shipped tree): 244310 to 244369 tokens. - `node scripts/pm/check-skill-line-ratchet.mjs`: exit 0. `node scripts/check-skills-token-ratchet.mjs`: exit 0. </details> <details><summary>Derived gates: 46 derived, 44 run green, 2 NOT MEASURED</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 46 families for the two paths; each was run with its exit code captured before any pipe. - 41 exit 0 on the first run, among them `check-adr-0087-registration`, `check-empty-changeset`, `check-skills-token-ratchet` (scan and `--self-test` each), `@objectstack/spec check:skill-docs`, `check:doc-authoring`, `check:nul-bytes`, `check:pm-governed-merges`, `check:published-files`, `check:skill-compatibility`, `check:skill-frame-sync`, `check:skill-identifier-liveness`, `check:skill-links`. - `@objectstack/lint check:doc-formula-expressions`: first exit 3 (no lint dist); exit 0 after `pnpm --filter "@objectstack/lint..." build` under the verify lock (VERDICT command-exit 0, 89s; rebuilt for head fa4ef05, 73s). - `check:dts-closure` and `check:sourcemap-no-sources-content`: first exit 3, then exit 0 after that build, sweeping only the 5 built packages, not every package's `dist/`. - NOT MEASURED, exit 3 PREREQUISITE NOT MET (every package's `dist/`): `check:dual-build-cjs-loads`, `check:lean-entry-closure`. No package source is touched, so no full build was paid; CI builds and runs them. - `--ran`: "46 derived famil(ies) accounted for — 44 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)". - CI families are read from this PR's check-runs, not re-run here. </details> <details><summary>Tier and governed readings</summary> - `dispatch-gates --tier`: MANDATORY contract-review tier, `skills/**` under clause ① (the published catalog); no one-line exit for this surface. - `node scripts/pm/check-governed-merges.mjs --branch claude/project-thread-7ha66d`: exit 3, GOVERNED, landing tier H (人合). 1 of 2 paths on the register (`skills/**`); the changeset is not. Size +11 / -0, under the 3000 threshold. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01FEkQ5nzn5SncinMdswdSzM <!-- signed: domain:skills#1 · os-project-manager · session_01FEkQ5pjSPT7ui2EUcunaVb --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Elon · project thread
Fixes #32865
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #32974 — skills/objectstack-data/SKILL.md (the
enablecapability table has noaiReadablerow; it should say the key is refused on any object whose name does not start withsys_, so an app author never writes it)维护者速读
enable块新增aiReadable(只读的 AI 开放声明)。只有系统表(sys_开头)可以声明,声明后 AI 的读工具(查询、取单条、聚合、描述、列表)可以读它的记录,权限和行级安全照旧;它永远不开放写,写仍只走动作自己的ai.exposed。false会让人误以为锁住了);sys_metadata、sys_metadata_history两张存元数据正文的表一律拒绝。运行时还没有任何地方读它。回滚即 revert 本 PR。packages/spec/src/data/ai-read-exposure.ts(拒收与唯一读法isAiReadExposed,元数据表先于键判断);packages/spec/src/data/object.zod.ts中aiReadable键与写臂提示;packages/spec/src/data/ai-read-exposure.test.ts。pnpm --filter @objectstack/spec exec vitest run src/data/ai-read-exposure.test.ts,应见 17 个测试全绿。What changes
@objectstack/specgains a per-object, read-only AI exposure declaration, executing the maintainer's ruling A on the read half of #32442 (ruling record 6837430865).ObjectCapabilities.aiReadable(enable.aiReadable, optional boolean, absent by default).truedeclares that the AI read tools (query, get one, aggregate, describe, list) may reach this system object's records. Every gate after admission is unchanged: the caller's permissions, row-level security, field masking, and the object's API exposure. It never opens a write; a write on a system object stays on its actions, each opened by its ownai.exposed(ADR-0011). No deployment switch is added, andallowSystemObjectsis untouched.ObjectSchema's existing refinement (refuseMisplacedAiReadExposure→aiReadExposureRefusal), so every door that parses an object inherits it (ObjectSchema.create,defineStack,os validate, the object save door):STORED_METADATA_BODY_OBJECTS(sys_metadata,sys_metadata_history) inpackages/spec/src/kernel/stored-metadata-body-objects.ts, the one list the action surface already refuses by (ADR-0066 D4, note of 2026-10-30). It is imported, not copied;sys_is refused: the MCP record tools already read a business object as the caller, so the key would change nothing there, andfalsewould read as a lock that locks nothing (ADR-0049);falseincluded. The key is new, so no stored object carries it.enabledeclares no other AI key.aiExposed,aiWritable,aiWrite,aiEditableandaiinsideenableare refused with a read-only prescription that points writes at actions'ai.exposed;aiRead,aiReadEnabled,aiReadExposedandmcpReadableget a rename toaiReadable. A value that is not a boolean is refused.isAiReadExposed(schema), exported from@objectstack/spec/data, is the one reading for the server half. It answersfalsefor the stored-metadata family before it reads the key,falseoff asys_*object, andtrueonly for the booleantrue(fail-closed, the shape ofisPublicSharingEnabled).object.enable.aiReadableisplanneduntil the server half lands. The Studio object form omits the key (reconciliation ledger row), because the objects that form edits are the ones the parse refuses it on.Placement and mechanism (measured; for the contract review)
enablerather than a new top-levelaiblock. The MCP layer already reads an object'senableblock for its record tools:packages/mcp/src/stdio-data-bridge.tsgates every data verb onenable.apiEnabled/apiMethods, and both bridges carryenableFeatures: def.enableinto the object description (packages/mcp/src/mcp-server-runtime.ts,packages/runtime/src/domains/mcp.ts). The new key sits beside the exposure flags it is read with, andenablealready holds a read-only opt-in of the same kind (approvalsVisibleToReaders). A top-levelaiblock would add a second home for object exposure, and itsexposedwould read as full exposure.aiReadablekeeps theaiprefix and states the read-only scope in the name. The exact action spelling,aiExposed, is refused with guidance, because on an object it would read as write exposure too.packages/lintrule. The card says the off-sys_*declaration is "refused by lint". A parse refusal is a strict superset:os validatereports parse issues, and the parse also coversdefineStack, module load and the object save door, which a lint rule does not reach. This follows the precedents in the same refinement (refuseWriteLockedUserActions,refuseExternalBindingOnPrimaryDatasource). The claim's file surface was amended accordingly (claim re-post 6839889768). The contract review should confirm this mechanism change.Tests
packages/spec/src/data/ai-read-exposure.test.ts, 17 cases: accepted onsys_approval_request(true, false, absent); refused on a business object (true and false, located atenable.aiReadable); refused on each member ofSTORED_METADATA_BODY_OBJECTS(true and false);isAiReadExposedanswersfalseon each family member without reading the key (getter probe, with a control leg on a non-family system object that is read); no write arm (enabledeclares exactly oneai/mcpkey, the write-arm names areunrecognized_keys, non-boolean values areinvalid_type, the reading opens on booleantrueonly).Ablations (each rule once;
scripts/ablation-replace.mjswith an on-disk anchor proof, EXIT-trap restore, blob == HEAD verified after each; spec tests importsrc/directly, so no dist rebuild applies):sys_*removedisAiReadExposedremovedsys_*removedenableTwo existing tests were updated for the new key:
alias-integrity.test.ts(theenableguidance table now lists the five write-arm names) andmetadata-form-zod-reconciliation.test.ts(anomitledger row forobject.enable.aiReadable).Acceptance notes
isAiReadExposedon the object's registered definition. Whether a tenant object overlay of asys_*object can carryenable.aiReadable(ADR-0029 D9 overlays) is the server half's to measure; this PR measured only that an object extension cannot carryenableat all (ObjectExtensionSchemais closed and takes noenable).sys_predicate (packages/mcp/src/mcp-http-tools.ts,packages/runtime/src/action-execution.ts#isSystemObjectName, and the module-private one here) are not unified; spec cannot import either runtime copy. Noted, not filed.Blocked-by:edge has cleared; the merged key isenable.aiReadableand its reading isisAiReadExposed.Verification
All readings at head
9782f9e7fc(merge oforigin/main2d52e29 into the branch), after a whole-treeturbo run build --concurrency=2(VERDICT command-exit 0).Derived gate families — 113 derived, 113 run, all exit 0
node scripts/pm/dispatch-gates.mjs --ran FILE→113 derived famil(ies) accounted for — 113 run, 0 NOT-MEASURED (a DERIVED zero — all 113 recorded an exit code and none of them is 3). The list covers the@objectstack/specartifact and source audits (check:api-surface,check:authorable-surface,check:docs,check:liveness,check:strictness-ledger,check:export-origins,check:exported-any,check:generated, …), the changeset gates (check-adr-0087-registration,check-changeset-no-major,check-empty-changeset),check:nul-bytes,check:test-source-alias,check:type-check-coverage,check:type-check-debt(under the verify lock) and the rest of the derivation. Families outside the derivation run in CI and are read from this PR's check-runs.Package suites
pnpm --filter @objectstack/spec test→Test Files 837 passed (837),Tests 26754 passed | 1 todo(VERDICT command-exit 0).pnpm --filter @objectstack/spec typecheck→ exit 0.pnpm --filter @objectstack/lint exec vitest run(consumer of the spec contract) →Test Files 200 passed (200),Tests 8579 passed.pnpm --filter @objectstack/spec check:generated→All 14 generated artifacts are up to date.Clause-②:/Metadata-protocol:lines read byscripts/pm/clause2-line.mjsfrom the changeset:yes (widening),added.Not run locally:
pnpm lintandtest:repo(CI's); the dogfood battery (no!in the title, no(narrowing)arm).Human Minimum
packages/specholds no runtime logic (the exported reading is a pure predicate, asisPublicSharingEnabled).pnpm lintis CI's.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code