claude-code-plugin-ref…
Explain plugin, skill, command, agent, and hook mechanics used here. Use when authoring or debugging plugins. Do not use for ops;…
Implements structured usage logging and audit trails for cost and session tracking. Use when adding audit trails, usage analytics, or cost tracking to a skill.
Claude Code
$ npx -y skills add athola/claude-night-market --skill usage-logging --agent claude-code
Codex
$ npx skills add athola/claude-night-market --skill usage-logging -a codex -y
Cursor
$ npx skills add athola/claude-night-market --skill usage-logging -a cursor -y
Gemini CLI
$ npx skills add athola/claude-night-market --skill usage-logging -a gemini-cli -y
GitHub Copilot
$ npx skills add athola/claude-night-market --skill usage-logging -a github-copilot -y
OpenCode
$ npx skills add athola/claude-night-market --skill usage-logging -a opencode -y
Windsurf
$ npx skills add athola/claude-night-market --skill usage-logging -a windsurf -y
name: usage-logging description: Implements structured usage logging and audit trails for cost and session tracking. Use when adding audit trails, usage analytics, or cost tracking to a skill. alwaysApply: false category: infrastructure tags: - logging - usage - audit - metrics - sessions - analytics dependencies: [] tools: [] provides: infrastructure: - usage-logging - session-management - audit-trails patterns: - structured-logging - metrics-collection - cost-tracking usage_patterns: - audit-logging - cost-tracking - usage-analytics - session-management complexity: beginner estimated_tokens: 450 progressive_loading: true modules: - modules/session-patterns.md - modules/log-formats.md
Records individual call costs and usage events. For aggregate budget enforcement, use quota-management.
Session-aware logging infrastructure for tracking operations across plugins. Provides structured JSONL logging with automatic session management for audit trails and analytics.
Sessions group related operations:
{
"timestamp": "2025-12-05T10:30:00Z",
"session_id": "session_1733394600",
"service": "my-service",
"operation": "analyze_files",
"tokens": 5000,
"success": true,
"duration_seconds": 2.5,
"metadata": {}
}**Verification:** Run the command with `--help` flag to verify availability.
from leyline.usage_logger import UsageEvent, UsageLogger logger = UsageLogger(service="my-service")
**Verification:** `python -m leyline.usage_logger --help` prints the query options.
logger.log_usage(
UsageEvent(
"analyze_files",
tokens=5000,
success=True,
duration=2.5,
metadata={"files": 10},
)
)**Verification:** `plugins/leyline/tests/unit/test_usage_logger_quick_start.py` runs this call and reads it back.
# Recent operations
recent = logger.get_recent_operations(hours=24)
# Usage summary
summary = logger.get_usage_summary(days=7)
print(f"Total tokens: {summary['total_tokens']}")
print(f"Total cost: ${summary['estimated_cost']:.2f}")
# Recent errors
errors = logger.get_recent_errors(count=10)**Verification:** Run the command with `--help` flag to verify availability.
# In your skill's frontmatter dependencies: [leyline:usage-logging]
**Verification:** Run the command with `--help` flag to verify availability.
Standard integration flow: 1. Initialize logger for your service 2. Log operations after completion 3. Query for analytics and debugging
Default location: `~/.claude/leyline/usage/{service}.jsonl`
# View recent logs tail -20 ~/.claude/leyline/usage/my-service.jsonl | jq . # Query by date grep "2025-12-05" ~/.claude/leyline/usage/my-service.jsonl
**Verification:** Run the command with `--help` flag to verify availability.
A plugin marketplace for Claude Code. Install only the plugins you need to run git workflows, code review, spec-driven development, and autonomous agents from inside your Claude Code session.
Explain plugin, skill, command, agent, and hook mechanics used here. Use when authoring or debugging plugins. Do not use for ops;…
States load-bearing decisions, invariants, and weak points. Use when judging a design change. Do not use for gating; use…
Rebuild the dev environment: uv, Python tiers, pins, traps. Use when onboarding or toolchain breaks. Do not use for daily…
Classify, gate, and review changes. Use when landing a PR, releasing, or amending rules. Do not use for failure triage; use…
Search and record project memory (Discussions, journal, ADRs). Use before re-investigating anything. Do not use for settled…
Bind loop 'done' to unfakeable gates. Use to harden egregore/herald loops or promote completion_integrity. Not for QA gates; use…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.