# Notes, lessons and claims

> How agents share what they learn through DMN: notes in each project's .dmn folder, your rules, the briefing a session starts with, lessons from fixed errors, past sessions, and file claims.

Source: https://getdmn.com/docs/notes/

## Notes

A note is a short markdown file in the project's `.dmn/memories` folder. Agents write them as they learn something worth keeping: why a test is flaky, which file owns a setting, a decision you made. Every agent on the project can read them, whichever vendor it comes from.

```markdown
---
name: stripe-webhook-raw-body
description: The Stripe webhook must read the raw body before any JSON parsing
---

Stripe signs the raw request body. The handler in app/api/stripe/route.ts reads
request.text() first; parsing JSON before verifying breaks the signature check.
```

Agents use `dmn memory` or the `memory` tool. You can read and edit the files like any others, or in the Memory view beside the Fleet panel.

| Command | What it does |
|---|---|
| `dmn memory list` | The project's notes |
| `dmn memory read <path>` | One note |
| `dmn memory write <path> --content "<text>"` | Write a note, replacing any note at that path |
| `dmn memory delete <path>` | Delete one |

Notes sit alongside `CLAUDE.md`, `AGENTS.md` and Claude Code's auto memory rather than replacing them. [Claude Code's memory between sessions](/guides/claude-code-memory-between-sessions/) compares them.

## Your rules

A rule is a note you mark with `kind: rule` in its front matter. Rules come first in every briefing, before any agent's notes, so use them for what every agent must know: how you want tests run, what never to touch.

```markdown
---
name: no-force-push
description: Never force-push; open a new branch instead
kind: rule
---
```

## The briefing

*Diagram: What a new session is told, in order. All of it comes from your machine.*

A session starts with a briefing built from the project's files. Claude Code gets it from the hook `dmn hook-init` installs, at the start of each session and again after it compacts its context. Codex gets it from its own hook, and agents connected over MCP get it with DMN's server instructions. A note whose code has been deleted, or changed in a commit since the note was written, is flagged, so an old note isn't taken for a current one.

## Lessons

When agents in two or more sessions hit the same error and fix it the same way, DMN turns that into a lesson: the error, and a one-line fix. Lessons come from your Claude Code and Codex session logs, read on your machine with recognised secrets removed.

- The briefing lists them, so a new session knows them from the start.
- In Claude Code, when a command fails and matches a lesson, the hook hands the agent the fix straight away.
- `dmn gotchas list` shows them, and `dmn gotchas forget <id>` stops one for good. The command line calls lessons gotchas.

## Past sessions

`dmn memory search "<question>"` searches dated records of earlier sessions: what each was asked, what it ran and what it concluded. Use it when you remember that something was done, but not where.

## Claims

Before an agent edits, it can claim the files or folders it's about to change, with a reason and an expiry (30 minutes unless it asks for longer, up to eight hours). Other agents check claims before they edit, and see who holds a file and why.

Claims are advisory. They never block a write: they're there so parallel agents can see each other, not to lock anything. Agents use the `lease` tool for them; you don't manage anything.
