> ## Documentation Index
> Fetch the complete documentation index at: https://datagen.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Context overview

> Knowledge bases, skills and memory: what each one is, where it lives, and when to use which

**Context** is everything an agent knows before it starts working: curated reference material, reusable know-how, and what it learned on earlier runs. DataGen gives you three tools for it, and each answers a different question.

| | Knowledge base | Skill | Memory |
| - | - | - | - |
| **Answers** | "What does the agent need to know?" | "How should the agent do this kind of task?" | "What did the agent learn last time?" |
| **What it is** | A named, versioned file tree built from workspace files | A folder with a `SKILL.md` and supporting files, reviewed before use | Files an agent writes into a knowledge base it is allowed to write to |
| **Who writes it** | You, with the AI Context Builder | You upload it; a reviewer approves it | The agent, during its runs |
| **Where the agent sees it** | Read-only at `/mnt/context/contexts/<slug>/` | In the agent's `.claude/skills/` | Through the `list_context_files`, `read_context_file` and `write_context` tools |
| **Versioned** | Every publish is a version, with rollback | Every upload is a version, pinned per install | Every agent write is a knowledge base version |
| **Page** | [Build](/context/build) and [Use](/context/use) | [Skills](/context/skills) | [Memory](/context/memory) |

In the product, knowledge bases live under **Files** in the sidebar: the panel next to the Files page is titled **Files & context** and lists every knowledge base under **Context**. Skills live under **More → Skills**.

## Knowledge bases

A knowledge base (`WorkspaceContext`) turns raw uploads into a compact tree an agent can rely on. You pick source files, describe what you want in a chat with the AI Context Builder, review the files it writes, and publish.

### The snapshot model

Each knowledge base has a **slug**, set once when you create it. The slug is the folder name under `.context/` in workspace storage, so a knowledge base always publishes to `.context/<slug>/`. You can rename the knowledge base later; the slug never changes.

<Note>
  A knowledge base is a **snapshot**, not a live link to its sources. Publishing copies the builder's file tree to `.context/<slug>/` and records it as a new version. When a source file changes, the knowledge base changes only when someone (or a scheduled automation) runs the builder again and publishes.
</Note>

* **Sources stay out of the published tree.** The builder reads copies of your sources in its own `.sources/` folder; only the tree it builds is published.
* **Agents read the live version.** Every connected agent reads the published version on its next turn after a publish.
* **Every version is kept.** You can roll back to any earlier version; rolling back publishes that version's files as a new version, so nothing is lost.

### When to use a knowledge base

* Policies, product documentation, playbooks or reference tables an agent should consult.
* A distilled summary of a large set of files, so the agent does not read hundreds of raw documents on every run.
* One shared reference built from several agents' outputs.

## Skills

A skill is a reusable instruction set: a folder with a `SKILL.md` (name, description, instructions) and any supporting files. Skills are uploaded to the workspace's skill registry, reviewed, and then installed where they are needed:

* **On an agent**, a skill is copied into the agent's own `.claude/skills/` and ships with every run.
* **On a knowledge base or an app**, a skill is a build-time tool for the AI builder only. It is never published and never reaches the agents or the app that use the result.

Use a skill when the knowledge is a **procedure** ("how to write our weekly report", "how to score a lead") rather than **facts**. See [Skills](/context/skills).

## Memory

Agent sandboxes are discarded when a run ends, so an agent has no memory of its own. In DataGen, an agent's memory is a knowledge base it is allowed to write to. Connect a knowledge base to the agent with **Read & write** access, and the agent gets tools to list, read and update its files. Each write is a new version of that knowledge base, which you can inspect and roll back like any other.

Use memory for things the agent discovers while working: a customer's renamed contact, a runbook step that turned out to be wrong, a preference a user stated. See [Memory](/context/memory).

## Which one to use

| If you want the agent to... | Use |
| - | - |
| Answer from your documents, policies or reference data | A knowledge base, connected with **Read** access |
| Follow a repeatable procedure or house style | A skill installed on the agent |
| Remember what it learns between runs | A knowledge base connected with **Read & write** access |
| Give the AI Context Builder or App Builder a better way to work | A skill installed on that knowledge base or app |

<Tip>
  Raw files and published data models are separate from Context. An agent can also read raw workspace files on demand through its `workspace_data` tools, and query published data models through the `datagen-data` CLI. See [Use files](/files/use) and [Use data](/data/use).
</Tip>

## Next

<CardGroup cols={2}>
  <Card title="Build a knowledge base" icon="hammer" href="/context/build">
    Create a knowledge base, pick its sources and publish the first version.
  </Card>

  <Card title="Use a knowledge base" icon="plug" href="/context/use">
    Connect it to agents and apps, and choose read or read and write access.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.