147 lines
3.3 KiB
Markdown
147 lines
3.3 KiB
Markdown
# GOAP Autonomy System - Quick Start
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
cd /root/allegro/goap
|
|
./setup.sh
|
|
```
|
|
|
|
## Running the System
|
|
|
|
### Option 1: Systemd Service (Recommended)
|
|
|
|
```bash
|
|
# Start the service
|
|
systemctl start goap-autonomy
|
|
|
|
# Enable auto-start on boot
|
|
systemctl enable goap-autonomy
|
|
|
|
# Check status
|
|
systemctl status goap-autonomy
|
|
|
|
# View logs
|
|
journalctl -u goap-autonomy -f
|
|
```
|
|
|
|
### Option 2: Manual Execution
|
|
|
|
```bash
|
|
cd /root/allegro/goap
|
|
|
|
# Run one autonomy cycle
|
|
python3 self_goap.py --once
|
|
|
|
# Run continuous autonomy loop
|
|
python3 self_goap.py --run
|
|
|
|
# Run in background
|
|
nohup python3 self_goap.py --run > /var/log/goap.log 2>&1 &
|
|
```
|
|
|
|
## Managing Autonomy
|
|
|
|
```bash
|
|
# Check system status
|
|
python3 self_goap.py --status
|
|
|
|
# Enable autonomy
|
|
python3 self_goap.py --enable
|
|
|
|
# Disable autonomy
|
|
python3 self_goap.py --disable
|
|
|
|
# Force plan for specific goal
|
|
python3 self_goap.py --plan system_health
|
|
```
|
|
|
|
## Goals
|
|
|
|
The system manages 13 goals across 5 categories:
|
|
|
|
| Category | Goals | Priority |
|
|
|----------|-------|----------|
|
|
| HUNGER | Resource acquisition, Efficiency | HIGH |
|
|
| SAFETY | System health, Security, Data integrity | CRITICAL |
|
|
| LEARNING | Knowledge, Skills, Adaptation | MEDIUM |
|
|
| SOCIAL | User engagement, Relationships, Collaboration | MEDIUM |
|
|
| GROWTH | Self-improvement, Exploration | LOW |
|
|
|
|
## Actions
|
|
|
|
14 actions available across categories:
|
|
|
|
- **System**: check_system_health, cleanup_resources, restart_service, backup_data
|
|
- **Knowledge**: research_topic, index_knowledge, learn_from_interaction
|
|
- **Skills**: practice_skill, acquire_new_skill
|
|
- **Social**: send_message, proactive_check_in, share_knowledge
|
|
- **Growth**: self_analysis, experiment
|
|
|
|
## How It Works
|
|
|
|
1. **State Collection** - Every 60 seconds, collects system metrics
|
|
2. **Goal Evaluation** - Updates goal satisfaction based on current state
|
|
3. **Planning** - Every 5 minutes, creates plans for top-priority goals
|
|
4. **Execution** - Schedules and executes plans with monitoring
|
|
5. **Learning** - Tracks success rates and adapts
|
|
|
|
## Files
|
|
|
|
- `/root/allegro/goap/autonomy.log` - Operation log
|
|
- `/root/allegro/goap/goals_state.json` - Goal history
|
|
- `/root/allegro/goap/executor_state.json` - Execution stats
|
|
- `/root/allegro/goap/self_state.json` - System config
|
|
|
|
## Troubleshooting
|
|
|
|
### Service won't start
|
|
```bash
|
|
# Check for Python errors
|
|
python3 self_goap.py --once
|
|
|
|
# Check permissions
|
|
ls -la /root/allegro/goap/*.py
|
|
|
|
# Check logs
|
|
journalctl -u goap-autonomy -n 50
|
|
```
|
|
|
|
### No plans found
|
|
This is normal if all goals are satisfied or current state doesn't match action preconditions. The system will keep trying.
|
|
|
|
### High CPU usage
|
|
The system runs in adaptive mode and will reduce activity under high load.
|
|
|
|
## Integration
|
|
|
|
The GOAP system reads from:
|
|
- Timmy metrics database (`/root/allegro/timmy_metrics.db`)
|
|
- Heartbeat logs (`/root/allegro/heartbeat_logs/`)
|
|
- System metrics (CPU, memory, disk)
|
|
|
|
## Development
|
|
|
|
### Adding a Custom Goal
|
|
```python
|
|
from goap import Goal, GoalCategory, GoalPriority
|
|
|
|
class CustomGoal(Goal):
|
|
def evaluate(self, world_state):
|
|
return 0.5 # Satisfaction level
|
|
```
|
|
|
|
### Adding a Custom Action
|
|
```python
|
|
from goap import Action, ActionResult
|
|
|
|
class CustomAction(Action):
|
|
async def execute(self, context):
|
|
# Do something
|
|
return ActionResult.success_result("Done!")
|
|
```
|
|
|
|
## Support
|
|
|
|
See `README.md` for detailed documentation.
|