Agent Audit
Scan your entire OpenClaw setup and get actionable cost/performance recommendations.
What This Skill Does
- Scans config — reads OpenClaw config to map models to agents/tasks
- Analyzes cron history — checks every cron job's model, token usage, runtime, success rate
- Classifies tasks — determines complexity level of each task
- Calculates costs — per agent, per cron, per task type using provider pricing
- Recommends changes — with confidence levels and risk warnings
- Generates report — markdown report with specific savings estimates
Running the Audit
python3 {baseDir}/scripts/audit.py
Options:
python3 {baseDir}/scripts/audit.py --format markdown # Full report (default)
python3 {baseDir}/scripts/audit.py --format summary # Quick summary only
python3 {baseDir}/scripts/audit.py --dry-run # Show what would be analyzed
python3 {baseDir}/scripts/audit.py --output /path/to/report.md # Save to file
How It Works
Phase 1: Discovery
- Read OpenClaw config (
~/.openclaw/openclaw.json or similar)
- List all cron jobs and their configurations
- List all agents and their default models
- Detect provider (Anthropic, OpenAI, Google, xAI) from model names
Phase 2: History Analysis
- Pull cron job run history (last 7 days by default)
- Calculate per-job: avg tokens, avg runtime, success rate, model used
- Pull session history where available
- Calculate total token spend by model tier
Phase 3: Task Classification
Classify each task into complexity tiers:
| Tier |
Examples |
Recommended Models |
| Simple |
Health checks, status reports, reminders, notifications |
Cheapest tier (Haiku, GPT-4o-mini, Flash, Grok-mini) |
| Medium |
Content drafts, research, summarization, data analysis |
Mid tier (Sonnet, GPT-4o, Pro, Grok) |
| Complex |
Coding, architecture, security review, nuanced writing |
Top tier (Opus, GPT-4.5, Ultra, Grok-2) |
Classification signals:
- Simple: Short output (<500 tokens), low thinking requirement, repetitive pattern, status/health tasks
- Medium: Medium output, some reasoning needed, creative but templated, research tasks
- Complex: Long output, multi-step reasoning, code generation, security-critical, tasks that previously failed on weaker models
Phase 4: Recommendations
For each task where the model tier doesn't match complexity:
⚠️ RECOMMENDATION: Downgrade "Knox Bot Health Check" from opus to haiku
Current: anthropic/claude-opus-4 ($15/M input, $75/M output)
Suggested: anthropic/claude-haiku ($0.25/M input, $1.25/M output)
Reason: Simple status check averaging 300 output tokens
Estimated savings: $X.XX/month
Risk: LOW — task is simple pattern matching
Confidence: HIGH
Safety Rules — NEVER Recommend Downgrading:
- Coding/development tasks
- Security reviews or audits
- Tasks that have previously failed on weaker models
- Tasks where the user explicitly chose a higher model
- Complex multi-step reasoning tasks
- Anything the user flagged as critical
Phase 5: Report Generation
Output a clean markdown report with:
- Overview — total agents, crons, monthly spend estimate
- Per-agent breakdown — model, usage, cost
- Per-cron breakdown — model, frequency, avg tokens, cost
- Recommendations — sorted by savings potential
- Total potential savings — monthly estimate
- One-liner config changes — exact model strings to swap
Model Pricing Reference
See references/model-pricing.md for current pricing across all providers.
Update this file when prices change.
Task Classification Details
See references/task-classification.md for detailed heuristics
on how tasks are classified into complexity tiers.
Important Notes
- This skill is read-only — it never changes your config automatically
- All recommendations include risk levels and confidence scores
- When unsure about a task's complexity, it defaults to keeping the current model
- The audit should be re-run periodically (monthly) as usage patterns change
- Token counts are estimates based on cron history — actual costs depend on your provider's billing
1---2name: agent-audit3description: Audit your AI agent setup for performance, cost, and ROI. Scans OpenClaw config, cron jobs, session history, and model usage to find waste and recommend optimizations. Works with any model provider (Anthropic, OpenAI, Google, xAI, etc.). Use when: (1) user says "audit my agents", "optimize my costs", "am I overspending on AI", "check my model usage", "agent audit", "cost optimization", (2) user wants to know which cron jobs are expensive vs cheap, (3) user wants model-task fit recommendations, (4) user wants ROI analysis of their agent setup, (5) user says "where am I wasting tokens".4---56# Agent Audit78Scan your entire OpenClaw setup and get actionable cost/performance recommendations.910## What This Skill Does11121. **Scans config** — reads OpenClaw config to map models to agents/tasks132. **Analyzes cron history** — checks every cron job's model, token usage, runtime, success rate143. **Classifies tasks** — determines complexity level of each task154. **Calculates costs** — per agent, per cron, per task type using provider pricing165. **Recommends changes** — with confidence levels and risk warnings176. **Generates report** — markdown report with specific savings estimates1819## Running the Audit2021```bash22python3 {baseDir}/scripts/audit.py23```2425Options:26```bash27python3 {baseDir}/scripts/audit.py --format markdown # Full report (default)28python3 {baseDir}/scripts/audit.py --format summary # Quick summary only29python3 {baseDir}/scripts/audit.py --dry-run # Show what would be analyzed30python3 {baseDir}/scripts/audit.py --output /path/to/report.md # Save to file31```3233## How It Works3435### Phase 1: Discovery36- Read OpenClaw config (`~/.openclaw/openclaw.json` or similar)37- List all cron jobs and their configurations38- List all agents and their default models39- Detect provider (Anthropic, OpenAI, Google, xAI) from model names4041### Phase 2: History Analysis42- Pull cron job run history (last 7 days by default)43- Calculate per-job: avg tokens, avg runtime, success rate, model used44- Pull session history where available45- Calculate total token spend by model tier4647### Phase 3: Task Classification48Classify each task into complexity tiers:4950| Tier | Examples | Recommended Models |51|------|----------|-------------------|52| **Simple** | Health checks, status reports, reminders, notifications | Cheapest tier (Haiku, GPT-4o-mini, Flash, Grok-mini) |53| **Medium** | Content drafts, research, summarization, data analysis | Mid tier (Sonnet, GPT-4o, Pro, Grok) |54| **Complex** | Coding, architecture, security review, nuanced writing | Top tier (Opus, GPT-4.5, Ultra, Grok-2) |5556Classification signals:57- **Simple**: Short output (<500 tokens), low thinking requirement, repetitive pattern, status/health tasks58- **Medium**: Medium output, some reasoning needed, creative but templated, research tasks59- **Complex**: Long output, multi-step reasoning, code generation, security-critical, tasks that previously failed on weaker models6061### Phase 4: Recommendations62For each task where the model tier doesn't match complexity:6364```65⚠️ RECOMMENDATION: Downgrade "Knox Bot Health Check" from opus to haiku66 Current: anthropic/claude-opus-4 ($15/M input, $75/M output)67 Suggested: anthropic/claude-haiku ($0.25/M input, $1.25/M output)68 Reason: Simple status check averaging 300 output tokens69 Estimated savings: $X.XX/month70 Risk: LOW — task is simple pattern matching71 Confidence: HIGH72```7374### Safety Rules — NEVER Recommend Downgrading:75- Coding/development tasks76- Security reviews or audits77- Tasks that have previously failed on weaker models78- Tasks where the user explicitly chose a higher model79- Complex multi-step reasoning tasks80- Anything the user flagged as critical8182### Phase 5: Report Generation83Output a clean markdown report with:841. **Overview** — total agents, crons, monthly spend estimate852. **Per-agent breakdown** — model, usage, cost863. **Per-cron breakdown** — model, frequency, avg tokens, cost874. **Recommendations** — sorted by savings potential885. **Total potential savings** — monthly estimate896. **One-liner config changes** — exact model strings to swap9091## Model Pricing Reference9293See [references/model-pricing.md](references/model-pricing.md) for current pricing across all providers.94Update this file when prices change.9596## Task Classification Details9798See [references/task-classification.md](references/task-classification.md) for detailed heuristics99on how tasks are classified into complexity tiers.100101## Important Notes102103- This skill is **read-only** — it never changes your config automatically104- All recommendations include risk levels and confidence scores105- When unsure about a task's complexity, it defaults to keeping the current model106- The audit should be re-run periodically (monthly) as usage patterns change107- Token counts are estimates based on cron history — actual costs depend on your provider's billing