Repository navigation
An agent's session names the collections it can read, and a collection refusal says how to find them - #220
Merged
Conversation
…ys how to reach it Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/agents-see-collections
branch
from
November 4, 2026 02:47
58e857d to
9a87791
Compare
…s for no grant The plugin cannot read the deployment's knowledge_search_fanout_kinds, so the session-start lines say how to name a collection in a search rather than that loom_search reads them, which the server's own instructions state when it is true. The collection gate tells a token its own claim keeps out only what the claim must say, as the MCP screen does, with the role a delegated token's creator needs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ollection A minted token is capped to its owner's grants, so telling a claim-capped token to re-mint only helps when those grants already reach the role. The gate and the MCP screen now read the grants before the claim's cap (sharing.claim_advice) and give the claim's fix only then, else the grant's. The session lines name knowledge.search for searching one collection, since loom_search takes no namespace. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…o search Choosing the refusal's advice from the caller's grants told a scoped token whether a collection it cannot see exists, so the advice is read from the token alone again: a token its claim caps is told both what it needs, the claim that names the collection and the grant a new token is capped to, on the gate and the MCP screen alike, with a delegated token's creator. The session lines no longer name a search op: knowledge.search is kept off MCP and loom_search takes no namespace, and how a search covers collections is the server's to say. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
On a refused collection the MCP screen asks for a grant and points at collection.list, and no longer suggests dropping the namespace, which would file a write meant for the collection in the default namespace. The session lines say collection.list lists collections a page at a time. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
The grant a refusal asks for is read for the token's own subject, so the refusal names that principal rather than the token's owner, which for a service account is someone else. The gate's refusal says collection.list is reached through loom_op over MCP. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
The gate does not know the transport, and an assistant connection has no loom_op, so its refusal names collection.list and the dashboard's Library only; the MCP screen says how its own connection reaches the op. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…e creator Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
8 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #219 (adds
descriptiontocollection.listand makes the dashboard's Library the collection browser, which the refusal names; this PR merges after it)Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
A coding agent's session now starts with a few lines naming the shared collections its token can read, with its role and each one's description, and how to search and write them. The MCP instructions and a refused collection's error point at
collection.list.Why
An agent already searches every collection its token can read:
knowledge.searchandloom_searchfan out over them by default (knowledge_search_fanout_kindsincludescollection). But nothing told it which collections exist, so it could not do either of these without being told acol-…name:The plugin, its skills, the mentor and the MCP tool texts never mentioned collections, and a refused
col-…name said onlycannot access.The smallest change that makes them discoverable without widening anything:
lib/collections-line.mjs). It makes onecollection.listcall for the session's org, reading up to 1,000 rows, cached a minute per (server, org, token digest, toolset). The answer is the token's own, so two agents sharing a home with their own tokens each read their own line.knowledge_search_fanout_kinds, which the plugin cannot read, and the server's own instructions state it. If the caller writes one of them and the toolset is not read-only, the lines also say how to add a document when asked to (they never suggest filing one there unprompted): callknowledge.addwithnamespaceset to the collection's name, as its own tool where the toolset lists it (Codex does), otherwise throughloom_opwith{"op": "knowledge.add", "arguments": {"namespace": "<name>", ...}}. A pointer tocollection.list, throughloom_op, follows the list when there are more.everyoneadmin on it, which ranks with the caller's own admin collections, so the order is a convenience, not a defence; that is why the write sentence only answers a request. Names are shown whole, since the agent uses the name it reads; a name the server would not make is left off.{"collection": …, "role": …, "description": …}. The block marks it as data, and the JSON string keeps a description to its own entry. Names are held to the server's name rule. After NFKC, a description keeps only letters, marks, digits, spaces, a few ASCII punctuation marks and emoji. The okina and the modifier apostrophe become an ASCII apostrophe. Common quote, backtick and bracket lookalikes, control and format characters, and default-ignorable characters (which can hide text) become spaces. Emoji keep their joiners, skin tones and selectors. Each character, as a reader sees it, keeps at most four combining marks (an Indic conjunct needs that many); one over 16 code units is dropped; the description is cut to 60 characters.@me, since a session's token has none. It is silent when there are none, on an op the server does not serve, and on any error. Thetoolsetoption is read as the server reads it: parts split on+, a space or a comma, lower-cased. An unknown value takes the deployment's default on the server, which the plugin cannot know. The assistant toolset alone, which routes neitherloom_searchnorloom_op, gets no lines, andreadonly(whichroutes_writestreats as the one read-only value) gets no write sentence. The Codex plugin names its toolset in its own.mcp.jsonand sets no option, so there the lines read the toolset as writable.LOOM_COLLECTIONS_LINE=offdrops them.server/transport/mcp_primer.py) says thatloom_search's knowledge leg covers the collections the caller can read, and that a document for a collection goes there by its name as the namespace. It namescollection.listby the tool that reaches it, in the read section of the full primer, and the shorterinitializeinstructions on the coding toolset say thatloom_searchalso reads the collections you can read. Both say so only whileknowledge_search_fanout_kindsincludes collections, and so does the MCP refusal: one helper,server.auth.fanout.knowledge_search_reads_collections, reads the setting for all three.server/auth/sharing.py::check) now also says the role it needs: "a collection needs a grant of at least on it or a collection above it; collection.list (or the dashboard's Library) lists the ones you can read". It names no tool route: the gate does not know the transport, and an assistant connection has noloom_op; the MCP screen says how its connection reaches the op. One helper,sharing.claim_cap, decides for the gate and the MCP screen alike when the token's own claim, rather than a missing grant, caps it: a scoped claim whose role there is short, a delegated claim that does not name it (a*claim does not, as the gate's own cap reads it), anns_writeclaim that does not name it for a write, or a token whose own role is short (a viewer bot asked to write). It reads the same ceiling as the gate's cap, so the note and the refusal never disagree. Such a token is told both what it needs: which part of its claim blocks it, and that the token's own subject, which the grants are read for, must hold the grant. The words come from the token alone, never from the grants, since what a caller's grants reach on a collection its token cannot see would confirm that collection exists; so a caller who already holds the grant reads that part as already met. The gate and the MCP screen say the same, including a delegated token's creator. The parts a claim can lack: its write set (ns_write) must include the collection, its claim must name it, or name it with that role; every limit that applies is named at once, with the role it needs. A tree or grant that cannot be read still refuses, in the short words, so a caller that holds a grant retries instead of asking for one. A delegated token is also told its creator must hold the role. A caller from another org, and anyone refused someone else's personal collection (which takes no grant), gets the short refusal, with nothing added. The MCP screen's refusal of acol-name, which an agent's direct tool call meets first (server/transport/mcp_auth.py::_not_accessible_result), asks the collection's admin for a grant and points atcollection.listthroughloom_op. A token whose claim caps it is told what its claim must say and that its own subject must hold a grant of at least viewer (directly, through a group or to everyone); a delegated token is told its creator must be active and hold a grant too. It no longer sends the agent to the Spaces page, since a collection is never joined, nor suggests omitting the namespace, which would file a write meant for the collection in the default namespace; and, for a plain namespace, it saysloom_searchreads the collections the agent can read. On the assistant toolset it names neitherloom_searchnorloom_op(that connection reaches neither); a plain namespace there keeps its default-namespace and Spaces-page advice. Someone else's personal collection gets the bare refusal, which names no grant. Both say the same words whether the collection exists or not, so they confirm nothing.Not done, on purpose:
col-…names. A second name space would add a resolver to every op and a new ambiguity.Scope and risk
collection.listreturns for the session's own token (sharing.readable), which is what its grants already reach.grepovertests/and the clients).Compatibility, rollout and rollback
scripts.codegen.agent_plugin_sync). The descriptions come from The Library shows the collections a person can read, and the separate Collections page is gone #219; a server without it answerscollection.listwithout them, and the line then names the collections and roles only.Tests
integrations/claude-code-plugin/tests/collections-line.test.mjs:collection.listfor the rest;collection.listfor the rest, also when only the server's cursor says there are more;readonly;tests/unit/test_access_refusal.py: an assistant connection is pointed at no tool it cannot call (and keeps the default-namespace advice for a plain namespace), and someone else's personal collection gets no advice.tests/unit/test_sharing.py: another org's caller gets the short refusal, and a token is named only when its claim is what caps it (a scoped claim that already names the collection is not; a delegated token is told its creator must hold the role; a viewer bot and a scoped writer outside its write set are told about their claim).tests/unit/test_mcp_coding_toolset.py: the primer namescollection.listby the tool that reaches it, and the rendered full primer and coding instructions say thatloom_searchreads collections.tests/unit/test_access_refusal.py: a scoped token refused a collection is told its claim must name it.tests/unit/test_sharing.py::test_a_refusal_points_at_the_library_and_confirms_nothing: an existing and a missing collection are refused in the same words, which name the role needed and the dashboard's Library; someone else's personal collection gets neither.tests/unit/test_access_refusal.py::test_a_refused_collection_points_at_collection_list_and_a_namespace_does_not.collections-line.test.mjsalso passes on Node 18, the plugins' minimum, andnode --checkpasses there on the hook.tests/unit/test_mcp_coding_toolset.pyalso: the primers drop the collections clause when the fan-out setting leaves collections out.node --test integrations/claude-code-plugin/tests/*.test.mjs(432 tests),claude plugin validate integrations/claude-code-plugin,make lint typecheck, and the sharing, access-refusal and primer unit tests (290) pass.🤖 Generated with Claude Code