Skip to content

The assistant reads Loom's documentation through help.search and help.get - #488

Merged
zlareb1 merged 1 commit into
mainfrom
feat/assistant-help
Nov 10, 2026
Merged

zlareb1 merged 1 commit into
mainfrom
feat/assistant-help

Conversation

@zlareb1

@zlareb1 zlareb1 commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • New Feature

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

The assistant can read Loom's own documentation, as the running build ships it: help.search finds the sections that answer a question and help.get returns a page or one section. Both are read-only and on the assistant toolset.

Why

The assistant answers questions about what a namespace holds, but not about how Loom works ("how do I share a collection", "what does this health warning mean", "what can a viewer do"): the docs were not in the image, and no assistant tool read them. This PR ships the docs and gives the agent two reads over them. The agent is told to read them for how Loom works and to name a page in words; a checked help citation kind, the asker's role and fuller instructions follow in separate PRs.

Design (also in docs/architecture/assistant.md#looms-documentation):

  • What ships. The runtime image copies docs/; .dockerignore keeps docs/images/ out of the build context. server.core.paths.DOCS_DIR points at it, so a source run reads the checkout's docs. Contributor pages (development/) are not indexed.
  • Index. Built in process on the first help call, in a worker thread, once per process, and kept for its life: the docs change only with the build. Pages are split with the splitter documents already use (server/knowledge/domain/chunking.py detect_sections), so a breadcrumb starts with the page title as a document citation's does, and each section gets the anchor a Markdown renderer gives its heading. Sections are scored with BM25 (server/core/bm25.py). Terms are the words, with plurals and simple suffixes folded and question words dropped, plus every whole identifier (memory.set, LOOM_ASSISTANT_MODEL), so an exact op or setting name finds the line that names it. An operator page (operations/, architecture/, benchmarks/) scores three quarters, since most askers use Loom rather than run it.
  • Why not a knowledge source. Knowledge rows are tenant data: org and namespace on every row, erasure coverage, and a copy per org or a cross-tenant read path. They also cost embedding calls, and during a rolling upgrade replicas of two builds would share one copy. Help keeps the docs out of ClickHouse, so nothing is written, erased or embedded.
  • Nothing withheld by role. Every page is in the public source tree, and test_public_copy.py keeps hosts and secrets out of it. Each hit carries an audience (user or operator) instead. Help reads no environment, setting value or secret.
  • Failure. An unreadable page is left out with a warning. A process with no docs, or whose build raises, answers available: false until it restarts. A call that arrives during the first build waits for that build instead of reading no index.

The design was reviewed in six adversarial rounds before the build; the last round had no findings.

Scope and risk

  • New package server/help/ (api, app, domain; no store). It reads no database and no tenant data.
  • help.search and help.get are experimental, read-only and deployment-scoped (skip_namespace_authz, like mentor.guide). They are on the assistant toolset, in END_USER_ORG_OPS and in the read-scope registry. They are in no curated roster and not in the all listing.
  • A help.get path is a key of the index, never a filesystem path: ../.env answers found: false.
  • Memory and CPU: about 2,200 sections in about 14 MB per process, built in about a second off the event loop. A search scores at most 20 terms over their postings; a help.get read, of a section or a whole page, returns at most 16,000 characters and is read on by offset; a page read, or one that is cut, adds the page's outline.
  • The agent definition moves to version 5, because its tool list changed. For the grounding label, both ops are Loom's own documentation (ASSISTANT_NO_NAMESPACE_DATA_OPS): a call to them is never the namespace's data.

Compatibility, rollout and rollback

  • Wire: new ops help.search (query, limit) and help.get (path, section, anchor, offset; output next_offset); nothing changed or removed.
  • Operator steps: none. The image carries the docs. A source run reads docs/ from the checkout.
  • Rolling upgrade: the newest build writes the agent definition, so during an upgrade a help call that reaches an older replica answers UNKNOWN_OP and that answer goes without the docs (stated in docs/architecture/assistant.md#rolling-upgrades).
  • Rollback: nothing stored. An older build sees agent definition version 5 as newer and leaves it, so its replicas answer help calls UNKNOWN_OP until they are upgraded again.

Tests

  • tests/unit/test_help_docs.py:
    • splitting at headings, with fenced headings ignored and repeated headings given distinct anchors, and a repeated heading read back by its hit's anchor;
    • search with folded terms (settings/setting, embeds/embedded) and question words dropped, and an exact identifier finding its own line;
    • section and page reads, with the outline on a page read or a cut one;
    • truncation, and a long page read to its end by offset, and every shipped section longer than one read as well;
    • contributor pages not indexed;
    • no docs, or an index that fails to build, answers unavailable;
    • an unreadable page is left out;
    • one build for concurrent first calls, and a call during the first build waiting for it (this test fails on the earlier ordering, which set the flag before the build);
    • the image copies the docs;
    • the ops' flags and rosters;
    • every token kind that may read the agent guide may read the docs.
  • tests/integration/test_help_docs.py: a viewer finds a section over HTTP and reads it back; ../.env is not found.
  • test_assistant_service.py: the definition digest is pinned to version 5; test_assistant_support.py holds the help ops to their grounding set and found fields.
  • Ran: make format, make lint and make typecheck (green), and the full unit suite in four parts with -n 2: 32,710 passed. The four failures it found were this PR's (the tunable-constant, SDK surface, deployment-scoped and projection gates) and are fixed. Two others are not in this diff and fail the same way on main here: test_code_regex_cost and test_deeply_nested_hidden_html_parses_in_bounded_time, a known local-environment failure.
  • The integration test runs in CI's integration jobs; it was not run locally.
  • Measured on this checkout's docs: 156 pages, 2,190 sections, a 0.94 s build, about 14 MB.

AI assistance in the code (leave one; writing this description with AI is fine):

  • AI-generated (an agent wrote most of the diff): Claude Code. The design went through six adversarial architecture reviews to zero findings, and each part is covered by the tests above.

  • I can explain every line of this diff and how it interacts with the rest of Loom.

Checklist

  • make format-check, make lint, make typecheck and make test-unit pass; the integration suite passes if server behaviour changed.
  • Generated files are regenerated in this PR, not by hand: the SDK op tables, docs/reference/configuration.md and the docs/reference/ tables (python scripts/codegen/docs_reference.py), the reach manifest, schemas/schema.sql (make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).
  • A new migration is additive and numbered after the latest on main; no merged migration is edited.
  • A behaviour change to any file a plugin ships (hooks/, lib/, bin/, skills/, .mcp.json, the Codex plugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.
  • The frontend builds (npm --prefix frontend run build) and its tests pass, if frontend/ changed.
  • Docs under docs/ describe the system as it now is, and this description names any operator steps and wire changes.
  • Repository text has no dates, people, host names, internal namespaces, ticket or decision numbers; the history goes in this description (tests/unit/test_public_copy.py).
  • Commits are signed off (git commit -s), as CONTRIBUTING.md asks.

🤖 Generated with Claude Code

@zlareb1
zlareb1 force-pushed the feat/assistant-help branch from e30e89d to 943cc6a Compare November 10, 2026 16:27
….get

The image ships docs/ (Markdown; the screenshots stay out of the build
context), and two read-only, deployment-scoped ops serve it: help.search
scores the docs' sections with BM25 in process and help.get returns a page
or one section, by anchor and from an offset. Both are on the assistant
toolset, count as Loom's own documentation for the grounding label, and are
in no curated roster.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: zlareb1 <lareb.zafar@clickhouse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant