Skip to content
CodeBook

Knowledge from pull requests, the web, and ticket systems

Index a pull request with its reviews, a page on an approved web origin, or an item from Jira, Linear, Slack or Notion as a scoped knowledge source.

Knowledge sources began with uploads, selected repository files, repository issues and GitHub discussions. Three more kinds of source join them under the same scopes, permissions, freshness clocks and retrieval budget: pull requests with their reviews, pages on approved web origins, and items read through a connection to Jira, Linear, Slack or Notion.

Everything below is untrusted reference text. Its document header says so, and the retrieval block tells the model that retrieved knowledge is not an instruction.

Pull requests with their reviews

Choose Pull / merge request (with reviews) in Factory settings → Knowledge, select a connected repository and enter the pull request number. This is a separate source kind from an issue/PR conversation, so adding it does not change or re-embed conversation sources you already have, and a number that is really an issue fails clearly instead of quietly becoming a conversation.

GitHub sources include the pull request, conversation, submitted review summaries and inline review threads. Pending reviews are excluded. GitLab sources include the merge request and submitted discussion/system notes, including resolved state; draft notes and approval-policy state are not imported. Gitea sources include the pull request, issue comments, submitted review summaries and inline comments; reply-parent grouping is not available from its response.

Review citations retain provider-reported file, side, line or range, link and revision evidence. GitHub preserves outdated original lines and commits. GitLab compares head, base and start commit identities before labelling a diff current. Gitea retains old/new-side positions; unavailable commit identity or an older snapshot is labelled unverified rather than presented as current. When a host supplies no comment permalink, the citation falls back to the conversation link. Comment bodies cannot forge citation headers.

Limits fail rather than truncate: 500 items across comments, reviews and inline comments, 1 MB of text and 20 requests per review-source sync. Requests time out after 30 seconds and responses are bounded at 3 MB. Gitea issue comments use one bounded complete-list read; other paginated endpoints are read until exhausted. A 404 marks the source missing; a 403 remains an error. Attachments and images are not imported; suggestions remain Markdown text, never applied patches.

The Gitea path was checked against a real isolated Gitea server with repository commits, an issue, a pull request, both review sides, changed-content sync, access revocation and deletion. GitLab adapter checks use protocol fixtures; live GitLab account verification remains open.

Pages on approved web origins

A web page can be a source only on an origin an administrator has approved first. Organization-wide approvals live under Organization settings → Approved web sources; workspace approvals live under Workspace settings → Web sources, which also shows the inherited organization rows. An approval names a scheme, a host, an optional port and a path prefix, with a note. Revoking keeps the row for audit and can be reversed. People who are not administrators see the list read-only.

Matching is exact on host and port. There are no wildcard subdomains, on purpose: one approval cannot cover a subdomain someone else controls, so an administrator approves each host.

Then choose Web page (approved origin) as the source kind and paste the URL. One source is one URL. Links found in a page are kept as text and never followed; there is no crawling. Content types are limited to HTML, plain text and Markdown. PDFs and other binary types are refused.

The fetch honours robots.txt for the CodeBook-Knowledge product token, and identifies itself as CodeBook-Knowledge/1.0. Every hop is checked against private, loopback, link-local and metadata addresses, and the connection is pinned to the checked address so a DNS answer cannot change between the check and the connection. Redirects are followed by hand, at most five, and each must land on an approved origin. Requests time out at 15 seconds and are capped at 2 MB; a compressed body is refused rather than inflated.

Approval is checked live, so a revoked origin drops out of worker context immediately. Sources that relied on the revoked approval and no other become unapproved, lose their indexed text and stop syncing until the origin is approved again. Refresh uses the usual scheduler with content hashing; an unchanged page is not re-embedded.

Jira, Linear, Slack and Notion

Under Factory settings → Knowledge → Connected accounts, a workspace administrator connects an account by pasting a token. Jira Cloud takes the site URL, an account email and an API token; Linear a personal API key; Slack a bot token from a workspace's own internal app; Notion an internal integration token. The token goes into a password field, is stored encrypted and is never shown, logged or put in a prompt again. Test calls the vendor's identity endpoint. Remove states its impact before it acts.

Connections belong to one workspace. A source may use only a connection from its own workspace, and organization-scope sources cannot use one. Removing a connection clears the index of every source that read through it and marks those sources missing with the reason.

Then choose the origin in Add knowledge source, pick the connection and paste a key, URL, permalink or page link:

  • Jira: an issue with its fields and its full comment pages. Atlassian document format is converted to plain text, including lists, code, panels, tables and mentions; media becomes a placeholder.
  • Linear: an issue with its comments.
  • Slack: a thread, from a permalink or channel and timestamp, with a per-message link. Messages cite the user ID; display names are not fetched.
  • Notion: a page and its blocks, read recursively up to 1,000 blocks and 5 levels. Headings carry block anchors. Child pages and databases are listed by title but not descended into; add a child page as its own source.

Each source shows its vendor link, its connection and any rate-limit wait. Sources refresh every 15 minutes with the same lifecycle as a GitHub issue: unchanged content is not re-embedded, a deleted item becomes missing and loses its index, and errors stay visible with Sync / retry. A vendor rate limit stores the wait it asked for and no request is made before it.

Limits fail rather than truncate: 500 comments or messages, 1 MB of text, 2 MB per response, 15 seconds per request, and a request budget per sync (Jira 8, Linear 12, Slack 12, Notion 60). Redirects are refused. Every request passes the private-network guard; a Jira custom domain is accepted as any https origin that passes it.

Slack's stricter limit for commercially distributed non-Marketplace apps applies to those apps, not to a workspace's own internal app. Under that limit a long thread can exhaust the budget, which is reported as an error.

Not built

  • OAuth installs for Atlassian, Slack, Notion or Linear. Each needs a registered vendor app with redirect URLs and client secrets. Token-based authentication is what is built.
  • Attachments and files from Jira, Slack or Notion are shown as not imported placeholders.
  • Slack display names, which would need one extra request per author.
  • The connectors are written against the vendor documentation and tested against local stand-ins that speak each vendor's documented shapes. They have not been run against real Jira, Linear, Slack or Notion accounts.