Skip to content

Storage

Storage is injected into the agent runtime.

ts
import { memoryStorage, type Storage, type Message } from "duclaw-cli/sdk";

Storage<T>

Use the storage contract to provide message history or runtime state.

ts
const storage = memoryStorage<Message[]>();

memoryStorage() creates an in-process Map<string, T>. Data lives only for the lifetime of that JavaScript process and is lost when the process restarts.

Runtime Storage

memoryStorage() is the generic SDK default for examples, tests, and short-lived local agents. Product runtimes should inject their own Storage<T> implementation when they need persistence, sharing across processes, or production durability.

ts
const agent = createAgent({
  system,
  model,
  storage: memoryStorage<Message[]>(),
  tools,
});

Duclaw product storage remains part of the Duclaw preset path.

Released as part of the duclaw-cli package.