|
| 1 | +--- |
| 2 | +name: tool-description-optimizer |
| 3 | +version: "1.0" |
| 4 | +category: openclaw-native |
| 5 | +description: Analyzes skill descriptions for trigger quality — scores clarity, keyword density, and specificity, then suggests rewrites that improve discovery accuracy. |
| 6 | +stateful: true |
| 7 | +--- |
| 8 | + |
| 9 | +# Tool Description Optimizer |
| 10 | + |
| 11 | +## What it does |
| 12 | + |
| 13 | +A skill's description is its only discovery mechanism. If the description is vague, overlapping, or keyword-poor, the agent won't trigger it — or worse, will trigger the wrong skill. Tool Description Optimizer analyzes every installed skill's description for trigger quality and suggests concrete rewrites. |
| 14 | + |
| 15 | +Inspired by OpenLobster's tool-description scoring layer, which penalizes vague descriptions and rewards keyword-rich, action-specific ones. |
| 16 | + |
| 17 | +## When to invoke |
| 18 | + |
| 19 | +- After installing new skills — check if descriptions are trigger-ready |
| 20 | +- When a skill isn't firing when expected — diagnose whether the description is the problem |
| 21 | +- Periodically to audit all descriptions for quality drift |
| 22 | +- Before publishing a skill — polish the description for discoverability |
| 23 | + |
| 24 | +## How it works |
| 25 | + |
| 26 | +### Scoring dimensions (5 metrics, 0–10 each) |
| 27 | + |
| 28 | +| Metric | What it measures | Weight | |
| 29 | +|---|---|---| |
| 30 | +| Clarity | Single clear purpose, no ambiguity | 2x | |
| 31 | +| Specificity | Action verbs, concrete nouns vs. vague terms | 2x | |
| 32 | +| Keyword density | Trigger-relevant keywords per sentence | 1.5x | |
| 33 | +| Uniqueness | Low overlap with other installed skill descriptions | 1.5x | |
| 34 | +| Length | Optimal range (15–40 words) — too short = vague, too long = diluted | 1x | |
| 35 | + |
| 36 | +### Quality grades |
| 37 | + |
| 38 | +| Grade | Score range | Meaning | |
| 39 | +|---|---|---| |
| 40 | +| A | 8.0–10.0 | Excellent — high trigger accuracy expected | |
| 41 | +| B | 6.0–7.9 | Good — minor improvements possible | |
| 42 | +| C | 4.0–5.9 | Fair — likely to miss triggers or overlap | |
| 43 | +| D | 2.0–3.9 | Poor — needs rewrite | |
| 44 | +| F | 0.0–1.9 | Failing — will not trigger reliably | |
| 45 | + |
| 46 | +## How to use |
| 47 | + |
| 48 | +```bash |
| 49 | +python3 optimize.py --scan # Score all installed skills |
| 50 | +python3 optimize.py --scan --grade C # Only show skills graded C or below |
| 51 | +python3 optimize.py --skill <name> # Deep analysis of a single skill |
| 52 | +python3 optimize.py --suggest <name> # Generate rewrite suggestions |
| 53 | +python3 optimize.py --compare "desc A" "desc B" # Compare two descriptions |
| 54 | +python3 optimize.py --status # Last scan summary |
| 55 | +python3 optimize.py --format json # Machine-readable output |
| 56 | +``` |
| 57 | + |
| 58 | +## Procedure |
| 59 | + |
| 60 | +**Step 1 — Run a full scan** |
| 61 | + |
| 62 | +```bash |
| 63 | +python3 optimize.py --scan |
| 64 | +``` |
| 65 | + |
| 66 | +Review the scorecard. Focus on skills graded C or below — these are the ones most likely to cause trigger failures. |
| 67 | + |
| 68 | +**Step 2 — Get rewrite suggestions for low-scoring skills** |
| 69 | + |
| 70 | +```bash |
| 71 | +python3 optimize.py --suggest <skill-name> |
| 72 | +``` |
| 73 | + |
| 74 | +The optimizer generates 2–3 alternative descriptions with predicted score improvements. |
| 75 | + |
| 76 | +**Step 3 — Compare alternatives** |
| 77 | + |
| 78 | +```bash |
| 79 | +python3 optimize.py --compare "original description" "suggested rewrite" |
| 80 | +``` |
| 81 | + |
| 82 | +Side-by-side scoring shows exactly which metrics improved. |
| 83 | + |
| 84 | +**Step 4 — Apply the best rewrite** |
| 85 | + |
| 86 | +Edit the skill's `SKILL.md` frontmatter `description:` field with the chosen rewrite. |
| 87 | + |
| 88 | +## Vague word penalties |
| 89 | + |
| 90 | +These words score 0 on specificity — they say nothing actionable: |
| 91 | + |
| 92 | +`helps`, `manages`, `handles`, `deals with`, `works with`, `does stuff`, `various`, `things`, `general`, `misc`, `utility`, `tool for`, `assistant for` |
| 93 | + |
| 94 | +## Strong trigger keywords (examples) |
| 95 | + |
| 96 | +`scans`, `detects`, `validates`, `generates`, `audits`, `monitors`, `checks`, `reports`, `fixes`, `migrates`, `syncs`, `schedules`, `blocks`, `scores`, `diagnoses` |
| 97 | + |
| 98 | +## State |
| 99 | + |
| 100 | +Scan results and per-skill scores stored in `~/.openclaw/skill-state/tool-description-optimizer/state.yaml`. |
| 101 | + |
| 102 | +Fields: `last_scan_at`, `skill_scores` list, `scan_history`. |
| 103 | + |
| 104 | +## Notes |
| 105 | + |
| 106 | +- Does not modify any skill files — analysis and suggestions only |
| 107 | +- Uniqueness scoring uses Jaccard similarity against all other installed descriptions |
| 108 | +- Length scoring uses a bell curve centered at 25 words (optimal) |
| 109 | +- Rewrite suggestions are heuristic-based, not LLM-generated — deterministic and fast |
0 commit comments