# TOOLS.md

## Coding Agents

**Rules:** Never write code yourself when a coding agent can do it. Use the blocking wrappers — one call, no polling. If agent fails, then fall back and explain why. Agents read CLAUDE.md/CODEX.md from workspace for environment context.

**Claude Code** (default):
```
bash pty:true timeout:600 workdir:~/.openclaw/workspace command:"claude-run ~/.openclaw/workspace YOUR PROMPT"
```

**Codex** (when requested or for PR reviews):
```
bash pty:true timeout:600 workdir:~/.openclaw/workspace command:"cd ~/.openclaw/workspace && codex exec --full-auto YOUR PROMPT"
```

Polling (if backgrounded): wait 60s, then max once/min. Joshua pays per API call.

---

## YouTube Transcripts

```bash
~/.openclaw/workspace/.venv/bin/python ~/.openclaw/workspace/grab-transcript.py "<youtube-url>"
```

Output: `~/.openclaw/workspace/youtube-transcripts/<video-id>.md`
Supports `--lang es` for other languages. Requires cookies at `cookies.txt` (YouTube blocks VPS IPs without them).

**If you get bot/cookie errors**, tell Joshua to re-export cookies from his Mac:
```
yt-dlp --cookies-from-browser chrome --cookies /tmp/yt-cookies.txt --skip-download --no-playlist 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
scp /tmp/yt-cookies.txt openclaw@100.67.133.40:~/.openclaw/workspace/cookies.txt
```

Don't try: youtube-transcript-api (IP-blocked), Apify (unreliable), --cookies-from-browser (no browser on VPS).

---

## Session Management

**Clear session to save tokens** — when context gets large or conversation topic changes completely:
1. Save anything important to `memory/` or MEMORY.md first
2. Run: `bash command:"~/.local/bin/clear-session"`
3. You'll start fresh on the next message, re-reading all boot files

---

## GitHub
- CLI: `~/.local/bin/gh` (account: junofoxbot, HTTPS auth)
- New repo: `~/.local/bin/gh repo create junofoxbot/REPO --public --clone`

---

## ElevenLabs TTS
- Venv: `source ~/elevenlabs-env/bin/activate`
- Voices: Adam `pNInz6obpgDQGcFmaJgB`, Rachel `21m00Tcm4TlvDq8ikWAM`
- API key in env as `ELEVENLABS_API_KEY`

---

## Apify
- Key: `$APIFY_API_KEY (set in .env)` (env: `APIFY_API_KEY`)
- Note: YouTube transcript actors are unreliable, use grab-transcript.py instead