Record Class SkillUsageRecord

java.lang.Object
java.lang.Record
io.agentscope.harness.agent.skill.curator.SkillUsageRecord

public record SkillUsageRecord(String createdBy, long useCount, long viewCount, long patchCount, Instant lastUsedAt, Instant lastViewedAt, Instant lastPatchedAt, Instant createdAt, SkillUsageRecord.State state, boolean pinned, Instant archivedAt, Instant promotedAt, String promotedBy, String sourceSessionId, List<String> environments) extends Record
Per-skill operational telemetry plus enterprise-staging audit fields. Persisted as a single JSON object inside the workspace sidecar skills/.usage.json (one record per skill, keyed by skill name).

Field naming intentionally mirrors hermes-agent's tools/skill_usage.py sidecar shape (snake_case via JsonProperty) so the two ecosystems can share telemetry files if a user copies skills between them.

createdBy provenance values:

  • null — user-authored / hub-installed / pre-existing skill (NOT eligible for curator auto-management or canary gating)
  • "agent-draft" — agent created via skill_manage but not yet promoted
  • "agent" — agent-created skill that has been promoted to the live skills root
  • Constructor Details

    • SkillUsageRecord

      public SkillUsageRecord(String createdBy, long useCount, long viewCount, long patchCount, Instant lastUsedAt, Instant lastViewedAt, Instant lastPatchedAt, Instant createdAt, SkillUsageRecord.State state, boolean pinned, Instant archivedAt, Instant promotedAt, String promotedBy, String sourceSessionId, List<String> environments)
      Creates an instance of a SkillUsageRecord record class.
      Parameters:
      createdBy - the value for the createdBy record component
      useCount - the value for the useCount record component
      viewCount - the value for the viewCount record component
      patchCount - the value for the patchCount record component
      lastUsedAt - the value for the lastUsedAt record component
      lastViewedAt - the value for the lastViewedAt record component
      lastPatchedAt - the value for the lastPatchedAt record component
      createdAt - the value for the createdAt record component
      state - the value for the state record component
      pinned - the value for the pinned record component
      archivedAt - the value for the archivedAt record component
      promotedAt - the value for the promotedAt record component
      promotedBy - the value for the promotedBy record component
      sourceSessionId - the value for the sourceSessionId record component
      environments - the value for the environments record component
  • Method Details

    • defaults

      public static SkillUsageRecord defaults()
      Default record for a newly-tracked skill (just appeared on disk).
    • newAgentDraft

      public static SkillUsageRecord newAgentDraft(String sessionId)
      Default record for a freshly created agent draft.
    • ofJson

      public static SkillUsageRecord ofJson(String createdBy, Long useCount, Long viewCount, Long patchCount, Instant lastUsedAt, Instant lastViewedAt, Instant lastPatchedAt, Instant createdAt, SkillUsageRecord.State state, Boolean pinned, Instant archivedAt, Instant promotedAt, String promotedBy, String sourceSessionId, List<String> environments)
      Jackson constructor for tolerant decoding (missing fields default to null/0/false).
    • latestActivityAt

      public Instant latestActivityAt()
      Latest of last_used_at, last_viewed_at, last_patched_at.
    • activityCount

      public long activityCount()
      Sum of use_count, view_count, patch_count.
    • isAgentCreated

      public boolean isAgentCreated()
      Whether this skill is eligible for curator auto-management / canary visibility filtering.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • createdBy

      public String createdBy()
      Returns the value of the createdBy record component.
      Returns:
      the value of the createdBy record component
    • useCount

      public long useCount()
      Returns the value of the useCount record component.
      Returns:
      the value of the useCount record component
    • viewCount

      public long viewCount()
      Returns the value of the viewCount record component.
      Returns:
      the value of the viewCount record component
    • patchCount

      public long patchCount()
      Returns the value of the patchCount record component.
      Returns:
      the value of the patchCount record component
    • lastUsedAt

      public Instant lastUsedAt()
      Returns the value of the lastUsedAt record component.
      Returns:
      the value of the lastUsedAt record component
    • lastViewedAt

      public Instant lastViewedAt()
      Returns the value of the lastViewedAt record component.
      Returns:
      the value of the lastViewedAt record component
    • lastPatchedAt

      public Instant lastPatchedAt()
      Returns the value of the lastPatchedAt record component.
      Returns:
      the value of the lastPatchedAt record component
    • createdAt

      public Instant createdAt()
      Returns the value of the createdAt record component.
      Returns:
      the value of the createdAt record component
    • state

      public SkillUsageRecord.State state()
      Returns the value of the state record component.
      Returns:
      the value of the state record component
    • pinned

      public boolean pinned()
      Returns the value of the pinned record component.
      Returns:
      the value of the pinned record component
    • archivedAt

      public Instant archivedAt()
      Returns the value of the archivedAt record component.
      Returns:
      the value of the archivedAt record component
    • promotedAt

      public Instant promotedAt()
      Returns the value of the promotedAt record component.
      Returns:
      the value of the promotedAt record component
    • promotedBy

      public String promotedBy()
      Returns the value of the promotedBy record component.
      Returns:
      the value of the promotedBy record component
    • sourceSessionId

      public String sourceSessionId()
      Returns the value of the sourceSessionId record component.
      Returns:
      the value of the sourceSessionId record component
    • environments

      public List<String> environments()
      Returns the value of the environments record component.
      Returns:
      the value of the environments record component