Module 5: Your First AgentLesson 4 of 5

Build: Main Agent with Memory

Build: Main Agent with Memory

Let's wire everything together.

The Complete Workspace Structure

Your agent needs these files:

workspace/ ├── SOUL.md # Who the agent is ├── USER.md # Who you are ├── AGENTS.md # Operating instructions ├── MEMORY.md # Knowledge index ├── TOOLS.md # Tool-specific notes └── memory/ ├── WORKING.md # Current task state ├── daily/ # Daily logs ├── people/ # Info about people ├── projects/ # Project details └── knowledge/ # Lessons, playbooks

Exercise 1: Create AGENTS.md

This file contains operating instructions:

# AGENTS.md - Your Workspace ## First Run If BOOTSTRAP.md exists, follow it and delete after. ## Every Session Before doing anything else: 1. Read SOUL.md — this is who you are 2. Read USER.md — this is who you're helping 3. Read MEMORY.md — the INDEX 4. Read memory/WORKING.md — current task state 5. Read memory/daily/[today].md + [yesterday].md ## Memory Rules - **Daily log:** Append to memory/daily/YYYY-MM-DD.md with tags: - [E] = Decision - [L] = Learning - [K] = Correction - **Detail files:** Update when new info arrives - **Index:** Update MEMORY.md when significant changes happen ## Pre-Compaction Flush When you receive a compaction warning: 1. Scan session for everything important 2. Save ALL decisions, discussions, ideas 3. Update WORKING.md with current state 4. This is your LAST CHANCE before context compression ## Safety - trash > rm (recoverable beats gone) - Ask before irreversible actions - Don't exfiltrate private data

Exercise 2: Initialize Your Memory Structure

Create the folder structure:

mkdir -p memory/daily memory/people memory/projects memory/knowledge touch memory/WORKING.md

Create initial MEMORY.md (you did this in Module 4).

Create today's daily log:

## [Today's date] — Agent initialization ### Setup - [x] Created SOUL.md - [x] Created USER.md - [x] Created AGENTS.md - [x] Created memory structure ### Notes First day with [Agent Name]. Ready to work.

Exercise 3: Test the Agent

Start a conversation with your agent and:

  1. Ask: "Who are you?"

    • It should respond with its name and role from SOUL.md
  2. Ask: "Who am I?"

    • It should know from USER.md
  3. Ask: "What are we working on?"

    • It should check WORKING.md
  4. Tell it something: "Remember that I prefer dark mode"

    • It should save this somewhere appropriate
  5. End session, start new one, ask about dark mode

    • It should remember

Validation

Your agent is working when:

  • It knows its identity from SOUL.md
  • It knows about you from USER.md
  • It follows operating rules from AGENTS.md
  • It loads memory at session start
  • It saves important information
  • Information persists across sessions