@artale/pi-pai 4.4.1 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +41 -0
- package/AGENTS.md +32 -0
- package/INSTALL.md +224 -0
- package/README.md +192 -138
- package/SYSTEM.md +120 -0
- package/SYSTEM.md.pai +120 -120
- package/VERSION +1 -0
- package/dist/extension.d.ts +32 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +1118 -0
- package/dist/extension.js.map +1 -0
- package/dist/lifeos-pai-core.d.ts +15 -0
- package/dist/lifeos-pai-core.d.ts.map +1 -0
- package/dist/lifeos-pai-core.js +290 -0
- package/dist/lifeos-pai-core.js.map +1 -0
- package/memory/learning/.gitkeep +0 -0
- package/memory/state/.gitkeep +0 -0
- package/memory/work/.gitkeep +0 -0
- package/models.json +43 -0
- package/package.json +21 -9
- package/settings.json +14 -0
- package/src/lifeos-pai-core.ts +608 -0
package/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Pi Package CI — shared GitLab CI template
|
|
2
|
+
# Use with: include https://warehouse:8888/artale/pi-ci-template/raw/main/.gitlab-ci.yml
|
|
3
|
+
# Or copy directly into each repo.
|
|
4
|
+
|
|
5
|
+
image: node:22-alpine
|
|
6
|
+
|
|
7
|
+
stages:
|
|
8
|
+
- validate
|
|
9
|
+
- test
|
|
10
|
+
|
|
11
|
+
cache:
|
|
12
|
+
paths:
|
|
13
|
+
- node_modules/
|
|
14
|
+
|
|
15
|
+
before_script:
|
|
16
|
+
- node --version
|
|
17
|
+
- npm --version
|
|
18
|
+
|
|
19
|
+
validate:
|
|
20
|
+
stage: validate
|
|
21
|
+
script:
|
|
22
|
+
- echo "Package: $(node -p "require('./package.json').name") v$(node -p "require('./package.json').version")"
|
|
23
|
+
- |
|
|
24
|
+
if [ -f tsconfig.json ]; then
|
|
25
|
+
npm ci --ignore-scripts 2>/dev/null || npm install --ignore-scripts
|
|
26
|
+
npx tsc --noEmit && echo "TypeScript: PASS" || { echo "TypeScript: FAIL"; exit 1; }
|
|
27
|
+
else
|
|
28
|
+
echo "No tsconfig — skipping compile"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
test:
|
|
32
|
+
stage: test
|
|
33
|
+
script:
|
|
34
|
+
- |
|
|
35
|
+
if [ -f scripts/test.sh ]; then
|
|
36
|
+
bash scripts/test.sh && echo "Tests: PASS" || { echo "Tests: FAIL"; exit 1; }
|
|
37
|
+
elif [ -f test.sh ]; then
|
|
38
|
+
bash test.sh && echo "Tests: PASS" || { echo "Tests: FAIL"; exit 1; }
|
|
39
|
+
else
|
|
40
|
+
echo "No tests — skipping"
|
|
41
|
+
fi
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Context: You
|
|
2
|
+
|
|
3
|
+
## Who You Are
|
|
4
|
+
|
|
5
|
+
Customize this file with your own context — role, expertise, preferences.
|
|
6
|
+
|
|
7
|
+
## Key Preferences
|
|
8
|
+
|
|
9
|
+
- Concise responses for simple tasks
|
|
10
|
+
- Verification over claims of completion
|
|
11
|
+
- Direct language, no hedging
|
|
12
|
+
- CLI-first approach
|
|
13
|
+
- Simple solutions over clever ones
|
|
14
|
+
- Evidence over claims
|
|
15
|
+
|
|
16
|
+
## Voice Server (Optional)
|
|
17
|
+
|
|
18
|
+
If you set up a TTS voice server, configure it here:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Example: ElevenLabs or local TTS at a given endpoint
|
|
22
|
+
curl -s -X POST http://localhost:8888/notify \
|
|
23
|
+
-H "Content-Type: application/json" \
|
|
24
|
+
-d '{"message": "MESSAGE_HERE", "voice_id": "YOUR_VOICE_ID", "voice_enabled": true}'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Memory Location
|
|
28
|
+
|
|
29
|
+
Persistent memory files at the configured memory directory:
|
|
30
|
+
- `learning/` — Signals and patterns from interactions
|
|
31
|
+
- `state/` — Current work tracking
|
|
32
|
+
- `work/` — PRD files for Algorithm sessions
|
package/INSTALL.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Installing PAI on Pi — Step by Step
|
|
2
|
+
|
|
3
|
+
> **Note:** This is v1.0.0 (alpha) — an early release. Expect rough edges as this evolves.
|
|
4
|
+
|
|
5
|
+
This guide takes you from zero to a working PAI system on Pi. Total time: ~15 minutes.
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
- **Node.js 18+** — [nodejs.org](https://nodejs.org/) or via your package manager
|
|
10
|
+
- **A model provider** — at least one of:
|
|
11
|
+
- [Ollama](https://ollama.ai/) for local models (free, private)
|
|
12
|
+
- An API key for Anthropic, OpenAI, or OpenRouter
|
|
13
|
+
|
|
14
|
+
## Step 1: Install Pi
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g @mariozechner/pi-coding-agent
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Verify it's installed:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pi --version
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Step 2: Set Up a Model Provider
|
|
27
|
+
|
|
28
|
+
### Option A: Ollama (Local Models — Free)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Install Ollama
|
|
32
|
+
curl -fsSL https://ollama.ai/install.sh | sh
|
|
33
|
+
|
|
34
|
+
# Pull a model (pick one)
|
|
35
|
+
ollama pull llama3.1:8b # Fast, good for simple tasks (~4.7GB)
|
|
36
|
+
ollama pull llama3.1:70b # Powerful, needs 48GB+ RAM (~40GB)
|
|
37
|
+
ollama pull qwen2.5:32b # Good balance of speed and quality (~19GB)
|
|
38
|
+
ollama pull deepseek-r1:32b # Strong reasoning (~19GB)
|
|
39
|
+
|
|
40
|
+
# Ollama runs automatically at http://localhost:11434
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Option B: Cloud API (Anthropic, OpenAI, OpenRouter)
|
|
44
|
+
|
|
45
|
+
Get an API key from your provider and have it ready for Step 4.
|
|
46
|
+
|
|
47
|
+
## Step 3: Copy the PAI Scaffold
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Create the config directory
|
|
51
|
+
mkdir -p ~/.config/PAI-pi
|
|
52
|
+
|
|
53
|
+
# From this directory (Releases/Pi/), copy everything
|
|
54
|
+
cp -r config/* ~/.config/PAI-pi/
|
|
55
|
+
mkdir -p ~/.config/PAI-pi/extensions
|
|
56
|
+
cp -r extensions/* ~/.config/PAI-pi/extensions/
|
|
57
|
+
mkdir -p ~/.config/PAI-pi/skills
|
|
58
|
+
cp -r skills/* ~/.config/PAI-pi/skills/
|
|
59
|
+
mkdir -p ~/.config/PAI-pi/memory
|
|
60
|
+
cp -r memory/* ~/.config/PAI-pi/memory/
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Step 4: Configure Your Model Provider
|
|
64
|
+
|
|
65
|
+
Edit `~/.config/PAI-pi/models.json`. Here are working examples:
|
|
66
|
+
|
|
67
|
+
### Ollama (Local)
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"providers": {
|
|
72
|
+
"ollama": {
|
|
73
|
+
"type": "ollama",
|
|
74
|
+
"baseUrl": "http://localhost:11434",
|
|
75
|
+
"models": {
|
|
76
|
+
"default": "llama3.1:8b"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Anthropic
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"providers": {
|
|
88
|
+
"anthropic": {
|
|
89
|
+
"type": "anthropic",
|
|
90
|
+
"apiKey": "sk-ant-...",
|
|
91
|
+
"models": {
|
|
92
|
+
"default": "claude-sonnet-4-6"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### OpenRouter (Access Many Models)
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"providers": {
|
|
104
|
+
"openrouter": {
|
|
105
|
+
"type": "openai",
|
|
106
|
+
"baseUrl": "https://openrouter.ai/api/v1",
|
|
107
|
+
"apiKey": "sk-or-...",
|
|
108
|
+
"models": {
|
|
109
|
+
"default": "anthropic/claude-sonnet-4-6"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Multiple Providers
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"providers": {
|
|
121
|
+
"local": {
|
|
122
|
+
"type": "ollama",
|
|
123
|
+
"baseUrl": "http://localhost:11434",
|
|
124
|
+
"models": {
|
|
125
|
+
"default": "llama3.1:8b",
|
|
126
|
+
"thinking": "qwen2.5:32b"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"cloud": {
|
|
130
|
+
"type": "anthropic",
|
|
131
|
+
"apiKey": "sk-ant-...",
|
|
132
|
+
"models": {
|
|
133
|
+
"default": "claude-sonnet-4-6"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Step 5: Customize Your Identity
|
|
141
|
+
|
|
142
|
+
Edit `~/.config/PAI-pi/SYSTEM.md` and replace the placeholders:
|
|
143
|
+
|
|
144
|
+
- `{{YOUR_NAME}}` → Your name (e.g., "Alex")
|
|
145
|
+
- `{{YOUR_AI_NAME}}` → Your AI's name (e.g., "Nova", "Atlas", "Friday")
|
|
146
|
+
|
|
147
|
+
Also update:
|
|
148
|
+
- The **Projects** table with your actual projects
|
|
149
|
+
- The **Environment** section with your setup
|
|
150
|
+
- Any **Behavioral Rules** you want to add or modify
|
|
151
|
+
|
|
152
|
+
Edit `~/.config/PAI-pi/AGENTS.md` with your context and preferences.
|
|
153
|
+
|
|
154
|
+
## Step 6: Launch
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
pi
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
You should see the PAI status line and your AI is ready.
|
|
161
|
+
|
|
162
|
+
### Test the Algorithm
|
|
163
|
+
|
|
164
|
+
Try a complex request to see the 7-phase Algorithm in action:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
Create a TypeScript function that parses CSV files with proper error handling
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Your AI should enter Algorithm mode, generate ISC criteria, and work through all 7 phases.
|
|
171
|
+
|
|
172
|
+
### Test Skills
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
/status # Check PAI system status
|
|
176
|
+
/algorithm # Force Algorithm mode for next task
|
|
177
|
+
research quick: what is Pi coding agent
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Step 7: Optional — Voice Notifications
|
|
181
|
+
|
|
182
|
+
If you want your AI to speak:
|
|
183
|
+
|
|
184
|
+
1. Set up a TTS server (ElevenLabs, Coqui, or any HTTP-based TTS)
|
|
185
|
+
2. Set environment variables:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
export PAI_VOICE_ENABLED=true
|
|
189
|
+
export PAI_VOICE_ENDPOINT=http://localhost:8888/notify
|
|
190
|
+
export PAI_VOICE_ID=your-voice-id
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
3. Restart Pi. Voice will announce Algorithm phase transitions.
|
|
194
|
+
|
|
195
|
+
## Troubleshooting
|
|
196
|
+
|
|
197
|
+
### Pi can't find the extension
|
|
198
|
+
|
|
199
|
+
Make sure the extension is at `~/.config/PAI-pi/extensions/pai-core/index.ts`. Pi looks for extensions in the `extensions/` subdirectory of its config path.
|
|
200
|
+
|
|
201
|
+
### Ollama connection refused
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Check if Ollama is running
|
|
205
|
+
curl http://localhost:11434/api/tags
|
|
206
|
+
|
|
207
|
+
# Start it if not
|
|
208
|
+
ollama serve
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Model too slow
|
|
212
|
+
|
|
213
|
+
Use a smaller model for everyday tasks and a larger one for complex work. Configure multiple models in `models.json` and switch between them.
|
|
214
|
+
|
|
215
|
+
### Skills not loading
|
|
216
|
+
|
|
217
|
+
Skills are loaded from `~/.config/PAI-pi/skills/`. Each skill needs a `SKILL.md` file with proper frontmatter (the `---` delimited header).
|
|
218
|
+
|
|
219
|
+
## Next Steps
|
|
220
|
+
|
|
221
|
+
1. **Add your own skills** — Create new directories in `skills/` for your domains
|
|
222
|
+
2. **Build your memory** — The `memory/` directory grows with usage
|
|
223
|
+
3. **Customize the Algorithm** — Adjust effort levels and ISC rules in SYSTEM.md
|
|
224
|
+
4. **Explore full PAI** — For the complete experience with 63+ skills, try [PAI v4.0.3 on Claude Code](../v4.0.3/)
|
package/README.md
CHANGED
|
@@ -1,139 +1,193 @@
|
|
|
1
|
-
# π-PAI v4.2.0 — Personal AI Infrastructure for Pi
|
|
2
|
-
|
|
3
|
-
A Pi Coding Agent extension implementing [Daniel Miessler's PAI framework](https://github.com/danielmiessler/Personal_AI_Infrastructure) (9.6K ⭐), synced with PAI v4.0.3 + Daniels official Pi release (v1.0.0). Includes the Ralph Wiggum iteration technique, damage control, and 5 features ported from Miessler's full system.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pi install npm:@artale/pi-pai
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## What's New in v4.0
|
|
12
|
-
|
|
13
|
-
### Synced with Miessler's PAI v4.0.3
|
|
14
|
-
|
|
15
|
-
| Feature | Source | Implementation |
|
|
16
|
-
|---------|--------|---------------|
|
|
17
|
-
| **v4 Algorithm** | PAI v4.0.3 | OBSERVE → PLAN → DECIDE → EXECUTE → VERIFY (was 7-phase, now 5) |
|
|
18
|
-
| **Sentiment tracking** | PAI Observability | Every rating gets sentiment (positive/neutral/negative) + trend analysis |
|
|
19
|
-
| **Agent personas** | PAI 14 agents | 7 personas: architect, engineer, pentester, designer, reviewer, researcher, qa |
|
|
20
|
-
| **Self-evolution** | PAI self-upgrade | Detects repeating learning patterns (3+ occurrences), triggers `/pai evolve` |
|
|
21
|
-
| **Plans convention** | PAI Plans dir | Auto-creates `.pi/plans/`, lists plans via `/pai plans` |
|
|
22
|
-
|
|
23
|
-
## Commands
|
|
24
|
-
|
|
25
|
-
### `/pai` — Goal-Driven Algorithm
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# Setup
|
|
29
|
-
/pai mission Build a profitable trading system
|
|
30
|
-
/pai goal Deploy live stat-arb strategy
|
|
31
|
-
/pai challenge Overfitting risk on historical data
|
|
32
|
-
|
|
33
|
-
# Run the v4 algorithm loop
|
|
34
|
-
/pai loop Deploy live strategy # Start: OBSERVE
|
|
35
|
-
/pai isc Strategy achieves Sharpe >1.5 on 5-year backtest
|
|
36
|
-
/pai next Observed: spread mean-reverts at 3.2 std
|
|
37
|
-
/pai next Plan: backtest 2020-2025, then paper trade 2 weeks
|
|
38
|
-
/pai next Decision: go with mean-reversion, tight stops
|
|
39
|
-
/pai next Executed: deployed to paper trading
|
|
40
|
-
/pai next Verified: 58% win rate, Sharpe 1.8
|
|
41
|
-
|
|
42
|
-
# Templates
|
|
43
|
-
/pai template trading # Pre-built mission + goals + challenges
|
|
44
|
-
/pai template saas|devops|research|agent
|
|
45
|
-
|
|
46
|
-
# Agent personas (NEW in v4)
|
|
47
|
-
/pai agent architect Design the auth system for a multi-tenant SaaS
|
|
48
|
-
/pai agent pentester Review this API for security vulnerabilities
|
|
49
|
-
/pai agent designer Create the onboarding flow for mobile
|
|
50
|
-
/pai agent reviewer Review the feature branch against main
|
|
51
|
-
|
|
52
|
-
# Sentiment & trends (NEW in v4)
|
|
53
|
-
/pai trend # Rating trend: avg, recent, sentiment distribution
|
|
54
|
-
/pai evolve # Self-evolution: repeating pattern report
|
|
55
|
-
|
|
56
|
-
# Other
|
|
57
|
-
/pai plans # List .pi/plans/ directory
|
|
58
|
-
/pai status # Full status with all v4 features
|
|
59
|
-
/pai learn <insight> # Record a learning
|
|
60
|
-
/pai done g0 # Complete a goal
|
|
61
|
-
/pai block g1 # Block a goal
|
|
62
|
-
/pai reset # Clear everything
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### `/rate` — Sentiment-Aware Ratings
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
/rate 9 Clean architecture, fast execution # → ⭐9 😊 positive
|
|
69
|
-
/rate 3 Missed edge cases, slow # → ⭐3 😞 negative → auto-captures learning
|
|
70
|
-
/rate 6 # → ⭐6 😐 neutral
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Ratings track: score (1-10), context, timestamp, **sentiment** (inferred from score + keywords).
|
|
74
|
-
|
|
75
|
-
Widget shows trend: `⭐7.2 📈8.0 (15 ratings)` — improving/declining/stable.
|
|
76
|
-
|
|
77
|
-
### `/ralph` — Deterministic Iteration
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
/ralph Build a REST API with auth, tests, and docs
|
|
81
|
-
# Agent iterates up to 50 times until RALPH_DONE
|
|
82
|
-
/ralph stop
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### 🛡️ Damage Control
|
|
86
|
-
|
|
87
|
-
Guards via YAML rules (`damage-control-rules.yaml`):
|
|
88
|
-
- **Blocked patterns:** `rm -rf`, `git reset --hard`, `git push --force`, `DROP TABLE`
|
|
89
|
-
- **Confirm-first:** `git push --delete`, `git branch -D`
|
|
90
|
-
- **Zero-access:** `.env`, `~/.ssh/`, `~/.aws/`, `*.pem`
|
|
91
|
-
- **Read-only/No-delete:** configurable per project
|
|
92
|
-
|
|
93
|
-
### 🔧 Agent Tools
|
|
94
|
-
|
|
95
|
-
| Tool | Description |
|
|
96
|
-
|------|-------------|
|
|
97
|
-
| `pai_status` | Full status with v4 algorithm, trends, personas, patterns |
|
|
98
|
-
| `pai_learn` | Record insight with sentiment |
|
|
99
|
-
| `pai_rate` | Rate 1-10 with sentiment + trend tracking |
|
|
100
|
-
|
|
101
|
-
### 📊 Live Widget
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
🎯 Build a profitable trading system
|
|
105
|
-
Goals: 2⚡ 0🚫 1✓ │ 5 learnings │ ⭐7.2 📈8.0 (15)
|
|
106
|
-
Loop: ● ● ◉ ○ ○ [DECIDE] standard 42s
|
|
107
|
-
⚠️ 2 repeating pattern(s) — consider /pai evolve
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Agent Personas
|
|
111
|
-
|
|
112
|
-
| Persona | Focus |
|
|
113
|
-
|---------|-------|
|
|
114
|
-
| `architect` | System design, scalability, API design, failure modes |
|
|
115
|
-
| `engineer` | Production code, error handling, types, tests |
|
|
116
|
-
| `pentester` | Security: injection, auth bypass, SSRF, secrets, deps |
|
|
117
|
-
| `designer` | UX/UI, accessibility, responsive, interaction patterns |
|
|
118
|
-
| `reviewer` | Code review: correctness, edge cases, P1/P2/P3 findings |
|
|
119
|
-
| `researcher` | Deep investigation, evidence-based, source citations |
|
|
120
|
-
| `qa` | Test planning: happy paths, edge cases, boundaries, regression |
|
|
121
|
-
|
|
122
|
-
## Lineage
|
|
123
|
-
|
|
124
|
-
| Project | Author | What |
|
|
125
|
-
|---------|--------|------|
|
|
126
|
-
| [Personal AI Infrastructure](https://github.com/danielmiessler/Personal_AI_Infrastructure) | [Daniel Miessler](https://danielmiessler.com) | PAI v4.0.3 framework (9.6K ⭐) |
|
|
127
|
-
| [pi-ralph](https://github.com/Whamp/pi-ralph) | Whamp | Ralph Wiggum iteration technique |
|
|
128
|
-
| [pi-vs-claude-code](https://github.com/disler/pi-vs-claude-code) | disler | Damage control + extension patterns |
|
|
129
|
-
| [Pi Coding Agent](https://github.com/badlogic/pi) | Mario Zechner | The platform |
|
|
130
|
-
|
|
131
|
-
## v3 → v4 Migration
|
|
132
|
-
|
|
133
|
-
The algorithm changed from 7 phases to 5:
|
|
134
|
-
- **Old:** OBSERVE → THINK → PLAN → DEFINE → EXECUTE → MEASURE → LEARN
|
|
135
|
-
- **New:** OBSERVE → PLAN → DECIDE → EXECUTE → VERIFY
|
|
136
|
-
|
|
137
|
-
THINK+PLAN merged into PLAN. DEFINE became DECIDE. MEASURE+LEARN merged into VERIFY.
|
|
138
|
-
|
|
1
|
+
# π-PAI v4.2.0 — Personal AI Infrastructure for Pi
|
|
2
|
+
|
|
3
|
+
A Pi Coding Agent extension implementing [Daniel Miessler's PAI framework](https://github.com/danielmiessler/Personal_AI_Infrastructure) (9.6K ⭐), synced with PAI v4.0.3 + Daniels official Pi release (v1.0.0). Includes the Ralph Wiggum iteration technique, damage control, and 5 features ported from Miessler's full system.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pi install npm:@artale/pi-pai
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What's New in v4.0
|
|
12
|
+
|
|
13
|
+
### Synced with Miessler's PAI v4.0.3
|
|
14
|
+
|
|
15
|
+
| Feature | Source | Implementation |
|
|
16
|
+
|---------|--------|---------------|
|
|
17
|
+
| **v4 Algorithm** | PAI v4.0.3 | OBSERVE → PLAN → DECIDE → EXECUTE → VERIFY (was 7-phase, now 5) |
|
|
18
|
+
| **Sentiment tracking** | PAI Observability | Every rating gets sentiment (positive/neutral/negative) + trend analysis |
|
|
19
|
+
| **Agent personas** | PAI 14 agents | 7 personas: architect, engineer, pentester, designer, reviewer, researcher, qa |
|
|
20
|
+
| **Self-evolution** | PAI self-upgrade | Detects repeating learning patterns (3+ occurrences), triggers `/pai evolve` |
|
|
21
|
+
| **Plans convention** | PAI Plans dir | Auto-creates `.pi/plans/`, lists plans via `/pai plans` |
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
### `/pai` — Goal-Driven Algorithm
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Setup
|
|
29
|
+
/pai mission Build a profitable trading system
|
|
30
|
+
/pai goal Deploy live stat-arb strategy
|
|
31
|
+
/pai challenge Overfitting risk on historical data
|
|
32
|
+
|
|
33
|
+
# Run the v4 algorithm loop
|
|
34
|
+
/pai loop Deploy live strategy # Start: OBSERVE
|
|
35
|
+
/pai isc Strategy achieves Sharpe >1.5 on 5-year backtest
|
|
36
|
+
/pai next Observed: spread mean-reverts at 3.2 std
|
|
37
|
+
/pai next Plan: backtest 2020-2025, then paper trade 2 weeks
|
|
38
|
+
/pai next Decision: go with mean-reversion, tight stops
|
|
39
|
+
/pai next Executed: deployed to paper trading
|
|
40
|
+
/pai next Verified: 58% win rate, Sharpe 1.8
|
|
41
|
+
|
|
42
|
+
# Templates
|
|
43
|
+
/pai template trading # Pre-built mission + goals + challenges
|
|
44
|
+
/pai template saas|devops|research|agent
|
|
45
|
+
|
|
46
|
+
# Agent personas (NEW in v4)
|
|
47
|
+
/pai agent architect Design the auth system for a multi-tenant SaaS
|
|
48
|
+
/pai agent pentester Review this API for security vulnerabilities
|
|
49
|
+
/pai agent designer Create the onboarding flow for mobile
|
|
50
|
+
/pai agent reviewer Review the feature branch against main
|
|
51
|
+
|
|
52
|
+
# Sentiment & trends (NEW in v4)
|
|
53
|
+
/pai trend # Rating trend: avg, recent, sentiment distribution
|
|
54
|
+
/pai evolve # Self-evolution: repeating pattern report
|
|
55
|
+
|
|
56
|
+
# Other
|
|
57
|
+
/pai plans # List .pi/plans/ directory
|
|
58
|
+
/pai status # Full status with all v4 features
|
|
59
|
+
/pai learn <insight> # Record a learning
|
|
60
|
+
/pai done g0 # Complete a goal
|
|
61
|
+
/pai block g1 # Block a goal
|
|
62
|
+
/pai reset # Clear everything
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### `/rate` — Sentiment-Aware Ratings
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
/rate 9 Clean architecture, fast execution # → ⭐9 😊 positive
|
|
69
|
+
/rate 3 Missed edge cases, slow # → ⭐3 😞 negative → auto-captures learning
|
|
70
|
+
/rate 6 # → ⭐6 😐 neutral
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Ratings track: score (1-10), context, timestamp, **sentiment** (inferred from score + keywords).
|
|
74
|
+
|
|
75
|
+
Widget shows trend: `⭐7.2 📈8.0 (15 ratings)` — improving/declining/stable.
|
|
76
|
+
|
|
77
|
+
### `/ralph` — Deterministic Iteration
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
/ralph Build a REST API with auth, tests, and docs
|
|
81
|
+
# Agent iterates up to 50 times until RALPH_DONE
|
|
82
|
+
/ralph stop
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 🛡️ Damage Control
|
|
86
|
+
|
|
87
|
+
Guards via YAML rules (`damage-control-rules.yaml`):
|
|
88
|
+
- **Blocked patterns:** `rm -rf`, `git reset --hard`, `git push --force`, `DROP TABLE`
|
|
89
|
+
- **Confirm-first:** `git push --delete`, `git branch -D`
|
|
90
|
+
- **Zero-access:** `.env`, `~/.ssh/`, `~/.aws/`, `*.pem`
|
|
91
|
+
- **Read-only/No-delete:** configurable per project
|
|
92
|
+
|
|
93
|
+
### 🔧 Agent Tools
|
|
94
|
+
|
|
95
|
+
| Tool | Description |
|
|
96
|
+
|------|-------------|
|
|
97
|
+
| `pai_status` | Full status with v4 algorithm, trends, personas, patterns |
|
|
98
|
+
| `pai_learn` | Record insight with sentiment |
|
|
99
|
+
| `pai_rate` | Rate 1-10 with sentiment + trend tracking |
|
|
100
|
+
|
|
101
|
+
### 📊 Live Widget
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
🎯 Build a profitable trading system
|
|
105
|
+
Goals: 2⚡ 0🚫 1✓ │ 5 learnings │ ⭐7.2 📈8.0 (15)
|
|
106
|
+
Loop: ● ● ◉ ○ ○ [DECIDE] standard 42s
|
|
107
|
+
⚠️ 2 repeating pattern(s) — consider /pai evolve
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Agent Personas
|
|
111
|
+
|
|
112
|
+
| Persona | Focus |
|
|
113
|
+
|---------|-------|
|
|
114
|
+
| `architect` | System design, scalability, API design, failure modes |
|
|
115
|
+
| `engineer` | Production code, error handling, types, tests |
|
|
116
|
+
| `pentester` | Security: injection, auth bypass, SSRF, secrets, deps |
|
|
117
|
+
| `designer` | UX/UI, accessibility, responsive, interaction patterns |
|
|
118
|
+
| `reviewer` | Code review: correctness, edge cases, P1/P2/P3 findings |
|
|
119
|
+
| `researcher` | Deep investigation, evidence-based, source citations |
|
|
120
|
+
| `qa` | Test planning: happy paths, edge cases, boundaries, regression |
|
|
121
|
+
|
|
122
|
+
## Lineage
|
|
123
|
+
|
|
124
|
+
| Project | Author | What |
|
|
125
|
+
|---------|--------|------|
|
|
126
|
+
| [Personal AI Infrastructure](https://github.com/danielmiessler/Personal_AI_Infrastructure) | [Daniel Miessler](https://danielmiessler.com) | PAI v4.0.3 framework (9.6K ⭐) |
|
|
127
|
+
| [pi-ralph](https://github.com/Whamp/pi-ralph) | Whamp | Ralph Wiggum iteration technique |
|
|
128
|
+
| [pi-vs-claude-code](https://github.com/disler/pi-vs-claude-code) | disler | Damage control + extension patterns |
|
|
129
|
+
| [Pi Coding Agent](https://github.com/badlogic/pi) | Mario Zechner | The platform |
|
|
130
|
+
|
|
131
|
+
## v3 → v4 Migration
|
|
132
|
+
|
|
133
|
+
The algorithm changed from 7 phases to 5:
|
|
134
|
+
- **Old:** OBSERVE → THINK → PLAN → DEFINE → EXECUTE → MEASURE → LEARN
|
|
135
|
+
- **New:** OBSERVE → PLAN → DECIDE → EXECUTE → VERIFY
|
|
136
|
+
|
|
137
|
+
THINK+PLAN merged into PLAN. DEFINE became DECIDE. MEASURE+LEARN merged into VERIFY.
|
|
138
|
+
|
|
139
139
|
Active loops will reset on upgrade. All other state (goals, learnings, ratings) carries forward.
|
|
140
|
+
|
|
141
|
+
## LifeOS Scaffold Compatibility (from `Releases/Pi`)
|
|
142
|
+
|
|
143
|
+
This repo also ships the LifeOS Pi scaffold as a compatibility layer and migration path.
|
|
144
|
+
|
|
145
|
+
### Added in this port
|
|
146
|
+
|
|
147
|
+
- `SYSTEM.md` and `AGENTS.md` now match the canonical LifeOS scaffold policies.
|
|
148
|
+
- Added root `models.json` + `settings.json` plus `VERSION` (`1.0.0`).
|
|
149
|
+
- Added `INSTALL.md` with the full LifeOS install flow.
|
|
150
|
+
- Added `src/lifeos-pai-core.ts` (a compat extension implementing:
|
|
151
|
+
- `voice_notify` tool
|
|
152
|
+
- `prd_create` / `prd_update` tools
|
|
153
|
+
- `lifeos_capture_learning` tool
|
|
154
|
+
- optional session voice hooks)
|
|
155
|
+
- Added `memory/learning`, `memory/state`, `memory/work` with `.gitkeep` placeholders.
|
|
156
|
+
- Added canonical 9 skill `SKILL.md` files under `skills/` from LifeOS.
|
|
157
|
+
|
|
158
|
+
### Merge strategy (recommended)
|
|
159
|
+
|
|
160
|
+
- **Primary runtime/experience remains this repo's enhanced `v4` PAI loop** (`/pai`, personas, ratings, telemetry, /rate sentiment, damage control).
|
|
161
|
+
- Load `src/lifeos-pai-core.ts` in parallel for LifeOS-specific features when desired.
|
|
162
|
+
- Keep `.pai` variants as rollback references:
|
|
163
|
+
- `SYSTEM.md.pai`
|
|
164
|
+
- `INSTALL.md.pai`
|
|
165
|
+
- `models.json.pai`
|
|
166
|
+
- `settings.json.pai`
|
|
167
|
+
|
|
168
|
+
### Scaffold quick tree
|
|
169
|
+
|
|
170
|
+
```text
|
|
171
|
+
Releases/Pi/
|
|
172
|
+
├── config/
|
|
173
|
+
│ ├── AGENTS.md
|
|
174
|
+
│ ├── SYSTEM.md
|
|
175
|
+
│ ├── settings.json
|
|
176
|
+
│ └── models.json
|
|
177
|
+
├── extensions/
|
|
178
|
+
│ └── pai-core/index.ts -> src/lifeos-pai-core.ts
|
|
179
|
+
├── skills/
|
|
180
|
+
│ ├── agents/SKILL.md
|
|
181
|
+
│ ├── content-analysis/SKILL.md
|
|
182
|
+
│ ├── investigation/SKILL.md
|
|
183
|
+
│ ├── media/SKILL.md
|
|
184
|
+
│ ├── research/SKILL.md
|
|
185
|
+
│ ├── scraping/SKILL.md
|
|
186
|
+
│ ├── security/SKILL.md
|
|
187
|
+
│ ├── telos/SKILL.md
|
|
188
|
+
│ └── thinking/SKILL.md
|
|
189
|
+
└── memory/
|
|
190
|
+
├── learning/
|
|
191
|
+
├── state/
|
|
192
|
+
└── work/
|
|
193
|
+
```
|