move pi-mono into companion-cloud as apps/companion-os

- Copy all pi-mono source into apps/companion-os/
- Update Dockerfile to COPY pre-built binary instead of downloading from GitHub Releases
- Update deploy-staging.yml to build pi from source (bun compile) before Docker build
- Add apps/companion-os/** to path triggers
- No more cross-repo dispatch needed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Harivansh Rathi 2026-03-07 09:22:50 -08:00
commit 0250f72976
579 changed files with 206942 additions and 0 deletions

View file

@ -0,0 +1,281 @@
---
name: memory-init
description: 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
1. **GitHub repository** - Create a new empty repository on GitHub
2. **Git access** - Configure SSH keys or personal access token
3. **Node.js & npm** - For installing the package
## Step 1: Install Package
```bash
pi install npm:pi-memory-md
```
## Step 2: Create GitHub Repository
Create a new repository on GitHub:
- Name it something like `memory-md` or `pi-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`):
```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:**
1. Clones the GitHub repository
2. Creates directory structure:
- `core/user/` - Your identity and preferences
- `core/project/` - Project-specific info
3. Creates default files:
- `core/user/identity.md` - User identity template
- `core/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`:
1. **Read AGENTS.md** (typically at `.pi/agent/AGENTS.md` or project root)
2. **Extract relevant sections** such as:
- IMPORTANT Rules
- Code Quality Principles
- Coding Style Preferences
- Architecture Principles
- Development Workflow
- Technical Preferences
3. **Present extracted content** to the user in a summarized format
4. **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)
```
5. **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)
```
6. **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:
```bash
#!/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:**
1. Verify SSH keys are configured: `ssh -T git@github.com`
2. Check repo URL is correct in settings
3. Ensure repo exists on GitHub
### Settings Not Found
**Error:** `GitHub repo URL not configured in settings["pi-memory-md"].repoUrl`
**Solution:**
1. Edit settings file (global or project)
2. Add `pi-memory-md` section (see Step 3)
3. Run `/reload` in pi
### Directory Already Exists
**Error:** `Directory exists but is not a git repo`
**Solution:**
1. Remove existing directory: `rm -rf {localPath}` (use your configured path)
2. Run `memory_init()` again
### No Write Permission
**Error:** `EACCES: permission denied`
**Solution:**
1. Check directory permissions: `ls -la {localPath}/..` (use your configured path)
2. 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-status` shows correct info
- [ ] `memory_list()` returns files
- [ ] `prefer.md` populated (either from AGENTS.md or default template)
## Next Steps
After initialization:
1. **Import preferences** - Agent will prompt to extract from AGENTS.md
2. Edit your identity: `memory_read(path="core/user/identity.md")` then `memory_write(...)` to update
3. Review preferences: `memory_read(path="core/user/prefer.md")`
4. Add project context: `memory_write(path="core/project/overview.md", ...)`
5. Learn more: See `memory-management` skill
## Related Skills
- `memory-management` - Creating and managing memory files
- `memory-sync` - Git synchronization
- `memory-search` - Finding information

View file

@ -0,0 +1,308 @@
---
name: memory-management
description: Core memory operations for pi-memory-md - create, read, update, and delete memory files
---
# Memory Management
Use this skill when working with pi-memory-md memory files. Memory is stored as markdown files with YAML frontmatter in a git repository.
## Design Philosophy
Inspired by Letta memory filesystem:
- **File-based memory**: Each memory is a `.md` file with YAML frontmatter
- **Git-backed**: Full version control and cross-device sync
- **Auto-injection**: Files in `core/` are automatically injected to context
- **Organized by purpose**: Fixed structure for core info, flexible for everything else
## Directory Structure
**Base path**: Configured via `settings["pi-memory-md"].localPath` (default: `~/.pi/memory-md`)
```
{localPath}/
└── {project-name}/ # Project memory root
├── core/ # Auto-injected to context every session
│ ├── user/ # 【FIXED】User information
│ │ ├── identity.md # Who the user is
│ │ └── prefer.md # User habits and code style preferences
│ │
│ └── project/ # 【FIXED】Project information (pre-created)
│ ├── overview.md # Project overview
│ ├── architecture.md # Architecture and design
│ ├── conventions.md # Code conventions
│ └── commands.md # Common commands
├── docs/ # 【AGENT-CREATED】Reference documentation
├── archive/ # 【AGENT-CREATED】Historical information
├── research/ # 【AGENT-CREATED】Research findings
└── notes/ # 【AGENT-CREATED】Standalone notes
```
**Important:** `core/project/` is a pre-defined folder under `core/`. Do NOT create another `project/` folder at the project root level.
## Core Design: Fixed vs Flexible
### 【FIXED】core/user/ and core/project/
These are **pre-defined** and **auto-injected** into every session:
**core/user/** - User information (2 fixed files)
- `identity.md` - Who the user is (name, role, background)
- `prefer.md` - User habits and code style preferences
**core/project/** - Project information
- `overview.md` - Project overview
- `architecture.md` - Architecture and design
- `conventions.md` - Code conventions
- `commands.md` - Common commands
- `changelog.md` - Development history
**Why fixed?**
- Always in context, no need to remember to load
- Core identity that defines every interaction
- Project context needed for all decisions
**Rule:** ONLY `user/` and `project/` exist under `core/`. No other folders.
## Decision Tree
### Does this need to be in EVERY conversation?
**Yes** → Place under `core/`
- User-related → `core/user/`
- Project-related → `core/project/`
**No** → Place at project root level (same level as `core/`)
- Reference docs → `docs/`
- Historical → `archive/`
- Research → `research/`
- Notes → `notes/`
- Other? → Create appropriate folder
**Important:** `core/project/` is a FIXED subdirectory under `core/`. Always use `core/project/` for project-specific memory files, NEVER create a `project/` folder at the root level.
## YAML Frontmatter Schema
Every memory file MUST have YAML frontmatter:
```yaml
---
description: "Human-readable description of this memory file"
tags: ["user", "identity"]
created: "2026-02-14"
updated: "2026-02-14"
---
```
**Required fields:**
- `description` (string) - Human-readable description
**Optional fields:**
- `tags` (array of strings) - For searching and categorization
- `created` (date) - File creation date (auto-added on create)
- `updated` (date) - Last modification date (auto-updated on update)
## Examples
### Example 1: User Identity (core/user/identity.md)
```bash
memory_write(
path="core/user/identity.md",
description="User identity and background",
tags=["user", "identity"],
content="# User Identity\n\nName: Vandee\nRole: Developer..."
)
```
### Example 2: User Preferences (core/user/prefer.md)
```bash
memory_write(
path="core/user/prefer.md",
description="User habits and code style preferences",
tags=["user", "preferences"],
content="# User Preferences\n\n## Communication Style\n- Be concise\n- Show code examples\n\n## Code Style\n- 2 space indentation\n- Prefer const over var\n- Functional programming"
)
```
### Example 3: Project Architecture (core/project/)
```bash
memory_write(
path="core/project/architecture.md",
description="Project architecture and design",
tags=["project", "architecture"],
content="# Architecture\n\n..."
)
```
### Example 3: Reference Docs (root level)
```bash
memory_write(
path="docs/api/rest-endpoints.md",
description="REST API reference documentation",
tags=["docs", "api"],
content="# REST Endpoints\n\n..."
)
```
### Example 4: Archived Decision (root level)
```bash
memory_write(
path="archive/decisions/2024-01-15-auth-redesign.md",
description="Auth redesign decision from January 2024",
tags=["archive", "decision"],
content="# Auth Redesign\n\n..."
)
```
## Reading Memory Files
Use the `memory_read` tool:
```bash
memory_read(path="core/user/identity.md")
```
## Listing Memory Files
Use the `memory_list` tool:
```bash
# List all files
memory_list()
# List files in specific directory
memory_list(directory="core/project")
# List only core/ files
memory_list(directory="system")
```
## Updating Memory Files
To update a file, use `memory_write` with the same path:
```bash
memory_write(
path="core/user/identity.md",
description="Updated user identity",
content="New content..."
)
```
The extension preserves existing `created` date and updates `updated` automatically.
## Folder Creation Guidelines
### core/ directory - FIXED structure
**Only two folders exist under `core/`:**
- `user/` - User identity and preferences
- `project/` - Project-specific information
**Do NOT create any other folders under `core/`.**
### Root level (same level as core/) - COMPLETE freedom
**Agent can create any folder structure at project root level (same level as `core/`):**
- `docs/` - Reference documentation
- `archive/` - Historical information
- `research/` - Research findings
- `notes/` - Standalone notes
- `examples/` - Code examples
- `guides/` - How-to guides
**Rule:** Organize root level in a way that makes sense for the project.
**WARNING:** Do NOT create a `project/` folder at root level. Use `core/project/` instead.
## Best Practices
### DO:
- Use `core/user/identity.md` for user identity
- Use `core/user/prefer.md` for user habits and code style
- Use `core/project/` for project-specific information
- Use root level for reference, historical, and research content
- Keep files focused on a single topic
- Organize root level folders by content type
### DON'T:
- Create folders under `core/` other than `user/` and `project/`
- Create other files under `core/user/` (only `identity.md` and `prefer.md`)
- Create a `project/` folder at root level (use `core/project/` instead)
- Put reference docs in `core/` (use root `docs/`)
- Create giant files (split into focused topics)
- Mix unrelated content in same file
## Maintenance
### Session Wrap-up
After completing work, archive to root level:
```bash
memory_write(
path="archive/sessions/2025-02-14-bug-fix.md",
description="Session summary: fixed database connection bug",
tags=["archive", "session"],
content="..."
)
```
### Regular Cleanup
- Consolidate duplicate information
- Update descriptions to stay accurate
- Remove information that's no longer relevant
- Archive old content to appropriate root level folders
## When to Use This Skill
Use `memory-management` when:
- User asks to remember something for future sessions
- Creating or updating project documentation
- Setting preferences or guidelines
- Storing reference material
- Building knowledge base about the project
- Organizing information by type or domain
- Creating reusable patterns and solutions
- Documenting troubleshooting steps
## Related Skills
- `memory-sync` - Git synchronization operations
- `memory-init` - Initial repository setup
- `memory-search` - Finding specific information
- `memory-check` - Validate folder structure before syncing
## Before Syncing
**IMPORTANT**: Before running `memory_sync(action="push")`, ALWAYS run `memory_check()` first to verify the folder structure is correct:
```bash
# Check structure first
memory_check()
# Then push if structure is correct
memory_sync(action="push")
```
This prevents accidentally pushing files in wrong locations (e.g., root `project/` instead of `core/project/`).

View file

@ -0,0 +1,69 @@
---
name: memory-search
description: Search and retrieve information from pi-memory-md memory files
---
# Memory Search
Use this skill to find information stored in pi-memory-md memory files.
## Search Types
### Search by Content
Search within markdown content:
```
memory_search(query="typescript", searchIn="content")
```
Returns matching files with content excerpts.
### Search by Tags
Find files with specific tags:
```
memory_search(query="user", searchIn="tags")
```
Best for finding files by category or topic.
### Search by Description
Find files by their frontmatter description:
```
memory_search(query="identity", searchIn="description")
```
Best for discovering files by purpose.
## Common Search Patterns
| Goal | Command |
| ---------------- | ------------------------------------------------------------- |
| User preferences | `memory_search(query="user", searchIn="tags")` |
| Project info | `memory_search(query="architecture", searchIn="description")` |
| Code style | `memory_search(query="typescript", searchIn="content")` |
| Reference docs | `memory_search(query="reference", searchIn="tags")` |
## Search Tips
- **Case insensitive**: `typescript` and `TYPESCRIPT` work the same
- **Partial matches**: `auth` matches "auth", "authentication", "author"
- **Be specific**: "JWT token validation" > "token"
- **Try different types**: If content search fails, try tags or description
## When Results Are Empty
1. Check query spelling
2. Try different `searchIn` type
3. List all files: `memory_list()`
4. Sync repository: `memory_sync(action="pull")`
## Related Skills
- `memory-management` - Read and write files
- `memory-sync` - Ensure latest data
- `memory-init` - Setup repository

View file

@ -0,0 +1,74 @@
---
name: memory-sync
description: Git synchronization operations for pi-memory-md repository
---
# Memory Sync
Git synchronization for pi-memory-md repository.
## Configuration
Configure `pi-memory-md.repoUrl` in settings file (global: `~/.pi/agent/settings.json`, project: `.pi/settings.json`)
## Sync Operations
### Pull
Fetch latest changes from GitHub:
```
memory_sync(action="pull")
```
Use before starting work or switching machines.
### Push
Upload local changes to GitHub:
```
memory_sync(action="push")
```
Auto-commits changes before pushing.
**Before pushing, ALWAYS run memory_check first:**
```
memory_check()
```
This verifies that the folder structure is correct (e.g., files are in `core/project/` not in a root `project/` folder).
### Status
Check uncommitted changes:
```
memory_sync(action="status")
```
Shows modified/added/deleted files.
## Typical Workflow
| Action | Command |
| -------------- | ------------------------------ |
| Get updates | `memory_sync(action="pull")` |
| Check changes | `memory_sync(action="status")` |
| Upload changes | `memory_sync(action="push")` |
## Troubleshooting
| Error | Solution |
| ----------------- | --------------------------------------- |
| Non-fast-forward | Pull first, then push |
| Conflicts | Manual resolution via bash git commands |
| Not a git repo | Run `memory_init(force=true)` |
| Permission denied | Check SSH keys or repo URL |
## Related Skills
- `memory-management` - Read and write files
- `memory-init` - Setup repository