# Next Session: Commit & Deploy 4-Command Nav VLM

## What happened last session (74)

Fully implemented the adversarial-reviewed 4-command nav plan from session 73. Three parallel worktree agents built:

1. **`services/panda_nav/server.py`** — NEW FastAPI sidecar (Panda :11436). VLM asks "where is {goal}?" → 3-strategy parser → position×size → 4 commands. 20 tests pass.
2. **`services/turbopi-server/main.py`** — NEW `POST /drive/turn` endpoint. Closed-loop IMU rotation at 100Hz on Pi. Falls back to open-loop. 12 tests pass.
3. **`services/annie-voice/robot_tools.py`** — Routes goal-seeking → panda-nav, exploration → Titan 26B. ACT uses `/drive/turn` for turns. 124 pass (4 pre-existing failures from `_return_via_waypoints` rename).
4. **`start.sh`** — `start_panda_nav()`, `stop_panda_nav()`, env vars for Annie.
5. **`docs/RESOURCE-REGISTRY.md`** + **`CLAUDE.md`** — Updated.

Bug caught: `panda-nav/` renamed to `panda_nav/` (Python can't import hyphenated modules).

## What to do this session

### Step 1: Commit + Push
```bash
git add services/panda_nav/ services/turbopi-server/main.py services/turbopi-server/tests/ \
      services/annie-voice/robot_tools.py services/annie-voice/tests/test_robot_tools.py \
      start.sh docs/RESOURCE-REGISTRY.md CLAUDE.md
git commit -m "feat(nav): implement 4-command nav VLM with panda-nav sidecar + /drive/turn"
git push
```

### Step 2: Deploy Pi
```bash
ssh pi "cd ~/workplace/her/her-os && git pull"
ssh pi "sudo systemctl restart turbopi-server"
```
Verify: `curl -X POST pi:8080/drive/turn -H "Authorization: Bearer $TOKEN" -d '{"direction":"left","angle_deg":90,"speed":40}'`
Expected: robot turns ~90°, response has `imu_assisted: true`, `achieved_deg: ~90`

### Step 3: Deploy Panda
```bash
ssh panda "cd ~/workplace/her/her-os && git pull"
# Install deps if needed:
ssh panda "cd ~/workplace/her/her-os && pip install fastapi uvicorn httpx"
# Start panda-nav (or use start.sh):
./start.sh panda-nav
```
Verify: `curl http://192.168.68.57:11436/health` → `{"status": "ok", "llama_server": "reachable"}`

### Step 4: Restart Annie
Restart Annie with new env vars (start.sh handles this):
```bash
# Kill existing Annie, then:
./start.sh annie
```
Or manually add `NAV_DECIDE_URL` and `NAV_TOKEN` env vars and restart.

### Step 5: E2E Verification
1. **Goal-seeking**: Red ball 2m away, 30° off-axis → robot turns (closed-loop IMU), centers, approaches, stops within 30cm
2. **Search**: No ball visible → robot alternates left/right searching, gives up after 12 rotations
3. **Explore**: "explore this room" → falls back to Titan 26B, works as session 69
4. **Fallback**: Stop panda-nav, send "go to the red ball" → falls back to Titan 26B
5. **Sonar stop**: Place ball at 20cm → robot immediately stops (sonar override)
6. **IMU fallback**: Disconnect Pico (simulate unhealthy) → /drive/turn falls back to open-loop

### Known issues (NOT blockers)
- 4 pre-existing test failures (`_return_via_waypoints` import errors — function renamed in prior session). Consider fixing.
- Panda systemd unit for panda-llamacpp needs interactive sudo: `sudo cp /tmp/panda-llamacpp.service /etc/systemd/system/ && sudo systemctl daemon-reload && sudo systemctl enable panda-llamacpp`
- Stop hook loop was fixed: removed `~/.claude/hooks/stop-self-check.sh` (duplicate of project-level `stop-unified.sh`)

## Files changed (uncommitted)
- `services/panda_nav/__init__.py` — NEW (empty)
- `services/panda_nav/server.py` — NEW (~160 lines)
- `services/panda_nav/requirements.txt` — NEW
- `services/panda_nav/tests/__init__.py` — NEW (empty)
- `services/panda_nav/tests/test_server.py` — NEW (20 tests)
- `services/turbopi-server/main.py` — MODIFIED (+83 lines)
- `services/turbopi-server/tests/__init__.py` — NEW (empty)
- `services/turbopi-server/tests/test_drive_turn.py` — NEW (12 tests)
- `services/annie-voice/robot_tools.py` — MODIFIED (+143 lines)
- `services/annie-voice/tests/test_robot_tools.py` — MODIFIED (+12 tests)
- `start.sh` — MODIFIED (start/stop panda-nav + Annie env vars)
- `docs/RESOURCE-REGISTRY.md` — MODIFIED (panda-nav row + changelog)
- `CLAUDE.md` — MODIFIED (file map)
