# Let the model write its own notes: the note-tool pattern

> The model that was in the conversation writes better facts than a summariser. How the note tool works, what a good fact is, and how to handle note calls.

Every memory system has to turn conversation into something smaller that lasts. Most do it after the fact: a separate model reads old messages and extracts or summarises them. That model was not there. It does not know which of three similar numbers was the one the user settled on, or that "the doc" means the pricing page.

The model running your agent was there. So Threadless AI asks it.

## How it works

1. You add the **note tool** to your tools once: `memory.chat.noteTool` or `memory.responses.noteTool`.
2. When older messages are about to stop being sent word for word, the request you get from `decorate` ends with a **note ask**: this response must begin or end with one call to the note tool holding the key facts of those messages.
3. The model answers the user as usual, and calls the tool once with the facts.
4. Your loop answers the call with `noted`. Nothing runs: the call's arguments are the note, and they reach us in the reply you report.
5. Once the facts are in, those messages stop being sent word for word and their facts are sent in their place, in the facts block.

```ts
import { isNoteCall, NOTE_RESULT } from '@threadlessai/sdk';

for (const call of message.tool_calls ?? []) {
  const output = isNoteCall(call.function.name) ? NOTE_RESULT : await runTool(call);
  newMessages.push({ role: 'tool', tool_call_id: call.id, content: output });
}
```

## What a good fact looks like

The note ask tells the model what we want: each fact as one sentence that reads on its own, naming what it is about the way the conversation already names it; identifiers and numbers verbatim; and milestones marked.

| Weak | Strong |
|---|---|
| They decided on the date. | Acme's product launch is set for March 14, 2027. |
| User prefers the shorter one. | The user chose headline option two ("Memory, solved") for the pricing page. |
| Legal is reviewing it. | Milestone (blocked): pricing page copy v3 awaits legal review of its refund line. |

A **milestone** is a fact about where the work stands: agreed, decided, done, blocked or next. Milestones keep a long-running agent oriented after the messages that set them are no longer sent word for word.

## What happens to the facts

The facts are kept in the memory they were written in, and nowhere else. From then on they are sent on every call, in the facts block, in place of the older messages they came from. Newer facts replace older ones: "moved to Denver" replaces "lives in Austin". When the conversation turns back to something older, the older messages and facts about it come back, with their dates.

## Questions people ask

### Does the user see the note?

Only if your interface shows tool calls. It is a tool call in the model's response, like any other.

### What if the model does not call the note tool?

Those messages keep being sent word for word, and the next call asks again. Older messages stop being sent word for word only once their facts are noted.

### What if my request has no tools at all?

A call that asks for notes carries the note tool whether or not your request had it, so the model can always answer. Handle `memory_note` calls in your loop either way.

### Does the note tool run any code?

No. The call itself is the note: its arguments reach us in the reply you report. Your handler answers every note call with `noted` and does nothing else.

### Why not let a separate model summarise the conversation?

A summariser reads the turns afterwards and was not there; your agent's model was. It knows which of several numbers the user settled on and what "the doc" refers to, so it writes facts that read on their own.

### Which models work with the note tool?

Any model that supports function calling. [Models and formats](https://threadlessai.com/docs/models-and-formats#models) has the details.

## Related

- [The three calls](https://threadlessai.com/docs/calls#the-note-tool)
- [Why agents should forget](https://threadlessai.com/guides/why-agents-should-forget)
- [Infinite context for OpenAI agents](https://threadlessai.com/guides/infinite-context)
