# The Library

The Library is your workspace's knowledge as folders of Markdown files: a word-for-word copy of
every crawled page, and a knowledge base written from them that people and agents both edit.

## Two layers

- **Sources** (`/sources`) holds a copy of every crawled page, at a path that follows the page's
  address: the website's under `/sources/website`, and each other [source](https://orbik.io/docs/guides/sources.md) — a
  documentation site, a review profile — in a folder of its own beside it (`/sources/docs`). It is
  written by code when a crawl finishes — no AI model reads a page in order to store it — and kept
  in step with each source after every crawl. A copy is marked **Copy of the site · read-only**,
  with the live page one press away; a copy from a source other than the website says which in its
  first lines (`- From: Clutch reviews (a page about the company elsewhere; testimonials &
  reviews)`).
- **The knowledge base** is the folders above it: what the company is, said once and in one place
  — an overview, an index, and subjects such as services, pricing and case studies. The
  **Knowledge base agent** writes it with an AI model from a selection of the site's pages, and
  links each file down to the copies it was written from (**Evidence**, at the foot of a file).

Apart from duplicate URLs and pages marked `noindex`, every page is stored, whatever the size of
the site. Only the knowledge base is written from a selection, so what a site costs follows the
size of its knowledge base, not its page count.

The crawl counts more than that: every address it found, including ones that answered with an
error and files that are not pages, such as the `.md` copy some sites publish beside each page.
Those are not stored, so the status line along the foot of the Library names both figures — "30
pages stored, from 68 addresses crawled" — and says on hover where the rest went.

## Which pages the knowledge base is written from

Code chooses them, with no model asked: up to 80 pages, by how many of the site's pages link to
each. In order, it takes pages a person asked for, pages a file of the knowledge base already
cites, pages linked from across the site (the navigation), the pages a site-wide page lists when it
lists only a few (a case studies page, say), and then the rest, most linked first. Legal pages,
logins and carts, paginated and tag listings, and pages with next to nothing on them are left out
unless somebody asks for them.

**Source ledger**, in the Knowledge base agent's menu (its icon at the bottom left of the Library) and on its page under **Agents**, lists every page with the reason it was used or
left out — "Linked from 72 of the site's 72 pages with content" — under **All**, **Used** and **Left out**. On a
left-out page, **Include** asks for the knowledge base to be written from it too. The row says
**Queued** until the next write run has used it. A copy's inspector offers the same under **In the
knowledge base**.

## Choosing the top-level folders

The top level of the Library is yours. After the first crawl you choose its folders, starting from
Orbik's standard ones:

```
00 Start Here   overview · index · open-questions
01 Company      about · team
02 Offer        services · products · features · pricing · process · faqs
03 Proof        case-studies · customers · testimonials
04 Market       buyers · industries · competitors
05 Content      content
```

Home calls this step **Choose how your Library is organised**, and the Library opens it as a tab.
Each folder is a row with its number, its name, its path and the kinds of page the agent files
there. Rename a folder with the pencil, remove it with the cross, add one with **Add a folder**,
and reorder them by dragging the handle at the left of a row (or focusing it and pressing the up
and down arrow keys). Up to twelve folders; the first holds the overview and the index, and the
numbers follow the order you set.

**Suggest changes** opens **Ask**, where you say what you want in your own words — "merge Proof
into Offer", "add a folder for our locations" — and press **Send**. Orbik makes the change to the
list on screen within a few seconds, says in a line what it changed, and offers **Undo**. It is one
model call, so it is offered only when AI is available; everything else on the step works without
it.

With the agent paused, **Use this structure and start writing** also sets it to work, and **Or
save without starting** keeps it paused; with the agent already at work the button is **Use this
structure**. **How this works** on the step has the rules below. Nothing is written until you
confirm.

Confirming opens the overview. Until it is written, it lists the steps before the first write —
site crawled, folders chosen, agent set to work, AI available — marks the one it is waiting on, and
offers the one action that moves it forward. Once nothing stands in the way the first run starts
within a minute, and the overview shows its progress, then the overview itself.

After that, agents never write at the top level and never rename, move or delete a folder a person
made. The numbers are part of each folder's name and nothing more; once the folders are chosen, the
order is set in the explorer. **Rebuild the structure…**, under **What changed**, offers the step again,
and the next run moves what the Library holds into the new folders, links and history included.

Two folders are not yours to choose: **Sources**, and `brand`, which is reserved for the Design
system agent.

## The overview and the index

