Skip to content

Commit db77cc4

Browse files
docs(adr): ADR-0160 amended — a citation names its pack and is verified once as the asking user (D9) (#37370)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg67aVMQDE1RzpDASKD6gP9f)_ repo:objectstack#5 · os-bill · session_01Utp6CYRWEQbrHTNYDXienp Fixes #37363 Clause-②: no Metadata-protocol: none Container & model: `S`, `mode:thread`, `model: claude-fable-5-1 (claim 7178304155 on #37363: dispatch-gates --tier mandates claude-fable-5-2 for docs/adr/**; measured unavailability, built at 5-1 above the default tier; compensating control: L2 at CONTRACT_REVIEW_TIER at handoff)`, `effort: xhigh (ADR amendment, standing order)` ## 维护者速读 - 用户无感:这是一条架构记录的第三次修订,只改文字。引用格式加上可选的资料包名,并写明引用在回答生成时按提问人权限核一次、核不上的不显示、关联记录的摘句指向主记录。 - 为什么做:记录 AI 问询专题里,引用这一项拆成三张施工卡之前,先把你在决策卡上选定的三条答案写进架构记录,后面三张卡照它施工,不再各自解释。 - 出错会怎样:不改代码、不改发布包;合并后若发现措辞有误,再开一次修订即可改回。 - 要你做什么:无。受管文件需要两位审批人批准,批准后席位落地。 ## What changes One file, `docs/adr/0160-record-scoped-ai-inquiry.md` (+22 / −7 against `main`; the rework commit below is +4 / −4 inside that). It is the third amendment of the record, by the maintainer's ruling on card #37144 (ruling comment 7177410380, four-axis analysis 7177223845; the option picked on the decision card at 2026-11-25T23:18Z was 「生成时核·D9加context·开主」). - **Amendment log** (the header's `Amended` list): a third entry naming the card, the ruling comment, the readings commit (`main` at `98bda0ac`) and the three answers. - **D9 — The citation shape**: 1. The shape becomes `{ object, id, context?, anchor?, quote }`. `context` is the pack's name, spelt as `get_record_context`'s `context` argument takes it (`packages/spec/src/ai/record-context-tools.zod.ts`, `GetRecordContextInputSchema`). On an object with several packs a citation without `context` is not verified: the verifier's call meets D4's several-packs refusal and the refusal stands. 2. A new paragraph, **When a citation is verified**: once, when the answer is produced, by the platform as the asking user, by calling the tool with the citation's four arguments and looking for `quote` verbatim in the answer's data member (`RecordContextDataSchema`). Not found, or the call refused, drops the citation before the answer is shown. The surviving list is persisted with the message; a surface never re-verifies on display. The sentence that left "whether a surface verifies before it renders" to row 10 is removed. 3. A new paragraph, **A quote from a related row**: `object`/`id` name the pack's root record; the quote is matched across the whole data member, related-list cells included; the surface opens the root record; `anchor` keeps its one meaning, a heading of the root record's body. 4. The closing sentence now leaves to row 10 which member carries the list, which strings of the data member a quote is matched against and how a non-text value is compared, and how a surface opens the root record at `anchor`. The stale "Shape only." opener is gone (also from TL;DR point 9). - **Three places that restate D9**, updated so the record does not contradict itself: TL;DR point 9; the "Citation rendering and verification" bullet of *Not decided here* (verification is now decided; rendering stays row 10's); and *Points that go past the card's words*, which gains the third amendment's introduction and **point 23**. - **Point 23** is the one settlement past the ruling's words (after the rework the text goes past the ruling nowhere else): the ruling says a citation without `context` on a several-packs object is not verified because the tool's refusal stands; the text reads every refusal the same way (a `context` no pack has, an `anchor` that does not resolve), since a refused call answers no data member. The alternative not taken is a second call without the offending argument, which would pick a pack or a body the model did not cite. Nothing else in the record changes: no decision outside D9, no row of the implementation split, the `**Status**:` line unchanged (so `docs/adr/README.md` stays current — `check:adr-index` green below). **Read first** (by risk): the D9 paragraph *When a citation is verified* (the one normative addition: what is dropped, what is persisted, what is never re-done), then the `context` bullet of D9 (the several-packs rule), then point 23 (the only text past the ruling). **Two-minute verification**: `pnpm check:adr-symbol-anchors` — expected: green, with the two new `record-context-tools.zod.ts` symbol anchors resolved. ## Tests n/a — `docs/adr/**` text; no package, test or schema is touched. The verification is the derived gate set below. ## Acceptance notes - **Rework at `e2a5535d`** (seat's 席位核对 REWORK on the L2 record 7178586654, PASS with two should-fixes). S1: the citation check reads "to the asking user", not "the reading user" (the principal Q1 = A names). S2: the parenthetical gloss listing what the data member carries is dropped; what a quote is matched against, and how a non-text value is compared, are left to row 10 explicitly. N1: "Shape only." dropped in D9's closing paragraph and TL;DR 9. N2 (a call that fails rather than refuses) is left to row 10c as the review suggests. No other hunk changed. - **Tier H by path.** `docs/adr/**` is Tier H whatever the body says (AGENTS.md Prime Directive #14); the ruling names the approvers os-zhuang and hotlong. The `Rule-change:` line is left out as the PR template asks for a diff that does not touch `.claude/**`; it would not change the tier. - **Three consistency touches beyond D9 and the log** are listed above (TL;DR 9, *Not decided here*, point 23). The card says "nothing else in the ADR changes"; these are the sentences that restate D9 and would otherwise contradict it. No other decision is touched. - **A consequence of the ruling, as ruled, not re-opened:** because a surface never re-verifies on display, a later reader of a persisted message sees the citations that were verified as the *asking* user, not as themselves. That is Q1 = A; the surfaces of rows 10b and 10c inherit it. `carrier: none` — recorded here for the seat's L1/L2 reading. - **Card labels.** #37363 carries `area:ai`, `priority:p2`, `pm:queue` and no `domain:*`; the ruling filed it as `domain:skills`. Observation for the seat; not written by this thread. - **No changeset.** `docs/adr/**` is on the fast track (not published); `skip-changeset` is declared with this create. - Gate run notes: the first local pass hit exit 3 (PREREQUISITE NOT MET: no `node_modules`) on eight families and was discarded; after `pnpm install` and building `@objectstack/formula...` and `@objectstack/lint...`, every family ran green, and the whole set was re-run on the final head. ## Verification - Gate list derived on the final head `e2a5535d` (identical to the list derived at `44767fb0`): `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` → 21 commands (1 path vs merge base `98bda0ac`). - All 21 exited 0 on `e2a5535d`, each exit code captured before any pipe (the same 21 were green on `44767fb0`). - `--ran` reconciliation on `e2a5535d`: `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)`. - `dispatch-gates --tier`: `docs/adr/**` ⇢ mandatory fable tier, effort floor xhigh; changed lines 29 vs the human-merge threshold 3000: under. - `check-prior-rulings --paths docs/adr/0160-record-scoped-ai-inquiry.md` at `98bda0ac`: 15 hit lines read; the three Amended entries and the Decided-by line are the rulings in force, none re-opened; the same-day churn line (dfdebfa, a ui fix in the same merge) does not touch this file. - CI-owned families (type-check lanes, artifact rosters, `test:repo`, the always-runs tail) are this PR's check-runs. <details><summary>Local gates (21, each `exit 0` on e2a5535)</summary> ```text node scripts/check-adr-links.mjs [+ --self-test] node scripts/check-closing-keyword-parity.mjs [+ --self-test] node scripts/check-comment-mask-corpus.mjs node scripts/ci/plan-test-core-shards.mjs --self-test pnpm --filter @objectstack/lint run check:doc-formula-expressions pnpm check:adr-anchors · check:adr-index · check:adr-symbol-anchors pnpm check:ci-filter-parity · check:closed-ceremony-text · check:cross-package-test-inputs pnpm check:doc-authoring · check:driver-memory-census · check:gitlink-declared pnpm check:nul-bytes · check:pm-governed-merges · check:pm-prior-rulings pnpm check:refd-timer-probe · check:watch-hint-literal ``` </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Utp6CYRWEQbrHTNYDXienp <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6CYRWEQbrHTNYDXienp --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 98b17fe commit db77cc4

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

‎docs/adr/0160-record-scoped-ai-inquiry.md‎

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
- a list cut at its `limit` stated as a cut (21);
2626
- the cap on an outline's entries, in [D3](#d3), "The body" (22). This one is not about `related`. It is carried from the seat's review of PR objectstack#37222 (card objectstack#37178), nit N5; that PR has since merged.
2727
- Nothing else changes.
28+
- **Amended**: 2026-11-25, a third time, by the maintainer's ruling on card [objectstack#37144](https://github.com/objectstack-ai/objectstack/issues/37144), row 10's placeholder. The maintainer picked the option 「生成时核·D9加context·开主」 on that card's decision thread at 2026-11-25T23:18Z, after the four-axis analysis in its comment 7177223845; the ruling is recorded in its comment 7177410380, and this amendment is card [objectstack#37363](https://github.com/objectstack-ai/objectstack/issues/37363). Its readings of the tree were taken on `main` at `98bda0ac`. It records the following, all in [D9](#d9):
29+
- **A citation gains an optional `context`**: the pack the record was read through, spelt as the tool's `context` argument takes it (`packages/spec/src/ai/record-context-tools.zod.ts#GetRecordContextInputSchema`). A citation without it on an object with several packs is not verified; on an object with one pack it verifies as before.
30+
- **A citation is verified once, when the answer is produced**, by the platform as the asking user, against the data member of `get_record_context`'s answer (`#RecordContextDataSchema`). One whose `quote` is not found is dropped before the answer is shown; the verified list is persisted with the message, and no surface re-verifies on display. This replaces D9's sentence that left "whether a surface verifies before it renders" to row 10.
31+
- **A quote from a related row names the root record.** `object` and `id` are the pack's root; the quote is matched across the whole data member, related-list cells included; the surface opens the root record; `anchor` keeps its one meaning, a heading of the root record's body.
32+
- The TL;DR's point 9 and [Not decided here](#not-decided-here) say the same. The ruling's words are the three answers above; the text adds one point of its own, point 23 of [Points that go past the card's words](#points-that-go-past-the-cards-words).
33+
- Nothing else changes.
2834
- **Decided by**: the maintainer, 2026-11-24, verbatim and untranslated, as epic [objectstack#36996](https://github.com/objectstack-ai/objectstack/issues/36996) records them: 「先立专题 ① 记录范围 AI 问询 ;⑤ 应用技能进入应用内 AI ,M0 那几项知识服务缺陷 也立专题,目前开发的策略是按专题派」 and 「需要拍板的事项 都同意」. The six rulings the epic sets over every child are quoted in [Provenance](#provenance); ⛔ none of them is re-opened here.
2935
- **Card**: [objectstack#36997](https://github.com/objectstack-ai/objectstack/issues/36997). It lists ten items; D1–D9 decide items 1–9 in the card's order and [Not decided here](#not-decided-here) carries item 10.
3036
- **Builds on**: [ADR-0005](./0005-metadata-customization-overlay.md) (its ai row: a behavioural contract takes no environment overlay), [ADR-0011](./0011-actions-as-ai-tools.md) (an action reaches AI only through its `ai` exposure block), [ADR-0049](./0049-no-unenforced-security-properties.md) (enforce or remove), [ADR-0088](./0088-metadata-kind-admission-and-retirement.md) (the kind admission test), [ADR-0090](./0090-permission-model-v2-concept-convergence.md) D10 (the agent ceiling over reads), [ADR-0106](./0106-metadata-plane-fls-object-schema-masking.md) (the caller's served schema), [ADR-0112](./0112-error-code-vocabulary-and-ledger.md) (the error envelope and its catalogue), [ADR-0149](./0149-ai-answers-business-questions-through-the-dataset-semantic-layer.md) D2 and M1 (one definition, one executor, every transport; guidance sentences belong to the executor), [ADR-0159](./0159-forms-are-their-own-metadata-type-public-forms-are-form-items-view-is-lists-only.md) (the latest kind admission; the form of D1).
@@ -67,7 +73,7 @@
6773
6. **`ToolExecutionContext.focus`** ([D6](#d6)) is written as objectstack#36999 fixes it.
6874
7. **`ask_ai` is an action type** ([D7](#d7)) that focuses the assistant on the record. It has no server dispatch, is never an AI tool, and is absent where there is no in-app assistant.
6975
8. **The skill key `context`** ([D8](#d8)) names a pack, and a skill that declares it binds `get_record_context`. Its reader in this repository is the MCP skill prompt, which gains a record argument.
70-
9. **A citation** ([D9](#d9)) is `{ object, id, anchor?, quote }`. Shape only; no schema lands before its reader.
76+
9. **A citation** ([D9](#d9)) is `{ object, id, context?, anchor?, quote }`, verified once when the answer is produced, as the asking user, and never re-verified on display (third amendment, 2026-11-25). No schema lands before its reader.
7177
10. **Not decided**: field egress, and the rest of [Not decided here](#not-decided-here).
7278

7379
## Context
@@ -320,23 +326,28 @@ A `context` that names no pack is an authoring error, reported where skills are
320326

321327
### D9 — The citation shape {#d9}
322328

323-
An answer may carry citations. One citation is `{ object: string, id: string, anchor?: string, quote: string }`:
329+
An answer may carry citations. One citation is `{ object: string, id: string, context?: string, anchor?: string, quote: string }` (`context` joined by the third amendment, 2026-11-25):
324330

325-
- `object`, `id`: the record the statement rests on.
326-
- `anchor`: a place in that record's body — an anchor the body outline issued (D3). Omitted when the citation is to the record as a whole or to a field.
331+
- `object`, `id`: the record the statement rests on — the root record of the pack the statement was read through. A quote taken from a related row still names the root ("A quote from a related row", below).
332+
- `context`: the pack the record was read through, by name, spelt as `get_record_context`'s `context` argument takes it (`packages/spec/src/ai/record-context-tools.zod.ts#GetRecordContextInputSchema`; [D4](#d4), "Pack selection"). Omitted when the object has one pack, as the argument may be. On an object with several packs a citation without `context` is not verified: the verifier's call meets [D4](#d4)'s several-packs refusal, and the refusal stands — no pack is picked for the citation.
333+
- `anchor`: a place in the root record's body — an anchor the body outline issued ([D3](#d3)). Omitted when the citation is to the record as a whole or to a field. This is its one meaning; a quote from a related row does not change it.
327334
- `quote`: the passage relied on, verbatim from text the tool returned.
328335

329-
It is the record sibling of what dataset answers carry — `sourceLine` on `packages/spec/src/ai/dataset-tools.zod.ts#QueryDatasetOutputSchema` and `#DatasetProvenanceSchema` — with one difference that shapes it. Those are composed by the tool and never typed by the model. A citation is written by the model, so it is a claim. The shape lets a reader check the claim without a model: `quote` must be found verbatim in what `get_record_context` returns for `object`, `id` and `anchor` to the reading user.
336+
It is the record sibling of what dataset answers carry — `sourceLine` on `packages/spec/src/ai/dataset-tools.zod.ts#QueryDatasetOutputSchema` and `#DatasetProvenanceSchema` — with one difference that shapes it. Those are composed by the tool and never typed by the model. A citation is written by the model, so it is a claim. The shape lets a reader check the claim without a model: `quote` must be found verbatim in what `get_record_context` returns for `object`, `id`, `context` and `anchor` to the asking user.
337+
338+
**When a citation is verified (third amendment, 2026-11-25).** Once, when the answer is produced, by the platform as the asking user. The platform calls `get_record_context` with the citation's `object`, `id`, `context` and `anchor`, as that user, and looks for `quote` verbatim in the data member of the answer (`packages/spec/src/ai/record-context-tools.zod.ts#RecordContextDataSchema`). A citation whose quote is not found is dropped before the answer is shown. A call the tool refuses answers no data member, so its citation is dropped the same way: a `context` no pack has, several packs and no `context`, an `anchor` that does not resolve (point 23). The citations that survive are persisted with the message as its verified list, and a surface never re-verifies on display: what it draws later is what was verified when the answer was produced, no more and no fewer.
339+
340+
**A quote from a related row (third amendment, 2026-11-25).** A pack carries related-list cells ([D3](#d3)), and a model may rest a statement on one. The citation names the pack's root record in `object` and `id`, and no related row: the quote is matched across the whole data member of that record's answer, related-list cells included, and the surface opens the root record. `anchor` keeps its one meaning, a heading of the root record's body.
330341

331-
Shape only. No schema lands with this record or with row 5: the shape enters spec with its first reader (row 10, ADR-0049). Which member of an answer carries the list, whether a surface verifies before it renders, and how a citation opens the record are row 10's.
342+
No schema lands with this record or with row 5: the shape enters spec with its first reader (row 10, ADR-0049). Which member of an answer carries the list, which strings of the data member the quote is matched against and how a value that is not text is compared, and how a surface opens the root record at `anchor`, are row 10's.
332343

333344
## Not decided here
334345

335346
- **Field egress** (card item 10): a field's declaration that it is never sent to AI, and its enforcement. cloud ADR-0119 D2 sets its tier and nothing else; the topic is not yet filed. It is not a dependency of this record: D3 carries what the caller may read, and a later egress rule narrows that on AI read paths.
336347
- Vector retrieval and the knowledge platform (objectstack#37000, objectstack#37001), and with them the fallback from a long body to knowledge search.
337348
- More than one focused record; a pack over more than one root record.
338349
- How the in-app assistant keeps the focus on a conversation and pre-reads the pack (cloud, row 9), beyond that the pre-read is a `get_record_context` tool call.
339-
- Citation rendering and verification (row 10).
350+
- Citation rendering (row 10): which member of an answer carries the list, and how a surface opens the root record at `anchor`. Verification is decided in [D9](#d9) (third amendment, 2026-11-25).
340351
- Audit, pattern masking and AI-identity narrowing (cloud ADR-0119 D3; cloud#4969, cloud#4970).
341352
- Adoption of the data wrapper by any tool other than `get_record_context`.
342353

@@ -370,6 +381,10 @@ Each is this record's settlement, taken from the tree's precedent. Points 1, 2 a
370381
21. **A list cut at its own `limit` is a stated cut** (D3), like a list cut at the cap, so the model knows that more rows matched than it was given.
371382
22. **The cap on an outline's entries is named** (D3, "The body"). This point is not about `related` and is not from the maintainer's word. The seat's review of PR objectstack#37222 (card objectstack#37178), nit N5, asked this record to name that cap as a further constant of the service and a further stated cut. The record sets no number.
372383

384+
**The third amendment's point (2026-11-25).** The maintainer's ruling for the third amendment is the three answers recorded in comment 7177410380 of card objectstack#37144: a citation is verified once when the answer is produced, as the asking user, and never re-verified on display; the shape gains an optional `context`; a quote from a related row names the root record. The text goes past them in one place.
385+
386+
23. **A refused verifying call drops the citation** (D9). The ruling says a citation without `context` on an object with several packs is not verified, because the tool's refusal stands. The text reads every refusal the same way: the verifier's call answers no data member, so the quote is not found and the citation is dropped — a `context` no pack has and an `anchor` that does not resolve, as much as the several-packs case. The alternative not taken is a second call without the offending argument, which would pick a pack or a body the model did not cite.
387+
373388
## Implementation split (after acceptance)
374389

375390
Rows 5–10 of the epic's table, with the epic's numbers, and row 11, which the second amendment of 2026-11-25 adds. Listed, not filed: the owning seat files them when this record merges. Each PR makes its own `Metadata-protocol:` declaration; the column is the expected one.

0 commit comments

Comments
 (0)