--- title: Memory description: CowAgent long-term memory system --- The memory system enables the Agent to remember important information over time, continuously accumulating experience, understanding user preferences, and truly achieving autonomous thinking and continuous growth. ## How It Works The Agent proactively stores memory in the following scenarios: - **When user shares important information** — Automatically identifies and stores preferences, decisions, facts, and other key information - **When conversation reaches a certain length** — Automatically extracts summaries to prevent information loss - **When retrieval is needed** — Intelligently searches historical memory, combining context for responses ## Memory Types ### Core Memory Stored in `~/cow/memory/core.md`, containing long-term user preferences, important decisions, key facts, and other information that doesn't fade over time. ### Daily Memory Stored in `~/cow/memory/daily/` directory, organized by date, recording daily conversation summaries and key events. ## First Launch On first launch, the Agent will proactively ask the user for key information and save it to the workspace (default `~/cow`): | File | Description | | --- | --- | | `system.md` | Agent system prompt and behavior settings | | `user.md` | User identity information and preferences | | `memory/core.md` | Core memory | | `memory/daily/` | Daily memory directory | ## Memory Retrieval The memory system supports hybrid retrieval modes: - **Keyword retrieval** — Match historical memory based on keywords - **Vector retrieval** — Semantic similarity search, finds relevant memory even with different wording The Agent automatically triggers memory retrieval during conversation as needed, incorporating relevant historical information into context. ## Configuration ```json { "agent_workspace": "~/cow", "agent_max_context_tokens": 40000, "agent_max_context_turns": 30 } ``` | Parameter | Description | Default | | --- | --- | --- | | `agent_workspace` | Workspace path, memory files stored under this directory | `~/cow` | | `agent_max_context_tokens` | Max context tokens, affects short-term memory capacity | `40000` | | `agent_max_context_turns` | Max context turns, oldest conversations discarded when exceeded | `30` |