The **overview** is the Library's front page: the briefing everything else starts from. The
**index** says what to read for which job — for sales outreach these files, for ads these. Both live
in the first top-level folder, move with it when it is renamed, and cannot be deleted. Your own AI
starts from them too when it reads the Library (see
[Connect your AI](https://orbik.io/docs/connect-your-ai.md)).

The `open-questions` file lists what the site leaves unsaid. Opened in the Library, it becomes
**Answer what the site leaves open**: answer a question in place, and the answer is added as your
paragraph to the file the question is about.

## Editing

Members and above edit the Library; read-only members read it.

Open a file and switch to **Editing** (⌘E). A file is edited block by block — a block is a
paragraph, list, table or heading — with its title, summary and tags above. Type `[[` to link to
another file. **Done** saves and returns to reading, ⌘S saves and stays, and **Discard** drops the
draft. New files and folders come from the explorer's toolbar or a folder's **+**.

What you write is kept:

- A block you write, or change, is yours. It is marked **Your writing · kept** (or **Yours now ·
  changed from the agent's**), and the agent must keep it every time it rewrites the file. Changing
  one word of the agent's paragraph makes the whole paragraph yours.
- A block you delete stays deleted: the agent cannot put it back.
- **Lock: keep agents out** on a file or folder stops every agent writing there, including your
  own AI writing for you. Only a person unlocks it.
- **Rename or move…** rewrites every link to the file or folder, inside your own blocks too.
- **History** keeps the last twenty versions of every file, with who wrote each and what changed.
  **Restore revision N** writes the old version forward as a new one, so nothing is lost.

## When the knowledge base is rewritten

Nobody starts a write run by hand. At the bottom left of the Library, the **Knowledge base agent**
is a small round icon: grey while it is paused, lime once it is set to work,
with a dot circling it while it writes. The words beside it say what it is doing, or what it is
waiting on (point at them for the whole sentence). Press the icon for its menu, where **Set to
work** decides whether the agent works at all:

The same switch, with the folders the agent writes into, the source ledger, what its last run
changed and its recent runs, is on its own page: **Agents → Knowledge base**. That page links into
the Library for anything that is read or changed there, such as choosing the folders.

That page also has the agent's **Model**: which AI model writes the knowledge base. It is the most
capable one unless somebody chose otherwise; with Claude the choice is **Claude Opus 5.5** or
**Claude Sonnet 5.5**, at about half the cost. The smallest model is not offered here: it is fine
for a quick question in Ask, but not for writing a knowledge base people rely on. Every write run
uses the model chosen, the ones a crawl starts included, from the next run on. Members and above
choose it, as they set the agent to work; read-only members see which it is.

- Set to work, it rewrites the knowledge base when a crawl finds that a page it is written from
  has changed, a page has been newly chosen, or a chosen page has left the site — once the crawl's
  copies have settled. A new blog post is copied and indexed on its own; it usually starts a run
  only through the blog's listing page, which changes with it and is linked from across the site.
- Paused, the site is still crawled, copied into Sources and indexed for search; the knowledge
  base is left as it is.

While a run is in flight, **This run** shows it and **Stop this run** ends it. **What changed** lists what
past runs changed, and, while nothing has been written, why. A run that fails is tried again when
the site next changes, or when the agent is paused and set to work again.

Writing needs a reasoning key: `ORBIK_ANTHROPIC_API_KEY`, or `ORBIK_OPENAI_API_KEY` on its own
(`ORBIK_AI_PROVIDER` picks one when both are set; see
[Configuration](https://orbik.io/docs/self-hosting/configuration.md)). Without one the copies and the search index are
still made, and the Library says the knowledge base cannot be written: to the install's admins with
the setting to change, to everyone else as "AI is not available on this Orbik right now". Every model call is listed under
**Settings** → **AI calls**. On a site of about seventy pages, with Claude making the reasoning
calls, a first build came to about $0.90 and a change to the folders asked for in words about $0.03; an ordinary
update, which reads only the pages that changed, costs a fraction of a first build.

## Finding things

⌘O (Ctrl+O) opens the quick switcher: **Files** matches titles as you type, and **By meaning**
searches the same index Ask and your own AI search, so a question in your own words finds the
passage that answers it. Ask itself is beside every page: see [Ask](https://orbik.io/docs/guides/ask.md).

Some folders show pages of the site rather than files of their own: a case studies folder can list,
under **Pages from the site**, the case studies the site links to, each opening its copy in
Sources. The list follows the site as pages are added and removed.

How the Library works inside — the mirror, the selection, the write run and the rules every
writer follows — is in [architecture/library.md](https://orbik.io/docs/architecture/library.md).
