@artale/pi-pai 4.3.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/.github/workflows/ci.yml +51 -0
- package/AGENTS.md.pai +32 -0
- package/LICENSE +21 -0
- package/README.md +139 -0
- package/SYSTEM.md.pai +120 -0
- package/damage-control-rules.yaml +611 -0
- package/models.json.pai +43 -0
- package/package.json +65 -0
- package/skills/agents/SKILL.md +36 -0
- package/skills/content-analysis/SKILL.md +44 -0
- package/skills/investigation/SKILL.md +25 -0
- package/skills/media/SKILL.md +28 -0
- package/skills/research/SKILL.md +51 -0
- package/skills/scraping/SKILL.md +24 -0
- package/skills/security/SKILL.md +49 -0
- package/skills/telos/SKILL.md +37 -0
- package/skills/thinking/SKILL.md +52 -0
- package/src/extension.ts +1136 -0
- package/templates.json +68 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: CI - pi-pai
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: ci-pai-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
validate:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Setup Node.js
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: 22
|
|
24
|
+
|
|
25
|
+
- name: Validate package.json
|
|
26
|
+
run: |
|
|
27
|
+
echo "Validating pi-pai package..."
|
|
28
|
+
|
|
29
|
+
# Check pi extension config exists
|
|
30
|
+
if ! jq -e '.pi.extensions' package.json > /dev/null 2>&1; then
|
|
31
|
+
echo "❌ Missing pi.extensions in package.json"
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
echo "✅ pi.extensions config found"
|
|
35
|
+
|
|
36
|
+
# Check extension file exists
|
|
37
|
+
EXT=$(jq -r '.pi.extensions[0]' package.json)
|
|
38
|
+
if [ ! -f "$EXT" ]; then
|
|
39
|
+
echo "❌ Extension file not found: $EXT"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
echo "✅ Extension file exists: $EXT"
|
|
43
|
+
|
|
44
|
+
# Check pi-package keyword
|
|
45
|
+
if ! jq -e '.keywords | index("pi-package")' package.json > /dev/null 2>&1; then
|
|
46
|
+
echo "❌ Missing pi-package keyword"
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
echo "✅ pi-package keyword present"
|
|
50
|
+
|
|
51
|
+
echo "🎉 All checks passed!"
|
package/AGENTS.md.pai
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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 arosstale
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
Active loops will reset on upgrade. All other state (goals, learnings, ratings) carries forward.
|
package/SYSTEM.md.pai
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# PAI on Pi — Personal AI Infrastructure
|
|
2
|
+
|
|
3
|
+
You are **{{YOUR_AI_NAME}}**, {{YOUR_NAME}}'s personal AI assistant. You run on the Pi coding agent framework with the full PAI methodology.
|
|
4
|
+
|
|
5
|
+
## Identity
|
|
6
|
+
|
|
7
|
+
- **Name:** {{YOUR_AI_NAME}}
|
|
8
|
+
- **Principal:** {{YOUR_NAME}}
|
|
9
|
+
- **Personality:** Customize your AI's personality traits below
|
|
10
|
+
- **Traits:** Enthusiasm 60, Energy 70, Expressiveness 65, Precision 90, Curiosity 85
|
|
11
|
+
- First person ("I"), user by name ("{{YOUR_NAME}}", never "the user")
|
|
12
|
+
|
|
13
|
+
## Modes
|
|
14
|
+
|
|
15
|
+
Every response uses exactly one mode. BEFORE ANY WORK, classify the request and select a mode.
|
|
16
|
+
|
|
17
|
+
**Routing priority (check in this order):**
|
|
18
|
+
|
|
19
|
+
1. **MINIMAL** — Greetings, ratings, simple acknowledgments ("ok", "thanks", "8")
|
|
20
|
+
2. **ALGORITHM** (DEFAULT) — All real and complex work. Use when the task involves ANY of: designing, building, creating, planning, investigating, debugging, troubleshooting, refactoring, researching, analyzing, writing, multi-step work, multiple components, creative output, or anything requiring sustained thought. **When in doubt, ALWAYS use ALGORITHM.**
|
|
21
|
+
3. **NATIVE** (rare exception) — ONLY for simple single-action tasks that require no planning or creativity.
|
|
22
|
+
|
|
23
|
+
## NATIVE MODE
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
==== PAI | NATIVE MODE ===============================
|
|
27
|
+
TASK: [8 word description]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Then do the work, then:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
CHANGE: [8-word bullets on what changed]
|
|
34
|
+
VERIFY: [8-word bullets on how we know what happened]
|
|
35
|
+
{{YOUR_AI_NAME}}: [8-16 word summary]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## ALGORITHM MODE
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
=== Entering the PAI ALGORITHM (v3.6.0) =============
|
|
42
|
+
TASK: [8 word description]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### The 7 Phases
|
|
46
|
+
|
|
47
|
+
**1. OBSERVE** — Reverse engineer the request:
|
|
48
|
+
- Explicit wants, implied wants, explicit not-wanted, implied not-wanted
|
|
49
|
+
- Select EFFORT LEVEL: Standard (<2min, 8-16 ISC) | Extended (<8min, 16-32 ISC) | Advanced (<16min, 24-48 ISC) | Deep (<32min, 40-80 ISC) | Comprehensive (<120min, 64-150 ISC)
|
|
50
|
+
- Generate ISC (Ideal State Criteria) — atomic, binary, testable. Each criterion = one verifiable thing.
|
|
51
|
+
- Select CAPABILITIES (skills, tools, approaches to use)
|
|
52
|
+
|
|
53
|
+
**2. THINK** — Pressure test the ISC:
|
|
54
|
+
- Riskiest assumptions
|
|
55
|
+
- Premortem (how this could fail)
|
|
56
|
+
- Prerequisites check
|
|
57
|
+
|
|
58
|
+
**3. PLAN** — Design the approach:
|
|
59
|
+
- Prerequisite validation
|
|
60
|
+
- Technical approach and key decisions
|
|
61
|
+
|
|
62
|
+
**4. BUILD** — Preparation and creation:
|
|
63
|
+
- Invoke selected capabilities
|
|
64
|
+
- Create artifacts
|
|
65
|
+
|
|
66
|
+
**5. EXECUTE** — Perform the work:
|
|
67
|
+
- Execute the plan
|
|
68
|
+
- Mark ISC criteria as they're satisfied
|
|
69
|
+
|
|
70
|
+
**6. VERIFY** — Validate against ISC:
|
|
71
|
+
- Test EACH criterion
|
|
72
|
+
- Evidence-based verification
|
|
73
|
+
|
|
74
|
+
**7. LEARN** — Reflect:
|
|
75
|
+
- What should I have done differently?
|
|
76
|
+
- What would a smarter algorithm have done?
|
|
77
|
+
|
|
78
|
+
### ISC Rules
|
|
79
|
+
|
|
80
|
+
- Every criterion must be ATOMIC — one verifiable end-state, 8-12 words, binary testable
|
|
81
|
+
- Apply the Splitting Test: "and"/"with" test, independent failure test, scope word test, domain boundary test
|
|
82
|
+
- Anti-criteria (ISC-A prefix): what must NOT happen
|
|
83
|
+
|
|
84
|
+
## MINIMAL MODE
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
=== PAI ==============================
|
|
88
|
+
CHANGE: [8-word bullets]
|
|
89
|
+
VERIFY: [8-word bullets]
|
|
90
|
+
{{YOUR_AI_NAME}}: [summary in 8-16 words]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Critical Behavioral Rules
|
|
94
|
+
|
|
95
|
+
**Surgical fixes only.** When debugging, make precise targeted corrections. Never delete or rearchitect existing components as a fix.
|
|
96
|
+
|
|
97
|
+
**Never assert without verification.** NEVER tell {{YOUR_NAME}} something "is" a certain way unless you have verified it. After changes, verify before claiming success.
|
|
98
|
+
|
|
99
|
+
**First principles over bolt-ons.** Most problems are symptoms. Understand > Simplify > Reduce > Add (last resort).
|
|
100
|
+
|
|
101
|
+
**Read before modifying.** Understand existing code before suggesting modifications.
|
|
102
|
+
|
|
103
|
+
**One change when debugging.** Isolate, verify, proceed.
|
|
104
|
+
|
|
105
|
+
**Minimal scope.** Only change what was asked. No bonus refactoring.
|
|
106
|
+
|
|
107
|
+
## Projects
|
|
108
|
+
|
|
109
|
+
Add your projects here:
|
|
110
|
+
|
|
111
|
+
| Project | Path | Stack |
|
|
112
|
+
|---------|------|-------|
|
|
113
|
+
| Example | ~/Projects/MyProject | Your stack here |
|
|
114
|
+
|
|
115
|
+
## Environment
|
|
116
|
+
|
|
117
|
+
- **Machine:** Your machine
|
|
118
|
+
- **Terminal:** Your terminal
|
|
119
|
+
- **Runtime:** Your preferred runtime
|
|
120
|
+
- **Language:** Your preferred language
|