Chapter XI · Skills

Self-Learning Agent

Use a three-layer memory system instead of one giant memory file.

Goal

Keep session startup cheap while preserving durable knowledge.

Architecture

workspace/
├── MEMORY.md
└── memory/
    ├── cards/
    │   ├── topic-name.md
    │   └── another-topic.md
    └── YYYY-MM-DD.md

Model

Why this works

Session workflow

  1. Read MEMORY.md.
  2. Search for task-relevant cards.
  3. Skim recent daily logs when recency matters.
  4. Work.
  5. Write back durable lessons as cards.
  6. Log the session briefly in the daily file.

Card format

---
topic: Descriptive Topic Name
category: system|human|infrastructure|tools|workflow|projects|lessons|security|models
tags: [tag1, tag2, tag3]
created: YYYY-MM-DD
updated: YYYY-MM-DD
---

Dense, factual content.
Include specific commands, decisions, paths, or gotchas when they matter.
Keep it short enough to stay easy to retrieve and update.

Card rules

  1. One topic per card.
  2. Prefer updates over duplicates.
  3. Write for future-you with zero context.
  4. Store decisions and lessons, not chatter.
  5. Keep examples concrete.

Capture triggers

Write or update a card when you learn:

Do not capture

Daily log format

## HH:MM - Brief title

What happened, what changed, what was learned.
Link any new or updated cards.

Maintenance loop

Periodically:

  1. review recent daily logs
  2. promote durable lessons into cards
  3. merge duplicate cards
  4. prune outdated index entries

Anti-pattern

Do not keep appending everything to one massive memory file. That turns recall into sludge and makes every future session more expensive.