Tin

Examples · anthropic · 48 of 339

memory

Claude's memory tool (memory_20250818): the model asks for file operations under /memories and this program runs them, in one JSON file next to it.

examples/anthropic/memory.tintin run examples/anthropic/memory.tin
// Claude's memory tool (memory_20250818): the model asks for file operations under /memories and this
// program runs them, in one JSON file next to it. Paths can never leave /memories.
import "std/anthropic"

/// Claude's memory, kept in memory.json.
tool fn remember(input: string): Result<string, string> => anthropic.memoryAt("memory.json", input)

agent Assistant {
  model: "claude-haiku-4-5"
  tools: [remember]
  clientTools: { memory: remember }
}

fn main() {
  print(Assistant("I prefer tea to coffee. Remember that."))
  print(Assistant.fresh()("What do I like to drink?"))
}