From 5b8dbd0ccb00b3cff85e9f4aa67e9bd736d7e986 Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Wed, 24 Jun 2026 21:46:37 +0200 Subject: [PATCH] adr: lock @chat on-demand read decision --- ...0001-rag-citation-and-context-architecture.md | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/docs/adr/0001-rag-citation-and-context-architecture.md b/docs/adr/0001-rag-citation-and-context-architecture.md index 469a2d04e..100c19e5f 100644 --- a/docs/adr/0001-rag-citation-and-context-architecture.md +++ b/docs/adr/0001-rag-citation-and-context-architecture.md @@ -356,7 +356,7 @@ Per mention type (note the channel — direct vs delegated): | `@document` | doc id + path | direct `search_knowledge_base(scope={document_ids:[id]})`, or delegated `task(knowledge_base, read …)` | `kb_chunk` / `kb_document` | | `@folder` | folder id + path | direct `search_knowledge_base(scope={folder_ids:[id]})`, or delegated browse | `kb_chunk` | | `@connector account` | connector_id + account | `task(, "… connector_id=id")` | `connector_item` | -| `@chat` | thread id + title | **read channel** (not `scope`): load thread turns directly, access-checked, via the existing `referenced_chat_context` resolver | `chat_turn` | +| `@chat` | thread id + title | **on-demand read** (not `scope`): pointer only; model calls `read_chat(thread_id)` when it needs the conversation, reusing the access-checked `referenced_chat_context` resolver | `chat_turn` | | anonymous upload | session doc ref | direct `search_knowledge_base(scope=anon)` / delegated read | `anon_chunk` | --- @@ -421,18 +421,14 @@ Keep / add: 10. **Delete the legacy `kb_priority` / `kb_matched_chunk_ids` plumbing**; add a dedicated `citation_registry` field to state rather than overloading old fields. ✅ +11. **`@chat` is a non-indexed read reference** (chats aren't in `Document`/`Chunk`): + pointer only, loaded **on demand** via a `read_chat(thread_id)` tool that reuses + the access-checked `referenced_chat_context` resolver and registers each surfaced + turn as `chat_turn`. ✅ ## 9. Open items -1. **`@chat` read mode.** Confirmed: chats are not KB-indexed, so `@chat` is a read - reference, not `scope`. The remaining choice is *when* the turns load: - - **(a) Eager inject** — keep the current `referenced_chat_context` budgeted - injection; the transcript is in context up front. Simple, already built; costs - tokens even when the chat is only tangentially referenced. - - **(b) On-demand read tool** — `@chat` renders as a pointer only; the model calls - `read_chat(thread_id)` when it actually needs the conversation. Consistent with - the pull model and context hygiene; adds a tool + a round-trip. - Both register each surfaced turn as `chat_turn`. Decision pending. +_None — all decisions locked. See §8._ ## 10. Rollout (suggested)