# Knowledge base

> How the model in Buff Code reads the organisation’s and project’s knowledge base, proposes a new entry, and why an entry appears only after you confirm it.

The organisation’s [knowledge base](/en/docs/knowledge) — working rules, facts about projects and environment
pitfalls — reaches the model in Buff Code the same way it reaches every platform run. Nothing
needs to be moved or set up: knowledge is connected by the [working context](/en/docs/buff-code/sign-in)
— organisation, project, chosen spaces.

## What the model reads

At the start of a session the model gets the table of contents of the knowledge base: mandatory entries — in full,
the rest — as a title and a one-line description. After that it reads the entry it needs itself,
with a read tool, when the question concerns it. This is the same order as in platform tasks:
see [How it reaches the model](/en/docs/knowledge/prompt).

The knowledge scope follows the context:

| Chosen in Buff Code | What the model sees |
| --- | --- |
| Organisation | organisation-level entries |
| Organisation and project | plus the project’s entries |
| Knowledge spaces (`/space`) | plus the entries of the chosen spaces |

Without a chosen organisation there is no knowledge — Buff Code suggests `/org`.

The tools of the **knowledge** server are named the same as in platform runs:
`knowledge_list_entries`, `knowledge_read_entry`, `knowledge_write_entry`. You can see them in `/mcps`.

## How a new entry appears

The model proposes an entry itself — when you ask it to remember something, when you formulate a
rule, when it has established a stable fact about the environment or found a way around an obstacle. **Nothing is written
without your “yes”.**

Buff Code shows the request **“Request from «Knowledge base»”** with the whole entry: title, type
(rule, fact, pitfall), scope (the whole organisation or the project), name and text.

- **In the window** — above the input field, with the buttons **“Not now”** and **“Add this entry to the knowledge base”**.
- **In the terminal** — the question “Add this entry to the knowledge base” with the options **“Yes”** and **“No”**
  (“No” by default): choose with the arrow keys, Enter sends, Esc closes the request.

_Illustration: A developer asked to record a team rule. The model checked the knowledge base’s table of contents and proposed an entry — it appears only after “Yes”._

_Illustration: The same in the window: the request above the input field (outlined). “Not now” — the entry does not appear, and the model will not propose it again._

- Confirmed — the entry appears in the [knowledge base](/en/docs/knowledge) under your name; the event
  “Knowledge “…” created from Buff Code” goes into the [audit log](/en/docs/audit-log).
- Declined — the model gets “not written” and does not propose this entry again.

This is the only way entries are created in Buff Code: you cannot edit or archive entries from Buff Code —
that is done in the workspace. An entry is never deleted for good: a removed one goes to the [archive](/en/docs/knowledge/archive).

## Why `buff run` writes no entries

`buff run` runs a task without asking a person anything and cancels any confirmation forms.
So a proposal to record knowledge is not carried out in this mode: the model gets “not written”.
If you want the model to add to the knowledge base, work in the Buff Code interface.

## Permissions

Any organisation member with access to the project can read the knowledge base in Buff Code.
Anyone can also propose an entry: confirming the form counts as your action, and the entry
is created under your name with your [knowledge base permissions](/en/docs/knowledge/permissions).
