---
title: "Memory"
description: "Persist context across Cody CLI sessions with the built-in memory system"
canonical: "https://docs.ainative.studio/docs/cody-cli/memory"
last-updated: "2026-10-22T17:48:46.689Z"
---

# Memory

Source: https://docs.ainative.studio/docs/cody-cli/memory

> Persist context across Cody CLI sessions with the built-in memory system

## Memory

Cody CLI has a built-in memory system that persists context, facts, and preferences across sessions.

## How It Works

Memory is stored as markdown files in `.cody/agent-memory/` (project) or `~/.cody/agent-memory/` (global). Cody reads and writes these files automatically during sessions.

## Memory Commands

```bash
/memory          # open memory panel
/memory show     # display all stored memories
/memory clear    # clear all memories
```

You can also ask Cody directly:
- *"Remember that we use Postgres, not MySQL"*
- *"Forget what you know about my API keys"*

## Memory Types

| Type | Location | Shared? |
|------|----------|---------|
| Project memory | `.cody/agent-memory/` | Yes — if committed |
| User memory | `~/.cody/agent-memory/` | No — across all projects |
| Local memory | `.cody/agent-memory-local/` | No — gitignored |

## Automatic Project Memory

Beyond the local markdown files above, Cody automatically maintains a
project-scoped memory in ZeroMemory — no setup or slash command required.

- **While you work**, Cody recalls relevant prior context from your
  project's memory and brings it into the conversation automatically,
  using semantic + graph-based search.
- **At the end of a session**, Cody extracts durable facts and
  relationships from the conversation (e.g. "the team uses Bun, not
  Node" or "the auth service depends on the billing service") and stores
  them — including as entries in a knowledge graph, so relationships
  between people, components, and decisions accumulate over time, not
  just flat notes.
- This memory is **shared across every session working in the same
  project**, including triggered runs (see
  [Code Triggers](/docs/cody-cli/code-triggers)) — so context a teammate's
  session picked up is available to yours.

To opt out, set `CODY_DISABLE_AUTO_MEMORY=1`, pass `--bare`, or disable
`autoMemoryEnabled` in your settings.

## ZeroDB Memory (Cloud, via MCP)

You can also connect ZeroDB directly as an MCP server for manual,
explicit memory operations (distinct from the automatic layer above):

```bash
cody mcp add zerodb-memory --transport http \
  --url https://api.ainative.studio/v1/mcp/zerodb-mcp/messages
```

## CODY.md

Place a `CODY.md` file at your project root to give Cody persistent instructions — coding standards, architecture notes, team conventions. Cody reads this file automatically at the start of every session.

```markdown
## My Project

## Stack
- TypeScript, Next.js, Postgres
- Tests with bun:test

## Conventions
- Use camelCase for variables
- All API calls go through src/services/api/
```
