Repository navigation
docs(adr): ADR-0150 addendum — ai_context joins the package-scoped bucket beside skill - #37209
Conversation
A dated addendum under D1 of ADR-0150 proposes that the context pack type of ADR-0160 is identified by (package, name), as skill is. It adds one dated row to the D1 table and an Amended clause to the status line, and rewrites no ruled sentence. It says what the bucket changes for the metadata service's copy, overlays, owner stamps and uninstall, names the readers that move without moving any, names the one follow-up card, and carries the interim rule: two parsed packs that share a name and a root are refused with one answer. ADR-0160 gains one cross-reference note under D1 and no changed sentence. Docs only: no schema, no code, no changeset. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
… rest of its several-packs answer to it Two sentences of the addendum, corrected against the tree. ADR-0160 is on main: it merged the day before, and only its status keyword still reads Proposed. And where the addendum says how the several-packs answer spells a pack, it now changes the name's spelling alone and leaves what else that answer carries to ADR-0160, so it holds whichever of the two records is amended first. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head 1179369 · 2026-11-25T03:55Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: Read for this record: card #37180 with its three comments, the PR body, the file list (two files, both
① Derived judgments
② Semver levelNo changeset, and none is owed:
③ Boundary flagsThe dev report carries three
Dev deviations that touch the
SQL push-down. No code is in the diff, so there is no new id materialisation and no in-app join. Escalated to the seat. ④ Design judgmentdocs/adr/0150 — the addendum, sentence by sentence against the tree. These hold on
(a) The
(b) The second holder in one namespace, through
(c) The root narrows before D3 picks. Right, and it needs no decision of its own.
docs/adr/0160 — the cross-reference. Consistent with ADR-0160's own decisions on Findings. S1 (should-fix) — Six sentences of the addendum are false on the tree this PR merges into. They were true at
The first two sit under a heading pinned to S2 (should-fix) — The addendum lets "an authorized approval" be the ruling for all three of its extra points. Two of them are the maintainer's alone.
Fix: say in the addendum that points 1 and 3 take the maintainer's own merge or word, and that point 2 follows from ADR-0160 D4. The PR is draft and is to be merged by the maintainer, so the landing path is already right. The record's text should not be wider than that path. Nit N1 — The interim rule says "refused with one answer, whether Nit N2 — "Overlays" says a package-less row under a name one package holds "is that holder's customization", one sentence after saying a pack takes no environment overlay. It does not say whether that row is served. On Nit N3 — The follow-up card is named and not filed. Row 8 (#37141) must wait for it, because the resolver throws for a type outside Nit N4 — The D6 bullet rests on a pack name holding no No must-fix. Two should-fix, S1 and S2, both prose in Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — REWORK · repo:objectstack#3 · head 1179369 · 2026-11-25T04:04ZL1: REWORK (L1-w, zone ai-A) The L2 at Should-fix (from the L2, adopted)
Nits (prose face; fix any in the same push, else each is an accepted deviation or a follow-up card)L2 N1–N4 are in the record:
The seat's three questions (answered from the L2, which I adopt)
Read and found right (head 1179369)
Path to final ACCEPT
|
…-context-package-scope-adr
…re the maintainer's alone The addendum's reading of the tree was taken before the context pack type, its tool and the ADR-0160 amendment landed. Every "today" sentence is re-measured on current main and reworded: the type and the pack selection are cited as merged code, the showcase app's two packs are the one first-party declarer and are not refused, and the follow-up card is named with its order before the skill key. The record now says who rules what. The face spelling in the context argument widens D6, and admitting the type to the namespace-unique list is reserved to the maintainer, so the addendum is ruled by the maintainer's own merge or word. That the root narrows the candidates is stated as following from ADR-0160 D4, not as a new decision. Review nits folded in: the interim rule no longer says "one answer" where an omitted context with a third pack gets the several-packs answer; the overlays bullet says a package-less row under a shipped name is not served; the no-hyphen premise of the face is anchored. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract-review-claim: session_01WGufzgv2LZN1W2qSYTZvYs · head deee29a · 2026-11-25T05:53Z |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs Contract reviewServed-tier: Delta review of Read for this record: card #37180 and its thread, the PR body, the file list, the delta and the net diff, card #37216, and the check-runs on the head. The cited code was read on
① Derived judgments
② Semver levelNo changeset, and none is owed: ③ Boundary flags
④ Design judgmentClosures, each read against S1: closed. The addendum is re-measured on
S2: closed. The status clause and the addendum's opening both say the ruling is the maintainer's alone, by the maintainer's own merge or word. The D2 bullet and point 3 say that admitting a type to N1: closed. The interim rule now matches N2: closed. "Overlays" now says a package-less row under a name a package ships is not served. That is true on N3: closed. Card #37216 exists and is open. It is what the text says: it adds N4: closed. The D6 bullet cites New sentences in the delta. Each was read against the tree, and none is false.
The three points beyond the card. My judgment of the first round stands, and the delta changes none of the three designs. The face in No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgv2LZN1W2qSYTZvYs 席位核对 — ACCEPT · repo:objectstack#3 · head deee29a · 2026-11-25T05:57ZL1: ACCEPT (L1-w, delta read, zone ai-A) No must-fix, no should-fix. The L2 at Delta
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W 维护者速读
Request: approval · Tier H by governed path ( Seat's view: land. This is the ADR-0150 addendum that #37180 asks for. It puts
Generated by Claude Code |
…mit (row 11 contract) (objectstack-ai#37240) <!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBEaJzgBWzjWCNjBjkVoeRto)_ repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK Fixes objectstack-ai#37202 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:现在用户无感(只改决定记录,不改代码);规则是给 AI 的记录资料包里,关联列表可以只带挑出来的行、按指定顺序排、限定条数(例如只带当前生效的那一版),筛选不增加任何权限,筛选或排序用到提问人不能据以查询的字段(看不到的、值被收起的、只显示掩码的)时整段省略并说明有资料不可见、不点名字段;要等后续实现卡 objectstack-ai#37203(把这三个写法和读取它们的服务一起做出来)合并后才真正生效。 - 为什么做:属于「按记录向 AI 提问」这一大项,你 11 月 25 日已同意关联列表的筛选和排序,这里把它写成成文规则,后面的实现照着做。 - 出错会怎样:规则写错的话,后面的实现会照着错的做,碰到的是写资料包的人和用它提问的人;这次只有文档,撤回这次合并即可。 - 要你做什么:审后由你本人合并(合并即批准);你的原话只说了筛选和排序,其余十处是记录自己补全的决定,已在记录的「超出卡面原话的几点」一节逐条编号列出(第 13 到 22 点,下文英文部分也有一份),不同意哪条可以先划掉再合并。 ## What changes One file under `docs/adr/`: `0160-record-scoped-ai-inquiry.md`, 55 lines added and 13 removed against `main`. No schema, no code, no changeset. This is ADR-0160's second amendment. It records the maintainer's word of 2026-11-25, verbatim: 「related 的筛选和排序 同意」 (the thread of epic objectstack-ai#36996, card objectstack-ai#37202). The first amendment (PR objectstack-ai#37196) had left filter and order on `related` as a separate protocol decision. - **Header.** A second `Amended:` bullet quotes the maintainer and lists what the amendment records. It says the maintainer's word names filter and order and no more, and it names each of the ten additions with its point number. The `Status:` line is byte-identical, so the generated `docs/adr/README.md` does not change and is not in the diff. - **D1.** A `related` entry gains `where`, `orderBy` and `limit`, on the child's own fields only. - `where` uses the platform's object filter form with ten operators (`$eq`, `$ne`, `$in`, `$nin`, `$gt`, `$gte`, `$lt`, `$lte`, `$null`, `$exists`), joined by `$and` / `$or`. A bare value is read as `$eq`. It follows no relation and takes no field-to-field comparand, no `$now` anchor, no formula and no whole `{token}` placeholder. Anything else is refused at parse. - `orderBy` is `{ field, order }[]`. - `limit` is a positive integer, at most the service's row cap for one related list. - The three keys leave "Later work". Placeholders resolved at call time join it. - The keys are declared here and land with their reader in row 11. Until then the schema on `main` refuses them. - **D3.** The filter and the order run inside the caller's one capped child query and grant nothing. A `related` entry whose `where` or `orderBy` names a field the caller cannot query on is dropped whole, with the statement that some material is not visible, and the field is never named. - **D4.** The read set is unchanged: the three keys add no object to it. - **Points that go past the card's words.** Points 5 and 11 are updated. Points 13–22 are new and list every place where the amendment goes past the maintainer's word and the card. - **Implementation split, Consequences.** The split gains row 11 (card objectstack-ai#37203). Consequences counts a fourth protocol addition. ### Round 2, at `1cd00b0d` The contract review of the first head passed with three should-fix findings (comment 7154648352, adopted by the seat in 7154665327). This head answers them. - **S1.** D3 said "a field this caller cannot read". It now says "a field this caller cannot query on" and defines it as every field outside the security service's `getQueryableFields` answer. That takes in the field served masked and the field an agent's ceiling withholds, which the engine's guard also refuses. Both symbols are anchored. - **S2, by the seat's ruling for this text.** A bare value such as `{ is_current: true }` is admitted and read as `$eq`. A comparand that is one whole `{token}` placeholder is refused at parse in v1, beside the `$now` anchor, and placeholders resolved at call time are later work. - **S3.** The `Amended:` bullet no longer says that one sentence goes past the maintainer's word. The record's own section now carries points 13–22, and point 11 covers `where` and `orderBy`. - **Nits applied where they touch this text.** - The refusal that the rule avoids is named as the security plugin's engine middleware, not the data engine. - "The body" says an outline is cut by the body bound or by the entry cap. PR objectstack-ai#37222 has merged, so the entry cap is now anchored on `main`. - A door whose own page cap is lower than a `limit` that parsed cuts the list there, and the cut is stated. - Row 11 may bound the size of a `where` at parse; this record sets no number. - **Not changed, by the review's own word.** The link-field sentence beside the new one still says "that caller's schema hides". The review asks for a follow-up card to carry it. The branch also merged `main` at `6211ddf4`, with no conflict. That brought the note PR objectstack-ai#37209 added to D1 and the outline cap of PR objectstack-ai#37222. ## Tests This PR changes a record only. No test is added or changed, and nothing is ablated. The readings the text rests on were re-taken on `main` at `6211ddf4`. The branch head is `1cd00b0d`, and every local gate below ran on that head. <details><summary>What the schema on main does with the three keys and with the sort direction</summary> A probe parsed a pack through `AiContextSchema` and a sort node through `SortNodeSchema`. It ran with `tsx` from the scratchpad and is not committed. ```text CONTROL (no new key) success = true related[].where: success = false | unrecognized_keys @ related.0: Unrecognized key(s) on a context pack `related` entry: `where`. related[].orderBy: success = false | unrecognized_keys @ related.0: Unrecognized key(s) on a context pack `related` entry: `orderBy`. related[].limit: success = false | unrecognized_keys @ related.0: Unrecognized key(s) on a context pack `related` entry: `limit`. SortNode { field, order }: success = true SortNode { field, direction }: success = false | unrecognized_keys: Unrecognized key(s) on this sort node: `direction`. Did you mean `direction` → `order`? ``` Each message is cut after its first sentence. The control row shows that the probe pack parses without the new keys, so each refusal is the key's own. </details> <details><summary>The anchors this round adds, resolved one by one</summary> `symbolResolutionClass` from `scripts/symbol-anchors.mjs`, asked for each new anchor and for one name that does not exist: ```text declaration packages/spec/src/contracts/security-service.ts#getQueryableFields declaration packages/plugins/plugin-security/src/security-plugin-object-inputs.ts#computeQueryGuardFieldPerms declaration packages/plugins/plugin-security/src/predicate-guard.ts#assertReadableQueryFields declaration packages/spec/src/data/context-tokens.zod.ts#FILTER_TOKEN_WRAPPED_RE declaration packages/core/src/utils/filter-tokens.ts#resolveFilterTokens declaration packages/services/service-record-context/src/body-outline.ts#RECORD_CONTEXT_OUTLINE_MAX_ENTRIES null packages/spec/src/contracts/security-service.ts#noSuchSymbolControl ``` </details> <details><summary>Local gates at 1cd00b0: 21 derived, 21 run, all exit 0</summary> `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived the same 21 commands as on the first head. Each exit code was captured before any pipe, and `--ran` reconciled the list: ```text ✓ dispatch-gates --ran: 21 derived famil(ies) accounted for — 21 run, 0 NOT-MEASURED (a DERIVED zero — all 21 recorded an exit code and none of them is 3). ``` The gates that read this file printed: ```text ✅ check-adr-links: 1222 relative link destination(s) under docs/adr/ resolve ✅ check-adr-symbol-anchors: 4199 anchors across 163 records resolve — 1416 symbol (1387 declaration, 29 literal), 2731 file-level, 52 cross-repo, 6 exempt, 96 continuation. adr-index --report: OK — docs/adr/README.md is current, every record parsed, self-test 60 assertions green. check-nul-bytes: OK (scanned 27783 text file(s) -- 27783 tracked, 0 untracked-not-ignored; skipped 101 binary; no raw ASCII control bytes). ``` The other 17 are `check-adr-links --self-test`, `check:adr-anchors`, `check:doc-authoring`, `check:pm-governed-merges`, `check:pm-prior-rulings`, `check:closed-ceremony-text`, `check-closing-keyword-parity` and its self-test, `check-comment-mask-corpus`, `check:cross-package-test-inputs`, `check:ci-filter-parity`, `check:driver-memory-census`, `check:gitlink-declared`, `check:refd-timer-probe`, `check:watch-hint-literal`, `plan-test-core-shards --self-test` and `check:doc-formula-expressions`. `check:doc-formula-expressions` reads the compiled output of `@objectstack/formula` and `@objectstack/lint`. Both were built first under the shared verify lock (`VERDICT command-exit 0`). `node scripts/adr-index.mjs` answered `unchanged docs/adr/README.md (250 lines)`. `node scripts/pm/overlap-check.mjs` answered `VERDICT clean exit 0` before each push. </details> Every family that CI runs is read from this PR's check-runs. None of them is re-run locally. ## Acceptance notes **Governed surface (Tier H).** `docs/adr/**` is governed. The maintainer's merge is the record. No seat readies, queues or arms this PR. **These decisions are listed for the maintainer.** The maintainer's word names filter and order on `related`. Everything below is the record's own settlement, accepted or struck by the merge. Each is a numbered point in the record's "Points that go past the card's words" section, and any one can be struck without touching the rest. | Point | Decision | Where it comes from | |:--|:--|:--| | 13 | `related` takes `limit` as well as filter and order. | The card names it; `get_record`'s `related` already takes one. | | 14 | A `limit` over the row cap is refused at parse. Row 11 declares one number that the schema and the service both read. | The pack's other bounds, and `get_record`'s own `related` limit. | | 15 | `where` admits ten operators, joined by `$and` / `$or`. `$not`, `$between`, `$empty`, the string-match operators, relation conditions, `{ $field }` and `$now` are refused. | The card says "a small operator set" and names none. | | 16 | A bare value is read as `$eq`. | The seat's ruling on review finding S2. | | 17 | A whole `{token}` comparand is refused at parse. Placeholders resolved at call time are later work. | The seat's ruling on review finding S2. | | 18 | `orderBy` is `{ field, order }[]`. | `SortNodeSchema` on `main` refuses `direction` by name. | | 19 | A `where` or `orderBy` field the caller cannot query on drops the section, stated and never named. | Review finding S1. The card says "hidden". | | 20 | A `where` or `orderBy` field the published definition lacks leaves the section out, and the answer states nothing. | The record's rule for author defects. | | 21 | A list cut at its own `limit` is a stated cut. | The record's rule that every cut is stated. | | 22 | D3, "The body", names the cap on an outline's entries. | Not about `related`: carried from the review of PR objectstack-ai#37222, nit N5. | **Sections touched beyond the card's list, all in the one claimed file:** the author-defects paragraph and "Later work" in D1, "The body" in D3, the "Points" section, the intro and the two paragraphs under the Implementation split table, and one line of Consequences. **Seen and not changed here** (read on `main`, not exercised through a public door, so not filed): - Row 5's service still refuses the whole call when a `related` child is not served to this caller. The first amendment says that child is left out and the answer says so. - The link-field rule in D3 still says "that caller's schema hides". A link field that the schema shows and the caller cannot query on would reach the engine's guard, which refuses the whole call. The review asks for a follow-up card. - Card objectstack-ai#37203's example spells the sort direction `direction`, and its item 3 says "hidden". Both now differ from the record. - The `ai_context` schema's guidance text for a stray `filter` key says a related list reads every child row the caller may read. Row 11 has to reword it. ## Verification Read first, by risk. All three are in `docs/adr/0160-record-scoped-ai-inquiry.md`: 1. **D3, "Field level", the bullet "The hidden field is one the pack uses structurally".** This is the disclosure rule: which callers lose the section, and what the answer may say. Round 2 rewrote its middle. 2. **D1, the `where` bullet under "Filter, order and limit on a related list".** This is the contract row 11 implements: the operator set, the bare value, and the comparands refused at parse. 3. **"Points that go past the card's words", points 13–22, and the header's second `Amended:` bullet.** They say which parts are the maintainer's word and which are the record's own. Two-minute check: run `pnpm check:adr-symbol-anchors`. It should exit 0 and print a line that starts `✅ check-adr-symbol-anchors:`. That line means every symbol the text cites is declared at the path the text names. At this head it counts 4199 anchors across 163 records. --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzi13yZRqVcp2mGonWK)_ <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK --> --------- Co-authored-by: Claude <noreply@anthropic.com>
…ped bucket beside skill and ai_context (objectstack-ai#37330) <!-- claude-projects-attribution: {"github_login":"os-warren"} --> _Requested by **Warren** · [project thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8ThLXnc2MYoAdJHGZxSsdaA)_ repo:cloud#1 · os-warren · session_01JQwxbZjKjZ947xtTvgJuHX Fixes objectstack-ai#37325 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:用户无感(只改决定记录,不改代码);把你今天定的「按应用+名字区分,都保留」写进记录:两个应用各带的同名知识源都保留、各建各的索引,AI 用「应用前缀-名字」指明是哪一个。 - 为什么做:属于「知识检索平台化」专题;哪些类型按应用区分要先写进记录,后面的实现卡 objectstack-ai#37304(让知识源成为应用包里的一份配置)才能照着做。 - 出错会怎样:记录写偏的话,后面的实现会照着偏的做;这次只有文档,撤回这次合并即可。 - 要你做什么:合并这个 PR,合并就是这条裁定的记录;其中一处超出你的原话、只能由你定:同一个应用前缀下不允许两个应用包带同名知识源(前缀不同的同名知识源照样都保留),不同意就先划掉这一条再合并。 ## What changes Two files under `docs/adr/`: 58 lines added, 1 line changed. No schema, no code, no changeset. **ADR-0150** (Accepted) gains a dated addendum. No ruled sentence is rewritten. - The status line gains one **Amended** clause, dated 2026-11-25, after the `ai_context` one. This is the one changed line: the clause is appended, and nothing before it is edited. - The D1 table gains one row, marked with the date, after the `ai_context` row and before bucket 4. - A new section after the `ai_context` addendum and before D2, "Addendum (2026-11-25): `knowledge_source` joins bucket 3". It writes the maintainer's ruling of that day into the record: the knowledge source type of ADR-0161 K4 is identified by `(package, name)`, in bucket 3 beside `skill` and `ai_context`. The ruling is quoted with its record id in the status clause, at the head of the addendum and in the ADR-0161 note: seat record `7168239918` on the code card, decision card tapped **B 「按应用+名字区分,都保留」** at 2026-11-25T16:34:09Z, against the card's recommendation. The addendum says, in this order: 1. **The type**, and what D2, D3, D4, D5, D6 and D8 mean for it. A package's source is spelled `NS-NAME` where its name crosses the AI face, which is inside `search_knowledge`: the `sources` list of an answer and the `sourceIds` argument. 2. **The principle, read for this type.** The recommendation read a source's name under D1's storage half. The ruling did not, so the keys of a source's index are derived from its identity, as its face is. Three things that reading does not hide are listed. 3. **The tree today**, measured on `main` at `fbb62e1c`. The type is not registered and is in none of the four lists. A source reaches the service through code only. The keys of an index are the bare `id`. 4. **What changes with the bucket**: the service's copy, overlays, owner stamps, uninstall and the keys of an index. 5. **The readers that move.** It names five and moves none. 6. **The follow-up**, the code card objectstack-ai#37304, after this merge. 7. **Past the ruling's words**: seven points, none decided here. One is the maintainer's, two follow from text already ruled, and four are left open for the code card. **ADR-0161** gains one cross-reference note after point 3 of K4 and before K5. No sentence of it is changed. **Not in this PR**, by the card's contract: none of the four lists is edited, no reader is moved and no store is re-keyed. That is the code card's work, after this merge. ## Tests No package is touched, so no package build or test is owed. The checks that read these two files are the docs gates under Verification. ## Acceptance notes - **The chain.** This PR is the ruling's record and step 1 of its execution. The code card objectstack-ai#37304 comes after it and stays open: it takes the four lists, the readers and the store keying in memory, pgvector and turso. - **One decision is the maintainer's alone** (point 1 of "Past the ruling's words"). The ruling record counts "the `domain:server` four lists and readers (precedent PR objectstack-ai#37291)" and names none of them. In that PR the fourth list is `NAMESPACE_UNIQUE_TYPES`: one package holder of a name inside one namespace, refused at install and in `os validate`. So "Two packages shipping one source name both work" holds for two namespaces, and inside one namespace the second is refused. The list's header reserves a further type to the maintainer. The merge accepts this point. Struck, two co-owners of a namespace may ship one name, and the one face they derive is refused at the call. - **Two points follow from text already ruled** and are no new decision. A source name takes the name grammar of buckets 2 and 3, which refuses a `_`-led name that today's `id` pattern admits. And a `409` names only the sources the tool may search (ADR-0161 K9). - **Four points are left open for the code card.** Each is stated in the addendum and decided nowhere in it: what each shape carries (a hit's `sourceId` and `documentId`, a stored document's `sourceId`, the by-name members of the service contract); which coordinate a key carries, the package id or the namespace, and what removes an index left under the old key; which holder a source registered in code is; and an environment source under a name a package later ships. - **The acceptance line of the card**, "The addendum quotes the ruling comment id and the maintainer's words; earlier text of the record unchanged". The id and the words are in all three places named above. ADR-0150's diff has one changed line, the status line, and its old text is a strict prefix of the new text. Every other old line of both files survives, in order. - **The tree moved once during the work.** `main` gained the knowledge splitter (PR objectstack-ai#37287) under six of the files the addendum anchors. `main` is merged into the branch (a merge commit, no rebase and no force-push). Every "today" sentence and every anchor was read again at `fbb62e1c`, and all hold. The two dated readings name that commit. - **Overlap.** PR objectstack-ai#37329 adds a dated note under K8 of the same ADR-0161 file. `node scripts/pm/overlap-check.mjs --branch=claude/project-thread-4uapwf` answered `VERDICT clean exit 0` at this head, against `origin/main` and that PR's head. Whichever of the two lands second merges `main`. - **Line budget.** 58 added and 1 changed; the precedent PR objectstack-ai#37209 was 44 and 1. The difference is the "principle" paragraph, which the precedent did not need because its ruling followed the recommendation, and the seven-point list. - **Citation form.** `check:adr-symbol-anchors` refuses a line anchor under `docs/adr/`, so the record cites `path#Symbol`, and the line numbers are in the table under Verification. - **No changeset.** `docs/adr/` ships in no package, so this PR carries `skip-changeset`. - **Tier H.** This PR stays draft. The merge is the maintainer's, and it is the ruling's record. - **Shallow checkout.** No claim here is read from history dates. - **Attribution lines.** The dispatch asked for a commit trailer that names a model and for the harness's two-line block at the end of this body. The repository's rules ask for the model-free trailer pair and for one footer line under a rule, and those are what the commits and this body carry. - **Noted, not filed.** ADR-0161's status keyword still reads Proposed on `main`, and its own status line says the record is in force from the merge of the PR that carried it. This PR adds one note to that record and does not touch its status line. ## Verification **Read first**, by risk: 1. `docs/adr/0150-…-literal-prefix.md`, "Past the ruling's words" at the end of the addendum (lines 191 to 199). Point 1 is the one decision that is the maintainer's. 2. The same file, "The principle, read for this type" (line 160): how D1's storage half reads for a type the ruling placed against the recommendation. 3. The same file, the D1 table hunk (line 95) and the status line (line 3): one row inserted into a ruled table and one appended clause. Check that both read as additions and change no ruled text. **Two-minute check**: run `node scripts/check-adr-symbol-anchors.mjs`. Expect `4220 anchors across 163 records resolve` and exit 0. Twenty-one of them are this diff's `path#Symbol` anchors. <details> <summary>Measured anchors on main at fbb62e1 (file:line)</summary> | What the addendum says | Where it is read | |---|---| | The type is in no row of the registry; `skill` and `ai_context` open no environment overlay | `packages/spec/src/kernel/metadata-plugin.zod.ts:798` (`DEFAULT_METADATA_TYPE_REGISTRY`), `:1384`, `:1388` | | The service keeps one slot per (package, name) for listed types | `packages/spec/src/api/protocol.zod.ts:2753` (`PACKAGE_SLOTTED_METADATA_TYPES`; `skill` at `:2754`) | | Any other type is keyed by name alone | `packages/metadata/src/package-slotted-store.ts:797` (`storeWriteKey`), `:820` | | The one rule resolves only its listed types, and throws for a type outside the list | `packages/core/src/package-scoped-resolution.ts:245` (`PACKAGE_SCOPED_TYPES`; `skill` at `:270`), `:740`; `packages/objectql/src/package-scoped-resolver.ts:149` | | A by-name read consults (package, name) for listed types | `packages/objectql/src/package-scoped-read.ts:88` (`PACKAGE_SCOPED_READ_TYPES`; `skill` at `:96`) | | One package holder of a name inside a namespace; the list is reserved to the maintainer | `packages/objectql/src/namespace-co-owner-names.ts:96` (`NAMESPACE_UNIQUE_TYPES`), `:27` | | A source reaches the service through code only | `packages/services/service-knowledge/src/knowledge-service-plugin.ts:91` (`KnowledgeServicePlugin`), `:44`, `:220` | | One map by `id`; a second registration replaces the first with a warning | `packages/services/service-knowledge/src/knowledge-service.ts:121` (`KnowledgeService`), `:123`, `:166`, `:168` | | A document id is the source's `id`, a `:` and the record id | `packages/services/service-knowledge/src/knowledge-service.ts:1570` (`documentIdFor`), `:1571` | | An adapter is handed the whole source | `packages/spec/src/contracts/knowledge-adapter.ts:33` (`AdapterContext`), `:35` | | The one in-tree store keyed by the bare `id` | `packages/plugins/knowledge-memory/src/index.ts:44` (`KnowledgeMemoryAdapter`), `:48`, `:55` | | The push door that takes a document id from a caller | `packages/spec/src/contracts/knowledge-service.ts:107` (`IKnowledgeService`), `:127` | | The tool lists each source by its `id`; a hit shows `sourceId` and `documentId` | `packages/services/service-knowledge/src/knowledge-tools.ts:61` (`SearchKnowledgeSourceSummary`), `:70`, `:72`, `:222` | | An unknown `sourceIds` entry is refused `NOT_FOUND` | `packages/services/service-knowledge/src/knowledge-tools.ts:246` (`createKnowledgeTools`), `:257`, `:260` | | Today's `id` pattern admits a `_`-led name; the bucket's pattern does not | `packages/spec/src/ai/knowledge-source.zod.ts:174` (`KnowledgeSourceSchema`), `:176`; `packages/spec/src/kernel/address-grammar.ts:68` (`ROUTER_ADDRESSABLE_NAME_PATTERN`) | | The one face derivation | `packages/spec/src/ai/face-name.ts:86` (`deriveAiFaceName`) | | A skill prompt's name: a face, else a bare name by the one rule | `packages/mcp/src/skill-prompts.ts:373` (`lookupSkillPrompt`) | | The owner stamp's judge, and the collections it judges | `packages/spec/src/kernel/collection-item-owner-stamp.ts:129` (`judgeCollectionItemOwnerStamp`), `:100` | | The type's row is not among the served overrides | `packages/metadata-protocol/src/protocol-package-bindings.ts:388` (`SEALED_ROW_SERVED_OVERRIDE_TYPES`) | | Uninstall, the registry's half | `packages/objectql/src/registry.ts:5328` (`uninstallPackage`) | | Uninstall, the service's half | `packages/metadata/src/metadata-manager.ts:2880` (`unregisterPackage`) | Absence readings at the same commit, each with a positive control: - `knowledge_source` in the four list files, in `packages/metadata/src/package-slotted-store.ts` and in the registry's rows: 0 lines each. Control: `skill` is in the first three lists and in the registry, at the lines the table gives. - A stack collection: `knowledgeSources` in `packages/spec/src/stack.zod.ts`, 0 lines. Control: `aiContexts`, 3 lines. - `knowledge_source` under `packages/`, `examples/`, `ui/`, `skills/` and `content/`: 0 files. Control: `ai_context`, 60 files. - `KnowledgeServicePlugin` or `registerSource` under `examples/`: 0 files. Control: 25 files under `packages/`. - Tracked paths under `knowledge-pgvector` or `knowledge-turso`: 0. Control: `packages/plugins/knowledge-memory`, 10 files. - Before this diff, ADR-0161 named ADR-0150 on 0 lines (control: ADR-0088, 7 lines), and ADR-0150 held the word "knowledge" on 0 lines (control: `ai_context`, 6 lines). </details> <details> <summary>Local gates at head 05f35b6: 21 derived, 21 run, all exit 0</summary> Derived with `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands`, and reconciled with `--ran`: ``` Run reconciliation — 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN. ✓ dispatch-gates --ran: 21 derived famil(ies) accounted for — 21 run, 0 NOT-MEASURED (a DERIVED zero — all 21 recorded an exit code and none of them is 3). ``` Each exit code was captured before any pipe: ``` 0 node scripts/check-adr-links.mjs 1225 relative link destination(s) under docs/adr/ resolve 0 node scripts/check-adr-links.mjs --self-test 0 node scripts/check-closing-keyword-parity.mjs 3 parsers agree on all 9 keywords 0 node scripts/check-closing-keyword-parity.mjs --self-test 0 node scripts/check-comment-mask-corpus.mjs 23929 files, 0 disagree, 0 unparseable 0 node scripts/ci/plan-test-core-shards.mjs --self-test 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions 0 pnpm check:adr-anchors 132 anchored file(s), every governing ADR still referenced 0 pnpm check:adr-index docs/adr/README.md is current, every record parsed 0 pnpm check:adr-symbol-anchors 4220 anchors across 163 records resolve 0 pnpm check:ci-filter-parity 0 pnpm check:closed-ceremony-text 0 pnpm check:cross-package-test-inputs 0 pnpm check:doc-authoring 0 pnpm check:driver-memory-census 0 pnpm check:gitlink-declared 0 pnpm check:nul-bytes no raw ASCII control bytes 0 pnpm check:pm-governed-merges 0 pnpm check:pm-prior-rulings 0 pnpm check:refd-timer-probe 0 pnpm check:watch-hint-literal ``` `check:doc-formula-expressions` reads the compiled output of `@objectstack/formula` and `@objectstack/lint`. Those two and their dependencies were built first on the merged tree, under the shared verify lock (`VERDICT command-exit 0`). `docs/adr/README.md` is generated from each record's status keyword. ADR-0150's keyword stays Accepted and ADR-0161's stays Proposed, so the index does not change and is not in this diff. Also at this head: `node scripts/check-commit-card-trailers.mjs --range origin/main..HEAD` exits 0 over the 3 commits of the branch. Not measured locally, and CI's to run: the type-check lanes, the `Plan Test Core shards` job and the governed-merges audit, which take values only a CI run has. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01JQwxbZjKjZ947xtTvgJuHX)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
…xt pack is identified by its package and its name; get_record_context selects a pack by its face on both MCP doors (objectstack-ai#37291) repo:objectstack#4 · os-justin · session_01QSeKYpEsWWE9Y5YtSsDgqZ Fixes objectstack-ai#37216 Clause-②: yes (narrowing) Metadata-protocol: narrowed Skills-docs: follow-up objectstack-ai#37177 ## 维护者速读 - 用户能看到什么变化:两个应用各自带了同名的资料包时,外部 AI 通过 MCP 读取记录资料能按“应用+名字”分别选到各自的包;只给名字且有两个应用都带这个名字时,会被明确拒绝并列出每个可选的写法。 - 为什么做:属于“在一条记录上问 AI”专题,落实已合并的资料包身份裁决(资料包按应用+名字认),也为后续“技能指定资料包”那张卡扫清前提。 - 出错会怎样:只影响资料包的选取与同名校验;第一方应用里没有任何同名资料包,现有部署读到的结果不变,可直接撤回。 - 要你做什么:这是收窄改动,请你批准;批准后由席位合入。契约审核通过记录是 PR comment 7168612536,Head-sha `7408543965b4dbbc8e51cf8033e51106d2e2f79d`。 ## What changes ADR-0150's addendum (PR objectstack-ai#37209, merged by the maintainer) puts the context pack in bucket 3 beside `skill`: a pack is identified by its package and its name. - **The four lists.** `ai_context` joins `PACKAGE_SCOPED_TYPES` (`packages/core/src/package-scoped-resolution.ts`, the one ADR-0150 D3 rule), `PACKAGE_SCOPED_READ_TYPES` (`packages/objectql/src/package-scoped-read.ts`, the `/meta` by-name read and its `?package=` qualifier), `PACKAGE_SLOTTED_METADATA_TYPES` (`packages/spec/src/api/protocol.zod.ts`, the metadata service's per-`(package, name)` slot; uninstall drops one package's pack and keeps another's) and `NAMESPACE_UNIQUE_TYPES` (`packages/objectql/src/namespace-co-owner-names.ts`, D2's refusal of a second holder inside one namespace, at install and in `os validate`). - **Reader 1, pack selection** (`packages/services/service-record-context/src/read-set.ts`). Candidates are still the packs rooted on `objectName`. `context` is read as a skill prompt's name is: a face (`NS-NAME`, `deriveAiFaceName`) answers its one pack; a bare name resolves by D3 as a caller with no package (the environment's pack, else the one package holder, else `409 RESOURCE_CONFLICT` naming each candidate by its face). `RecordContextDoor` gains an optional `packageNamespace(packageId)`; the tool description teaches `NAMESPACE-NAME`. - **Both MCP doors place a pack's package.** The `/mcp` route (`packages/runtime/src/domains/mcp.ts`) implements `packageNamespace` through `packageNamespaceOf`, on the engine resolved beside the `listContextPacks` read, as `listSkills` does. The stdio bridge (`packages/mcp/src/stdio-data-bridge.ts`) implements it from its `engine`'s registry (the `objectql` service, the same record `installedPackageNamespace` reads for skill prompts). Both sit on top of objectstack-ai#37255's `stripReadDecorations` listing, unchanged. - **The several-packs answer** (triage row 7154571964, ADR-0160 D4 step 3 as amended by objectstack-ai#37196): each pack is listed by its face with its label, in en and zh-Hans; a pack with a blank label is listed by its face alone. - **The overlay consequence** (card What 4, ADR-0150 D4 as ruled for `skill`): a package-less `ai_context` row under a name a package ships is that holder's customization and is not served, read at `(type, name)` whatever the row's root. Measured by a §5 pin with a control in `packages/metadata-protocol/src/protocol.reads-environment-only.test.ts`. - **ADR-0087 semantic entry** `packages/spec/src/migrations/entries/semantic/18.ai-context-package-scoped-name.ts`, registered by the changeset's `registered ai-context-package-scoped-name` marker. **Narrowings, each measured on first-party trees** (objectstack at `d7f299c0`, re-read at this head; hotcrm at `9b735103`): the one declarer of packs, `examples/app-showcase` (`src/ai/record-context.ai-context.ts`), ships two packs of different names (`showcase_project_brief`, `showcase_task_notes`) in one package; hotcrm declares none. | Narrowing | First-party count | |:---|:---| | A second holder of a pack name inside one namespace: refused at install (`422 NAMESPACE_CONFLICT`) and by `os validate` | 0 | | `GET /api/v1/meta/ai_context/NAME` with no package, for a name two packages hold: first match becomes `409 RESOURCE_CONFLICT` | 0 | | A package-less pack row under a name a package ships: not served (the holder's customization) | 0 | ## Tests - `packages/mcp/src/mcp-record-context-tools.test.ts`: a new top-level `describe` on the stdio bridge whose engine's registry places two packages: each same-name pack reached by its face, alike over MCP-over-HTTP and stdio; the bare name refused `409` naming both faces; a control engine with no registry spells each pack bare, so no face reaches one (`404`). - `packages/runtime/src/mcp-record-context-tools-bridge.test.ts`: in the real-protocol `/mcp` harness, two packages of two namespaces ship `rcd_brief` on one root: each is reached by its face, and the bare name is refused `409` naming both. The door's member pin lists `packageNamespace`. - `packages/services/service-record-context/src/__tests__/record-context-tools.test.ts`: a new top-level `describe` for selection by `(package, name)`: each of two packages' same-name packs reached by its face; the bare name refused `409` naming both faces with nothing read; uninstalling one holder keeps the other; environment pack first under D3; the root narrows before D3 picks; the several answer by face and label in en and zh-Hans, with the blank-label fallback; a door without `packageNamespace`. - `packages/metadata/src/metadata-manager-keyed-plural-read.test.ts`: the pinned slotted set gains `ai_context`, so every plural-read case runs for it. - `packages/metadata/src/loaders/database-loader.test.ts` (objectstack-ai#32521 priming): the two host-file cases spelt the host's file `helper.TYPE.yml`, which the pass never reads for `ai_context` (the registry declares `**/*.ai-context.yml`). They now spell the file from the type's registry pattern. Every assertion is unchanged, and the `ai_context` cases assert the slotted behaviour every other type already had. - objectql and CLI enumeration pins (`registry-namespace-co-owner-names`, `package-scoped-exact-qualifier`, `package-scoped-e8-readers`, `manifest-service-residual-namespace-name`, the CLI's `namespace-co-owner-names`) list `ai_context` where it moved. ## Acceptance notes - **Owed item 3 of the hand-off is folded into this PR.** Both doors' `packageNamespace` (`packages/runtime/src/domains/mcp.ts`, `packages/mcp/src/stdio-data-bridge.ts`) waited for PR objectstack-ai#37255 (objectstack-ai#37243), which edits the same `listContextPacks` regions. It landed after objectstack-ai#37255 merged: `main` was merged in at `057cedfa` (no rebase), and the doors were built on its `stripReadDecorations` listing (commit `1deea31f`). - `record-context-tools.zod.ts`'s `context` describe still says "by name"; the addendum makes it a face or a bare name. Noted for objectstack-ai#37141, which owns that key. - The contract review at CONTRACT_REVIEW_TIER (`packages/spec/src/api/protocol.zod.ts`) is run by the zone, not here. ## Verification <details><summary>Local readings</summary> Each run under `scripts/pm/os-verify-lock.sh`, exit taken from its `VERDICT command-exit` line. Readings taken at `6cb32813` (main merged at `057cedfa`, which carries objectstack-ai#37255). The head is now `74085439`: the two commits since change only the changeset's `Clause-②` line and the semantic entry's `reason` plus the first BREAKING bullet (`422 NAMESPACE_CONFLICT`). The dogfood battery was re-run on `74085439` (see below). The suites the door commits touch were re-run there; the rest were read at `c61fb9f7`, and the merge brought no change to their packages (`packages/spec`, `core`, `objectql`, `metadata`, `metadata-protocol` untouched by it). | Command | Head | Result | |:---|:---|:---| | `pnpm --filter @objectstack/mcp test` | `6cb32813` | 85 files, 1507 tests passed · exit 0 | | `pnpm --filter @objectstack/runtime test` | `6cb32813` | 647 files; 11997 passed, 25 skipped · exit 0 | | `pnpm --filter @objectstack/service-record-context test` | `6cb32813` | 2 files, 82 tests passed · exit 0 | | `typecheck` mcp, runtime | `6cb32813` | exit 0 each | | `pnpm --filter @objectstack/core test` | `c61fb9f7` | 157 files, 3761 tests passed · exit 0 | | `pnpm --filter @objectstack/objectql test` | `c61fb9f7` | 638 files, 14423 tests passed · exit 0 | | `pnpm --filter @objectstack/metadata test` | `c61fb9f7` | 83 files, 2798 tests passed · exit 0 | | `pnpm --filter @objectstack/metadata-protocol test` | `c61fb9f7` | 370 files passed, 9 skipped; 23419 tests passed · exit 0 (§5 pin and its control both ran and passed) | | `pnpm --filter @objectstack/spec exec vitest run src/migrations src/api` | `c61fb9f7` | 69 files, 2339 tests passed · exit 0 | | `pnpm --filter @objectstack/cli exec vitest run --project unit src/utils/namespace-co-owner-names.test.ts` | `c61fb9f7` | 31 tests passed · exit 0 | | `typecheck` service-record-context, metadata, core, objectql, metadata-protocol, spec, cli | `c61fb9f7` | exit 0 each | The objectstack-ai#32521 host-file pins before the fixture fix: 2 failed / 539 passed (the two `ai_context` host-file cases; the pass read no file). After: 541 passed, 23 of them `ai_context` cases. **Ablations** (once each, after committing; restore proven by blob equal to HEAD): deleting the stdio bridge's `packageNamespace` member turns both face cases of the new mcp `describe` red (2 failed, the control passes). Deleting the `/mcp` door's member turns the runtime face case and the member pin red (2 failed). The CLI `integration` layer and `test:repo` were not run locally; CI runs them. </details> <details><summary>Gate sweep (dispatch-gates --commands)</summary> `node scripts/pm/dispatch-gates.mjs --commands` at `6cb32813`: 105 derived commands, each run with its exit code recorded. `--ran`: **105 derived, 105 run, 0 NOT MEASURED** (a derived zero: every line carries its exit code). - 104 exit 0 on the first run. - `pnpm check:type-check-debt`: exit 3 on the first run (lock queue-timeout behind the dogfood run, nothing measured). Re-run under the lock: exit 0. - `check:adr-0087-registration`: `registered ai-context-package-scoped-name (new here: ai-context-package-scoped-name)`. </details> <details><summary>Dogfood battery</summary> Head `74085439` (the current head; the os-dev-report is objectstack-ai#37216 comment 7169906867): the full battery under the lock gave `VERDICT command-exit 0` · Test Files 487 passed, 3 skipped (490) · Tests 4128 passed, 68 skipped (4196) · no failures. Earlier reading, head `6cb32813`, `pnpm turbo run build --filter='@objectstack/dogfood^...'` (exit 0), then `pnpm --filter @objectstack/dogfood test` under the lock: `VERDICT command-exit 0` · Test Files 487 passed, 3 skipped (490) · Tests 4128 passed, 68 skipped (4196) · no failures. (Also run at `c61fb9f7`, before the door commits: the same counts.) </details> **Read first:** `packages/services/service-record-context/src/read-set.ts` (`selectContextPack`, the face / D3 order), `packages/spec/src/api/protocol.zod.ts` (the slot list, a contract surface), `packages/mcp/src/stdio-data-bridge.ts` (`installedPackageNamespaceOf`, the stdio door's new member). **Two-minute check:** `pnpm --filter @objectstack/service-record-context exec vitest run src/__tests__/record-context-tools.test.ts` → 65 passed, including "the bare name two packages hold is refused 409, naming both faces". ## Provenance Opened by seat repo:objectstack#4 on the maintainer's authorization in the seat session (「objectstack-ai#37216 开 PR 放行」). The dev session's (`session_01QSeKYohZLmQ1Ug9FKcQtVu`, zone a4-A) own relay `pr_create` was refused by its permission check and not retried; the dev sent the prepared body. The seat changed the dev's `Clause-②: no (narrowing)` to `Clause-②: yes (narrowing)`. A narrowing arm is legal with either value; `yes` is right here because the diff also widens published surface: `?package=` on the history and rollback doors for `ai_context`, a face in `get_record_context`'s `context`, and new `service-record-context` exports. Branch `claude/issue-37216-ai-context-package-scope` @ `74085439`. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QSeKYpEsWWE9Y5YtSsDgqZ --------- Co-authored-by: Claude <noreply@anthropic.com>
…nd a related-lists block scoped to each child (objectstack-ai#37315) <!-- claude-projects-attribution: {"github_login":"os-alice"} --> _Requested by **Alice** · [project thread](https://claude.ai/code/project/chan_01NoziMoftaSPmzgKNjJGePH?thread=cmsg_01NoziMoftaSPmzgKNjJGePH8HwrkPJDQVtqCcoED6n6og)_ Fixes objectstack-ai#37143 Clause-②: yes (widening) — one new public export, `aiContextForm` from `@objectstack/spec/ai`, and `/meta/types` now serves a form for `ai_context`; no key is added to what a pack may hold Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:应用作者在 Studio 里可以新建、编辑资料包:选根对象和它的字段,选指向它的关联列表并为每个列表选列,选正文字段,再保存发布。 - 为什么做:记录 AI 问询专题的第 7 步,让资料包不必写在代码包里(运行时可编辑)。 - 出错会怎样:最坏是编辑界面选项不对或保存被拒;已有的资料包和对象的关联列表编辑不受影响,可以直接撤回。 - 要你做的:无。 ## What changes ADR-0160 D1, clause 2 (runtime authoring). The type was already registered with `allowRuntimeCreate: true` and its author defects are already reported at save (`validateAiContext` on the runtime publish door); what was missing was a form, so Studio's generic metadata editor had nothing to lay a pack out with. - **`aiContextForm`** (`packages/spec/src/ai/ai-context.form.ts`, exported from `@objectstack/spec/ai`, registered as `ai_context` in `METADATA_FORM_REGISTRY`), by the `skill.form.ts` precedent. Two sections: Basics (`name`, `label`, the root `object` through `ref:object`) and Material (`fields` as `field-multi` with `dependsOn: 'object'`, the `page.form.ts` precedent; `related` as `related-list-entries` with `dependsOn: 'object'`, the `object.form.ts` precedent; `body` as a composite whose `field` is a `field-ref` over the root). The form names every top-level key `AiContextSchema` accepts and no other (the registry-wide reconciliation test). - **The `related-list-entries` block learns the pack's entry shape** (`ui/packages/app-shell/src/views/metadata-admin/ContextPackRelatedEntries.tsx`). A pack entry is `{ object, field?, fields? }`, not the object form's bare name or `{ list, label?, columns? }`, so the block now tells the two apart by the entry schema it is handed (`items.properties.object`), never by the type's name: - the add picker offers every reference field of a served object whose target is the root, resolved with the spec's own `REFERENCE_VALUE_TYPES` and `referenceTargetOf`, the link `validateAiContext` resolves (a self-reference and each of a child's several links included); a pick is written `{ object, field }`; - each entry's columns are picked from THAT child object's fields (`useObjectFields`, draft-overlaid), never the root's; - it stops at the schema's `maxItems` (3 lists, 10 columns), and an emptied list or column set removes its key (both arrays are `minItems: 1`); - a stored entry the catalog shows no link for is kept and marked; the save-time report is its judge. - The object form's `relatedLists` keeps its chip face, unchanged (`RelatedListNameEntries`, the old body). - while the object list is loading, or after it failed (`getTypeStatus('object')`), no stored entry is marked unlinked and the add picker says loading / could not load, never "no reference field". - **An emptied picker removes its key** (L2 review on this PR, S1). Removing the last chip of a `field-multi` whose schema has `minItems >= 1` (the pack's `fields`) removes the key instead of writing `[]`; in a composite, a cleared sub-field drops its key (as `setField` already does at the top level), and a composite left empty while its schema requires a key that has no default is removed (the pack's `body` after "None") instead of written as `{ field: '' }`. A composite whose required keys all carry a default keeps `{}` (S3: `/meta/types` serves the output derivation, which lists a defaulted key as required; a view's `pagination: {}` and `selection: {}` are read by their presence). Both were drafts the save door refuses with no way back in the form. `SchemaForm.tsx` (`compositeWith`) and `widgets.tsx` (`emptyArrayRefused`). - **Words**: eleven `engine.form.contextPack.*` keys in the studio namespace (en, zh); the platform's `metadataForms.ai_context` bundles regenerated (`node scripts/check-i18n-bundles.mjs --write`), with the zh-CN leaves translated by hand, and the console's zh-CN overlay rows (`metadata-form-zh-cn.ts`) copied from them. - `api-surface/ai.json` and `export-origins/ai.json` regenerated for the one new export. objectstack-ai#37180's outcome, read for the soft dependency: PR objectstack-ai#37209 (merged by the maintainer) puts `ai_context` in ADR-0150's package-scoped bucket beside `skill`. A pack created in Studio is therefore saved the way a skill created in Studio is, into the package the editor is working in; nothing in this PR picks a package for it, and the reader move is objectstack-ai#37216. ## Tests - `packages/spec/src/ai/ai-context.form.test.ts`: the registry entry, the identity rows, and every picker scoped by `object`. - `ui/packages/app-shell/src/views/metadata-admin/ContextPackRelatedEntries-37143.test.tsx` (12): the four rework pins (loading / idle / error catalog marks nothing; the pack's last root field removed writes no key; an array without `minItems` still writes `[]`; "None" for the body removes `body`, a composite requiring nothing keeps `{}`), and the original eight: the schema discriminator; the links offered (four, the self-reference and both links of one child, an unrelated object absent); a pick written as `{ object, field }`; columns offered from the child, not the root; column and list removal dropping their keys; an unlinked stored entry kept and marked and a listed link not offered again; the bound and the no-root state; the host id on the add picker. Every value the block writes is parsed with `AiContextSchema`. - `RelatedListEntriesWidget-35923.test.tsx` (the object form's face) still passes unchanged. - `openPathObjectReaders-12811.test.ts` (app-shell console): one row, `ContextPackRelatedEntries.tsx` classified `off` among the readers of `useMetadata().objects` (the block reads the served object list for its link catalog and is mounted only in the metadata admin, never on an app's object-list open). - `bare-type-display-echo-decisions.test.ts` and `object-lifecycle-panel-echo-decisions.test.ts` (platform-objects): literal counts and a dated comment row only, because `ai_context` now has a form and its eighteen leaves are authored in zh-CN, ja-JP and es-ES (surface widened by the seat, claim amendment 1). <details><summary>Local runs (head 4b6929e)</summary> - `pnpm --filter @objectstack/spec test`: exit 0. `pnpm --filter @objectstack/spec typecheck`: exit 0. - `pnpm --filter @objectstack/platform-objects test`: Test Files 126 passed (126), Tests 2161 passed (2161). typecheck: exit 0. - `ui`: `pnpm exec vitest run packages/app-shell/src/views/metadata-admin/ packages/app-shell/src/__tests__/`: Test Files 824 passed (824), Tests 9036 passed, 1 skipped. `packages/i18n/`: Test Files 111 passed (111). The rest of app-shell's suite is left to `Test UI` (a full local run did not finish in 54 minutes on the shared box and was stopped). - Ablation, once: the pack branch of `RelatedListEntriesWidget` disabled (`if (false && isContextPackEntrySchema(schema))`, written and restored by `scripts/ablation-replace.mjs`, blob equal to HEAD after restore) turns the new file red, 7 failed of 8; the one that stays green is the helper-only case. - `node scripts/check-i18n-bundles.mjs`: exit 0, every bundle in sync. `pnpm --filter @objectstack/spec check:generated`: api-surface and export-origins regenerated with `--fix`, then clean. - After the merge of `main` and the reader-table row: `packages/app-shell/src/console/__tests__/openPathObjectReaders-12811.test.ts` 3/3 (it was the one red file of `Test UI (15/16)` at 7d37a1d); spec 894 files and platform-objects 126/2161 green again after the merge. - `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran`: at 4b6929e, 93 derived, 92 run, 1 NOT-MEASURED (exit 3, prerequisite not met here: `check-plugin-teardown-shape.mjs --self-test`), 0 UNRUN. - CI at 3a215ad: 59 success, 10 expected skip, 0 failed. At 6ada5fd: 57 success, 10 expected skip, 2 failed (`Test UI (5/16)` and its aggregator), the one failure `packages/auth/src/__tests__/AuthProvider.test.tsx` (objectstack#36972 pin, `mounts` 2 vs 1), in a package this PR does not touch; it passed 3 of 3 runs locally at 6ada5fd. At 4b6929e: 59 success, 10 expected skip, 0 failed. - Rework (6ada5fd): `ui` `pnpm exec vitest run packages/app-shell/src/views/metadata-admin/ packages/app-shell/src/console/__tests__/openPathObjectReaders-12811.test.ts`: Test Files 800 passed (800), Tests 8588 passed, 1 skipped. Ablation, one at a time with `scripts/ablation-replace.mjs` (blob equal to HEAD after each restore): the `field-multi` prune off, the composite's empty-required prune deleted, the catalog state forced `ready`; each turns exactly its own pin red (1 failed of 12). - Rework 2 (4b6929e): `ui` `pnpm exec vitest run packages/app-shell/src/views/metadata-admin/`: Test Files 799 passed (799), Tests 8589 passed, 1 skipped; `ContextPackRelatedEntries-37143.test.tsx` 16/16, its new pins built on the SERVED derivation (`z.toJSONSchema(getMetadataTypeSchema(type), { unrepresentable: 'any' })`): view `pagination`, `selection`, `gallery` keep `{}`, view `kanban` and the pack's `body` are removed. Ablation: the default check removed (every required key counts) turns those three red (3 failed of 16), restored to HEAD. Swept every composite row of the registered forms against the served derivation: the rows whose required keys all carry defaults (view `selection`, `pagination`, `gallery`, `userFilters`, `appearance`, `userActions`, `navigation`, `sharing`; object `enable`, `access`, `publicSharing`; field `currencyConfig`; hook `retryPolicy`; report and dashboard `dateRange`, dashboard `header`; page `interfaceConfig.appearance`, `interfaceConfig.userActions`; agent `planning`; flow `errorHandling`) keep `{}`; the rest have a required key with no default and are removed when emptied. - NOT MEASURED locally: `@object-ui/app-shell` and `@object-ui/i18n` type-check (the ui workspace's own packages have no `dist/` in this container, so tsc stops on module resolution); `Type Check UI` is the reading. </details> ## Acceptance notes - The card's end-to-end clause (an author creates a pack in Studio and `get_record_context` serves it) is covered here in pieces, not by one booted host: the block's every write parses as a pack; the metadata API save of an `ai_context` row is `protocol.runtime-authoring-gate.test.ts` (metadata-protocol); the record-context door reads the protocol's merged `ai_context` listing (`mcp-record-context-tools-bridge.test.ts`, runtime). Measured once live as well (showcase booted with `objectstack dev --seed-admin`, the `ui/` console served by Vite against it, Chromium via Playwright, at the rework's source): Studio → AI → AI Context Pack → create `project_brief` on `showcase_project` saved and published (`PUT …/meta/ai_context/project_brief?mode=draft` 200, `POST …/publish` 200); edit: root fields `name`, `status`; the add picker offered the four links to the root (`showcase_client_brief.project`, `showcase_field_zoo.f_master_detail`, `showcase_project_membership.project`, `showcase_task.project`); the columns offered were `showcase_task`'s fields; body chosen then set to "None"; saved body `{"name":"project_brief","label":"Project brief","object":"showcase_project","fields":["name","status"],"related":[{"object":"showcase_task","field":"project","fields":["title","status"]}]}` (no `body` key), 200 and published. A second edit removed both root fields: saved without `fields`, 200. Then MCP `get_record_context` (`objectName: showcase_project`, `context: project_brief`) on a seeded project answered the pack, with the task rows' `title` and `status`. - The body picker offers every root field, not only the long-text ones: `field-ref` has no type filter, and a non-long-text pick is reported at save (`ai-context-body-not-long-text`). - The link catalog is the console's served object list (`useMetadata().objects`); an object it does not serve is not offered, and a stored entry naming one is kept and marked. ## Verification Two minutes: open Studio, pick a package, open AI → AI Context Pack (advanced fold), create one; choose a root object with a child list (showcase: an object another object looks up), add the related list and pick a column. Expected: the column picker lists the child object's fields, and the Source tab shows `related: [{ object, field, fields }]`. Read first, by risk: `ContextPackRelatedEntries.tsx` (`contextPackLinks`, `ContextPackRelatedEntries`), the dispatch at the top of `RelatedListEntriesWidget` in `widgets.tsx`, `ai-context.form.ts`. --- _Generated by [Claude Code](https://claude.ai/code/session_011y7As7YaCaudBfnWZagi4R)_ <!-- signed: repo:objectstack#7 · os-alice · session_011y7As6JrAPNfuwC2RLXXGu --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Yibo Wang · project thread
repo:objectstack#3 · os-support-ai · session_01WGufzi13yZRqVcp2mGonWK
Fixes #37180
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Two files under
docs/adr/: 44 lines added, 1 line changed. No schema, no code, no changeset.ADR-0150 (Accepted) gains a dated addendum. No ruled sentence is rewritten.
ai_contextjoins bucket 3". It proposes that the context pack type of ADR-0160 is identified by(package, name), in bucket 3 besideskill.The addendum says, in this order:
NS-NAMEwhere its name crosses the AI face.mainat0a1b69c0. The type and its pack selection are onmain. The registry keeps each package's item. The metadata service keeps one copy per name, the one registered last.ADR-0160 gains one cross-reference note under D1, which also names the follow-up and its order. No sentence of it is changed.
Not in this PR, by the card's contract:
PACKAGE_SCOPED_TYPESis not edited and no reader is moved. That is #37216's work, after the ruling.Round 2
The contract review of the first head passed with two should-fix findings and four nits. This head closes them.
maingained the type and the tool (feat(ai): ai_context context packs and the get_record_context tool over MCP (ADR-0160 row 5) #37173) and the ADR-0160 amendment (docs(adr): ADR-0160 amended — a related child this caller is not served is left out; pack selection conditions; carried-text bound #37196) after the first measurement.mainis merged into the branch (a merge commit, no rebase and no force-push), and every "today" sentence is re-measured at0a1b69c0. The addendum now cites the merged code. "Nothing first-party is refused" is restated against the showcase app, the one declarer: one package, two packs of different names on different roots.objectstack-ai/hotcrmatb1ea6fccdeclares none.contextthat names the two packs answers409. So does an omittedcontextwhen theirs is the only name on the root. With another name on the root, an omittedcontextgets the several-packs answer, which lists the shared name once. The first match is taken in none of these.skill, and that 37180 跟进:资料包(ai_context)进入按包分桶的四张表,get_record_context 按应用+名字选包 #37216 measures it.Tests
No package is touched, so no package build or test is owed. The checks that read these two files are the docs gates under Verification.
Acceptance notes
PACKAGE_SCOPED_TYPES.NS-NAMEin the tool'scontextargument. This widens D6 from the names a server lists to the value of an argument. The alternative, an optionalnamespaceinput on the tool, adds a key to two shapes ADR-0160 has ruled.NAMESPACE_UNIQUE_TYPES, whose header reserves a further type to the maintainer.PACKAGE_SCOPED_TYPES,PACKAGE_SCOPED_READ_TYPES,PACKAGE_SLOTTED_METADATA_TYPESandNAMESPACE_UNIQUE_TYPES. The service's one copy per name is governed by the third, not the first.skillis in the first three; its one-holder rule inside a namespace is phase 1's, which a new type never had.check:adr-symbol-anchorsrefuses a line anchor underdocs/adr/, so the record citespath#Symbol, and the line numbers are in the table under Verification.docs/adr/ships in no package, so this PR carriesskip-changeset.mainthe several-packs answer lists pack names only (packages/services/service-record-context/src/sentences.ts,severalPacks). ADR-0160 D4, as amended on 2026-11-25, says each candidate is listed by name with itslabel. This is read from source, not measured through the tool, and no first-party object has several packs. The addendum leaves what that answer carries to D4.Verification
Read first, by risk:
docs/adr/0150-…-literal-prefix.md, "Past the card's words" at the end of the addendum: the two decisions that are the maintainer's.Two-minute check: run
node scripts/check-adr-symbol-anchors.mjs. Expect4186 anchors across 163 records resolveand exit 0. Fourteen of them are this diff'spath#Symbolanchors.Measured anchors on main at 0a1b69c (file:line)
main, and a pack name holds no hyphenpackages/spec/src/ai/ai-context.zod.ts:136(AiContextSchema),:157;packages/spec/src/kernel/address-grammar.ts:68(ROUTER_ADDRESSABLE_NAME_PATTERN)packages/services/service-record-context/src/read-set.ts:65(selectContextPack)409; with another name and nocontext: the several-packs answerpackages/services/service-record-context/src/record-context-tools.ts:266,:265packages/core/src/package-scoped-resolution.ts:245(PACKAGE_SCOPED_TYPES;skillat:270)packages/core/src/package-scoped-resolution.ts:740,packages/objectql/src/package-scoped-resolver.ts:148packages/objectql/src/package-scoped-read.ts:88(PACKAGE_SCOPED_READ_TYPES;skillat:96), read bypackages/objectql/src/registry-package-addressing.ts:433packages/spec/src/api/protocol.zod.ts:2753(PACKAGE_SLOTTED_METADATA_TYPES;skillat:2754),packages/metadata/src/package-slotted-store.ts:154packages/metadata/src/package-slotted-store.ts:797(storeWriteKey),:820packages/metadata/src/metadata-manager.ts:1499,packages/metadata-protocol/src/protocol-registry-hydration.ts:148packages/objectql/src/namespace-co-owner-names.ts:96(NAMESPACE_UNIQUE_TYPES); the list is reserved to the maintainer at:27packages/spec/src/kernel/metadata-plugin.zod.ts:1388,packages/metadata-protocol/src/protocol-package-bindings.ts:388(SEALED_ROW_SERVED_OVERRIDE_TYPES)packages/mcp/src/skill-prompts.ts:373(lookupSkillPrompt)packages/spec/src/ai/face-name.ts:86(deriveAiFaceName)packages/spec/src/kernel/collection-item-owner-stamp.ts:129,:107packages/objectql/src/registry.ts:5328(uninstallPackage)packages/metadata/src/metadata-manager.ts:2880(unregisterPackage)examples/app-showcase/objectstack.config.ts:223,examples/app-showcase/src/ai/record-context.ai-context.ts:20,:30Absence readings, each with a positive control:
ai_contextin the four list files and inpackages/metadata/src/package-slotted-store.ts: 0 lines each. Control:skillis in the first three lists, at the lines the table gives.packages/spec/src/ai/skill.zod.tshas 0context:property lines. Control: 1tools:line.objectstack-ai/hotcrmatb1ea6fcc:ai_context,aiContextsorai-context, 0 files. Control:skills:, 6 files.Local gates at head deee29a: 21 derived, 21 run, all exit 0
Derived with
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands, and reconciled with--ran:Each exit code was captured before any pipe:
check:doc-formula-expressionsreads the compiled output of@objectstack/formulaand@objectstack/lint. Those two and their dependencies were built first, under the shared verify lock (VERDICT command-exit 0).docs/adr/README.mdis generated from each record's status keyword. ADR-0150's keyword stays Accepted, so the index does not change and is not in this diff.