Tools
Clawdrill
A OpenClaw plugin that turns any group chat into a Strava fitness competition.
Install
openclaw plugins install /path/to/clawdrill
README
# ClawDrill
A [OpenClaw](https://openclaw.dev) plugin that turns any group chat into a Strava fitness competition. ClawDrill acts as a charismatic coach โ tracking active minutes, running a live leaderboard, and trash-talking the bottom of the pack with love.
## Features
- **Auto-created agent** โ installs itself as a `clawdrill` agent on first gateway start
- **Group leaderboard** โ ranks members by active minutes in the last 7 days (from Strava)
- **Auto-sync** โ refreshes Strava data in the background when it goes stale
- **Secure token storage** โ Strava OAuth2 tokens are encrypted at rest with AES-256-GCM
- **Editable persona** โ change the coach's voice without touching any code
## Requirements
- [OpenClaw](https://openclaw.dev) gateway
- A [Strava API application](https://www.strava.com/settings/api) (free)
## Installation
```bash
openclaw plugins install /path/to/clawdrill
```
For local development, use `--link` so OpenClaw references the folder directly instead of copying it:
```bash
openclaw plugins install --link /path/to/clawdrill
```
## First-time setup
**Step 1 โ Create a Strava app (once, by the bot owner)**
1. Go to [https://www.strava.com/settings/api](https://www.strava.com/settings/api) and create an application
2. Note your **Client ID** and **Client Secret**
**Step 2 โ Configure ClawDrill in chat**
Send the credentials to the ClawDrill agent in chat:
> Set up Strava: client ID is `12345`, client secret is `abc...xyz`
The first person to do this becomes the **admin** โ their sender ID is stored and only they can update the credentials later. No config file editing needed.
**Step 3 โ Each competitor connects their Strava account**
Each user completes the Strava OAuth flow to get their personal `refresh_token`, then shares it in chat:
> Connect my Strava: `abc...xyz`
ClawDrill calls `clawdrill_connect_strava` and immediately syncs their activities.
## Customization
### Coach persona
Edit [`persona/coach.txt`](persona/coach.txt) to change the coach's personality, rules, and tone. Plain text โ no code required. Restart the gateway to apply changes.
### Settings
Edit [`clawdrill.config.ts`](clawdrill.config.ts):
| Setting | Default | Description |
|---|---|---|
| `STALE_THRESHOLD_MINUTES` | `30` | How long before Strava data is re-synced automatically |
| `PERSONA_FILE` | `./persona/coach.txt` | Path to the coach persona file |
## Project structure
```
clawdrill/
โโโ index.ts # Plugin entry point โ hooks and tools
โโโ clawdrill.config.ts # User-editable settings
โโโ persona/
โ โโโ coach.txt # Coach personality (edit freely)
โโโ src/
โโโ crypto.ts # AES-256-GCM token encryption
โโโ storage.ts # Data model and file I/O
โโโ strava.ts # Strava OAuth2 and activities API
โโโ leaderboard.ts # Leaderboard logic and formatting
```
## Available tools
| Tool | Description |
|---|---|
| `clawdrill_setup` | Save Strava app credentials โ first caller becomes admin, only they can change them later |
| `clawdrill_save_name` | Save a member's display name |
| `clawdrill_connect_strava` | Connect a Strava account via refresh token |
| `clawdrill_sync_activities` | Manually refresh Strava data (`me` or `all`) |
## Security
- Strava tokens and the app client secret are encrypted with AES-256-GCM before being written to disk
- The encryption key is stored at `{stateDir}/clawdrill/.key` with `0o600` permissions
- Credentials are entered via chat and never stored in config files
- Group data files are written with `0o600` permissions via OpenClaw's atomic file writer
## License
MIT
tools
Comments
Sign in to leave a comment