Skip to content

Commit eec1040

Browse files
docs(adr): ADR-0160 amended — a body outline past its bounds comes in pages (outlineFrom / outlineNext) (#37573)
<!-- claude-projects-attribution: {"github_login":"os-bill"} --> _Requested by **Bill** · [project thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgKJcxVQvtK7UsENd5xsHrZe)_ repo:objectstack#5 · os-bill · session_01Utp6CaY7QjyzmyWTJGfguK Fixes #37490 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:这是一条架构记录的第四次修订,只改文字。把已经上线的「长正文目录分页」写进记录,包括怎么翻页、每页都带哪些提示、以及翻页中途正文被改时可能漏列或重列标题。 - 为什么做:记录 AI 问询专题里,资料包读取工具的目录分页已经合并,但架构记录还停在「目录只有一页」的说法,后续施工和审阅的人会读到过时的约定。 - 出错会怎样:不改代码、不改发布包;合并后若发现措辞有误,再开一次修订即可改回。 - 要你做什么:这是受管的架构记录,需要你批准后才能合并。 ## What changes One file, `docs/adr/0160-record-scoped-ai-inquiry.md` (+22 / −3). It is the fourth amendment of the record. It writes down what PR #37484 put on `main` (merge commit `59571b2f07`, for card #37233) and carries the scope note on this card (comment 7187692455, N1 of contract review 7187652688). Every sentence was read against `body-outline.ts`, `record-context-tools.ts`, `sentences.ts` and `record-context-tools.zod.ts` on `main` at `41164656`. - **Status line and amendment log**: the status line names the second amendment date; the header's `Amended` list gains a fourth entry naming this card, PR #37484, the readings commit and the three things recorded. It says in words that the amendment rests on no ruling of its own. - **D3, a new paragraph "Outline pages"**, placed after "The body" (whose text stands and is not restated): 1. The two outline bounds bound one answer, not which headings can be listed; an outline past either comes in pages (`boundedOutline`). 2. The order: shallowest level first, body order within a level; each page lists its own headings in body order. 3. The continuation: a page that leaves headings for a later page carries `outlineNext` on its body, and that number as `outlineFrom` lists the next page. An `anchor` reads its section whichever page issued it. 4. Coverage: within one state of the body, every heading is on exactly one page with its anchor. The exception is a heading whose entry alone passes the body bound: no page lists it, no anchor is issued for it, and the cut statement counts it. 5. **The per-body-state qualifier (N1)**: `outlineFrom` is a position in the page order of the body as the call reads it, and the tool keeps nothing between calls. An edit between two page calls can make the walk skip a heading or list one twice, with no signal; the anchors on each page stay current. 6. The notes on every page: the outline statement on each page, and the cut statement on each page that does not list every heading. The cut statement carries counts and a position, never an anchor. 7. A page that does not exist: an `outlineFrom` above 0 with no heading left to list from it gets one `RESOURCE_NOT_FOUND` (404) answer whatever the reason, so `outlineFrom`, like `anchor`, cannot show that a pack has a body the caller's schema hides. - **D4 "Definition"**: the input row gains `outlineFrom?: integer` and the exclusion: a call that names both `anchor` and `outlineFrom` is refused `VALIDATION_ERROR` (400) in step 1, before any gate is judged and any record is read. The output row gains `outlineNext` on the body. - **Points that go past the card's words** gains the fourth amendment's introduction and **point 24**: paging stays on the same tool, and the cursor is a position and not an anchor because a note may carry no record text. The alternative it names is the one PR #37484 weighed. Nothing else in the record changes: "The body" paragraph, the TL;DR, the implementation split and every other decision stand as they were. **Read first** (by risk): the bullet "One state of the body" in D3 "Outline pages" (the N1 qualifier), then "A page that does not exist" (the list of reasons behind the one 404), then the D4 input row (the exclusion and where it is refused). **Two-minute verification**: `pnpm check:adr-symbol-anchors` — expected: green, with the new `body-outline.ts` symbol anchor `boundedOutline` found. ## Tests n/a — `docs/adr/**` text; no package, test or schema is touched. The verification is the derived gate set below. ## Acceptance notes - **Acceptance bullet 1** (the sentences match `record-context-tools.zod.ts` and `body-outline.ts` on `main`): `outlineFrom` is `z.number().int().min(0).optional()`, written as `outlineFrom?: integer` with "`outlineFrom` 0 is the first page"; `outlineNext` is present only when a heading remains that a later page lists; the page order and the skipped over-long heading are `boundedOutline`'s; the 400 and the 404 are the executor's (`executeGetRecordContext`, step 1 and the body block). - **Acceptance bullet 2** (the amendment log cites this card): the fourth `Amended` entry and the introduction of point 24. - **Acceptance bullet 3**: `Clause-②: no`, `Metadata-protocol: none`, as claimed. - **Where the text differs from the card's draft sentences, on purpose.** The card says "`outlineFrom` past the last page, or on a body that is no outline" is the 404. `main` answers the first page for `outlineFrom: 0` on any body, so the text says "an `outlineFrom` above 0 with no heading left to list from it". It does not say "a position that starts no page": `main` answers a page from any position that still has a heading to list, whether or not an earlier answer issued that position, and the text neither promises nor forbids that. The card says "every heading is listed on exactly one page"; the text scopes that to one state of the body, as the scope note asks. - **One structural choice.** The paging text is a new paragraph after "The body", and "The body" is left byte-identical, so the amendment adds to D3 and rewrites nothing there. One phrase of "The body" now reads slightly narrow beside it ("the most headings one outline lists" is, since the paging, the most one page lists); the first sentence of "Outline pages" says so. `carrier: none`. - **An observation, not acted on.** D4's input row says "with the record tools' aliases for the first two"; the schema on `main` also aliases `pack` and `contextName` to `context`, and `section` to `anchor`. That sentence predates this card and is outside its claim. `carrier: none`. - **Tier H by path.** `docs/adr/**` is governed whatever the body says. The `Rule-change:` line is left out: the diff does not touch `.claude/**`. - **No changeset.** `docs/adr/**` is on the fast track (not published); `skip-changeset` is declared with this create. ## Verification - Two commits. `98e42a52` is the amendment; `a3f1e40a` (+3 / −3 inside the new paragraph) makes three of its sentences exact after a second reading against the executor: when a page call is refused, what the cut statement carries, and that an edit between two page calls can also end in that refusal. - Gate list derived on the final head `a3f1e40a`: `node scripts/pm/dispatch-gates.mjs --commands` → 21 commands (1 path vs merge base `41164656`). - All 21 exited 0 on `a3f1e40a`, each exit code captured before any pipe. On the first head, `check:doc-formula-expressions` had exited 3 (PREREQUISITE NOT MET, no built output) until `@objectstack/formula...` and `@objectstack/lint...` were built under the verify lock (VERDICT command-exit 0). - `--ran` reconciliation on `a3f1e40a`: `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/**` is the mandatory contract tier; changed lines 25 vs the human-merge threshold 3000: under. - `overlap-check --branch=HEAD` before each push: `VERDICT clean exit 0` against `origin/main` at `4116465625` and 0 PR heads. - CI-owned families (type-check lanes, artifact rosters, the always-runs tail) are this PR's check-runs. <details><summary>Local gates (21, each exit 0 on a3f1e40)</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_01Utp6CaY7QjyzmyWTJGfguK <!-- signed: repo:objectstack#5 · os-bill · session_01Utp6CaY7QjyzmyWTJGfguK --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4805d83 commit eec1040

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ADR-0160: Record-scoped AI inquiry — a context pack is its own metadata type, read as the caller and served by one tool; conversation focus, the `ask_ai` action type, the skill `context` key, the citation shape
22

3-
**Status**: Accepted — merged 2026-11-24 (PR [objectstack#37115](https://github.com/objectstack-ai/objectstack/pull/37115)); amended 2026-11-25 (see **Amended** below). Written 2026-11-24 for objectstack#36997 (epic objectstack#36996) on the maintainer's acceptance of the epic's decision list that day, verbatim as the epic records it: 「需要拍板的事项 都同意」. It stands on cloud ADR-0119 (Accepted 2026-11-24), which rules this mechanism open source ([Provenance](#provenance)). `docs/adr/**` is Tier H (Prime Directive #14): this record becomes **Accepted** by an authorized approval or the maintainer's merge of the PR that carries it, and is in force from that merge. **This record declares; it implements nothing** — no schema, no code, no changeset, and no anchor under `scripts/adr-anchors/`; every mechanism below is cut as a card after the merge ([Implementation split](#implementation-split-after-acceptance)).
3+
**Status**: Accepted — merged 2026-11-24 (PR [objectstack#37115](https://github.com/objectstack-ai/objectstack/pull/37115)); amended 2026-11-25 and 2026-11-26 (see **Amended** below). Written 2026-11-24 for objectstack#36997 (epic objectstack#36996) on the maintainer's acceptance of the epic's decision list that day, verbatim as the epic records it: 「需要拍板的事项 都同意」. It stands on cloud ADR-0119 (Accepted 2026-11-24), which rules this mechanism open source ([Provenance](#provenance)). `docs/adr/**` is Tier H (Prime Directive #14): this record becomes **Accepted** by an authorized approval or the maintainer's merge of the PR that carries it, and is in force from that merge. **This record declares; it implements nothing** — no schema, no code, no changeset, and no anchor under `scripts/adr-anchors/`; every mechanism below is cut as a card after the merge ([Implementation split](#implementation-split-after-acceptance)).
44

55
- **Date**: 2026-11-24
66
- **Amended**: 2026-11-25, by the maintainer's word, verbatim: 「同意你的建议」. The maintainer was answering two independent analyses of this record, written in the maintainer's session on 2026-11-25 for [objectstack#36996](https://github.com/objectstack-ai/objectstack/issues/36996). One weighed points 1, 2 and 10 of [Points that go past the card's words](#points-that-go-past-the-cards-words), which this record said needed the maintainer's explicit acceptance. The other reviewed the six cards cut from the [Implementation split](#implementation-split-after-acceptance). The amendment records the following:
@@ -31,6 +31,12 @@
3131
- **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.
3232
- 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).
3333
- Nothing else changes.
34+
- **Amended**: 2026-11-26, a fourth time, to record what PR [objectstack#37484](https://github.com/objectstack-ai/objectstack/pull/37484) shipped for card [objectstack#37233](https://github.com/objectstack-ai/objectstack/issues/37233): a body outline past its bounds comes in pages. This amendment is card [objectstack#37490](https://github.com/objectstack-ai/objectstack/issues/37490), that PR's follow-up. It rests on no ruling of its own: it writes down what `main` does, and it is accepted with the approval or the merge of the PR that carries it. Its readings of the tree were taken on `main` at `41164656`. It records the following:
35+
- **An outline past its bounds comes in pages.** The tool's `outlineFrom` lists a later page, and `outlineNext` on the answer's body says where the next page starts. See [D3](#d3), "Outline pages", and [D4](#d4), "Definition".
36+
- **A walk of the pages holds for one state of the body.** The cursor is a position in the body as it is when the call reads it, so an edit between two page calls can skip or repeat a heading with no signal. See [D3](#d3), "Outline pages".
37+
- **`anchor` and `outlineFrom` are exclusive.** A call that names both is refused before any gate is judged and any record is read. See [D4](#d4), "Definition".
38+
- The text's own settlement is point 24 of [Points that go past the card's words](#points-that-go-past-the-cards-words).
39+
- Nothing else changes.
3440
- **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.
3541
- **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.
3642
- **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).
@@ -220,6 +226,15 @@ This is how ruling 2's sentence — "A field hidden from the caller reads 'not v
220226

221227
**The body.** A body within the service's bound is carried whole. A longer body is carried as an outline: its headings in order, each with an `anchor`. One section is read by calling the tool again with that `anchor` ([D4](#d4)). A long body with no headings is carried up to the bound and marked truncated. An outline is bounded too. Its listing stays within the body bound, and the most headings one outline lists is a further constant of the service (`packages/services/service-record-context/src/body-outline.ts#RECORD_CONTEXT_OUTLINE_MAX_ENTRIES`). An outline cut by either bound says so (second amendment, 2026-11-25, carried from the review of objectstack#37178). Every cut is stated in the notes — a truncated body, a cut outline, a related list cut at its `limit`, at its cap or at the door's page cap, or a cell cut under the bound below. The body bound and the row cap of a related list are constants of the service, fixed and pinned by test in row 5; the outline's cap is one too, set and pinned by test in objectstack#37178; this record sets no number.
222228

229+
**Outline pages (fourth amendment, 2026-11-26).** The two bounds on an outline bound one answer, not which headings can be listed. An outline past either bound comes in pages (`packages/services/service-record-context/src/body-outline.ts#boundedOutline`).
230+
231+
- **The order.** The pages run through the body's headings in one order: shallowest level first, and in body order within a level. Each page lists its own headings in body order. So the first page of a nested body is its top levels, and a flat body's pages are runs of it.
232+
- **The continuation.** A page that leaves headings for a later page carries `outlineNext` on its body. Calling the tool again with that number as `outlineFrom` lists the next page ([D4](#d4)). The last page carries no `outlineNext`. An `anchor` reads its section whichever page issued it.
233+
- **What a walk covers.** Within one state of the body, every heading is listed on exactly one page, with its anchor, so following `outlineNext` from the first page lists them all. The one exception is a heading whose entry alone passes the body bound. No page lists it and no anchor is issued for it; the cut statement counts it.
234+
- **One state of the body.** `outlineFrom` is a position in the page order of the body as the call reads it, and the tool keeps nothing between calls. If the body is edited between two page calls, the later call answers the page at that position of the body as it then is, or is refused as below where that body has nothing left to list from it. The walk can then skip a heading or list one twice, and nothing in the answer says so. The anchors on each page are still current: they are derived from the body that call read.
235+
- **The notes, on every page.** Every page carries the statement that the body is given as an outline. Every page that does not list all of the body's headings carries the cut statement: how many headings the page lists, how many it does not, and the `outlineFrom` of the next page, or that no later page lists more. That statement carries counts and a position, never an anchor: a note never carries record text, and an anchor is derived from heading text. That is why the cursor is a position.
236+
- **A page that does not exist.** An `outlineFrom` above 0 with no heading left to list from it is refused, never answered with the first page. The refusal is one answer whatever the reason, with the code an `anchor` that does not resolve gets (`RESOURCE_NOT_FOUND`, 404): a position past the last heading a page lists, a body carried whole or cut without an outline, a pack with no `body`, a body the caller's projection dropped, or a body withheld from the caller. So `outlineFrom`, like `anchor`, cannot show that a pack has a body the caller's schema hides. `outlineFrom` 0 is the first page.
237+
223238
**The bound on carried text (amended 2026-11-25).** A related list's columns may include long-text fields, and their values are carried as served, within one bound. Text the pack carries counts toward one total bound: the body, and every long-text value in the related lists' cells.
224239

225240
- **What counts.** Every long-text cell counts, a long-text field in `fields` included. Nothing is carried unbounded.
@@ -243,8 +258,8 @@ The framing sentence covers the data member only, so it does not undo a note. Sp
243258

244259
**Definition.** Input and output are zod in `@objectstack/spec`, in a new module beside the dataset tools' module, projected to JSON Schema the way `packages/spec/src/ai/dataset-tools.zod.ts#getDatasetToolJsonSchemas` does. This follows the dataset tools' form, not the knowledge tool's.
245260

246-
- Input, strict: `{ objectName: string, recordId: string, context?: string, anchor?: string }`, with the record tools' aliases for the first two.
247-
- Output: the D3 envelope, with its three parts — the data member, the notes and the framing sentence. The data member holds the pack header (`name`, `label`), the record (`object`, `id`, display name), the field entries, the related lists and the body or its outline.
261+
- Input, strict: `{ objectName: string, recordId: string, context?: string, anchor?: string, outlineFrom?: integer }`, with the record tools' aliases for the first two. `anchor` reads one section of the body and `outlineFrom` lists one page of its outline ([D3](#d3), "Outline pages"; fourth amendment, 2026-11-26), so a call names at most one of them. A call that names both is refused `VALIDATION_ERROR` (400) in step 1 of the order below, before any gate is judged and any record is read.
262+
- Output: the D3 envelope, with its three parts — the data member, the notes and the framing sentence. The data member holds the pack header (`name`, `label`), the record (`object`, `id`, display name), the field entries, the related lists and the body or its outline. An outline page that leaves headings for a later page carries `outlineNext` on the body: the `outlineFrom` of the next page (fourth amendment, 2026-11-26).
248263

249264
**Order of judgement.** The steps run in this order, and no later step changes an earlier answer:
250265

@@ -385,6 +400,10 @@ Each is this record's settlement, taken from the tree's precedent. Points 1, 2 a
385400

386401
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.
387402

403+
**The fourth amendment's point (2026-11-26).** The fourth amendment records what PR objectstack#37484 shipped and rests on no ruling of its own. So its text is this record's settlement, accepted with the PR that carries the amendment, and it is listed as one point.
404+
405+
24. **A long outline is paged on the same tool, by a position** (D3, D4). `outlineFrom` joins `anchor` on `get_record_context`, as point 4 keeps a section read on that tool, and a call that names both is refused. The cursor is a position in the body's page order and not an anchor, because the note that says where to continue may carry no record text. So a walk holds for one state of the body, and an edit between two page calls is not signalled. The alternative that PR weighed and did not take is one answer that lists every omitted heading's anchor compactly: for a large enough body it passes the same bound and needs a cut of its own.
406+
388407
## Implementation split (after acceptance)
389408

390409
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)