6.7 KiB
| name | description |
|---|---|
| memory-init | Initial setup and bootstrap for pi-memory-md repository |
Memory Init
Use this skill to set up pi-memory-md for the first time or reinitialize an existing installation.
Prerequisites
- GitHub repository - Create a new empty repository on GitHub
- Git access - Configure SSH keys or personal access token
- Node.js & npm - For installing the package
Step 1: Install Package
pi install npm:pi-memory-md
Step 2: Create GitHub Repository
Create a new repository on GitHub:
- Name it something like
memory-mdorpi-memory - Make it private (recommended)
- Don't initialize with README (we'll do that)
Clone URL will be: git@github.com:username/repo-name.git
Step 3: Configure Settings
Add to your settings file (global: ~/.pi/agent/settings.json, project: .pi/settings.json):
{
"pi-memory-md": {
"enabled": true,
"repoUrl": "git@github.com:username/repo-name.git",
"localPath": "~/.pi/memory-md",
"autoSync": {
"onSessionStart": true
}
}
}
Settings explained:
| Setting | Purpose | Default |
|---|---|---|
enabled |
Enable/disable extension | true |
repoUrl |
GitHub repository URL | Required |
localPath |
Local clone location (supports ~) |
~/.pi/memory-md |
autoSync.onSessionStart |
Auto-pull on session start | true |
Step 4: Initialize Repository
Start pi and run:
memory_init()
This does:
- Clones the GitHub repository
- Creates directory structure:
core/user/- Your identity and preferencescore/project/- Project-specific info
- Creates default files:
core/user/identity.md- User identity templatecore/user/prefer.md- User preferences template
Example output:
Memory repository initialized:
Cloned repository successfully
Created directory structure:
- core/user
- core/project
- reference
Step 5: Import Preferences from AGENTS.md
After initialization, extract relevant preferences from your AGENTS.md file to populate prefer.md:
-
Read AGENTS.md (typically at
.pi/agent/AGENTS.mdor project root) -
Extract relevant sections such as:
- IMPORTANT Rules
- Code Quality Principles
- Coding Style Preferences
- Architecture Principles
- Development Workflow
- Technical Preferences
-
Present extracted content to the user in a summarized format
-
Ask first confirmation: Include these extracted preferences in
prefer.md?Found these preferences in AGENTS.md: - IMPORTANT Rules: [summary] - Code Quality Principles: [summary] - Coding Style: [summary] Include these in core/user/prefer.md? (yes/no) -
Ask for additional content: Is there anything else you want to add to your preferences?
Any additional preferences you'd like to include? (e.g., communication style, specific tools, workflows) -
Update prefer.md with:
- Extracted content from AGENTS.md (if user confirmed)
- Any additional preferences provided by user
Step 6: Verify Setup
Check status with command:
/memory-status
Should show: Memory: project-name | Repo: Clean | Path: {localPath}/project-name
List files:
memory_list()
Should show: core/user/identity.md, core/user/prefer.md
Project Structure
Base path: Configured via settings["pi-memory-md"].localPath (default: ~/.pi/memory-md)
Each project gets its own folder in the repository:
{localPath}/
├── project-a/
│ ├── core/
│ │ ├── user/
│ │ │ ├── identity.md
│ │ │ └── prefer.md
│ │ └── project/
│ └── reference/
├── project-b/
│ └── ...
└── project-c/
└── ...
Project name is derived from:
- Git repository name (if in a git repo)
- Or current directory name
First-Time Setup Script
Automate setup with this script:
#!/bin/bash
# setup-memory-md.sh
REPO_URL="git@github.com:username/memory-repo.git"
SETTINGS_FILE="$HOME/.pi/agent/settings.json"
# Backup existing settings
cp "$SETTINGS_FILE" "$SETTINGS_FILE.bak"
# Add pi-memory-md configuration
node -e "
const fs = require('fs');
const path = require('path');
const settingsPath = '$SETTINGS_FILE';
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
settings['pi-memory-md'] = {
enabled: true,
repoUrl: '$REPO_URL',
localPath: path.join(require('os').homedir(), '.pi', 'memory-md'),
autoSync: {
onSessionStart: true,
onMessageCreate: false
}
};
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
"
echo "Settings configured. Now run: memory_init()"
Reinitializing
To reset everything:
memory_init(force=true)
Warning: This will re-clone the repository, potentially losing local uncommitted changes.
Troubleshooting
Clone Failed
Error: Clone failed: Permission denied
Solution:
- Verify SSH keys are configured:
ssh -T git@github.com - Check repo URL is correct in settings
- Ensure repo exists on GitHub
Settings Not Found
Error: GitHub repo URL not configured in settings["pi-memory-md"].repoUrl
Solution:
- Edit settings file (global or project)
- Add
pi-memory-mdsection (see Step 3) - Run
/reloadin pi
Directory Already Exists
Error: Directory exists but is not a git repo
Solution:
- Remove existing directory:
rm -rf {localPath}(use your configured path) - Run
memory_init()again
No Write Permission
Error: EACCES: permission denied
Solution:
- Check directory permissions:
ls -la {localPath}/..(use your configured path) - Fix ownership:
sudo chown -R $USER:$USER {localPath}(use your configured path)
Verification Checklist
After setup, verify:
- Package installed:
pi install npm:pi-memory-md - Settings configured in settings file
- GitHub repository exists and is accessible
- Repository cloned to configured
localPath - Directory structure created
/memory-statusshows correct infomemory_list()returns filesprefer.mdpopulated (either from AGENTS.md or default template)
Next Steps
After initialization:
- Import preferences - Agent will prompt to extract from AGENTS.md
- Edit your identity:
memory_read(path="core/user/identity.md")thenmemory_write(...)to update - Review preferences:
memory_read(path="core/user/prefer.md") - Add project context:
memory_write(path="core/project/overview.md", ...) - Learn more: See
memory-managementskill
Related Skills
memory-management- Creating and managing memory filesmemory-sync- Git synchronizationmemory-search- Finding information