Skip to main content
Files are static context you give an agent: 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 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
src/agents/support.ts
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 both materialize into the agent workspace, but they serve different purposes:
FilesSkills
What it isStatic context: documents to readA playbook: instructions for a task
Where it lands/workspace/agent/{path}/workspace/agent/skills/{slug}/
Attach withsandbox: defineSandbox({ files: true }) or defineSandbox({ files: "set" })skills: ["name"]
Reach for it whenThe agent needs reference materialThe 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 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
Who owns itYou, authored in your project and version-controlledThe agent, scratch space it reads and writes during a runThe agent, written and recalled automatically
What it’s forStatic context the agent should readWorking files for the current taskCarrying knowledge between sessions
Where it livesSeeded into /workspace/{path}/workspaceA memory area outside /workspace (MEMORY.md, USER.md, archived notes, searchable past sessions)
LifetimeRe-seeded the same way every sessionThe session’s workspacePersists 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, 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

Attach files to agents

Use the agent’s set or a shared set.

Skills

Give agents reusable playbooks alongside files.

Build agents

Configure models, tools, skills, and files.

Sandboxes

How the agent workspace and file system work.