# Memory

> An AI helper forgets each conversation. I had heard about the second brain idea, so mine keeps notes: one fact per file, one short index, and one search command.

- Site: Ideas In Reach (https://ideasinreach.com/)
- Page: https://ideasinreach.com/chapters/memory/
- Voice: "I" is Paul, the owner. "Alfred" is the AI helper. Lines marked **Alfred:** are Alfred's own words.
- Kind: Chapter 2 of 9 (started 2026-10-10)
- Before this: [Chapter 1: Why I started](https://ideasinreach.com/chapters/why-i-started/index.md)
- After this: [Chapter 3: Giving it a name](https://ideasinreach.com/chapters/a-name/index.md)

## Does this fit you?

- Who it is for: Anyone whose AI helper forgets what you told it last week.
- What you need: A helper that can read and write files, and git.
- Cost: Free. The notes are text files.
- Time: One hour to start. The upkeep runs by itself.

The first surprise: an AI helper does not remember earlier conversations. Each session starts empty. I had to tell it the same things again and again.

## What I wanted

1. To say a thing once.
2. To read what the helper "knows" about me, and to correct it.
3. The same knowledge on my desktop and on my laptop.

## What I was thinking

I had heard about the "second brain" idea on YouTube: you keep your notes in one place, and an AI keeps them in order. After the first day, this looked like a good time to try it.

I did not remember who it came from. So I asked Claude Code, my AI coding helper, to look up "the guy whose name starts with a K" and what he said about a second brain. I think I asked it almost like that. It found Andrej Karpathy and his idea: plain text notes that the AI writes, links and tidies by itself. There is no special database.

That was enough for me. I asked it to set all of that up.

## What we did

On day one, the helper kept its notes in a hidden folder of its own. We moved them into a git repository that I own. That one move made the rest possible: I can read the notes, undo a change, and share them between machines.

Two days later, on 2026-10-12, we built the rest in one day:

1. **The notes.** They got the structure in the list below.
2. **A home that is always on.** I have a second computer that runs Proxmox, a system for small virtual machines. The helper set up a place for itself there. I call it the Desk. Long jobs run there when my desktop is off. I reach it with a terminal tool named herdr: see [my everyday tools](/posts/my-everyday-tools/).
3. **A name.** That day the helper became **Alfred**. [Chapter 3](/chapters/a-name/) tells that story.
4. **One way to start.** I start the helper from Alfred's folder. It reads the rule file and the index of the notes, and then it knows where we are. Today that is one word in a terminal: `alfred`.

That is how I started to use Alfred.

How the notes work today:

1. The notes are plain text files in one folder.
2. Each file holds one fact. The top of the file says what kind of fact it is: about me, about how we work, about a project, or a pointer to something outside.
3. One short index file lists the folders and the rules that are always true. Alfred loads only the index at the start of a session.
4. Alfred opens a note only when the task needs it.
5. A rule that I give is saved with my reason. The reason lets Alfred judge a new case that the rule did not name.
6. A note that turns out to be wrong is deleted, not corrected in a second note.
7. The repository is synced between my machines.

This is one note, in the real format:

```markdown
---
name: say-the-check-first
description: Before a change, say in one line how we will know that it worked
metadata:
  type: feedback
---
Before a change, state the check in one line. Run the check after the change.

**Why:** "It should work" is not a result.
**How to apply:** If only the owner can run the check, say that it is untested,
and say what the owner must try.
```

### The check at every start

A script runs at the start of each session. It prints nothing when all is well. It looks for:

1. A note with no header, or a note that the index does not list.
2. A link to a note that does not exist.
3. Two notes with the same name.
4. An old machine name that must not be used any more.
5. A note that is too large. A note like that has become a diary.
6. An index that has grown too long.

### The weekly tidy

Once a week a job reads all the notes and proposes fixes: merge two notes, shorten a diary, move a solved item to the archive. The job works on its own copy. It never changes the live notes. I read its summary and say yes or no.

### One search command

One command searches the notes, the daily logs, the research reports, the to-do lists and the old sessions. It prints one ranked list.

> **Alfred:**
> ```text
> $ alfred-recall worker fact check
> 1. [logs · 2026-11-06]     Weekly tidy fix + worker fact check
> 2. [research · 2026-11-28] Fact check
> 3. [sessions · 2026-11-28] Fact check
> ```

It is plain full-text search with ranking. There is no special database. We tested it with 24 questions that have a known answer. The right file was in the top 3 for 20 of them. The index covers about 400 files.

## What I learned

1. **The notes are worth more than the tool.** If I change helpers one day, the notes come with me.
2. **Notes go stale.** Renamed machines and finished jobs stayed in the notes as if they were current. The check at every start fixed most of this.
3. **Notes turn into diaries.** A note that gets a new dated line every day is a log, not a fact. The size limit finds these.
4. **Knowledge hides in old sessions.** Something that we worked out in a long session was gone when the session closed. Since 2026-11-09 every session is archived as text, and the search covers it.
5. **Short costs less.** The index is read at the start of every session. So it must stay short.

## Try it

```text
Keep your own notes in a folder "memory" in this repository. One fact per
file, with a header: name, one-line description, type (user, feedback,
project or reference). Keep an index file MEMORY.md with one line per note,
and load only that file at the start. Save a rule that I give you together
with my reason. Delete a note that is wrong.
```


## Why this way (decisions)

- 2026-11-09: How does Alfred find old knowledge? Options: A vector database; Plain full-text search with ranking. Picked: Plain full-text search with ranking. Reason: For about 400 files it found the right one in the top 3 for 20 of 24 test questions. It is one file and needs no service.
- 2026-10-17: Who may rewrite the notes? Options: The weekly tidy job changes the notes directly; The tidy job proposes changes; I approve them. Picked: The tidy job proposes changes; I approve them. Reason: The notes hold rules that I gave. A tidy job must never drop a rule without my yes.
- 2026-10-10: Where do the helper's notes live? Options: In the tool's own hidden folder; In a git repository that I own. Picked: In a git repository that I own. Reason: The notes are worth more than the tool. In a repository I can read them, undo a change, and share them between machines.


## What we passed on

- 2026-11-09: A search before every prompt Run the recall search automatically before each message, and add the results to the conversation. Why it looked good: Alfred would never miss a note. Why I passed: It adds text to every turn, and most turns do not need it. Alfred searches when the task needs it. What would change my mind: Proof that Alfred misses notes that a search would find. Idea from: a second-brain video by Nick Saraev.
- 2026-11-09: Email, chat and phone feeds into the notes Feed private messages into the helper's notes, so it knows more about my day. Why it looked good: The helper would have more context. Why I passed: Private messages do not belong in a helper's notes. The gain was small. The risk was not. What would change my mind: Nothing planned. Idea from: a second-brain video by Nick Saraev.
- 2026-11-09: A vector database for recall Store all notes in a database that finds text by meaning. Why it looked good: It can find a note even when the words do not match. Why I passed: We have about 400 files. Plain full-text search with ranking put the right file in the top 3 for 20 of 24 test questions. It needs no extra service. What would change my mind: The test score drops as the notes grow.
- 2026-10-17: Other AI tools write to the notes Let every AI tool that I use write to the shared notes. Why it looked good: One brain for all tools. Why I passed: Two writers with different habits make a mess. Other tools may read the notes. Only Alfred's sessions write. A sandbox enforces this. What would change my mind: A tool that follows the same note rules and passes the same check.


## Who I learned from

- Andrej Karpathy (https://karpathy.bearblog.dev/): Essays and talks on how to work with AI. What I took: His notes wiki has a 'lint' pass that looks for stale and broken notes. Our memory check uses the same idea. What I passed on: We read his 'Claws' and Agenthub ideas and did not adopt them.
- Nick Saraev (https://www.youtube.com/@nicksaraev): Practical videos about AI agents. What I took: A second-brain video (2026-11-09) led to our recall search and our session archive. What I passed on: From the same video: private message feeds into the notes, a search before every prompt, and a summary of every session.
- Hamel Husain (https://hamel.dev/): Writing about evals: how to measure if an AI setup got better. What I took: Measure before you believe. We test on real examples: 24 recall questions, and 56 real first messages for the session picker.

