Memory
Dawn has three memory mechanisms. Choose by who owns the data and how it should be read; route state and checkpoints preserve workflow execution, but they are not a fourth memory mechanism.
| Mechanism | Scope and shape | Best for | Owner |
|---|---|---|---|
workspace/AGENTS.md | App-wide Markdown, re-read each model turn | Stable instructions and facts shared by consuming agent routes | You or an agent with writeFile |
Route memory.md | Route-local Markdown, re-read each model turn | Versioned prompt facts for one route | Application developer |
Route memory.ts | Typed, store-backed records in declared namespaces | Facts, episodes, and reflections accumulated across sessions | Application and agent tools |
Start with prompt files for small, reviewed context. When records need a schema, governance, retention, or retrieval, the smallest useful memory.ts is:
import { defineMemory } from "@dawn-ai/sdk"
import { z } from "zod"
export default defineMemory({
kind: "semantic",
scope: ["workspace", "route"],
schema: z.object({
subject: z.string(),
predicate: z.string(),
value: z.string(),
}),
})From this typed collection, continue with Long-term Memory, Recall and Retrieval, Episodes, Distillation, or Browse and Manage Memory, depending on the task.
Workspace profile (AGENTS.md)
If workspace/AGENTS.md exists and has content, Dawn injects it under # Memory on every model turn. It is shared by every consuming agent route and subagent using the same app root; raw graph, workflow, and chain routes do not consume it.
# Workspace Memory
- Use pnpm for package commands.
- Prefer short, direct customer replies.
- Escalate billing exceptions to the finance queue.The default local app root makes this a shared host prompt source. A per-thread sandbox does not isolate that host file automatically. Use separate app roots or trust domains for tenants, constrain untrusted writes, and review seeded content. The Workspace Filesystem guide explains the file tools and backend boundary.
Updating it
See Workspace Filesystem for controlled writeFile access and backend behavior.
Route memory (memory.md)
For stable context that applies to one agent route, place memory.md beside its index.ts:
src/app/research/
index.ts
memory.md# Research Route Memory
- Every claim in a report must carry an inline citation to a source you read.
- Prefer primary sources; flag anything you could not verify.Dawn trims and injects the file under # Route Memory, after workspace/AGENTS.md, on every model turn. Presence is the opt-in: there is no import or registration call. It is a versioned prompt fragment, not a store, and the agent does not write it automatically. Empty files contribute nothing; files larger than 32 KiB are skipped and produce a prompt note.
Long-term collection (memory.ts)
Schemas and write lifecycle: Long-term Memory.
Generated tools
Generated tool contract: Long-term Memory.
How recall ranks
Ranking stages: Recall and Retrieval.
Semantic recall (opt-in)
Embedding-based recall: Recall and Retrieval.
Postgres backend (pgvector)
Shared vector storage: Recall and Retrieval.
The injected index
Prompt index behavior: Recall and Retrieval.
Episodic memory
Run-event concepts: Episodes.
Enabling the run recorder
Recorder setup: Episodes.
What gets recorded
Record shape: Episodes.
Retention
Expiry and caps: Episodes.
Time-windowed recall
Window filters: Episodes.
Governance
Write policy: Episodes.
Agent-authored episodes
Agent-written events: Episodes.
Distillation
Pass selection: Distillation.
Consolidation
Compaction details: Distillation.
Reflection
Insight derivation: Distillation.
Distilled records are found by keyword
Keyword reachability: Distillation.
Provenance
Source provenance: Distillation.
Cost
Cost controls: Distillation.
Running it on a schedule
Scheduling guidance: Distillation.
Distillation configuration
Configuration options: Distillation.
Write governance
Write modes: Long-term Memory.
ask mode
Supervision behavior: Long-term Memory.
Reviewing candidates
Candidate operations: Long-term Memory.
Configuration
Store settings: Long-term Memory.
Testing
Deterministic setup: Long-term Memory.
Verifying against a real model
Live verification: Long-term Memory.
What's deferred
Current limits: Long-term Memory.