Files
prime-core/docs/PRIME_BOOTSTRAP.md
T

124 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Prime Bootstrap v0
## 1) Environment
```bash
source /srv/prime-core/scripts/prime-env.sh
export PRIME_VAULT_KEY='set-a-strong-random-value'
```
## 2) Validate
```bash
prime status
prime dispatch planning "design backup policy"
prime dispatch coding "implement hello endpoint"
```
## 3) Backup/Restore
```bash
prime backup-now
prime restore <commit-id>
```
## 4) OAuth broker stubs
Current `prime_core/oauth.py` is a stub interface (start/callback) and encrypted token vault.
Replace `auth.example` URLs and token exchange with provider-specific OAuth implementations.
## 5) Queue worker + approvals
```bash
prime queue add planning "design X"
prime queue run-once
prime queue list
prime queue approve <task-id>
prime queue deny <task-id> --reason "optional reason"
```
Worker service:
```bash
sudo systemctl status prime-worker.service
```
## 6) Telegram notifications
Set in local runtime secrets (`.secrets/runtime.env`):
- `TELEGRAM_BOT_TOKEN`
- `TELEGRAM_CHAT_ID`
Worker sends alerts for:
- blocked approval tasks
- failed tasks
## 7) Telegram control plane (beyond request/response)
Prime now includes:
- `prime-telegram-control.service` (inbound command channel)
- `prime-autonomy-loop.service` (goal-driven autonomous queue seeding)
Telegram commands:
- `status`
- `queue list`
- `queue add <task_type> <task>`
- `queue approve <id>`
- `queue deny <id> [reason]`
- `run once`
- `mode autonomous on|off`
- `goals show`
- `goals add <text>`
## 8) Stability Sprint v1
Added:
- Risk classification tiers (`prime_core/risk.py`)
- Audit trail (`logs/audit.jsonl`)
- Safer restore:
- `prime restore --dry-run <commit>`
- preflight + rollback on failure
- Telegram control guardrails for high-risk direct commands
## 9) Backup classes + verification (Stability Sprint v2)
Prime now separates backups into classes:
- `scripts/backup/code-backup.sh` -> git code/config backup
- `scripts/backup/state-backup.sh` -> encrypted state snapshot (`task-queue.json`, `tokens.enc`)
- `scripts/backup/secrets-backup.sh` -> encrypted secret escrow (optional, requires `PRIME_SECRET_BACKUP_PASSPHRASE`)
Timers:
- `prime-state-backup.timer` (15m)
- `prime-restore-test.timer` (nightly dry-run restore)
- `prime-audit-watch.timer` (15m anomaly check)
## 11) Telegram allowlist controls
Prime responds only to allowlisted Telegram users.
Owner (configured `TELEGRAM_CHAT_ID`) can manage list:
- `allowlist show`
- `allowlist add <telegram_user_id>`
- `allowlist remove <telegram_user_id>`
Owner cannot be removed from allowlist.
## 12) Prime proactive check-in loop
Service: `prime-checkin-loop.service`
Behavior:
- Sends proactive check-ins every ~3 hours
- Asks for goal/task direction when queue is clear
- Quiet hours enforced: 11:00 PM–6:00 AM America/New_York
- Personality: calm, strategic, concise (`prime_core/personality.py`)
## 13) Chat Mode v1 (conversational control)
Prime can now interpret natural-language messages and not just strict commands.
New controls:
- `mode chat on|off`
- `mode strict on|off`
Behavior:
- Interprets intent via OpenAI/Codex (`prime_core/chat_mode.py`)
- For action requests: proposes plan and asks for explicit approval (`approve`) when strict/confirm needed
- Keeps pending user action context in `state/pending-actions.json`
## 14) Chat Mode v1.2 (assistant-first behavior)
- Owner fast-lane for conversational planning/research requests
- Hard blocks only for tier4 destructive/external asks
- Softer plan/confirm messaging for normal requests
## 15) Startup rehydrate protocol (Hot/Cold memory)
- `STARTUP.md`, `HOT_MEMORY.md`, `COLD_INDEX.md`
- generated `state/boot-pack.json` for compact startup context
- timer: `prime-boot-pack.timer` (15m)
- Telegram: `startup show`