Class SkillUsageStore

java.lang.Object
io.agentscope.harness.agent.skill.curator.SkillUsageStore

public class SkillUsageStore extends Object
Sidecar telemetry store for per-skill usage and provenance.

Persists SkillUsageRecord instances (one per skill). The default backend stores all records in a single JSON file at <workspace>/skills/.usage.json; when constructed with a BaseStore, each skill is stored under ["skills", "usage"] with CAS updates.

Provenance gate: counter mutators (bumpView/bumpUse/bumpPatch) silently skip skills that are not agent-created. This avoids polluting telemetry for bundled / hub-installed / user-authored skills, matching the hermes-agent skill_usage._mutate behavior.

  • Field Details

    • DEFAULT_RELATIVE_PATH

      public static final String DEFAULT_RELATIVE_PATH
      Default workspace-relative path for the filesystem sidecar.
      See Also:
  • Constructor Details

  • Method Details

    • baseStore

      public static SkillUsageStore baseStore(BaseStore store)
      Creates a store backed by a distributed BaseStore (one key per skill).
    • load

      public Map<String,SkillUsageRecord> load()
      Load the entire sidecar map. Returns an empty map on missing / unreadable / corrupt.
    • save

      public void save(Map<String,SkillUsageRecord> data)
      Persist the entire sidecar map. Best-effort on failure.
    • get

      public Optional<SkillUsageRecord> get(String name)
      Read a single record by name.
    • bumpView

      public void bumpView(String name)
    • bumpUse

      public void bumpUse(String name)
    • bumpPatch

      public void bumpPatch(String name)
    • markAgentDraft

      public void markAgentDraft(String name, String sessionId)
      Tag a freshly-created agent draft (called from SkillManageTool.create).
    • markAgentCreated

      public void markAgentCreated(String name, String reviewerId, List<String> environments)
      Mark a skill as a fully agent-created (i.e. promoted from draft). Used by SkillManageTool when autoPromote=true (no staging) and by the future promotion gate.
    • setState

      public void setState(String name, SkillUsageRecord.State newState)
    • setPinned

      public void setPinned(String name, boolean pinned)
    • forget

      public void forget(String name)
      Drop the record entirely. Called when a skill is archived / deleted permanently.
    • agentCreatedReport

      public List<Map.Entry<String,SkillUsageRecord>> agentCreatedReport()
      All records whose createdBy is non-null (i.e. agent-authored, draft or live).