@@ -21,6 +21,7 @@ A kit packages a set of capabilities a sandbox can use, such as:
2121- Domains to allow
2222- Files to drop in
2323- Startup commands to run
24+ - Memory instructions to give the agent
2425
2526You declare these in a single ` spec.yaml ` file, point the CLI at the
2627directory (or a ZIP, OCI artifact, or Git URL), and the sandbox applies
@@ -166,6 +167,47 @@ See [Credentials](../security/credentials.md) for how to provide the
166167credential value on your host, other approaches for cases the example
167168above doesn't fit, and what the proxy does at request time.
168169
170+ # ## Inject agent memory
171+
172+ A kit can append content to the agent's memory file — the Markdown file
173+ the agent reads at startup, such as `CLAUDE.md` or `AGENTS.md`. Use it
174+ to give the agent project conventions, usage tips for a tool the kit
175+ installs, or any other guidance that should be in scope every time the
176+ sandbox runs.
177+
178+ ` ` ` yaml
179+ memory: |
180+ Ruff is installed. Run ` ruff check` before committing.
181+ Shared config lives at `/workspace/ruff.toml`.
182+ ```
183+
184+ Both mixin and agent kits can declare ` memory: ` . The content is written
185+ only when the active agent kit sets [ ` agent.aiFilename ` ] ( #agent-block )
186+ — the filename determines which memory file the content lands in. The
187+ file is written to the parent of the workspace path inside the sandbox,
188+ not to the workspace itself, and exists only inside the sandbox; nothing
189+ is written to the host.
190+
191+ When more than one loaded kit declares a ` memory: ` block, each kit's
192+ content is written to its own ` <kit-name>.md ` file under a sibling
193+ ` kits-memory/ ` directory, and the main memory file gets a ` ## Kits `
194+ section that points to each one:
195+
196+ ``` text
197+ /Users/you/
198+ ├── myproject/ # workspace
199+ ├── AGENTS.md # main memory file, gets a "## Kits" index
200+ └── kits-memory/
201+ ├── ruff-lint.md
202+ ├── vale.md
203+ └── git-ssh-sign.md
204+ ```
205+
206+ This layout lets the agent skip kit-specific instructions until they
207+ become relevant, instead of carrying every kit's memory in context on
208+ every turn. See [ ` memory ` ] ( #memory ) in the spec reference for the full
209+ field schema.
210+
169211### Define an agent
170212
171213Agent kits declare an ` agent: ` block with the image the agent runs in and
@@ -551,6 +593,35 @@ Parent directories are created automatically. Existing files are
551593overwritten. Absolute paths and path-traversal sequences (`../../`) are
552594rejected.
553595
596+ # ## Memory
597+
598+ ` ` ` yaml
599+ memory: |
600+ <markdown>
601+ ` ` `
602+
603+ Top-level field. Available in both mixin and agent kits. Markdown
604+ appended to the agent's memory file at sandbox creation. The agent reads
605+ this content at startup, so write it as instructions or notes the agent
606+ should follow when working in the sandbox. Applied only when the active
607+ agent kit sets [`agent.aiFilename`](#agent-block).
608+
609+ The file is written to the parent of the workspace path inside the
610+ sandbox, not to the workspace itself. For a workspace mounted at
611+ ` /Users/you/myproject` , the memory file lands at
612+ ` /Users/you/AGENTS.md` (or whatever `aiFilename` is set to). It exists
613+ only inside the sandbox — nothing is written to the host.
614+
615+ When several loaded kits declare `memory:` blocks, the content is split
616+ across files instead of being concatenated into the main one :
617+
618+ - Each kit's memory is written to `<kit-name>.md` in a sibling
619+ ` kits-memory/` directory next to the main memory file.
620+ - The main memory file gets a `## Kits` section listing every kit with
621+ a pointer to its file. The section is delimited by
622+ ` <!-- sbx:kits-section start -->` and `<!-- sbx:kits-section end -->`
623+ markers so it can be regenerated when kits are added or removed.
624+
554625# ## Agent block
555626
556627Required for `kind : agent`.
@@ -587,24 +658,6 @@ The agent's container image must provide:
587658Build on top of `docker/sandbox-templates:shell-docker` to get these for
588659free.
589660
590- # ### Memory
591-
592- ` ` ` yaml
593- memory: |
594- <markdown>
595- ` ` `
596-
597- Top-level field. Markdown appended to the agent's memory file at sandbox
598- creation. The agent reads this content at startup, so write it as
599- instructions or notes the agent should follow when working in the
600- sandbox. Applied only when `agent.aiFilename` is set.
601-
602- The file is written to the parent of the workspace path inside the
603- sandbox, not to the workspace itself. For a workspace mounted at
604- ` /Users/you/myproject` , the memory file lands at
605- ` /Users/you/AGENTS.md` (or whatever `aiFilename` is set to). It exists
606- only inside the sandbox — nothing is written to the host.
607-
608661# # Debugging
609662
610663When a kit doesn't behave as expected, start with the network policy log
0 commit comments