/** * Cross-session skill usage, persisted at `~/.moxxy/skills/.meta/usage.json` * (next to the agent-created audit log). A forward-going aggregate keyed by * skill NAME: each session folds its own `skill_invoked` / `skill_created` * events and merges the delta in on shutdown (see `@moxxy/plugin-usage-stats`). * Purely additive `invocations` counter plus first-`createdAt` / latest- * `lastInvokedAt` timestamps — a session's contribution is added once and the * file stays a monotone sum. * * KNOWN LIMITATION (as of this file's introduction): the only site that emits * `skill_invoked` today is the `load_skill` tool (reason `'load_skill_tool'` — * see `packages/core/src/skills/synthesize.ts`). The event type also carries * `'trigger_match' | 'classifier' | 'manual'` reasons, but nothing emits those * yet. So `invocations` counts ONLY explicit `load_skill` calls for now. When * trigger-match / classifier emission lands later, this same file simply starts * counting more — no format change required. * * Like `usage-stats.ts`, this is best-effort: a missing or malformed file reads * as empty, and a write failure never blocks shutdown. */ export interface SkillUsage { /** Total `load_skill`-driven invocations recorded across all sessions. */ readonly invocations: number; /** ISO timestamp of the most recent recorded invocation, if any. */ readonly lastInvokedAt?: string; /** ISO timestamp of when this skill was first agent-synthesized, if seen. */ readonly createdAt?: string; } export interface SkillUsageFile { readonly version: 1; /** ISO timestamp of the last merge. */ readonly updatedAt: string; /** Per-skill-name lifetime usage. */ readonly skills: Record; } /** * One session's contribution for a single skill: how many invocations it saw, * the latest invocation timestamp within the run, and — if the skill was * created during the run — its creation timestamp. */ export interface SkillUsageDelta { readonly invocations: number; readonly lastInvokedAt?: string; readonly createdAt?: string; } export declare function skillsUsagePath(): string; /** * Read the skill usage aggregate. Returns an empty file when missing or * unparseable — skill usage is an optional, non-load-blocking layer. */ export declare function loadSkillUsage(filePath?: string): Promise; /** * Merge a session's per-skill delta into the persisted aggregate and write it * back. Reads the current file, adds each `invocations` field-wise, keeps the * earliest `createdAt` and the latest `lastInvokedAt`, and writes atomically. * Returns the updated file. * * Best-effort: a write failure logs to stderr but does not throw — losing one * session's stats must never block shutdown. */ export declare function mergeSkillUsage(delta: Record, filePath?: string): Promise; //# sourceMappingURL=skill-usage.d.ts.map