Create middleware for loading agent memory from AGENTS.md files.
Loads memory content from configured sources and injects into the system prompt. Supports multiple sources that are combined together.
createMemoryMiddleware(
options: MemoryMiddlewareOptions
): AgentMiddleware<StateSchema<__type>, undefined, unknown, readonly ClientTool | ServerTool[]>| Name | Type | Description |
|---|---|---|
options* | MemoryMiddlewareOptions | Configuration options |
const middleware = createMemoryMiddleware({
backend: new FilesystemBackend({ rootDir: "/" }),
sources: [
"~/.deepagents/AGENTS.md",
"./.deepagents/AGENTS.md",
],
});