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

# Overview

> Static context copied into the agent workspace.

Files are static context you give an [agent](/learn/agents/overview): documents, instructions, reference material that get copied into the agent's workspace so it can read them like local files. Use files for the background an agent needs every time, such as a product guide, a style sheet, or an API reference, that the agent should read rather than have packed into its system prompt.

Use files for material the agent should read. Use [skills](/learn/skills/overview) for instructions about how the agent should do a task.

## Example requests

Ask your coding agent which reference material an agent should always have on hand. It can attach those documents as files.

> "Give the sales agent our pricing sheet and competitor comparison to reference on every call prep."

> "Attach our refund policy and support macros so the support agent can read them before drafting replies."

## How files work

Files live in your project under `src/files/`, grouped into folders called file sets. Attach a set with `sandbox: defineSandbox({ files })` on `defineAgent()`, and Keystroke materializes its contents into `/workspace/agent` before a prompt runs.

```
src/files/support/
  product-guide.md
  support-instructions.md
  context/seed.txt
```

```ts src/agents/support.ts theme={null}
import { defineAgent } from "@keystrokehq/keystroke/agent";
import { defineSandbox } from "@keystrokehq/keystroke/sandbox";

export default defineAgent({
  slug: "support",
  systemPrompt: "Read /workspace/agent/product-guide.md before answering.",
  model: "anthropic/claude-sonnet-4.6",
  sandbox: defineSandbox({ files: true }),
});
```

With `defineSandbox({ files: true })`, Keystroke uses the file set matching the agent's `slug` (here, `src/files/support/`). The folder layout is preserved under `/workspace/agent`, so `src/files/support/context/seed.txt` becomes `/workspace/agent/context/seed.txt`. Point the agent at the paths it should read from the `systemPrompt`.

## Files vs skills

Files and [skills](/learn/skills/overview) both materialize into the agent workspace, but they serve different purposes:

|                       | Files                                                                          | [Skills](/learn/skills/overview)      |
| --------------------- | ------------------------------------------------------------------------------ | ------------------------------------- |
| **What it is**        | Static *context*: documents to read                                            | A *playbook*: instructions for a task |
| **Where it lands**    | `/workspace/agent/{path}`                                                      | `/workspace/agent/skills/{slug}/`     |
| **Attach with**       | `sandbox: defineSandbox({ files: true })` or `defineSandbox({ files: "set" })` | `skills: ["name"]`                    |
| **Reach for it when** | The agent needs reference material                                             | The agent needs procedural guidance   |

Many agents use both: files for the documents, a skill for how to use them.

## Files vs memory

Files, the agent's own file system, and [memory](/learn/agents/build-agents#memory) all involve "files," but they answer different questions: what *you* give the agent, what the agent *writes during a run*, and what the agent *remembers across runs*.

|                    | Files (`src/files/`)                                 | Agent file system (`/workspace`)                          | [Memory](/learn/agents/build-agents#memory)                                                           |
| ------------------ | ---------------------------------------------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **Who owns it**    | You, authored in your project and version-controlled | The agent, scratch space it reads and writes during a run | The agent, written and recalled automatically                                                         |
| **What it's for**  | Static context the agent should read                 | Working files for the current task                        | Carrying knowledge between sessions                                                                   |
| **Where it lives** | Seeded into `/workspace/{path}`                      | `/workspace`                                              | A memory area outside `/workspace` (`MEMORY.md`, `USER.md`, archived notes, searchable past sessions) |
| **Lifetime**       | Re-seeded the same way every session                 | The session's workspace                                   | Persists across sessions                                                                              |

The relationship in one line: **files** are the read-only-by-convention context you seed into the **agent file system** at the start of a session, while **memory** is the separate, durable store the agent uses to remember things from one session to the next.

Because files are re-seeded each session, treat them as fixed input rather than a place the agent saves work. If an agent needs to remember something for next time, that's [memory](/learn/agents/build-agents#memory), enabled by default and managed by the agent itself, not by editing files. Set `memory: false` on an agent to make it stateless.

## Files and the sandbox

Files seed the agent's `/workspace`, the same sandbox the agent uses for its file system and bash tools. Seeding is idempotent: files are written once per session and the agent's own edits during a run are preserved.

## Next steps

<CardGroup cols={2}>
  <Card title="Attach files to agents" href="/learn/files/attach-files-to-agents">
    Use the agent's set or a shared set.
  </Card>

  <Card title="Skills" href="/learn/skills/overview">
    Give agents reusable playbooks alongside files.
  </Card>

  <Card title="Build agents" href="/learn/agents/build-agents">
    Configure models, tools, skills, and files.
  </Card>

  <Card title="Sandboxes" href="/learn/agents/build-agents#sandboxes">
    How the agent workspace and file system work.
  </Card>
</CardGroup>
