⏳ This skill is pending AI review.
Scores will appear once the review pipeline completes.
skill-discovery
Skill lifecycle toolkit — discover new skills from session patterns, then monitor them for degradation with skill-health.py.
Choose how to use this skill
You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.
1. Native installer
This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.
Do not guess an installer command or replace an existing version without reviewing the diff.
2. Complete package recommended
Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.
No complete ProSkills package is published for this listing yet.3. Prompt-only
Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.
Need only the instruction file?
Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.
No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.
// RATINGS
Not yet listed on ClawHub or SkillsMP
// README
skill-discovery v2.0.0
OpenClaw skill lifecycle toolkit — discover new skills from session patterns, then monitor them for degradation.
The Problem
Two things go wrong with agent skills:
- You don't create them. You do the same thing 5 times before realizing "I should automate this."
- They silently break. A skill that worked last month fails when models change, APIs shift, or codebases evolve.
This repo solves both.
What's New in v2
🧠 LCM as a Data Source
Before reading raw JSONL, the skill now queries LCM summaries first. LCM captures compacted history that raw session files lose after compaction — patterns from weeks ago are often only visible there. Uses lcm_grep and lcm_expand_query.
🔴 Operational Anomaly Detection
Three new checks run alongside pattern discovery:
- Camofox tab leaks — sessions that opened browser tabs without closing them
- Workspace file bloat — context files >15KB eating your token budget (MEMORY.md, AGENTS.md, etc.)
- Cron failure patterns — consecutive failures on the same job = broken automation that needs immediate attention
🤖 Subagent Delegation Gap Detection
Identifies sessions where the main agent did too much work inline: >15 tool calls + >3 different tool types + zero sessions_spawn = delegation miss. Flags them as refactor candidates to keep main session context lean.
🔗 Tool Sequence Pattern Matching
Looks for repeated tool-call sequences across sessions (same 3+ tool types in same order, appearing 3+ times). Example: web_fetch → exec → message send repeated 4x = a research-and-report workflow worth scripting into a dedicated skill.
What's Included
🔍 Skill Discovery (SKILL.md)
Analyzes your OpenClaw session history to find:
- Repeated task patterns → New skill candidates
- Re-learned lessons → Rules for AGENTS.md
- Multi-step workflows → Automation opportunities
- Cross-agent struggles → Infrastructure improvements
- Operational anomalies → Leaks, bloat, broken crons
- Delegation gaps → Tasks that should have used subagents
Works as a behavioral skill — no scripts, just session analysis patterns your agent follows.
📊 Skill Health Tracker (skill-health.py)
Lightweight invocation logger that tracks which skills are failing and whether they're getting worse:
# Log results
./skill-health.py log github success
./skill-health.py log github failure --error "gh auth expired"
# Full report
./skill-health.py report
# Degrading skills only (for cron use)
./skill-health.py check
Example output:
Skill Invocations Fail Rate Trend Last Error
--------------------------------------------------------------------------------
github 12 25% ! degrading gh auth token expired
weather 8 0% stable
todoist 5 20% * improving API timeout
Install
cd ~/.openclaw/skills
git clone https://github.com/tuncer-deniz/skill-discovery
chmod +x skill-discovery/skill-health.py
Custom workspace path: If your OpenClaw data lives somewhere other than
~/.openclaw, setCLAWD_WORKSPACE:export CLAWD_WORKSPACE=/path/to/your/workspaceThe skill's session-find commands respect this variable.
Skill Discovery Usage
Manual
Analyze my sessions from the last 7 days and identify skill candidates.
Weekly Cron (Recommended)
{
"name": "weekly-skill-discovery",
"schedule": { "kind": "cron", "expr": "0 10 * * 0", "tz": "America/Edmonton" },
"payload": {
"kind": "agentTurn",
"message": "Run skill discovery analysis on sessions from the last 7 days. Report findings with recommendations."
},
"sessionTarget": "isolated"
}
Skill Health Usage
Log invocations from your scripts
if some_command; then
skill-health.py log my-skill success
else
skill-health.py log my-skill failure --error "$(cat /tmp/last-error.txt)"
fi
Weekly degradation check
{
"name": "weekly-skill-health-check",
"schedule": { "kind": "cron", "expr": "0 9 * * 1" },
"payload": {
"kind": "agentTurn",
"message": "Run skill-health.py check. Report any degrading skills."
},
"sessionTarget": "isolated"
}
Configuration
| Setting | Default | Override |
|---|---|---|
| Data file | ~/.skill-health/data.json | SKILL_HEALTH_DATA env var |
| Workspace | ~/.openclaw | CLAWD_WORKSPACE env var |
| Max entries | 500 (oldest rotated) | Edit MAX_ENTRIES in script |
The Lifecycle
Discovery → Creation → Monitoring → Improvement
↑ |
└─────────────────────────────────────┘
- Discovery finds patterns worth automating
- skill-creator scaffolds the new skill
- Health tracker monitors it in production
- When health degrades → discovery flags it for review
Scoring Guide (Discovery)
| Score | Action |
|---|---|
| 5+ occurrences, >5 min each | Create skill immediately |
| 3-4 occurrences | Add to AGENTS.md |
| 2 occurrences | Note for observation |
Real Discoveries
Patterns that became skills from actual usage:
| Pattern | Frequency | Result |
|---|---|---|
| Debugging cluster startup | 8x/week | exo-cluster-ops skill |
| Looking up config structure | 5x/week | AGENTS.md rule |
| Parsing session logs manually | 4x/week | This skill |
web_fetch → exec → message loop | 4x/week | research-report skill |
Requirements
- OpenClaw
- Python 3.8+ (skill-health.py, no external deps)
Inspired By
The observe → amend → evaluate loop from cognee-skills — stripped down to what most agent setups actually need.
License
MIT
A skill that helps you build more skills, then makes sure they keep working.
// HOW IT'S BUILT
// FILES
2 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.
SKILL.md7.9 KBupstream ↗
--- name: skill-discovery description: Skill lifecycle toolkit — discover new skills from session patterns, then monitor them for degradation with skill-health.py. metadata: { "openclaw": { "emoji": "🔍" } } --- # skill-discovery Automatically discover opportunities to codify repeated workflows into skills, plugins, or rules. ## Overview This skill analyzes your OpenClaw session history to find: - **Repeated task patterns** → Skill candidates - **Re-learned lessons** → AGENTS.md rules - **Multi-step workflows** → Automation opportunities - **Cross-agent struggles** → Shared infrastructure needs - **Operational anomalies** → Leaks, bloat, and broken automation - **Delegation gaps** → Tasks that should have used subagents ## When to Use - Weekly self-improvement review (recommended: schedule as cron) - After a busy week with lots of ad-hoc tasks - When you notice friction in your workflows - Before planning automation improvements ## Manual Run ``` Analyze my sessions from the last 7 days and identify: 1. Repeated task patterns that could become skills 2. Rules I keep re-learning that should be in AGENTS.md 3. Multi-step workflows that could be automated 4. Things that caused the most friction 5. Operational anomalies (tab leaks, file bloat, cron failures) 6. Subagent delegation gaps ``` ## Automated Weekly Check (Cron Setup) ```json { "name": "weekly-skill-discovery", "schedule": { "kind": "cron", "expr": "0 10 * * 0", "tz": "America/Edmonton" }, "payload": { "kind": "agentTurn", "message": "Run skill discovery analysis on sessions from the last 7 days. Report findings with recommendations.", "timeoutSeconds": 600 }, "sessionTarget": "isolated", "delivery": { "mode": "announce" } } ``` ## Analysis Steps ### 0. Query LCM First (New in v2) Before reading raw JSONL, check LCM summaries — they capture compacted history that the raw files no longer contain: ``` lcm_grep pattern="repeated|again|always|every time" ``` Use `lcm_expand_query` to drill into specific patterns found: ``` lcm_expand_query query="repeated workflow friction" prompt="What tasks does the agent do repeatedly that could be automated?" ``` LCM is especially valuable because raw JSONL entries are pruned after compaction — patterns that happened weeks ago are often only visible in LCM summaries. ### 1. Extract Session Data ```bash # Find recent sessions find ~/.openclaw/agents/*/sessions/ -name "*.jsonl" -mtime -7 # Extract user messages jq -r 'select(.type=="message" and .message.role=="user") | .message.content[]? | select(.type=="text") | .text' session.jsonl ``` > **Custom workspace:** If your sessions live elsewhere, set `CLAWD_WORKSPACE` env var: > ```bash > export CLAWD_WORKSPACE=/path/to/your/workspace > find $CLAWD_WORKSPACE/agents/*/sessions/ -name "*.jsonl" -mtime -7 > ``` ### 2. Filter Out Noise Remove automated/system messages: - Cron triggers (`[cron:...`) - Heartbeat prompts (`Read HEARTBEAT.md`) - Pre-compaction flushes - Timestamp prefixes **Heartbeat sessions:** Bucket separately — don't discard entirely. Heartbeat-initiated sessions are valid automation signal (they reveal what the agent monitors and how), but they dominate the user message corpus (~70% of sessions in a typical week). Mixing them into organic request clustering drowns out real user patterns. Analyze them in a dedicated "Automation Health" section instead. ### 3. Cluster Patterns Group similar requests by: - **Action verbs** (create, fix, analyze, search, deploy) - **Target objects** (config, skill, cron, agent, build) - **Context** (project, tool, service) #### Tool Sequence Pattern Matching (New in v2) Look for repeated tool-call sequences — the same 3+ tool types in the same order appearing 3+ times across sessions: ```bash # Extract tool call sequences per session jq -r 'select(.type=="tool_use") | .name' session.jsonl | paste - - - | sort | uniq -c | sort -rn ``` Example: `web_fetch → exec → message send` appearing 4 times = a research-and-report workflow worth scripting into a dedicated skill. Flag any sequence appearing 3+ times as an automation candidate. ### 4. Score Candidates Prioritize by: `frequency × estimated_time_saved` | Score | Action | |-------|--------| | 5+ occurrences, >5 min each | Create skill immediately | | 3-4 occurrences | Add to AGENTS.md as rule | | 2 occurrences | Note for observation | ### 5. Operational Anomaly Detection (New in v2) Check for operational problems that silently degrade agent performance: #### Camofox Tab Leaks ```bash # Sessions that opened tabs without closing them jq -r 'select(.type=="tool_use") | .name' session.jsonl | grep -E "camofox_(create_tab|close_tab)" ``` If `camofox_create_tab` count exceeds `camofox_close_tab` count in a session → tab leak. Browsers accumulate, memory climbs, bot-detection fingerprints diverge. **Remediation:** When a session is flagged as a chronic tab-leaker (2+ consecutive runs with unclosed tabs): 1. Identify the cron job name from the session metadata 2. Link to its instruction/skill file for editing 3. Add `camofox_close_tab` to the teardown path in the skill/cron instructions 4. Run `camofox-cleanup.sh` (from openclaw-optimization) to close leaked tabs immediately 5. If the cron runs nightly, verify the fix on the next run — don't wait for next week's report #### Workspace File Bloat ```bash wc -c ~/.openclaw/MEMORY.md ~/.openclaw/AGENTS.md ~/.openclaw/BRAIN.md 2>/dev/null ``` Files >15KB are eating context budget every session. Flag for pruning: - `MEMORY.md` >15KB → archive old entries - `AGENTS.md` >15KB → split into domain files - `BRAIN.md` >10KB → trim completed tasks #### Cron Failure Patterns ```bash # Check for consecutive failures on same job grep "FAILED\|error\|exit code [^0]" ~/.openclaw/cron-logs/*.log | \ awk -F: '{print $1}' | sort | uniq -c | sort -rn ``` 2+ consecutive failures on the same job = broken automation. Surface immediately, don't wait for weekly review. ### 6. Subagent Delegation Gap Detection (New in v2) Identify sessions where the main agent did too much work inline: ```bash # Sessions with high tool diversity but no subagent spawn jq -s ' group_by(.session_id)[] | { session: .[0].session_id, tool_calls: [.[] | select(.type=="tool_use")] | length, tool_types: [.[] | select(.type=="tool_use") | .name] | unique | length, spawned: ([.[] | select(.type=="tool_use" and .name=="sessions_spawn")] | length) } | select(.tool_calls > 15 and .tool_types > 3 and .spawned == 0) ' *.jsonl ``` Sessions with >15 tool calls, >3 different tool types, and zero `sessions_spawn` = delegation miss. Flag these as candidates for subagent refactoring — the main session context likely bloated unnecessarily. **Cron/organic split:** Before flagging, check if the session was cron-initiated (look for `[cron:` prefix or `cron` in session metadata). Cron-automated tasks (bookmark researcher, signal runner, intel dashboard) legitimately run 20-50+ tools inline by design — they're isolated sessions whose context dies after the run. Only flag organic (user-initiated) sessions as delegation gaps. ### 7. Cross-Agent Analysis (Multi-Node) If running multiple agents, SSH to other nodes: ```bash ssh luna@<IP> 'find ~/.openclaw/agents/*/sessions/ -name "*.jsonl" -mtime -7' ssh atlas@<IP> 'find ~/.openclaw/agents/*/sessions/ -name "*.jsonl" -mtime -7' ``` Issues appearing across multiple agents = highest priority. ## Output Format ```markdown ## Skill Discovery Report — Week of YYYY-MM-DD ### 🎯 Skill Candidates (create these) 1. **[name]** — [pattern description] — [frequency]x this week ### 📝 Rule Candidates (add to AGENTS.md) 1. **[rule]** — [why needed] — [frequency]x re-learned ### ⚙️ Automation Opportunities 1. **[workflow]** — [steps that could be scripted] ### 🔴 Operational Anomalies 1. **[issue type]** — [details] — [severity] ### 🤖 Delegation Gaps 1. **[session]** — [N tool calls, M tool types, 0 spawns] — [refactor candREADME.mdupstream ↗
Contents are not inlined in the catalog. Open the upstream file.
Plain-text copy, no login: /skill-bundles/tuncer-deniz-skill-discovery.md