Skip to content

[Feature Request] Skill lifecycle hooks (skill:read, skill:complete) #15695

@walterpembery

Description

@walterpembery

Summary

Add hook events that fire when the agent reads and completes using a skill, enabling automated skill quality monitoring and optimization workflows.

Motivation

I'm building a skill optimizer that automatically reviews skill executions and suggests improvements. Currently, I have to scan session transcripts looking for SKILL.md file reads to detect skill usage — this is inefficient and misses the completion boundary.

With proper skill lifecycle hooks, I could:

  1. Know exactly when a skill is invoked
  2. Know when the agent has finished using that skill's guidance
  3. Trigger quality review/optimization workflows automatically
  4. Track skill usage metrics accurately

Proposed Events

skill:read

Fires when agent reads a SKILL.md file (detected via read tool + path matching).

{
  type: "skill",
  action: "read",
  context: {
    skillName: string,      // e.g. "sonos", "github"
    skillPath: string,      // full path to SKILL.md
    sessionKey: string,
    timestamp: Date
  }
}

skill:complete

Fires when the agent completes a task that was guided by a skill. This is trickier — could be:

  • Explicit signal from agent (e.g. thinking/tool call pattern)
  • Heuristic: N turns after skill:read without re-reading
  • Turn boundary after skill-related tool calls
{
  type: "skill",
  action: "complete",
  context: {
    skillName: string,
    skillPath: string,
    sessionKey: string,
    startTimestamp: Date,
    endTimestamp: Date,
    toolsUsed: string[],    // tools called while skill was active
    success: boolean        // if determinable
  }
}

Use Case

// hooks/skill-optimizer/handler.js
export default async function(event) {
  if (event.type !== 'skill') return;
  
  if (event.action === 'complete') {
    // Queue skill for optimization review
    await triggerSkillReview({
      skill: event.context.skillName,
      sessionKey: event.context.sessionKey,
      duration: event.context.endTimestamp - event.context.startTimestamp
    });
  }
}

Current Workaround

Daily cron job scans session transcripts for SKILL.md reads, then triggers reviews. This is:

  • Delayed (not real-time)
  • Resource-intensive (parsing all transcripts)
  • Imprecise (can't detect completion boundary)

Related

Skill hooks would complement tool hooks — skills are higher-level workflows composed of multiple tool calls.

Environment

  • OpenClaw version: 2026.2.1
  • Use case: Automated skill quality optimization system

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions