agentleFS
scolladonscolladon/craft/skills/metrics/SKILL.md

metrics

Skill2 starsChanged 34 days agoMITView on GitHub

Mine transcript data for the current repo and report token usage, cost, cache performance, and model-routing recommendations. Triggers — "craft:metrics", "show usage metrics", "mine transcripts", "report token cost", "usage report for this repo".

21 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use docgen, knowledge-graph and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • prsolansSkill

    docgen

    Generate professional contract/agreement PDFs (and .docx CLM templates) from a declarative YAML config using the yaml-doc-generator tool ("docgen"). Use this whenever the user wants to create, manufacture, or mock up agreement documents — an MSA, NDA, SaaS/subscription agreement, amendment, exhibit, SOW, renewal notice, loan/credit agreement, fund/investment doc, BAA/DPA, government contract, or a whole document FAMILY between named parties — especially demo/test documents to load into Docusign Navigator/CLM or to feed an agreement-lifecycle agent. Triggers include "generate an MSA/NDA/agreement", "make demo contracts", "create a document family for <party> and <party>", "use docgen", or "use the yaml-doc-generator". Produces real PDFs with parties, clauses, and a manifest of critical dates (renewal/expiration).

    Also in 3 projects that use this

  • ddehartSkill

    knowledge-graph

    Search, capture, and query the claude-code-plugins knowledge graph. Use when asked to "capture this", "add this to the graph", "what do we know about X", "update the graph", "check the graph for X", or when a decision, pattern, or non-obvious fact surfaces mid-session that's worth recording. Also: "log an observation", "what patterns do we have about skill triggering", "any decisions on the knowledge-commons plugin", "what do we know about the commit-creator agent".

    Also in 3 projects that use this

  • rajnavakotiSkill

    scan

    Run the AI dashboard scanner and generate the HTML report.

    Also in 3 projects that use this

  • MicrosoftSkill

    retrospective

    Review how work went and improve the next round. USE WHEN asked for a retro, delays, or process lessons. DO NOT USE for code review or transcript replay.

    Also in 3 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 3 projects that use this

  • BlockSkill

    plan

    Draft a TDD, PRD, or lightweight plan in the conversation without committing it.

    Also in 5 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before invoking the miner, confirm the environment and resolve where transcripts would live.

    line 25
  2. Distinctive:

    If the test fails, surface a diagnostic and stop — the plugin installation is incomplete.

    line 35
  3. Distinctive:

    Run the miner with zero arguments (or forward any flags the user explicitly supplied):

    line 50
  4. Distinctive:

    Never refresh to silence an *uninvestigated* drift flag — that converts the alarm into the regression.

    line 96
  5. Distinctive:

    After the bin exits 0, report:

    line 103

“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

craft:metrics — usage-telemetry front door

Standalone session-owned skill. You (the session) probe the current repo's transcript directory, invoke the miner, and report the output paths. No worker agent is spawned. This skill is ADVISORY — an absent, empty, or malformed transcript directory produces a recorded no-op and exits 0; it is never a blocker.

Input: $ARGUMENTS (zero-argument; optional pass-through flags accepted if the user supplies them — see Step 1).

Shell entry: scripts/mine-transcripts.sh is a shell convenience wrapper around the same miner for direct terminal use (e.g. bash scripts/mine-transcripts.sh). It is equivalent to invoking this skill but bypasses the skill preamble checks.


Preamble — read-only probe

Before invoking the miner, confirm the environment and resolve where transcripts would live.

1. Plugin root

Confirm ${CLAUDE_PLUGIN_ROOT} is set and the entrypoint exists:

test -f "${CRAFT_ROOT:-${CLAUDE_PLUGIN_ROOT}}/engine/bin/usage-mine.js"

If the test fails, surface a diagnostic and stop — the plugin installation is incomplete.

2. Transcript directory

The miner resolves the transcript directory for the current working directory internally (cwd → dashes mapping). You do not need to construct or validate the path yourself. An absent or empty directory is within the miner's advisory contract — it writes a no-data report and exits 0. Never abort the skill on a missing directory.


