Skip to content

Commit c6fb967

Browse files
authored
Merge pull request #25094 from dvdksn/sbx/kit-memory-docs
Document memory blocks in mixin kits
2 parents 5767b99 + e256af0 commit c6fb967

1 file changed

Lines changed: 64 additions & 18 deletions

File tree

  • content/manuals/ai/sandboxes/customize

content/manuals/ai/sandboxes/customize/kits.md

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ A kit packages a set of capabilities a sandbox can use, such as:
2121
- Network rules to allow or deny domains
2222
- Files to drop in
2323
- Startup commands to run
24+
- Memory instructions to give the agent
2425

2526
You declare these in a single `spec.yaml` file, point the CLI at the
2627
directory (or a ZIP, OCI artifact, or Git URL), and the sandbox applies
@@ -175,6 +176,40 @@ See [Credentials](../security/credentials.md) for how to provide the
175176
credential value on your host, other approaches for cases the example
176177
above doesn't fit, and what the proxy does at request time.
177178

179+
### Inject agent memory
180+
181+
A kit can append content to the agent's memory file, such as `CLAUDE.md`
182+
or `AGENTS.md`. The agent reads this file at startup. Use it to give
183+
the agent project conventions, usage tips for a tool the kit installs,
184+
or other guidance that should be in scope when the sandbox runs.
185+
186+
```yaml
187+
memory: |
188+
Ruff is installed. Run `ruff check` before committing.
189+
Shared config lives at `/workspace/ruff.toml`.
190+
```
191+
192+
Both mixin and agent kits can declare `memory:`. The content is written
193+
only when the active agent kit sets [`agent.aiFilename`](#agent-block),
194+
which determines the memory file's name.
195+
196+
When more than one loaded kit declares a `memory:` block, each kit's
197+
content is written to its own `<kit-name>.md` file under a sibling
198+
`kits-memory/` directory. The main memory file gets a `## Kits` section
199+
that points to each kit file:
200+
201+
```text
202+
/Users/you/
203+
├── myproject/ # workspace
204+
├── AGENTS.md # main memory file with a "## Kits" index
205+
└── kits-memory/
206+
├── ruff-lint.md
207+
├── vale.md
208+
└── git-ssh-sign.md
209+
```
210+
211+
See [`memory`](#memory) in the spec reference for the full field schema.
212+
178213
### Define an agent
179214

180215
Agent kits declare an `agent:` block with the image the agent runs in and
@@ -569,6 +604,35 @@ Parent directories are created automatically. Existing files are
569604
overwritten. Absolute paths and path-traversal sequences (`../../`) are
570605
rejected.
571606

607+
### Memory
608+
609+
```yaml
610+
memory: |
611+
<markdown>
612+
```
613+
614+
Top-level field. Available in both mixin and agent kits. Markdown
615+
appended to the agent's memory file at sandbox creation. The agent reads
616+
this content at startup. Write it as instructions or notes the agent
617+
should follow when working in the sandbox. Applied only when the active
618+
agent kit sets [`agent.aiFilename`](#agent-block).
619+
620+
The file is written to the parent of the workspace path inside the
621+
sandbox, not to the workspace itself. For a workspace mounted at
622+
`/Users/you/myproject`, the memory file lands at
623+
`/Users/you/AGENTS.md` (or whatever `aiFilename` is set to). It exists
624+
only inside the sandbox. Nothing is written to the host.
625+
626+
When several loaded kits declare `memory:` blocks, the content is split
627+
across files instead of being concatenated into the main one:
628+
629+
- Each kit's memory is written to `<kit-name>.md` in a sibling
630+
`kits-memory/` directory next to the main memory file.
631+
- The main memory file gets a `## Kits` section listing every kit with
632+
a pointer to its file. The section is delimited by
633+
`<!-- sbx:kits-section start -->` and `<!-- sbx:kits-section end -->`
634+
markers so it can be regenerated when kits are added or removed.
635+
572636
### Agent block
573637

574638
Required for `kind: agent`.
@@ -605,24 +669,6 @@ The agent's container image must provide:
605669
Build on top of `docker/sandbox-templates:shell-docker` to get these for
606670
free.
607671

608-
#### Memory
609-
610-
```yaml
611-
memory: |
612-
<markdown>
613-
```
614-
615-
Top-level field. Markdown appended to the agent's memory file at sandbox
616-
creation. The agent reads this content at startup, so write it as
617-
instructions or notes the agent should follow when working in the
618-
sandbox. Applied only when `agent.aiFilename` is set.
619-
620-
The file is written to the parent of the workspace path inside the
621-
sandbox, not to the workspace itself. For a workspace mounted at
622-
`/Users/you/myproject`, the memory file lands at
623-
`/Users/you/AGENTS.md` (or whatever `aiFilename` is set to). It exists
624-
only inside the sandbox — nothing is written to the host.
625-
626672
## Debugging
627673

628674
When a kit doesn't behave as expected, start with the network policy log

0 commit comments

Comments
 (0)