Initializing memory

From edmundmiller/dotfiles · View interactive version

Initializing memory is an AI agent skill from the GitHub repository edmundmiller/dotfiles. Comprehensive guide for initializing or reorganizing agent memory into a deeply hierarchical file structure. Use when running /init, when user asks to set up memory, or when memory needs a major reorganization. Trigger phrases: "initialize memory", "set up memory", "populate memory", "build my memor

How to use this skill

Skill file

Memory Initialization

Initialize persistent memory into a deeply hierarchical structure of 15-25

small, focused files in .pi/memory/.

Run /init again after major project changes or when you want to re-analyze.

Target Output

| Metric | Target |

| ------------------- | ---------------------------------------- |

| Total files | 15-25 (aim for ~20) |

| Max lines per file | ~40 (split if larger) |

| Hierarchy depth | 2-3 levels using / naming |

| Nesting requirement | Every file MUST be nested under a parent |

Anti-patterns:

Example Target Structure

system/
├── human/
│   ├── identity.md
│   ├── context.md
│   └── prefs/
│       ├── communication.md
│       ├── coding_style.md
│       └── workflow.md
├── project/
│   ├── overview.md
│   ├── architecture.md
│   ├── conventions.md
│   ├── gotchas.md
│   └── tooling/
│       ├── testing.md
│       └── linting.md
└── persona/
    ├── role.md
    └── behavior.md
reference/
├── README.md
└── history/
    └── decisions.md

What to Remember

1. Procedures (Rules & Workflows)

2. Preferences (Style & Conventions)

3. History & Context

Workflow

Step 1: Backup existing memory

Use memory_backup tool first if memory already has content.

Step 2: Ask upfront questions (bundle in one message)

  1. Research depth: Standard (~5-20 tool calls) or deep (~100+)?
  2. Identity: Which contributor are you? (check git context from /init)
  3. Related repos: Other repositories you should know about?
  4. Historical sessions: If prior agent sessions were detected, ask:

"I found prior Claude Code / Pi / Codex sessions. Should I analyze them

to learn your preferences and project context?"

  1. Communication: Terse or detailed responses?
  2. Rules: Any rules I should always follow?

Don't ask things you can find by reading files. Be autonomous during execution.

Step 3: Research the project

Standard research:

Deep research (if chosen):

Think like a new team member: What would you want to know on your first day?

Step 4: Analyze prior sessions (if approved)

If the user approved session history analysis:

Claude Code sessions (~/.claude/projects/):

Pi sessions (~/.pi/agent/sessions/):

Codex sessions (~/.codex/):

Focus on extracting:

Step 5: Create hierarchical file structure

Use memory_write for each file. Every file needs:

Write findings as you go — don't wait until the end.

Memory scope guide:

Step 6: Checkpoint

find .pi/memory/system -name '*.md' | wc -l

If count < 15, split more aggressively.

Step 7: Reflect and review

Before finishing, verify:

Ask the user: "I've completed initialization with N files. Want me to refine anything?"

Step 8: Commit and sync

memory_commit({ message: "init: populate memory with N files from project research" })

If a remote is configured, push: git -C .pi/memory push

Writing Good Memory Files

Descriptions are critical — write as if explaining to a future self with zero context:

Content should be:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.