Procedure

Step 1 — Mine

Run the miner with zero arguments (or forward any flags the user explicitly supplied):

node "${CRAFT_ROOT:-${CLAUDE_PLUGIN_ROOT}}/engine/bin/usage-mine.js"

Optional flags (pass through verbatim when the user supplies them):

FlagPurpose
--dir <path>Override the resolved transcript directory
--baseline <path>Baseline report for delta comparison and drift detection — e.g. the committed docs/contributing/metrics-baseline.report.json snapshot
--threshold <n>Relative-delta threshold for the drift signal (default 0.25); only used when --baseline is also supplied
--since <date>Restrict to transcripts on or after this date
--prices <path>Custom pricing table (JSON)
--no-inlineExclude the main-loop usage group (included by default)

Passing --baseline docs/contributing/metrics-baseline.report.json compares the current run against the committed snapshot: report.json gains a drift array flagging any (phase, dimension) pair whose per-occurrence mean token cost or duration moved beyond --threshold relative to the baseline's mean — corpus-size-invariant, so re-mining a grown corpus is not drift; a phase with no baseline activity carries a null delta (rendered "new") — and report.md gains a "Phases drifted since baseline" section when any phase drifted. This is a prompt-regression signal only — advisory, never a gate (see error semantics below).

The bin writes two artefacts inside the repo and exits 0 in all handled cases:

  • report.json — machine-readable usage summary (consumed by craft:tune and by the workflow-improvement loop)
  • report.md — human-readable narrative (cache performance, cost breakdown, model-routing recommendations)

Refreshing the committed baseline

docs/contributing/metrics-baseline.report.json is the drift reference. Refreshing it is a deliberate, reviewed act — never a side effect of running the miner:

  1. Refresh when the prompt surface changed on purpose — a run that edited skills/ or agents/ lands with intentionally different per-phase economics, and drift measured against the pre-change baseline would flag the intended shift forever. The integrate phase offers this step when the merged run touched those paths.
  2. Re-mine over the full transcript corpus, then copy report.json over docs/contributing/metrics-baseline.report.json and commit it in the same PR/change that altered the prompts (chore(metrics): refresh drift baseline), so the diff review sees old-vs-new economics side by side.
  3. Never refresh to silence an uninvestigated drift flag — that converts the alarm into the regression.

Done

After the bin exits 0, report:

  • Artefact paths: report.json and report.md (relative to the repo root)
  • One-line summary: surface the cache-creation hotspot and the top model-routing recommendation read from the bin's stdout or from report.json (e.g. "Highest cache-creation overhead: implementation phase — consider an explicit checkpoint. Top recommendation: route reviewer to a lighter model tier.")

Downstream consumers of report.json:

  1. Workflow improvement — review the cache and cost breakdown to tune phase ordering, checkpoint placement, and model-routing hints across the craft pipeline.
  2. craft:tune — the tuner reads report.json to propose model-routing, skip, and turn-budget patches to an existing named manifest.

Error semantics

ConditionBehaviour
Absent transcript directoryAdvisory no-op: miner writes a zero-data report, exits 0; skill reports the no-data report paths and continues
Empty transcript directorySame as absent — recorded no-op, exit 0
Malformed transcript filesMiner skips unparseable entries; exits 0 with a partial report; skill surfaces a warning from the bin's stderr and reports the partial paths
--dir path out of boundsMiner enforces path containment, writes a no-data report, exits 0; skill reports the paths and continues
Plugin root missingSTOP; surface "engine/bin/usage-mine.js not found — check CLAUDE_PLUGIN_ROOT"; do not invoke the bin
Bin stderr outputSurface stderr diagnostic as a warning; report what artefacts are available and continue — the miner always exits 0
--baseline absent or unreadableDrift is advisory: report.drift is empty and no "Phases drifted" section is rendered; exits 0 and continues — never a gate

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.